From a88848ab1df4f558295ef3337e329f00e222cb00 Mon Sep 17 00:00:00 2001 From: zz85 Date: Tue, 4 Oct 2011 22:25:52 +0800 Subject: [PATCH] Added THREE.SubdivisionModifier. Removed THREE.GeometryUtils.createSubdivision() --- build/Three.js | 948 ++++++++++---------- examples/canvas_geometry_subdivison.html | 32 +- src/extras/GeometryUtils.js | 17 - src/extras/modifiers/SubdivisionModifier.js | 447 +++++++++ utils/build.py | 1 + 5 files changed, 955 insertions(+), 490 deletions(-) create mode 100644 src/extras/modifiers/SubdivisionModifier.js diff --git a/build/Three.js b/build/Three.js index b5a6eda9..e86f8d17 100644 --- a/build/Three.js +++ b/build/Three.js @@ -1,7 +1,7 @@ // Three.js r45dev - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this}; -THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,h,m;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),h=b*6-f,b=e*(1-c),m=e*(1-c*h),c=e*(1-c*(1-h)),f){case 1:this.r=m;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=m;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r= -e;this.g=b;this.b=m;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; +THREE.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= +e;this.g=b;this.b=k;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this}, divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, @@ -15,87 +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 h,m,k,n,u,p,w,t,x,v,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f0:t<0)))if(t=w.dot((new THREE.Vector3).sub(k,x))/t,x=x.addSelf(v.multiplyScalar(t)),m instanceof THREE.Face3)e(x,k,n,u)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,p)||e(x,n,u,p)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}}; -THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,t){n=!1;c=k;e=m;f=w;h=t;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= -function(k,m,w,t,x,v){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,h=m>t?m>v?m:v:t>v?t:v):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>t?m>v?m>h?m:h:v>h?v:h:t>v?t>h?t:h:v>h?v: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=[]}; +c=c.clone().subSelf(e),m=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(m),k=c.dot(c),c=c.dot(m),m=1/(b*k-e*e),k=(k*f-e*c)*m,b=(b*c-e*f)*m;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 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=[]}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}}; -THREE.Matrix4=function(b,c,e,f,h,m,k,n,u,p,w,t,x,v,y,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,m!==void 0?m:1,k||0,n||0,u||0,p||0,w!==void 0?w:1,t||0,x||0,v||0,y||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,u,p,w,t,x,v,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=u;this.n32=p;this.n33=w;this.n34=t;this.n41=x;this.n42=v;this.n43=y;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, -c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; -b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ -e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,y=b.n41,z=b.n42,A=b.n43,D=b.n44,E=c.n11,F=c.n12, -J=c.n13,P=c.n14,S=c.n21,I=c.n22,H=c.n23,G=c.n24,Y=c.n31,C=c.n32,Q=c.n33,R=c.n34,W=c.n41,X=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*S+h*Y+m*W;this.n12=e*F+f*I+h*C+m*X;this.n13=e*J+f*H+h*Q+m*o;this.n14=e*P+f*G+h*R+m*ea;this.n21=k*E+n*S+u*Y+p*W;this.n22=k*F+n*I+u*C+p*X;this.n23=k*J+n*H+u*Q+p*o;this.n24=k*P+n*G+u*R+p*ea;this.n31=w*E+t*S+x*Y+v*W;this.n32=w*F+t*I+x*C+v*X;this.n33=w*J+t*H+x*Q+v*o;this.n34=w*P+t*G+x*R+v*ea;this.n41=y*E+z*S+A*Y+D*W;this.n42=y*F+z*I+A*C+D*X;this.n43=y*J+z*H+A*Q+D*o;this.n44=y* -P+z*G+A*R+D*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,m=this.n22,k=this.n23,n=this.n24,u=this.n31,p=this.n32,w=this.n33,t=this.n34,x=this.n41,v=this.n42,y=this.n43,z=this.n44;return f*k*p*x-e*n*p*x-f*m*w*x+c*n*w*x+e*m*t*x-c*k*t*x-f*k*u*v+e*n*u*v+f*h*w*v-b*n*w*v-e*h*t*v+b*k*t*v+f*m*u*y-c*n*u*y-f*h*p*y+b*n*p*y+c*h*t*y-b*m*t*y-e*m*u*z+c*k*u*z+e*h*p*z-b*k*p*z-c*h* -w*z+b*m*w*z},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,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= this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, -0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,m=b.x,k=b.y,n=b.z,u=h*m,p=h*k;this.set(u*m+e,u*k-f*n,u*n+f*k,0,u*k+f*n,p*k+e,p*n-f*m,0,u*n-f*k,p*n+f*m,h*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= -new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,m=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var u= -k*n,p=k*h,w=f*n,t=f*h;this.n11=u+t*e;this.n12=w*e-p;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=p*e-w;this.n32=t+u*e;this.n33=m*k;break;case "ZXY":u=k*n;p=k*h;w=f*n;t=f*h;this.n11=u-t*e;this.n12=-m*h;this.n13=w+p*e;this.n21=p+w*e;this.n22=m*n;this.n23=t-u*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":u=m*n;p=m*h;w=e*n;t=e*h;this.n11=k*n;this.n12=w*f-p;this.n13=u*f+t;this.n21=k*h;this.n22=t*f+u;this.n23=p*f-w;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":u=m*k;p= -m*f;w=e*k;t=e*f;this.n11=k*n;this.n12=t-u*h;this.n13=w*h+p;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=p*h+w;this.n33=u-t*h;break;case "XZY":u=m*k;p=m*f;w=e*k;t=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=u*h+t;this.n22=m*n;this.n23=p*h-w;this.n31=w*h-p;this.n32=e*n;this.n33=t*h+u;break;default:u=m*n,p=m*h,w=e*n,t=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=p+w*f,this.n22=u-t*f,this.n23=-e*k,this.n31=t-u*f,this.n32=w+p*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,u=c*k;c*=n;var p=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(p+f);this.n12=u-h;this.n13=c+k;this.n21=u+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; -f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);m.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); -e.y=h.length();e.z=m.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= -b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,p=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,y=b.n41,z=b.n42,A=b.n43,D=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=u*v*z-p*x*z+p*t*A-n*v*A-u*t*D+n*x*D;c.n12=m*x*z-h*v*z-m*t*A+f*v*A+h*t*D-f*x*D;c.n13=h*p*z-m*u*z+m*n*A-f*p*A-h*n*D+f*u*D;c.n14=m*u*t-h*p*t-m*n*x+f*p*x+h*n*v-f*u*v;c.n21=p*x*y-u*v*y-p*w*A+k*v*A+u*w*D-k*x*D;c.n22=h*v*y-m*x*y+m*w*A-e*v*A-h*w*D+e*x*D;c.n23=m*u*y-h*p*y-m*k*A+e*p*A+h*k*D-e*u*D;c.n24= -h*p*w-m*u*w+m*k*x-e*p*x-h*k*v+e*u*v;c.n31=n*v*y-p*t*y+p*w*z-k*v*z-n*w*D+k*t*D;c.n32=m*t*y-f*v*y-m*w*z+e*v*z+f*w*D-e*t*D;c.n33=h*p*y-m*n*y+m*k*z-e*p*z-f*k*D+e*n*D;c.n34=m*n*w-f*p*w-m*k*t+e*p*t+f*k*v-e*n*v;c.n41=u*t*y-n*x*y-u*w*z+k*x*z+n*w*A-k*t*A;c.n42=f*x*y-h*t*y+h*w*z-e*x*z-f*w*A+e*t*A;c.n43=h*n*y-f*u*y-h*k*z+e*u*z+f*k*A-e*n*A;c.n44=f*u*w-h*n*w+h*k*t-e*u*t-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,u=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*u;e[6]=b*p;e[7]=b*w;e[8]=b*t;return c}; -THREE.Matrix4.makeFrustum=function(b,c,e,f,h,m){var k;k=new THREE.Matrix4;k.n11=2*h/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*h/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+h)/(m-h);k.n34=-2*m*h/(m-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,u,p;k=new THREE.Matrix4;n=c-b;u=e-f;p=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/u;k.n23=0;k.n24=-((e+f)/u);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((m+h)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),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; 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,h;e=0;for(f=this.children.length;e=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fo&&k.positionScreen.z0&&I.z<1))ga=F[E]=F[E]||new THREE.RenderableParticle,E++,D=ga,D.x=I.x/I.w,D.y=I.y/I.w,D.z= -I.z,D.rotation=Z.rotation.z,D.scale.x=Z.scale.x*Math.abs(D.x-(I.x+h.projectionMatrix.n11)/(I.w+h.projectionMatrix.n14)),D.scale.y=Z.scale.y*Math.abs(D.y-(I.y+h.projectionMatrix.n22)/(I.w+h.projectionMatrix.n24)),D.materials=Z.materials,P.push(D);m&&P.sort(c);return P}};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),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); +THREE.Projector=function(){function b(){var b=o[n]=o[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,m=e.z+e.w,h=-b.z+b.w,n=-e.z+e.w;return k>=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); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,u=this.w,p=u*e+k*h-n*f,w=u*f+n*e-m*h,t=u*h+m*f-k*e,e=-m* -e-k*f-n*h;c.x=p*u+e*-m+w*-n-t*-k;c.y=w*u+e*-k+t*-m-p*-n;c.z=t*u+e*-n+p*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; -THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; -THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; -THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; -THREE.Geometry.prototype={constructor:THREE.Geometry,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;e=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}; +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,m,p){n=b.vertices[e].position;o=b.vertices[c].position;t=b.vertices[f].position;w=h[k];v=h[m];x=h[p];u=o.x-n.x;z=t.x-n.x;y=o.y-n.y;A=t.y-n.y;C=o.z-n.z;E=t.z-n.z;D=v.u-w.u;G=x.u-w.u;I=v.v-w.v;M=x.v-w.v;H=1/(D*M-G*I);K.set((M*u-I*z)*H,(M*y-I*A)*H,(M*C-I*E)*H);Q.set((D*z-G*u)*H,(D*A-G*y)*H,(D*E-G*C)*H);L[e].addSelf(K);L[c].addSelf(K);L[f].addSelf(K);P[e].addSelf(Q); +P[c].addSelf(Q);P[f].addSelf(Q)}var c,e,f,m,k,h,n,o,t,w,v,x,u,z,y,A,C,E,D,G,I,M,H,B,L=[],P=[],K=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,$=new THREE.Vector3,X=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?m:m+1;e[3]=m>this.points.length-3?m:m+2;p=this.points[e[0]];w=this.points[e[1]]; -t=this.points[e[2]];x=this.points[e[3]];n=k*k;u=k*n;f.x=c(p.x,w.x,t.x,x.x,k,n,u);f.y=c(p.y,w.y,t.y,x.y,k,n,u);f.z=c(p.z,w.z,t.z,x.z,k,n,u);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;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;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;f0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* -255)+","+z+")"),v.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,p){function u(b){var e,c,f,k=b.lights;oa.setRGB(0,0,0);xa.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(e=k.length;b>1,w=u.height>>1,m=k.scale.x*t,p=k.scale.y*x,o=m*Fa,n=p*w,N.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-p),v.translate(-Fa,-w),v.drawImage(u,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v), -v.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(J!=b)v.lineWidth=J=b;b=m.linecap;if(P!=b)v.lineCap=P=b;b=m.linejoin;if(S!=b)v.lineJoin=S=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,u,v,x){m.info.render.vertices+=3;m.info.render.faces++;c(v.opacity);e(v.blending); -R=b.positionScreen.x;W=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ea=k.positionScreen.x;V=k.positionScreen.y;E(R,W,X,o,ea,V);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(ra=u.uvs[0],ab(R,W,X,o,ea,V,ra[h].u,ra[h].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,pa.copy(u.vertexNormalsWorld[0]),ua=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5, -Ca=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,za=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(u.vertexNormalsWorld[2]),Ba=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ga=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(R,W,X,o,ea,V,ua,Ca,Ea,za,Ba,Ga,v.envMap)}else v.wireframe?F(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&& -(v.map.mapping instanceof THREE.UVMapping&&(ra=u.uvs[0],ab(R,W,X,o,ea,V,ra[h].u,ra[h].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map)),e(THREE.SubtractiveBlending)),M?!v.wireframe&&v.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(U.r=Z.r=ga.r=oa.r,U.g=Z.g=ga.g=oa.g,U.b=Z.b=ga.b=oa.b,w(x,u.v1.positionWorld,u.vertexNormalsWorld[0],U),w(x,u.v2.positionWorld,u.vertexNormalsWorld[1],Z),w(x,u.v3.positionWorld,u.vertexNormalsWorld[2],ga),U.r=Math.max(0,Math.min(v.color.r*U.r,1)),U.g=Math.max(0,Math.min(v.color.g* -U.g,1)),U.b=Math.max(0,Math.min(v.color.b*U.b,1)),Z.r=Math.max(0,Math.min(v.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(v.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(v.color.b*Z.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka.r=(Z.r+ga.r)*0.5,ka.g=(Z.g+ga.g)*0.5,ka.b=(Z.b+ga.b)*0.5,qa=Xa(U,Z,ga,ka),Ua(R,W,X,o,ea,V,0,0,1,0,0,1,qa)):(ha.r=oa.r,ha.g=oa.g,ha.b=oa.b,w(x,u.centroidWorld,u.normalWorld,ha),da.r=Math.max(0, -Math.min(v.color.r*ha.r,1)),da.g=Math.max(0,Math.min(v.color.g*ha.g,1)),da.b=Math.max(0,Math.min(v.color.b*ha.b,1)),v.wireframe?F(da,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(da)):v.wireframe?F(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(v.color);else if(v instanceof THREE.MeshDepthMaterial)ma=p.near,na=p.far,U.r=U.g=U.b=1-Qa(b.positionScreen.z,ma,na),Z.r=Z.g=Z.b=1-Qa(f.positionScreen.z,ma,na),ga.r=ga.g=ga.b=1-Qa(k.positionScreen.z,ma,na),ka.r=(Z.r+ -ga.r)*0.5,ka.g=(Z.g+ga.g)*0.5,ka.b=(Z.b+ga.b)*0.5,qa=Xa(U,Z,ga,ka),Ua(R,W,X,o,ea,V,0,0,1,0,0,1,qa);else if(v instanceof THREE.MeshNormalMaterial)da.r=Va(u.normalWorld.x),da.g=Va(u.normalWorld.y),da.b=Va(u.normalWorld.z),v.wireframe?F(da,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(da)}function D(b,f,k,h,n,u,v,t,x){m.info.render.vertices+=4;m.info.render.faces++;c(t.opacity);e(t.blending);if(t.map||t.envMap)A(b,f,h,0,1,3,v,t,x),A(n,k,u,1,2,3,v,t,x);else if(R=b.positionScreen.x,W= -b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ea=k.positionScreen.x,V=k.positionScreen.y,la=h.positionScreen.x,aa=h.positionScreen.y,ia=n.positionScreen.x,ca=n.positionScreen.y,ja=u.positionScreen.x,fa=u.positionScreen.y,t instanceof THREE.MeshBasicMaterial)Ya(R,W,X,o,ea,V,la,aa),t.wireframe?F(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Na(t.color);else if(t instanceof THREE.MeshLambertMaterial)M?!t.wireframe&&t.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length== -4?(U.r=Z.r=ga.r=ka.r=oa.r,U.g=Z.g=ga.g=ka.g=oa.g,U.b=Z.b=ga.b=ka.b=oa.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],U),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],Z),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ga),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ka),U.r=Math.max(0,Math.min(t.color.r*U.r,1)),U.g=Math.max(0,Math.min(t.color.g*U.g,1)),U.b=Math.max(0,Math.min(t.color.b*U.b,1)),Z.r=Math.max(0,Math.min(t.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(t.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(t.color.b* -Z.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),ka.r=Math.max(0,Math.min(t.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(t.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(t.color.b*ka.b,1)),qa=Xa(U,Z,ga,ka),E(R,W,X,o,la,aa),Ua(R,W,X,o,la,aa,0,0,1,0,0,1,qa),E(ia,ca,ea,V,ja,fa),Ua(ia,ca,ea,V,ja,fa,1,0,1,1,0,1,qa)):(ha.r=oa.r,ha.g=oa.g,ha.b=oa.b,w(x,v.centroidWorld,v.normalWorld,ha),da.r=Math.max(0,Math.min(t.color.r*ha.r, -1)),da.g=Math.max(0,Math.min(t.color.g*ha.g,1)),da.b=Math.max(0,Math.min(t.color.b*ha.b,1)),Ya(R,W,X,o,ea,V,la,aa),t.wireframe?F(da,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Na(da)):(Ya(R,W,X,o,ea,V,la,aa),t.wireframe?F(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Na(t.color));else if(t instanceof THREE.MeshNormalMaterial)da.r=Va(v.normalWorld.x),da.g=Va(v.normalWorld.y),da.b=Va(v.normalWorld.z),Ya(R,W,X,o,ea,V,la,aa),t.wireframe?F(da,t.wireframeLinewidth, -t.wireframeLinecap,t.wireframeLinejoin):Na(da);else if(t instanceof THREE.MeshDepthMaterial)ma=p.near,na=p.far,U.r=U.g=U.b=1-Qa(b.positionScreen.z,ma,na),Z.r=Z.g=Z.b=1-Qa(f.positionScreen.z,ma,na),ga.r=ga.g=ga.b=1-Qa(h.positionScreen.z,ma,na),ka.r=ka.g=ka.b=1-Qa(k.positionScreen.z,ma,na),qa=Xa(U,Z,ga,ka),E(R,W,X,o,la,aa),Ua(R,W,X,o,la,aa,0,0,1,0,0,1,qa),E(ia,ca,ea,V,ja,fa),Ua(ia,ca,ea,V,ja,fa,1,0,1,1,0,1,qa)}function E(b,e,c,f,k,h){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(k,h);v.lineTo(b, -e);v.closePath()}function Ya(b,e,c,f,k,h,m,o){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,e);v.closePath()}function F(b,e,c,k){if(J!=e)v.lineWidth=J=e;if(P!=c)v.lineCap=P=c;if(S!=k)v.lineJoin=S=k;f(b.getContextStyle());v.stroke();N.inflate(e*2)}function Na(b){h(b.getContextStyle());v.fill()}function ab(b,e,c,f,k,m,o,n,t,p,u,Fa,w){if(w.image.width!=0){if(w.needsUpdate==!0||ta[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,y=w.wrapT==THREE.RepeatWrapping;ta[w.id]= -v.createPattern(w.image,x&&y?"repeat":x&&!y?"repeat-x":!x&&y?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,y=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+y)*w,t=(t+x)*L,p=(p+y)*w,u=(u+x)*L,Fa=(Fa+y)*w;c-=b;f-=e;k-=b;m-=e;t-=o;p-=n;u-=o;Fa-=n;x=1/(t*Fa-u*p);w=(Fa*c-p*k)*x;p=(Fa*f-p*m)*x;c=(t*k-u*c)*x;f=(t*m-u*f)*x;b=b-w*o-c*n;e=e-p*o-f*n;v.save();v.transform(w,p,c,f,b,e);v.fill();v.restore()}}function Ua(b,e, -c,f,k,h,m,o,n,t,p,u,Fa){var w,x;w=Fa.width-1;x=Fa.height-1;m*=w;o*=x;n*=w;t*=x;p*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;t-=o;p-=m;u-=o;x=1/(n*u-p*t);w=(u*c-t*k)*x;t=(u*f-t*h)*x;c=(n*k-p*c)*x;f=(n*h-p*f)*x;b=b-w*m-c*o;e=e-t*m-f*o;v.save();v.transform(w,t,c,f,b,e);v.clip();v.drawImage(Fa,0,0);v.restore()}function Xa(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),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Aa[0]=k<0? -0:k>255?255:k;Aa[1]=h<0?0:h>255?255:h;Aa[2]=b<0?0:b>255?255:b;Aa[4]=m<0?0:m>255?255:m;Aa[5]=o<0?0:o>255?255:o;Aa[6]=e<0?0:e>255?255:e;Aa[8]=n<0?0:n>255?255:n;Aa[9]=t<0?0:t>255?255:t;Aa[10]=c<0?0:c>255?255:c;Aa[12]=p<0?0:p>255?255:p;Aa[13]=u<0?0:u>255?255:u;Aa[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);$.drawImage(wa,0,0);return Ha}function Qa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Oa(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,Ia,Pa,Wa,$a,ya;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,p,this.sortElements);(M=b.lights.length>0)&&u(b);Za=0;for(bb=k.length;Za0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Y.sub(h.position,e.centroidWorld),Y.normalize(),m=e.normalWorld.dot(Y)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.info.render.vertices+=3;m.info.render.faces++;R=f(W++); -R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?J.copy(n.color):n instanceof THREE.MeshLambertMaterial?F?(P.r=S.r,P.g=S.g,P.b=S.b,b(t,o,P),J.r=Math.max(0,Math.min(n.color.r*P.r,1)),J.g=Math.max(0,Math.min(n.color.g*P.g,1)),J.b=Math.max(0,Math.min(n.color.b*P.b,1))):J.copy(n.color):n instanceof THREE.MeshDepthMaterial?(G=1-n.__2near/(n.__farPlusNear- -o.z*n.__farMinusNear),J.setRGB(G,G,G)):n instanceof THREE.MeshNormalMaterial&&J.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+J.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(R)}function e(e,c,k,n,o,t,p){m.info.render.vertices+= -4;m.info.render.faces++;R=f(W++);R.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?J.copy(t.color):t instanceof THREE.MeshLambertMaterial?F?(P.r=S.r,P.g=S.g,P.b=S.b,b(p,o,P),J.r=Math.max(0,Math.min(t.color.r*P.r,1)),J.g=Math.max(0,Math.min(t.color.g*P.g,1)),J.b=Math.max(0,Math.min(t.color.b*P.b,1))): -J.copy(t.color):t instanceof THREE.MeshDepthMaterial?(G=1-t.__2near/(t.__farPlusNear-o.z*t.__farMinusNear),J.setRGB(G,G,G)):t instanceof THREE.MeshNormalMaterial&&J.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));t.wireframe?R.setAttribute("style","fill: none; stroke: "+J.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):R.setAttribute("style","fill: "+J.getContextStyle()+ -"; fill-opacity: "+t.opacity);u.appendChild(R)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,w,t,x,v,y,z,A,D=new THREE.Rectangle,E=new THREE.Rectangle,F=!1,J=new THREE.Color(16777215),P=new THREE.Color(16777215),S=new THREE.Color(0), -I=new THREE.Color(0),H=new THREE.Color(0),G,Y=new THREE.Vector3,C=[],Q=[],R,W,X,o=1;this.domElement=u;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){p=b;w=e;t=p/2;x=w/2;u.setAttribute("viewBox",-t+" "+-x+" "+p+" "+w);u.setAttribute("width",p);u.setAttribute("height",w);D.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])}; -this.render=function(b,f){var h,p,w,J,P,C,G,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);X=W=0;if(F=b.lights.length>0){G=b.lights;S.setRGB(0,0,0);I.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(p=G.length;h0&&(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;m= 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,h={};for(c=0;c=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]), -o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,v=m.morphTargetInfluences;tu&&(w=x,u=v[w]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=u;p[w]=1;u=-1;t++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>= -0&&(f=k.__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,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER, -k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4, -o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount, -o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=k.__webglFaceCount,X.info.render.faces+=k.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),X.info.render.calls++): -m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),X.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,k,h,m,n,t,p,v,u,w,x=b.count*3;for(w=0;w=0;c--)b[c].object==e&&b.splice(c,1)}function P(b){function e(b){var k=[];c=0;for(f=b.length;c65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[], -materials:n,vertices:0,numMorphTargets:v})),b.geometryGroups[t].faces.push(k),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function I(b){if(b!=da){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)}da=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,W(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,W(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,W(e.magFilter)), -o.texParameteri(b,o.TEXTURE_MIN_FILTER,W(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,R(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,R(e.minFilter)))}function G(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.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,W(b.format),b.image.width,b.image.height,0,W(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Y(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);H(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,W(b.format),b.width,b.height,0,W(b.format),W(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,W(b.format), -b.width,b.height,0,W(b.format),W(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,k;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,k=f=0):(e=null,c=qa,b=ra,f=ma,k=na);e!=la&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,k,c,b),la=e)}function C(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 Q(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 R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function W(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 X=this,o,ea=[],V=null, -la=null,aa=-1,ia=null,ca=0,ja=null,fa=null,da=null,U=null,Z=null,ga=null,ka=null,ta=null,ma=0,na=0,qa=0,ra=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ea=new Float32Array(16),za=new Float32Array(16),Ba=new THREE.Vector4,Ga={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"), -O=b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,M=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),oa=b.clearAlpha!==void 0?b.clearAlpha:0,xa=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 va,pa=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader, -uniforms:wa,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=L.getContext("experimental-webgl",{antialias:M,stencil:O,preserveDrawingBuffer:N})))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(Aa){console.error(Aa)}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,oa);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,$={};$.vertices=new Float32Array(16);$.faces=new Uint16Array(6);O=0;$.vertices[O++]=-1;$.vertices[O++]=-1;$.vertices[O++]=0;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=-1;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]=1;$.vertices[O++]= -1;$.vertices[O++]=1;$.vertices[O++]=0;$.vertices[O++]=-1;$.vertices[O++]=1;$.vertices[O++]=0;O=$.vertices[O++]=0;$.faces[O++]=0;$.faces[O++]=1;$.faces[O++]=2;$.faces[O++]=0;$.faces[O++]=2;$.faces[O++]=3;$.vertexBuffer=o.createBuffer();$.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,$.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,$.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,$.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,$.faces,o.STATIC_DRAW);$.program=o.createProgram(); -o.attachShader($.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader($.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram($.program);$.attributes={};$.uniforms={};$.attributes.position=o.getAttribLocation($.program,"position");$.attributes.uv=o.getAttribLocation($.program,"uv");$.uniforms.uvOffset=o.getUniformLocation($.program,"uvOffset");$.uniforms.uvScale=o.getUniformLocation($.program,"uvScale");$.uniforms.rotation=o.getUniformLocation($.program,"rotation"); -$.uniforms.scale=o.getUniformLocation($.program,"scale");$.uniforms.alignment=o.getUniformLocation($.program,"alignment");$.uniforms.color=o.getUniformLocation($.program,"color");$.uniforms.map=o.getUniformLocation($.program,"map");$.uniforms.opacity=o.getUniformLocation($.program,"opacity");$.uniforms.useScreenCoordinates=o.getUniformLocation($.program,"useScreenCoordinates");$.uniforms.affectedByDistance=o.getUniformLocation($.program,"affectedByDistance");$.uniforms.screenPosition=o.getUniformLocation($.program, -"screenPosition");$.uniforms.modelViewMatrix=o.getUniformLocation($.program,"modelViewMatrix");$.uniforms.projectionMatrix=o.getUniformLocation($.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){ma=b;na=e;qa=c;ra=f;o.viewport(ma,na,qa,ra)};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);oa=e;o.clearColor(ha.r,ha.g,ha.b,oa)};this.setClearColor=function(b,e){ha.copy(b);oa=e;o.clearColor(ha.r,ha.g,ha.b,oa)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return oa};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)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--)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&&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(h in b.attributes)x[h]!==void 0&&x[h]>=0&&o.enableVertexAttribArray(x[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,e,c,f){Y(b); -this.clear(e,c,f)};this.render=function(b,c,t,L){var N,O,F,E,J,ma,M,H,oa=b.lights,G=b.fog;aa=-1;this.shadowMapEnabled&&z(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(za);c.projectionMatrix.flattenToArray(Ea);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ca);this.initWebGLObjects(b);Y(t);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil); -J=b.__webglObjects.length;for(L=0;L=0;L--)if(N=b.__webglObjects[L],N.render){M=N.object;H=N.buffer;F=N.opaque;m(M);for(N=0;N0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray= -new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(N*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(L=m.numMorphTargets;x=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&J(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, -da,y));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ka,y));Ka&&la.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));za&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,va,y));za&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ua,y));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ta,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, -p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,wa,y));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,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));N&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray, -delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;F(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=x=N=N= -void 0;v=h.vertices;t=h.colors;u=v.length;p=t.length;L=h.__vertexArray;y=h.__colorArray;O=h.__dirtyColors;if(h.__dirtyVertices){for(N=0;N=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;A1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=m;c.v=k;return c}, +THREE.ColorUtils={adjustHSV:function(b,c,e,f){var m=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,m);m.h=THREE.ColorUtils.clamp(m.h+c,0,1);m.s=THREE.ColorUtils.clamp(m.s+e,0,1);m.v=THREE.ColorUtils.clamp(m.v+f,0,1);b.setHSV(m.h,m.s,m.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,m=b.b,k=Math.max(Math.max(e,f),m),h=Math.min(Math.min(e,f),m);if(h==k)h=e=0;else{var n=k-h,h=n/k,e=e==k?(f-m)/n:f==k?2+(m-e)/n:4+(e-f)/n;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=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,h=b.vertices.length,m=c instanceof THREE.Mesh?c.geometry:c,k=b.vertices,n=m.vertices,u=b.faces,p=m.faces,w=b.faceVertexUvs[0],m=m.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 t=0,x=n.length;t1&&(f=1-f,h=1-h);m=1-f-h;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);k.addSelf(n);n.copy(e);n.multiplyScalar(m);k.addSelf(n);return k},randomPointInFace:function(b,c,e){var f,h,m;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,m=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,m);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;m=c.vertices[b.c].position;var c=c.vertices[b.d].position, -k;e?b._area1&&b._area2?(e=b._area1,k=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c),b._area1=e,b._area2=k):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c));return THREE.GeometryUtils.random()*(e+k) -b?e(c,k-1):p[k]1&&(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] 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"}}}; THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e}; -THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),h,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,p;m<=n;)if(f=Math.floor(m+(n-m)/2),p=e[f]-k,p<0)m=f+1;else if(p>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.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.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve; THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b}; THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,b)};THREE.QuadraticBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,b);c.normalize();return c}; -THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var h=Array.prototype.slice.call(arguments),b=new THREE.Vector2(h[0],h[1]),c=new THREE.Vector2(h[2],h[3]),e=new THREE.Vector2(h[4],h[5]),f=new THREE.Vector2(h[6],h[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var 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.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,b)};THREE.CubicBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,b);c.normalize();return c}; THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,h;h=(f.length-1)*b;b=Math.floor(h);h-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,h);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,h);return c};THREE.ArcCurve=function(b,c,e,f,h,k){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=h;this.aClockwise=k}; +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.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))}; -THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,h){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*h},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,h){var b=(e-b)*0.5,f=(f-c)*0.5,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.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.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,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.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.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?(k=e[e.length-1],v=k.x,y=k.y):(k=this.actions[f-1].args,v=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,v,t,n),z=THREE.Shape.Utils.b2(z,y,x, -u),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];u=m[5];t=m[0];x=m[1];p=m[2];w=m[3];e.length>0?(k=e[e.length-1],v=k.x,y=k.y):(k=this.actions[f-1].args,v=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,v,t,p,n),z=THREE.Shape.Utils.b3(z,y,x,w,u),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k); -for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];u=m[1];p=m[2];t=m[3];z=m[4];x=!!m[5];w=k[k.length-2];v=k[k.length-1];k.length==0&&(w=v=0);y=z-t;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=t+z*y,m=w+n+p*Math.cos(z),z=v+u+p*Math.sin(z),e.push(new THREE.Vector2(m,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; -THREE.Path.prototype.nltransform=function(b,c,e,f,h,m){var k=this.getPoints(),n,u,p,w,t;n=0;for(u=k.length;n0?(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;n=0?n-1:e.length-1;m=k-1>=0?k-1:p.length-1;var z=[p[k],e[n],e[h]];t=THREE.FontUtils.Triangulate.area(z);var A=[p[k],p[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);v=n;w=k;n+=1;k+=-1;n< -0&&(n+=e.length);n%=e.length;k<0&&(k+=p.length);k%=p.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:p.length-1;z=[p[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[p[k],p[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);t+x>z+A&&(n=v,k=w,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=p.length),k%=p.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:p.length-1);t=e.slice(0,n);x=e.slice(n);v=p.slice(k);w=p.slice(0,k);m=[p[k],p[m],e[n]];y.push([p[k],e[n],e[h]]);y.push(m);e=t.concat(v).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),m,k,n,u,p={};m=0;for(k=f.length;m=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;k1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",v,k.index-1).pos,this.points[1]=h,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",v,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== -"rot")THREE.Quaternion.slerp(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&w[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;vb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];u=b[e[2]];p=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],u[0],p[0],h,e,k);f[1]=this.interpolate(m[1],n[1],u[1],p[1],h,e,k);f[2]=this.interpolate(m[2],n[2],u[2],p[2],h,e,k);return f}; -THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+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=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, new THREE.Vector3(-1,0,0));this.cameraNX.target.position.add(this.position,new THREE.Vector3(1,0,0));this.cameraPY.target.position.add(this.position,new THREE.Vector3(0,1,0));this.cameraNY.target.position.add(this.position,new THREE.Vector3(0,-1,0));this.cameraPZ.target.position.add(this.position,new THREE.Vector3(0,0,1));this.cameraNZ.target.position.add(this.position,new THREE.Vector3(0,0,-1))};this.updateCubeMap=function(b,e){var c=this.renderTarget;b.setFaceCulling("back","cw");e.scale.y=-1;e.position.y= 2*this.height;e.updateMatrix();c.activeCubeFace=0;b.render(e,this.cameraPX,c);c.activeCubeFace=1;b.render(e,this.cameraNX,c);e.scale.y=1;e.position.y=0;e.updateMatrix();e.scale.x=-1;e.updateMatrix();c.activeCubeFace=2;b.render(e,this.cameraPY,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw");c.activeCubeFace=3;b.render(e,this.cameraNY,c);e.scale.x=-1;e.updateMatrix();b.setFaceCulling("back","cw");c.activeCubeFace=4;b.render(e,this.cameraPZ,c);c.activeCubeFace=5;b.render(e,this.cameraNZ, c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")}; -THREE.FirstPersonControls=function(b){function c(b,c){return function(){c.apply(b,arguments)}}this.object=b;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.domElement=document;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff= +THREE.FirstPersonControls=function(b){function c(b,c){return function(){c.apply(b,arguments)}}this.object=b;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.domElement=document;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff= 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;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));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward= !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.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.onKeyDown= 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, -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, +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, 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 k={name:c,fps:0.6,length:f,hierarchy:[]},h,m=e.getControlPointsArray(),n=e.getLength(),u=m.length,E=0;h=u-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:m[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h=0?f:f+h;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var n=k[1]-k[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.horizontalAngleMap.srcRange; -k=this.horizontalAngleMap.dstRange;n=k[1]-k[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.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}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),u=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(u,k);b.position.set(0, +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, 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.005;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= +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(),h=c.size[0]/2,m=c.size[1]/2;this.moveState.yawLeft=-(b.pageX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.pageY-c.offset[1]-m)/m;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward= +!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= !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,h=new THREE.Matrix4,m=!1,k=1,n=0,u=0,p=0,w=0,t=0,x=window.innerWidth/2,v=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*t));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*u);this.translateY(b*p);m&&(this.roll+=this.rollSpeed*this.delta*k);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); +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); 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;t=(b.clientY-v)/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:u=-1;break; -case 40:case 83:n=-1;break;case 39:case 68:u=1;break;case 81:m=!0;k=1;break;case 69:m=!0;k=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:u=0;break;case 40:case 83:n=0;break;case 39:case 68:u=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:p=0;break;case 70:p=0}},!1)}; -THREE.TrackballControls=function(b){function c(b,c){return function(){c.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,h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector2,u=new THREE.Vector2,p=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,c){return new THREE.Vector2((b-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(h).setLength(e.x)); -f.addSelf(h.setLength(e.z));return f};this.rotateCamera=function(){var b=Math.acos(m.dot(k)/m.length()/k.length());if(b){var c=(new THREE.Vector3).cross(m,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?m=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(u.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b), -this.staticMoving?n=u:n.y+=(u.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=w.clone().subSelf(p);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?p=w:p.addSelf(b.sub(w,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance* -this.maxDistance&&this.position.setLength(this.maxDistance),h.lengthSq()1?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()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(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(C=b.length;--C>=0;){ja=C;fa=C-1;fa<0&&(fa=b.length- -1);for(var e=0,c=v+w*2,e=0;e=0;R--){W=R/w;X=u*(1-W);W=p*Math.sin(W*Math.PI/2);C=0;for(Q=E.length;C0){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;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;K0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);p.push(w)}c.push(p)}for(var v,y,z,h=c.length,e=0;e0)for(f=0;f1&&(v= -this.vertices[k].position.clone(),y=this.vertices[u].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,u,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,t,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,m=Math.PI,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e0||(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.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b0)for(p=0;p2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=p;h<=u&&(u=0);p=u+1;h<=p&&(p=0);w=p+1;h<=w&&(w=0);var x;a:{x=b;var v=u,y=p,z=w,A=h,D=k,E=void 0,F=void 0,J=void 0, -P=void 0,S=void 0,I=void 0,H=void 0,G=void 0,Y=void 0,F=x[D[v]].x,J=x[D[v]].y,P=x[D[y]].x,S=x[D[y]].y,I=x[D[z]].x,H=x[D[z]].y;if(1.0E-10>(P-F)*(H-J)-(S-J)*(I-F))x=!1;else{for(E=0;E=0&&R>=0&&X>=0){x=!1; -break a}}x=!0}}if(x){m.push([b[k[u]],b[k[p]],b[k[w]]]);n.push([k[u],k[p],k[w]]);u=p;for(w=p+1;w0)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;w>7)-127;f|=(h&127)<<16|k<<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 u(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function p(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function t(e){var c, -f,k;c=h(b,e);f=h(b,e+S);k=h(b,e+I);e=u(b,e+H);D.faces.push(new THREE.Face3(c,f,k,null,null,D.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+S);k=h(b,e+I);m=u(b,e+H);o=h(b,e+G);p=h(b,e+Y);e=h(b,e+C);m=D.materials[m];var t=J[p*3],v=J[p*3+1];p=J[p*3+2];var w=J[e*3],x=J[e*3+1],e=J[e*3+2];D.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(J[o*3],J[o*3+1],J[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b, -e+W);e=u(b,e+X);D.faces.push(new THREE.Face4(c,f,k,m,null,null,D.materials[e]))}function y(e){var c,f,k,m,p,t,v,w;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,e+W);p=u(b,e+X);t=h(b,e+o);v=h(b,e+ea);w=h(b,e+V);e=h(b,e+la);p=D.materials[p];var x=J[v*3],L=J[v*3+1];v=J[v*3+2];var O=J[w*3],N=J[w*3+1];w=J[w*3+2];var y=J[e*3],z=J[e*3+1],e=J[e*3+2];D.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(J[t*3],J[t*3+1],J[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(O,N,w),new THREE.Vector3(y,z,e)],null,p))} -function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+aa);k=h(b,e+ia);e=P[c*2];m=P[c*2+1];c=P[f*2];var o=D.faceVertexUvs[0];f=P[f*2+1];var p=P[k*2];k=P[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 A(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+ca);k=h(b,e+ja);m=h(b,e+fa);e=P[c*2];o=P[c*2+1];c=P[f*2];p=P[f*2+1];f=P[k*2];var t=D.faceVertexUvs[0];k=P[k*2+1];var u=P[m*2];m=P[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 D=this,E=0,F,J=[],P=[],S,I,H,G,Y,C,Q,R,W,X,o,ea,V,la,aa,ia,ca,ja,fa,da,U,Z,ga,ka,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,f,e);F={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:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b, -E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=F.header_bytes;S=F.vertex_index_bytes;I=F.vertex_index_bytes*2;H=F.vertex_index_bytes*3;G=F.vertex_index_bytes*3+F.material_index_bytes;Y=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes;C=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*2;Q=F.vertex_index_bytes; -R=F.vertex_index_bytes*2;W=F.vertex_index_bytes*3;X=F.vertex_index_bytes*4;o=F.vertex_index_bytes*4+F.material_index_bytes;ea=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes;V=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*2;la=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*3;aa=F.uv_index_bytes;ia=F.uv_index_bytes*2;ca=F.uv_index_bytes;ja=F.uv_index_bytes*2;fa=F.uv_index_bytes*3;e=F.vertex_index_bytes*3+F.material_index_bytes;ta=F.vertex_index_bytes* -4+F.material_index_bytes;da=F.ntri_flat*e;U=F.ntri_smooth*(e+F.normal_index_bytes*3);Z=F.ntri_flat_uv*(e+F.uv_index_bytes*3);ga=F.ntri_smooth_uv*(e+F.normal_index_bytes*3+F.uv_index_bytes*3);ka=F.nquad_flat*ta;e=F.nquad_smooth*(ta+F.normal_index_bytes*4);ta=F.nquad_flat_uv*(ta+F.uv_index_bytes*4);E+=function(e){for(var f,h,m,n=F.vertex_coordinate_bytes*3,o=e+F.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].length=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift();for(f=0;f>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=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].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){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);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;be){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};G.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 H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ta[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=Ga;return this.material=new THREE.MeshLambertMaterial(b)};Y.prototype.parse=function(b){for(var e=0;e0&&(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,k,h;if(c)e=b.split("."),b=e.shift(),h=e.shift();else if(f){k=b.split("(");b=k.shift();for(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&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(S,Y);object.name=v;object.position.set(F[0],F[1],F[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;V.scene.add(object);V.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b)); -if(E.castsShadow)b=new THREE.ShadowVolume(S),V.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},V.triggers[object.name]=b)}}else F=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(F[0],F[1],F[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,V.scene.add(object),V.objects[v]=object,V.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},V.triggers[object.name]=b)}function u(b){return function(c){V.geometries[b]=c;n();W-=1;e.onLoadComplete();w()}}function p(b){return function(e){V.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-W,loadedTextures:ea-X},V);e.onLoadProgress();W==0&&X==0&&c(V)}var t, -x,v,y,z,A,D,E,F,J,P,S,I,H,G,Y,C,Q,R,W,X,o,ea,V;Q=b.data;G=new THREE.BinaryLoader;R=new THREE.JSONLoader;X=W=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in Q.objects)if(E=Q.objects[v],E.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;J=Q.transform.rotation;var la=Q.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);J&&V.scene.rotation.set(J[0], -J[1],J[2]);la&&V.scene.scale.set(la[0],la[1],la[2]);(b||J||la)&&V.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in Q.cameras){J=Q.cameras[z];if(J.type=="perspective")I=new THREE.Camera(J.fov,J.aspect,J.near,J.far),I.useTarget=!0;else if(J.type=="ortho")I=new THREE.Camera,I.useTarget=!0,I.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);F=J.position;J=J.target;I.position.set(F[0],F[1],F[2]);I.target.position.set(J[0],J[1],J[2]);V.cameras[z]= -I}for(y in Q.lights)z=Q.lights[y],I=z.color!==void 0?z.color:16777215,J=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(F=z.direction,C=new THREE.DirectionalLight(I,J),C.position.set(F[0],F[1],F[2]),C.position.normalize()):z.type=="point"?(F=z.position,d=z.distance,C=new THREE.PointLight(I,J,d),C.position.set(F[0],F[1],F[2])):z.type=="ambient"&&(C=new THREE.AmbientLight(I)),V.scene.add(C),V.lights[y]=C;for(A in Q.fogs)y=Q.fogs[A],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type== -"exp2"&&(H=new THREE.FogExp2(0,y.density)),J=y.color,H.color.setRGB(J[0],J[1],J[2]),V.fogs[A]=H;if(V.cameras&&Q.defaults.camera)V.currentCamera=V.cameras[Q.defaults.camera];if(V.fogs&&Q.defaults.fog)V.scene.fog=V.fogs[Q.defaults.fog];J=Q.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(J[0],J[1],J[2]);V.bgColorAlpha=Q.defaults.bgalpha;for(t in Q.geometries)if(A=Q.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")W+=1,e.onLoadStart();o=W;for(t in Q.geometries)A=Q.geometries[t],A.type== -"cube"?(S=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),V.geometries[t]=S):A.type=="plane"?(S=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),V.geometries[t]=S):A.type=="sphere"?(S=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),V.geometries[t]=S):A.type=="cylinder"?(S=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),V.geometries[t]=S):A.type=="torus"? -(S=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),V.geometries[t]=S):A.type=="icosahedron"?(S=new THREE.IcosahedronGeometry(A.subdivisions),V.geometries[t]=S):A.type=="bin_mesh"?G.load({model:f(A.url,Q.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?R.load({model:f(A.url,Q.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=Q.embeds[A.id])&&R.createModel(A,p(t),"");for(D in Q.textures)if(t=Q.textures[D],t.url instanceof Array){X+=t.url.length;for(G=0;G1&&(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;L=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,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=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&&(u=this.size-1);var x=Math.floor(p-n);x<1&&(x=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- -1);for(var y,z,A,D,E,F;t0&&(this.field[A+y]+=D)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,p=this.size,w=this.yd,t=this.zd,x=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(h=0;h0)for(m=0;mw&&(y=w);for(m=0;m0){u=m*t;for(h=0;hsize&&(dist=size);for(k=0;k0){u=zd*k;for(m=0;m=this.maxCount-3&&n(this)};this.begin=function(){this.count=0; +this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(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;km?this.hits.push(h):this.hits.unshift(h),m=f;return this.hits}; +THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,m,k=0;c=0;for(e=this.colliders.length;ck?this.hits.push(m):this.hits.unshift(m),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,h,m=0;m=n*h))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(m.x)> -Math.abs(m.y)?Math.abs(m.x)>Math.abs(m.z)?(b=n.y-c.y,m=e.y-c.y,h=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(m.y)>Math.abs(m.z)?(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=m*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=m*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k}; +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,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.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,k=0,m=0,n=0,p=0,u=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,u=!1,m=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, -u=!1,n=1);e.origin.zc.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,u=!1,p=1);if(u)return-1;u=0;h>f&&(u=1,f=h);k>f&&(u=2,f=k);switch(u){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(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,p)}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,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.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,u,p,w;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z= -2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var 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);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||p!==e.near||w!==e.fov){u=e.aspect;p=e.near;w=e.fov;var D=e.projectionMatrix.clone(),E=125/30*0.5,F=E*p/125,J=p*Math.tan(w*Math.PI/360),P;k.n14=E;n.n14=-E;E=-J*u+F;P=J*u+F;D.n11=2*p/(P-E);D.n13=(P+E)/(P-E);h.projectionMatrix=D.clone();E=-J*u-F;P=J*u-F;D.n11=2*p/(P-E);D.n13= -(P+E)/(P-E);m.projectionMatrix=D.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=p;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,v)}}; -if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera;k.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;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;k.updateProjectionMatrix();k.position.copy(e.position); -k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,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)}}; diff --git a/examples/canvas_geometry_subdivison.html b/examples/canvas_geometry_subdivison.html index 39f31d13..15244cfd 100644 --- a/examples/canvas_geometry_subdivison.html +++ b/examples/canvas_geometry_subdivison.html @@ -25,6 +25,7 @@ +