diff --git a/build/Three.js b/build/Three.js index 32c2b20648bcbabfbf668d512cbc4895b0068a5c..ecd1cdc2d5cc9082553d91529694f159ef933612 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,7 +1,7 @@ // Three.js r42 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)}; -THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,j,h,m,o;if(e==0)f=g=j=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),o=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=o;g=e;j=b;break;case 2:f=b;g=e;j=c;break;case 3:f=b;g=o;j=e;break;case 4:f=c;g=b;j=e;break;case 5:f=e;g=b;j=o;break;case 6:case 0:f=e,g=c,j=b}this.setRGB(f, -g,j)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)}; +THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,k,h,m,o;if(e==0)f=g=k=0;else switch(h=Math.floor(b*6),m=b*6-h,b=e*(1-c),o=e*(1-c*m),c=e*(1-c*(1-m)),h){case 1:f=o;g=e;k=b;break;case 2:f=b;g=e;k=c;break;case 3:f=b;g=o;k=e;break;case 4:f=c;g=b;k=e;break;case 5:f=e;g=b;k=o;break;case 6:case 0:f=e,g=c,k=b}this.setRGB(f, +g,k)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)}; THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.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)}, unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)}; @@ -14,67 +14,67 @@ THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w 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.set(0,0,0,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={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||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);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,m,o,p,n,t,u,v,x=b.geometry, -y=x.vertices,w=[],f=0;for(g=x.faces.length;f0:t<0))if(n=n.dot((new THREE.Vector3).sub(h,u))/t,u=u.addSelf(v.multiplyScalar(n)), -j instanceof THREE.Face3)e(u,h,m,o)&&(j={distance:this.origin.distanceTo(u),point:u,face:j,object:b},w.push(j));else if(j instanceof THREE.Face4&&(e(u,h,m,p)||e(u,m,o,p)))j={distance:this.origin.distanceTo(u),point:u,face:j,object:b},w.push(j);return w}else return[]}}; -THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,n,t){m=!1;c=h;e=j;f=n;g=t;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=ch?f:h,g=g>j?g:j);b()};this.add3Points= -function(h,j,n,t,u,v){m?(m=!1,c=hn?h>u?h:u:n>u?n:u,g=j>t?j>v?j:v:t>v?t:v):(c=hn?h>u?h>f?h:f:u>f?u:f:n>u?n>f?n:f:u>f?u:f,g=j>t?j>v?j>g?j:g:v>g?v:g:t>v?t>g?t:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=ch.getRight()?f:h.getRight(),g=g> +g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||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);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,k,h,m,o,t,n,p,u,v,x=b.geometry, +z=x.vertices,y=[],f=0;for(g=x.faces.length;f0:p<0))if(n=n.dot((new THREE.Vector3).sub(h,u))/p,u=u.addSelf(v.multiplyScalar(n)), +k instanceof THREE.Face3)e(u,h,m,o)&&(k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(u,h,m,t)||e(u,m,o,t)))k={distance:this.origin.distanceTo(u),point:u,face:k,object:b},y.push(k);return y}else return[]}}; +THREE.Rectangle=function(){function b(){k=f-c;h=g-e}var c,e,f,g,k,h,m=!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 g};this.set=function(h,k,n,p){m=!1;c=h;e=k;f=n;g=p;b()};this.addPoint=function(h,k){m?(m=!1,c=h,e=k,f=h,g=k):(c=ch?f:h,g=g>k?g:k);b()};this.add3Points= +function(h,k,n,p,u,v){m?(m=!1,c=hn?h>u?h:u:n>u?n:u,g=k>p?k>v?k:v:p>v?p:v):(c=hn?h>u?h>f?h:f:u>f?u:f:n>u?n>f?n:f:u>f?u:f,g=k>p?k>v?k>g?k:g:v>g?v:g:p>v?p>g?p:g:v>g?v:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=ch.getRight()?f:h.getRight(),g=g> h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,h,m,o,p,n,t,u,v,x,y){this.set(b||1,c||0,e||0,f||0,g||0,j||1,h||0,m||0,o||0,p||0,n||1,t||0,u||0,v||0,x||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,c,e,f,g,j,h,m,o,p,n,t,u,v,x,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=m;this.n31=o;this.n32=p;this.n33=n;this.n34=t;this.n41=u;this.n42=v;this.n43=x;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, -g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23* +THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,k,h,m,o,t,n,p,u,v,x,z){this.set(b||1,c||0,e||0,f||0,g||0,k||1,h||0,m||0,o||0,t||0,n||1,p||0,u||0,v||0,x||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,c,e,f,g,k,h,m,o,t,n,p,u,v,x,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=k;this.n23=h;this.n24=m;this.n31=o;this.n32=t;this.n33=n;this.n34=p;this.n41=u;this.n42=v;this.n43=x;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, +g=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());g.cross(k,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=k.x;this.n21=f.y;this.n22=g.y;this.n23=k.y;this.n31=f.z;this.n32=g.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23* f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,y=b.n42,w=b.n43,z=b.n44,H=c.n11,A=c.n12,J=c.n13,G=c.n14,C=c.n21,P=c.n22, -F=c.n23,K=c.n24,I=c.n31,V=c.n32,E=c.n33,$=c.n34,Q=c.n41,S=c.n42,T=c.n43,k=c.n44;this.n11=e*H+f*C+g*I+j*Q;this.n12=e*A+f*P+g*V+j*S;this.n13=e*J+f*F+g*E+j*T;this.n14=e*G+f*K+g*$+j*k;this.n21=h*H+m*C+o*I+p*Q;this.n22=h*A+m*P+o*V+p*S;this.n23=h*J+m*F+o*E+p*T;this.n24=h*G+m*K+o*$+p*k;this.n31=n*H+t*C+u*I+v*Q;this.n32=n*A+t*P+u*V+v*S;this.n33=n*J+t*F+u*E+v*T;this.n34=n*G+t*K+u*$+v*k;this.n41=x*H+y*C+w*I+z*Q;this.n42=x*A+y*P+w*V+z*S;this.n43=x*J+y*F+w*E+z*T;this.n44=x*G+y*K+w*$+z*k;return this},multiplyToArray:function(b, +return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,o=b.n23,t=b.n24,n=b.n31,p=b.n32,u=b.n33,v=b.n34,x=b.n41,z=b.n42,y=b.n43,w=b.n44,H=c.n11,A=c.n12,J=c.n13,G=c.n14,C=c.n21,P=c.n22, +F=c.n23,K=c.n24,I=c.n31,V=c.n32,E=c.n33,$=c.n34,Q=c.n41,S=c.n42,T=c.n43,j=c.n44;this.n11=e*H+f*C+g*I+k*Q;this.n12=e*A+f*P+g*V+k*S;this.n13=e*J+f*F+g*E+k*T;this.n14=e*G+f*K+g*$+k*j;this.n21=h*H+m*C+o*I+t*Q;this.n22=h*A+m*P+o*V+t*S;this.n23=h*J+m*F+o*E+t*T;this.n24=h*G+m*K+o*$+t*j;this.n31=n*H+p*C+u*I+v*Q;this.n32=n*A+p*P+u*V+v*S;this.n33=n*J+p*F+u*E+v*T;this.n34=n*G+p*K+u*$+v*j;this.n41=x*H+z*C+y*I+w*Q;this.n42=x*A+z*P+y*V+w*S;this.n43=x*J+z*F+y*E+w*T;this.n44=x*G+z*K+y*$+w*j;return this},multiplyToArray:function(b, c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*= -b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,m=this.n24,o=this.n31,p=this.n32,n=this.n33,t=this.n34,u=this.n41,v=this.n42,x=this.n43,y=this.n44;return f*h*p*u-e*m*p*u-f*j*n*u+c*m*n*u+e*j*t*u-c*h*t*u-f*h*o*v+e*m*o*v+f*g*n*v-b*m*n*v-e*g*t*v+b*h*t*v+f*j*o*x-c*m*o*x-f*g*p*x+b*m*p*x+c*g*t*x-b*j*t*x-e*j*o*y+c*h*o*y+e*g*p*y-b*h*p*y-c*g*n*y+b*j*n*y},transpose:function(){var b;b=this.n21;this.n21= +b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,k=this.n22,h=this.n23,m=this.n24,o=this.n31,t=this.n32,n=this.n33,p=this.n34,u=this.n41,v=this.n42,x=this.n43,z=this.n44;return f*h*t*u-e*m*t*u-f*k*n*u+c*m*n*u+e*k*p*u-c*h*p*u-f*h*o*v+e*m*o*v+f*g*n*v-b*m*n*v-e*g*p*v+b*h*p*v+f*k*o*x-c*m*o*x-f*g*t*x+b*m*t*x+c*g*p*x-b*k*p*x-e*k*o*z+c*h*o*z+e*g*t*z-b*h*t*z-c*g*n*z+b*k*n*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=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44= this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]= this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b, c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b, -c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,m=b.z,o=g*j,p=g*h;this.set(o*j+e,o*h-f*m,o*m+f*h,0,o*h+f*m,p*h+e,p*m-f*j,0,o*m-f*h,p*m+f*j,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31); -return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=h*m,p=h*g,n=f*m,t=f*g;this.n11=o+t*e;this.n12= -n*e-p;this.n13=j*f;this.n21=j*g;this.n22=j*m;this.n23=-e;this.n31=p*e-n;this.n32=t+o*e;this.n33=j*h;break;case "ZXY":o=h*m;p=h*g;n=f*m;t=f*g;this.n11=o-t*e;this.n12=-j*g;this.n13=n+p*e;this.n21=p+n*e;this.n22=j*m;this.n23=t-o*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":o=j*m;p=j*g;n=e*m;t=e*g;this.n11=h*m;this.n12=n*f-p;this.n13=o*f+t;this.n21=h*g;this.n22=t*f+o;this.n23=p*f-n;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":o=j*h;p=j*f;n=e*h;t=e*f;this.n11=h*m;this.n12=t-o*g;this.n13= -n*g+p;this.n21=g;this.n22=j*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+n;this.n33=o-t*g;break;case "XZY":o=j*h;p=j*f;n=e*h;t=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=o*g+t;this.n22=j*m;this.n23=p*g-n;this.n31=n*g-p;this.n32=e*m;this.n33=t*g+o;break;default:o=j*m,p=j*g,n=e*m,t=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=p+n*f,this.n22=o-t*f,this.n23=-e*h,this.n31=t-o*f,this.n32=n+p*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,j=c+c, -h=e+e,m=f+f,b=c*j,o=c*h;c*=m;var p=e*h;e*=m;f*=m;j*=g;h*=g;g*=m;this.n11=1-(p+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;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},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b, +c){var e=Math.cos(c),f=Math.sin(c),g=1-e,k=b.x,h=b.y,m=b.z,o=g*k,t=g*h;this.set(o*k+e,o*h-f*m,o*m+f*h,0,o*h+f*m,t*h+e,t*m-f*k,0,o*m-f*h,t*m+f*k,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31); +return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,k=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=h*m,t=h*g,n=f*m,p=f*g;this.n11=o+p*e;this.n12= +n*e-t;this.n13=k*f;this.n21=k*g;this.n22=k*m;this.n23=-e;this.n31=t*e-n;this.n32=p+o*e;this.n33=k*h;break;case "ZXY":o=h*m;t=h*g;n=f*m;p=f*g;this.n11=o-p*e;this.n12=-k*g;this.n13=n+t*e;this.n21=t+n*e;this.n22=k*m;this.n23=p-o*e;this.n31=-k*f;this.n32=e;this.n33=k*h;break;case "ZYX":o=k*m;t=k*g;n=e*m;p=e*g;this.n11=h*m;this.n12=n*f-t;this.n13=o*f+p;this.n21=h*g;this.n22=p*f+o;this.n23=t*f-n;this.n31=-f;this.n32=e*h;this.n33=k*h;break;case "YZX":o=k*h;t=k*f;n=e*h;p=e*f;this.n11=h*m;this.n12=p-o*g;this.n13= +n*g+t;this.n21=g;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=t*g+n;this.n33=o-p*g;break;case "XZY":o=k*h;t=k*f;n=e*h;p=e*f;this.n11=h*m;this.n12=-g;this.n13=f*m;this.n21=o*g+p;this.n22=k*m;this.n23=t*g-n;this.n31=n*g-t;this.n32=e*m;this.n33=p*g+o;break;default:o=k*m,t=k*g,n=e*m,p=e*g,this.n11=h*m,this.n12=-h*g,this.n13=f,this.n21=t+n*f,this.n22=o-p*f,this.n23=-e*h,this.n31=p-o*f,this.n32=n+t*f,this.n33=k*h}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,k=c+c, +h=e+e,m=f+f,b=c*k,o=c*h;c*=m;var t=e*h;e*=m;f*=m;k*=g;h*=g;g*=m;this.n11=1-(t+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;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},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b, c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,m=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,u=b.n33,v=b.n34,x=b.n41,y=b.n42,w=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*v*y-p*u*y+p*t*w-m*v*w-o*t*z+m*u*z;c.n12=j*u*y-g*v*y-j*t*w+f*v*w+g*t*z-f*u*z;c.n13=g*p*y-j*o*y+j*m*w-f*p*w-g*m*z+f*o*z;c.n14=j*o*t-g*p*t-j*m*u+f*p*u+g*m*v-f*o*v;c.n21=p*u*x-o*v*x-p*n*w+h*v*w+o*n*z-h*u*z;c.n22=g*v*x-j*u*x+j*n*w-e*v*w-g*n*z+e*u*z;c.n23=j*o*x-g*p*x-j*h*w+e*p*w+g*h*z-e*o*z;c.n24= -g*p*n-j*o*n+j*h*u-e*p*u-g*h*v+e*o*v;c.n31=m*v*x-p*t*x+p*n*y-h*v*y-m*n*z+h*t*z;c.n32=j*t*x-f*v*x-j*n*y+e*v*y+f*n*z-e*t*z;c.n33=g*p*x-j*m*x+j*h*y-e*p*y-f*h*z+e*m*z;c.n34=j*m*n-f*p*n-j*h*t+e*p*t+f*h*v-e*m*v;c.n41=o*t*x-m*u*x-o*n*y+h*u*y+m*n*w-h*t*w;c.n42=f*u*x-g*t*x+g*n*y-e*u*y-f*n*w+e*t*w;c.n43=g*m*x-f*o*x-g*h*y+e*o*y+f*h*w-e*m*w;c.n44=f*o*n-g*m*n+g*h*t-e*o*t-f*h*u+e*m*u;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*m;e[5]=b*o;e[6]=b*p;e[7]=b*n;e[8]=b*t;return c}; -THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(j+g)/(j-g);h.n34=-2*j*g/(j-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,m,o,p;h=new THREE.Matrix4;m=c-b;o=e-f;p=j-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((j+g)/p);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.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,k=b.n14,h=b.n21,m=b.n22,o=b.n23,t=b.n24,n=b.n31,p=b.n32,u=b.n33,v=b.n34,x=b.n41,z=b.n42,y=b.n43,w=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*v*z-t*u*z+t*p*y-m*v*y-o*p*w+m*u*w;c.n12=k*u*z-g*v*z-k*p*y+f*v*y+g*p*w-f*u*w;c.n13=g*t*z-k*o*z+k*m*y-f*t*y-g*m*w+f*o*w;c.n14=k*o*p-g*t*p-k*m*u+f*t*u+g*m*v-f*o*v;c.n21=t*u*x-o*v*x-t*n*y+h*v*y+o*n*w-h*u*w;c.n22=g*v*x-k*u*x+k*n*y-e*v*y-g*n*w+e*u*w;c.n23=k*o*x-g*t*x-k*h*y+e*t*y+g*h*w-e*o*w;c.n24= +g*t*n-k*o*n+k*h*u-e*t*u-g*h*v+e*o*v;c.n31=m*v*x-t*p*x+t*n*z-h*v*z-m*n*w+h*p*w;c.n32=k*p*x-f*v*x-k*n*z+e*v*z+f*n*w-e*p*w;c.n33=g*t*x-k*m*x+k*h*z-e*t*z-f*h*w+e*m*w;c.n34=k*m*n-f*t*n-k*h*p+e*t*p+f*h*v-e*m*v;c.n41=o*p*x-m*u*x-o*n*z+h*u*z+m*n*y-h*p*y;c.n42=f*u*x-g*p*x+g*n*z-e*u*z-f*n*y+e*p*y;c.n43=g*m*x-f*o*x-g*h*z+e*o*z+f*h*y-e*m*y;c.n44=f*o*n-g*m*n+g*h*p-e*o*p-f*h*u+e*m*u;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,p=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*g;e[2]=b*k;e[3]=b*h;e[4]=b*m;e[5]=b*o;e[6]=b*t;e[7]=b*n;e[8]=b*p;return c}; +THREE.Matrix4.makeFrustum=function(b,c,e,f,g,k){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(k+g)/(k-g);h.n34=-2*k*g/(k-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)}; +THREE.Matrix4.makeOrtho=function(b,c,e,f,g,k){var h,m,o,t;h=new THREE.Matrix4;m=c-b;o=e-f;t=k-g;h.n11=2/m;h.n12=0;h.n13=0;h.n14=-((c+b)/m);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+g)/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.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion; this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; -THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3}; -THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)}; +multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,k=b.x,h=b.y,m=b.z,b=b.w;this.x=c*b+g*k+e*m-f*h;this.y=e*b+g*h+f*k-c*m;this.z=f*b+g*m+c*h-e*k;this.w=g*b-c*k-e*h-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,k=this.x,h=this.y,m=this.z,o=this.w,t=o*e+h*g-m*f,n= +o*f+m*e-k*g,p=o*g+k*f-h*e,e=-k*e-h*f-m*g;c.x=t*o+e*-k+n*-m-p*-h;c.y=n*o+e*-h+p*-k-t*-m;c.z=p*o+e*-m+t*-h-n*-k;return c}}; +THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*k)/h;f=Math.sin(f*k)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; +THREE.Face3=function(b,c,e,f,g,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=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; +THREE.Face4=function(b,c,e,f,g,k,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=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.set(b||0,c||0)}; THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;p=this.points[e[0]];n=this.points[e[1]]; -t=this.points[e[2]];u=this.points[e[3]];m=h*h;o=h*m;f.x=c(p.x,n.x,t.x,u.x,h,m,o);f.y=c(p.y,n.y,t.y,u.y,h,m,o);f.z=c(p.z,n.z,t.z,u.z,h,m,o);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;bthis.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;t=this.points[e[0]];n=this.points[e[1]]; +p=this.points[e[2]];u=this.points[e[3]];m=h*h;o=h*m;f.x=c(t.x,n.x,p.x,u.x,h,m,o);f.y=c(t.y,n.y,p.y,u.y,h,m,o);f.z=c(t.z,n.z,p.z,u.z,h,m,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(;ft&&(e=n,n=t,t=e):nv&&(e=u,u=v,v=e):up&&(e=n,n=p,p=e):nv&&(e=u,u=v,v=e):u=0&&g>=0&&k>=0&&j>=0?!0:h<0&&g<0||k<0&&j<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),k<0?c=Math.max(c,k/(k-j)):j<0&&(f=Math.min(f,k/(k-j))),f=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?c=Math.max(c,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),fS&&h.positionScreen.z0&&G.z<1))ma=A[H]=A[H]||new THREE.RenderableParticle,H++,z=ma,z.x=G.x/G.w,z.y=G.y/G.w,z.z= -G.z,z.rotation=M.rotation.z,z.scale.x=M.scale.x*Math.abs(z.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),z.scale.y=M.scale.y*Math.abs(z.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),z.materials=M.materials,J.push(z);j&&J.sort(c);return J}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var o,p,n,t,u,v,x,y;b=c.projectScene(e,f);o=0;for(p=b.length;o>1,da=p.height>>1,j=h.scale.x*u,o=h.scale.y*v,k=j*n,m=o*da,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),Z.instersects(ra)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,-o),x.translate(-n,-da),x.drawImage(p,0,0),x.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,m=h.scale.y*v,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),Z.instersects(ra)&&(f(j.color),g(j.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,m),j.program(x),x.restore()))}function y(b,h,g,j){c(j.opacity); -e(j.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(h.positionScreen.x,h.positionScreen.y);x.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(G!=b)x.lineWidth=G=b;b=j.linecap;if(C!=b)x.lineCap=C=b;b=j.linejoin;if(P!=b)x.lineJoin=P=b;f(j.color);x.stroke();ra.inflate(j.linewidth*2)}}function z(b,f,g,m,o,p,da,t,u){h.data.vertices+=3;h.data.faces++;c(t.opacity);e(t.blending);Q=b.positionScreen.x;S=b.positionScreen.y;T=f.positionScreen.x;k=f.positionScreen.y; -L=g.positionScreen.x;fa=g.positionScreen.y;A(Q,S,T,k,L,fa);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ka=da.uvs[0],J(Q,S,T,k,L,fa,t.map.image,ka[m].u,ka[m].v,ka[o].u,ka[o].v,ka[p].u,ka[p].v));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=j.matrixWorldInverse,sa.copy(da.vertexNormalsWorld[0]),na=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,xa=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(da.vertexNormalsWorld[1]), -Aa=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ha=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(da.vertexNormalsWorld[2]),Ba=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Pa=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,J(Q,S,T,k,L,fa,t.envMap.image,na,xa,Aa,Ha,Ba,Pa)}else t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ka=da.uvs[0],J(Q,S, -T,k,L,fa,t.map.image,ka[m].u,ka[m].v,ka[o].u,ka[o].v,ka[p].u,ka[p].v)),e(THREE.SubtractiveBlending)),ta?!t.wireframe&&t.shading==THREE.SmoothShading&&da.vertexNormalsWorld.length==3?(ma.r=aa.r=ca.r=wa.r,ma.g=aa.g=ca.g=wa.g,ma.b=aa.b=ca.b=wa.b,n(u,da.v1.positionWorld,da.vertexNormalsWorld[0],ma),n(u,da.v2.positionWorld,da.vertexNormalsWorld[1],aa),n(u,da.v3.positionWorld,da.vertexNormalsWorld[2],ca),ja.r=(aa.r+ca.r)*0.5,ja.g=(aa.g+ca.g)*0.5,ja.b=(aa.b+ca.b)*0.5,oa=Sa(ma,aa,ca,ja),J(Q,S,T,k,L,fa,oa, -0,0,1,0,0,1)):(va.r=wa.r,va.g=wa.g,va.b=wa.b,n(u,da.centroidWorld,da.normalWorld,va),M.r=Math.max(0,Math.min(t.color.r*va.r,1)),M.g=Math.max(0,Math.min(t.color.g*va.g,1)),M.b=Math.max(0,Math.min(t.color.b*va.b,1)),M.updateHex(),t.wireframe?Ia(M,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(M)):t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshDepthMaterial)U=j.near,W=j.far,ma.r=ma.g=ma.b=1-Na(b.positionScreen.z, -U,W),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,U,W),ca.r=ca.g=ca.b=1-Na(g.positionScreen.z,U,W),ja.r=(aa.r+ca.r)*0.5,ja.g=(aa.g+ca.g)*0.5,ja.b=(aa.b+ca.b)*0.5,oa=Sa(ma,aa,ca,ja),J(Q,S,T,k,L,fa,oa,0,0,1,0,0,1);else if(t instanceof THREE.MeshNormalMaterial)M.r=Qa(da.normalWorld.x),M.g=Qa(da.normalWorld.y),M.b=Qa(da.normalWorld.z),M.updateHex(),t.wireframe?Ia(M,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(M)}function w(b,f,g,m,o,p,t,da,u){h.data.vertices+=4;h.data.faces++;c(da.opacity); -e(da.blending);if(da.map||da.envMap)z(b,f,m,0,1,3,t,da,u),z(o,g,p,1,2,3,t,da,u);else if(Q=b.positionScreen.x,S=b.positionScreen.y,T=f.positionScreen.x,k=f.positionScreen.y,L=g.positionScreen.x,fa=g.positionScreen.y,Y=m.positionScreen.x,ga=m.positionScreen.y,ea=o.positionScreen.x,ia=o.positionScreen.y,qa=p.positionScreen.x,ha=p.positionScreen.y,da instanceof THREE.MeshBasicMaterial)H(Q,S,T,k,L,fa,Y,ga),da.wireframe?Ia(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ja(da.color); -else if(da instanceof THREE.MeshLambertMaterial)ta?!da.wireframe&&da.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ma.r=aa.r=ca.r=ja.r=wa.r,ma.g=aa.g=ca.g=ja.g=wa.g,ma.b=aa.b=ca.b=ja.b=wa.b,n(u,t.v1.positionWorld,t.vertexNormalsWorld[0],ma),n(u,t.v2.positionWorld,t.vertexNormalsWorld[1],aa),n(u,t.v4.positionWorld,t.vertexNormalsWorld[3],ca),n(u,t.v3.positionWorld,t.vertexNormalsWorld[2],ja),oa=Sa(ma,aa,ca,ja),A(Q,S,T,k,Y,ga),J(Q,S,T,k,Y,ga,oa,0,0,1,0,0,1),A(ea,ia,L,fa,qa,ha),J(ea, -ia,L,fa,qa,ha,oa,1,0,1,1,0,1)):(va.r=wa.r,va.g=wa.g,va.b=wa.b,n(u,t.centroidWorld,t.normalWorld,va),M.r=Math.max(0,Math.min(da.color.r*va.r,1)),M.g=Math.max(0,Math.min(da.color.g*va.g,1)),M.b=Math.max(0,Math.min(da.color.b*va.b,1)),M.updateHex(),H(Q,S,T,k,L,fa,Y,ga),da.wireframe?Ia(M,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ja(M)):(H(Q,S,T,k,L,fa,Y,ga),da.wireframe?Ia(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ja(da.color));else if(da instanceof -THREE.MeshNormalMaterial)M.r=Qa(t.normalWorld.x),M.g=Qa(t.normalWorld.y),M.b=Qa(t.normalWorld.z),M.updateHex(),H(Q,S,T,k,L,fa,Y,ga),da.wireframe?Ia(M,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ja(M);else if(da instanceof THREE.MeshDepthMaterial)U=j.near,W=j.far,ma.r=ma.g=ma.b=1-Na(b.positionScreen.z,U,W),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,U,W),ca.r=ca.g=ca.b=1-Na(m.positionScreen.z,U,W),ja.r=ja.g=ja.b=1-Na(g.positionScreen.z,U,W),oa=Sa(ma,aa,ca,ja),A(Q,S,T,k,Y,ga),J(Q,S,T, -k,Y,ga,oa,0,0,1,0,0,1),A(ea,ia,L,fa,qa,ha),J(ea,ia,L,fa,qa,ha,oa,1,0,1,1,0,1)}function A(b,e,c,f,h,g){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(b,e);x.closePath()}function H(b,e,c,f,h,g,j,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(j,k);x.lineTo(b,e);x.closePath()}function Ia(b,e,c,h){if(G!=e)x.lineWidth=G=e;if(C!=c)x.lineCap=C=c;if(P!=h)x.lineJoin=P=h;f(b);x.stroke();ra.inflate(e*2)}function Ja(b){g(b);x.fill()}function J(b,e,c,f,h,g,j,k,m,o,p,da,t){var n, -u;n=j.width-1;u=j.height-1;k*=n;m*=u;o*=n;p*=u;da*=n;t*=u;c-=b;f-=e;h-=b;g-=e;o-=k;p-=m;da-=k;t-=m;n=o*t-da*p;if(!((n<0?-n:n)<1))u=1/n,n=(t*c-p*h)*u,p=(t*f-p*g)*u,c=(o*h-da*c)*u,f=(o*g-da*f)*u,b=b-n*k-c*m,e=e-p*k-f*m,x.save(),x.transform(n,p,c,f,b,e),x.clip(),x.drawImage(j,0,0),x.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),da=~~(f.g*255),f=~~(f.b*255);ua[0]=h<0?0:h>255? -255:h;ua[1]=g<0?0:g>255?255:g;ua[2]=b<0?0:b>255?255:b;ua[4]=j<0?0:j>255?255:j;ua[5]=k<0?0:k>255?255:k;ua[6]=e<0?0:e>255?255:e;ua[8]=m<0?0:m>255?255:m;ua[9]=o<0?0:o>255?255:o;ua[10]=c<0?0:c>255?255:c;ua[12]=p<0?0:p>255?255:p;ua[13]=da<0?0:da>255?255:da;ua[14]=f<0?0:f>255?255:f;X.putImageData(R,0,0);za.drawImage(Ea,0,0);return N}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h), -c*=h,f*=h,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ta,Va,pa,Ca,La,Ra,Ua,D;this.autoClear?this.clear():x.setTransform(1,0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,j,this.sortElements);(ta=b.lights.length>0)&&p(b);Ta=0;for(Va=m.length;Ta0&&G.z<1))ma=A[H]=A[H]||new THREE.RenderableParticle,H++,w=ma,w.x=G.x/G.w,w.y=G.y/G.w,w.z= +G.z,w.rotation=M.rotation.z,w.scale.x=M.scale.x*Math.abs(w.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),w.scale.y=M.scale.y*Math.abs(w.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),w.materials=M.materials,J.push(w);k&&J.sort(c);return J}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;k=f/2};this.render=function(e,f){var o,t,n,p,u,v,x,z;b=c.projectScene(e,f);o=0;for(t=b.length;o>1,da=t.height>>1,j=h.scale.x*u,o=h.scale.y*v,k=j*n,m=o*da,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),Z.instersects(ra)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,-o),x.translate(-n,-da),x.drawImage(t,0,0),x.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,m=h.scale.y*v,ra.set(b.x-k,b.y-m,b.x+k,b.y+m),Z.instersects(ra)&&(f(j.color),g(j.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,m),j.program(x),x.restore()))}function z(b,h,g,j){c(j.opacity); +e(j.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(h.positionScreen.x,h.positionScreen.y);x.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(G!=b)x.lineWidth=G=b;b=j.linecap;if(C!=b)x.lineCap=C=b;b=j.linejoin;if(P!=b)x.lineJoin=P=b;f(j.color);x.stroke();ra.inflate(j.linewidth*2)}}function w(b,f,g,m,o,t,da,p,u){h.data.vertices+=3;h.data.faces++;c(p.opacity);e(p.blending);Q=b.positionScreen.x;S=b.positionScreen.y;T=f.positionScreen.x;j=f.positionScreen.y; +L=g.positionScreen.x;fa=g.positionScreen.y;A(Q,S,T,j,L,fa);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ka=da.uvs[0],Ga(Q,S,T,j,L,fa,p.map.image,ka[m].u,ka[m].v,ka[o].u,ka[o].v,ka[t].u,ka[t].v));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=k.matrixWorldInverse,sa.copy(da.vertexNormalsWorld[0]),na=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,xa=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(da.vertexNormalsWorld[1]), +Aa=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Ia=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,sa.copy(da.vertexNormalsWorld[2]),Ba=(sa.x*b.n11+sa.y*b.n12+sa.z*b.n13)*0.5+0.5,Pa=-(sa.x*b.n21+sa.y*b.n22+sa.z*b.n23)*0.5+0.5,Ga(Q,S,T,j,L,fa,p.envMap.image,na,xa,Aa,Ia,Ba,Pa)}else p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ka=da.uvs[0],Ga(Q,S, +T,j,L,fa,p.map.image,ka[m].u,ka[m].v,ka[o].u,ka[o].v,ka[t].u,ka[t].v)),e(THREE.SubtractiveBlending)),ta?!p.wireframe&&p.shading==THREE.SmoothShading&&da.vertexNormalsWorld.length==3?(ma.r=aa.r=ca.r=wa.r,ma.g=aa.g=ca.g=wa.g,ma.b=aa.b=ca.b=wa.b,n(u,da.v1.positionWorld,da.vertexNormalsWorld[0],ma),n(u,da.v2.positionWorld,da.vertexNormalsWorld[1],aa),n(u,da.v3.positionWorld,da.vertexNormalsWorld[2],ca),ja.r=(aa.r+ca.r)*0.5,ja.g=(aa.g+ca.g)*0.5,ja.b=(aa.b+ca.b)*0.5,oa=Sa(ma,aa,ca,ja),Ga(Q,S,T,j,L,fa,oa, +0,0,1,0,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,n(u,da.centroidWorld,da.normalWorld,ua),M.r=Math.max(0,Math.min(p.color.r*ua.r,1)),M.g=Math.max(0,Math.min(p.color.g*ua.g,1)),M.b=Math.max(0,Math.min(p.color.b*ua.b,1)),M.updateHex(),p.wireframe?Ja(M,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(M)):p.wireframe?Ja(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(p.color);else if(p instanceof THREE.MeshDepthMaterial)U=k.near,W=k.far,ma.r=ma.g=ma.b=1-Na(b.positionScreen.z, +U,W),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,U,W),ca.r=ca.g=ca.b=1-Na(g.positionScreen.z,U,W),ja.r=(aa.r+ca.r)*0.5,ja.g=(aa.g+ca.g)*0.5,ja.b=(aa.b+ca.b)*0.5,oa=Sa(ma,aa,ca,ja),Ga(Q,S,T,j,L,fa,oa,0,0,1,0,0,1);else if(p instanceof THREE.MeshNormalMaterial)M.r=Qa(da.normalWorld.x),M.g=Qa(da.normalWorld.y),M.b=Qa(da.normalWorld.z),M.updateHex(),p.wireframe?Ja(M,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):J(M)}function y(b,f,g,m,o,t,p,da,u){h.data.vertices+=4;h.data.faces++;c(da.opacity); +e(da.blending);if(da.map||da.envMap)w(b,f,m,0,1,3,p,da,u),w(o,g,t,1,2,3,p,da,u);else if(Q=b.positionScreen.x,S=b.positionScreen.y,T=f.positionScreen.x,j=f.positionScreen.y,L=g.positionScreen.x,fa=g.positionScreen.y,Y=m.positionScreen.x,ga=m.positionScreen.y,ea=o.positionScreen.x,ia=o.positionScreen.y,qa=t.positionScreen.x,ha=t.positionScreen.y,da instanceof THREE.MeshBasicMaterial)H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(da.color); +else if(da instanceof THREE.MeshLambertMaterial)ta?!da.wireframe&&da.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==4?(ma.r=aa.r=ca.r=ja.r=wa.r,ma.g=aa.g=ca.g=ja.g=wa.g,ma.b=aa.b=ca.b=ja.b=wa.b,n(u,p.v1.positionWorld,p.vertexNormalsWorld[0],ma),n(u,p.v2.positionWorld,p.vertexNormalsWorld[1],aa),n(u,p.v4.positionWorld,p.vertexNormalsWorld[3],ca),n(u,p.v3.positionWorld,p.vertexNormalsWorld[2],ja),oa=Sa(ma,aa,ca,ja),A(Q,S,T,j,Y,ga),Ga(Q,S,T,j,Y,ga,oa,0,0,1,0,0,1),A(ea,ia,L,fa,qa,ha),Ga(ea, +ia,L,fa,qa,ha,oa,1,0,1,1,0,1)):(ua.r=wa.r,ua.g=wa.g,ua.b=wa.b,n(u,p.centroidWorld,p.normalWorld,ua),M.r=Math.max(0,Math.min(da.color.r*ua.r,1)),M.g=Math.max(0,Math.min(da.color.g*ua.g,1)),M.b=Math.max(0,Math.min(da.color.b*ua.b,1)),M.updateHex(),H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(M,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(M)):(H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(da.color));else if(da instanceof THREE.MeshNormalMaterial)M.r= +Qa(p.normalWorld.x),M.g=Qa(p.normalWorld.y),M.b=Qa(p.normalWorld.z),M.updateHex(),H(Q,S,T,j,L,fa,Y,ga),da.wireframe?Ja(M,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):J(M);else if(da instanceof THREE.MeshDepthMaterial)U=k.near,W=k.far,ma.r=ma.g=ma.b=1-Na(b.positionScreen.z,U,W),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,U,W),ca.r=ca.g=ca.b=1-Na(m.positionScreen.z,U,W),ja.r=ja.g=ja.b=1-Na(g.positionScreen.z,U,W),oa=Sa(ma,aa,ca,ja),A(Q,S,T,j,Y,ga),Ga(Q,S,T,j,Y,ga,oa,0,0,1,0,0,1),A(ea, +ia,L,fa,qa,ha),Ga(ea,ia,L,fa,qa,ha,oa,1,0,1,1,0,1)}function A(b,e,c,f,h,g){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(b,e);x.closePath()}function H(b,e,c,f,h,g,j,k){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(h,g);x.lineTo(j,k);x.lineTo(b,e);x.closePath()}function Ja(b,e,c,h){if(G!=e)x.lineWidth=G=e;if(C!=c)x.lineCap=C=c;if(P!=h)x.lineJoin=P=h;f(b);x.stroke();ra.inflate(e*2)}function J(b){g(b);x.fill()}function Ga(b,e,c,f,h,g,j,k,m,o,t,da,p){var n,u;n=j.width-1;u=j.height- +1;k*=n;m*=u;o*=n;t*=u;da*=n;p*=u;c-=b;f-=e;h-=b;g-=e;o-=k;t-=m;da-=k;p-=m;n=o*p-da*t;if(!((n<0?-n:n)<1))u=1/n,n=(p*c-t*h)*u,t=(p*f-t*g)*u,c=(o*h-da*c)*u,f=(o*g-da*f)*u,b=b-n*k-c*m,e=e-t*k-f*m,x.save(),x.transform(n,t,c,f,b,e),x.clip(),x.drawImage(j,0,0),x.restore()}function Sa(b,e,c,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(e.r*255),k=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),da=~~(f.g*255),f=~~(f.b*255);va[0]=h<0?0:h>255?255:h;va[1]=g<0?0:g>255? +255:g;va[2]=b<0?0:b>255?255:b;va[4]=j<0?0:j>255?255:j;va[5]=k<0?0:k>255?255:k;va[6]=e<0?0:e>255?255:e;va[8]=m<0?0:m>255?255:m;va[9]=o<0?0:o>255?255:o;va[10]=c<0?0:c>255?255:c;va[12]=t<0?0:t>255?255:t;va[13]=da<0?0:da>255?255:da;va[14]=f<0?0:f>255?255:f;X.putImageData(R,0,0);za.drawImage(Ea,0,0);return N}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Qa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),c*=h,f*=h,e.x+=c,e.y+= +f,b.x-=c,b.y-=f)}var Ta,Va,pa,Ca,La,Ra,Ua,D;this.autoClear?this.clear():x.setTransform(1,0,0,-1,u,v);h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,k,this.sortElements);(ta=b.lights.length>0)&&t(b);Ta=0;for(Va=m.length;Ta0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j)):g instanceof THREE.PointLight&&(V.sub(g.position,e.centroidWorld),V.normalize(),j=e.normalWorld.dot(V)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j))}function c(e,c,k,m,o,t){h.data.vertices+=3;h.data.faces++;Q=f(S++);Q.setAttribute("d", -"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?G.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?J?(C.r=P.r,C.g=P.g,C.b=P.b,b(t,m,C),G.r=Math.max(0,Math.min(o.color.r*C.r,1)),G.g=Math.max(0,Math.min(o.color.g*C.g,1)),G.b=Math.max(0,Math.min(o.color.b*C.b,1)),G.updateHex()):G.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(I=1-o.__2near/(o.__farPlusNear- -m.z*o.__farMinusNear),G.setRGB(I,I,I)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style","fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+o.opacity);p.appendChild(Q)}function e(e,c,k,m, -o,t,n){h.data.vertices+=4;h.data.faces++;Q=f(S++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.hex=t.color.hex:t instanceof THREE.MeshLambertMaterial?J?(C.r=P.r,C.g=P.g,C.b=P.b,b(n,o,C),G.r=Math.max(0,Math.min(t.color.r*C.r,1)),G.g=Math.max(0,Math.min(t.color.g*C.g,1)),G.b=Math.max(0,Math.min(t.color.b* -C.b,1)),G.updateHex()):G.hex=t.color.hex:t instanceof THREE.MeshDepthMaterial?(I=1-t.__2near/(t.__farPlusNear-o.z*t.__farMinusNear),G.setRGB(I,I,I)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(g(o.normalWorld.x),g(o.normalWorld.y),g(o.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: #"+j(G.hex.toString(16))+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style", -"fill: #"+j(G.hex.toString(16))+"; fill-opacity: "+t.opacity);p.appendChild(Q)}function f(b){E[b]==null&&(E[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),k==0&&E[b].setAttribute("shape-rendering","crispEdges"));return E[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function j(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,o=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,t,u,v,x,y,w,z,H=new THREE.Rectangle,A=new THREE.Rectangle,J= -!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),P=new THREE.Color(0),F=new THREE.Color(0),K=new THREE.Color(0),I,V=new THREE.Vector3,E=[],$=[],Q,S,T,k=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":k=1;break;case "low":k=0}};this.setSize=function(b,e){n=b;t=e;u=n/2;v=t/2;p.setAttribute("viewBox",-u+" "+-v+" "+n+" "+t);p.setAttribute("width",n);p.setAttribute("height",t);H.set(-u,-v, -u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,t,n,C,G,I,M,E;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,f,this.sortElements);T=S=0;if(J=b.lights.length>0){M=b.lights;P.setRGB(0,0,0);F.setRGB(0,0,0);K.setRGB(0,0,0);g=0;for(t=M.length;g0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j)):g instanceof THREE.PointLight&&(V.sub(g.position,e.centroidWorld),V.normalize(),j=e.normalWorld.dot(V)*g.intensity,j>0&&(c.r+=g.color.r*j,c.g+=g.color.g*j,c.b+=g.color.b*j))}function c(e,c,j,m,o,p){h.data.vertices+=3;h.data.faces++;Q=f(S++);Q.setAttribute("d", +"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?G.hex=o.color.hex:o instanceof THREE.MeshLambertMaterial?J?(C.r=P.r,C.g=P.g,C.b=P.b,b(p,m,C),G.r=Math.max(0,Math.min(o.color.r*C.r,1)),G.g=Math.max(0,Math.min(o.color.g*C.g,1)),G.b=Math.max(0,Math.min(o.color.b*C.b,1)),G.updateHex()):G.hex=o.color.hex:o instanceof THREE.MeshDepthMaterial?(I=1-o.__2near/(o.__farPlusNear- +m.z*o.__farMinusNear),G.setRGB(I,I,I)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: #"+k(G.hex.toString(16))+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style","fill: #"+k(G.hex.toString(16))+"; fill-opacity: "+o.opacity);t.appendChild(Q)}function e(e,c,j,m, +o,p,n){h.data.vertices+=4;h.data.faces++;Q=f(S++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?G.hex=p.color.hex:p instanceof THREE.MeshLambertMaterial?J?(C.r=P.r,C.g=P.g,C.b=P.b,b(n,o,C),G.r=Math.max(0,Math.min(p.color.r*C.r,1)),G.g=Math.max(0,Math.min(p.color.g*C.g,1)),G.b=Math.max(0,Math.min(p.color.b* +C.b,1)),G.updateHex()):G.hex=p.color.hex:p instanceof THREE.MeshDepthMaterial?(I=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),G.setRGB(I,I,I)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(g(o.normalWorld.x),g(o.normalWorld.y),g(o.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: #"+k(G.hex.toString(16))+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style", +"fill: #"+k(G.hex.toString(16))+"; fill-opacity: "+p.opacity);t.appendChild(Q)}function f(b){E[b]==null&&(E[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),j==0&&E[b].setAttribute("shape-rendering","crispEdges"));return E[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function k(b){for(;b.length<6;)b="0"+b;return b}var h=this,m=null,o=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,u,v,x,z,y,w,H=new THREE.Rectangle,A=new THREE.Rectangle,J= +!1,G=new THREE.Color(16777215),C=new THREE.Color(16777215),P=new THREE.Color(0),F=new THREE.Color(0),K=new THREE.Color(0),I,V=new THREE.Vector3,E=[],$=[],Q,S,T,j=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":j=1;break;case "low":j=0}};this.setSize=function(b,e){n=b;p=e;u=n/2;v=p/2;t.setAttribute("viewBox",-u+" "+-v+" "+n+" "+p);t.setAttribute("width",n);t.setAttribute("height",p);H.set(-u,-v, +u,v)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};this.render=function(b,f){var g,p,n,C,G,I,M,E;this.autoClear&&this.clear();h.data.vertices=0;h.data.faces=0;m=o.projectScene(b,f,this.sortElements);T=S=0;if(J=b.lights.length>0){M=b.lights;P.setRGB(0,0,0);F.setRGB(0,0,0);K.setRGB(0,0,0);g=0;for(p=M.length;g 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif", -lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\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 );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}", -lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", +lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\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 );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}", +lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", -default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap;\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord;\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif", -shadowmap_fragment:"#ifdef USE_SHADOWMAP\nvec3 shadowCoord = vShadowCoord.xyz / vShadowCoord.w;\nvec4 rgbaDepth = texture2D( shadowMap, shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) && ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )\ngl_FragColor = gl_FragColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord;\nuniform mat4 shadowMatrix;\n#endif", -shadowmap_vertex:"#ifdef USE_SHADOWMAP\nvShadowCoord = shadowMatrix * objectMatrix * vec4( position, 1.0 );\n#endif"}; +default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif", +shadowmap_fragment:"#ifdef USE_SHADOWMAP\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) && ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\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"}; THREE.UniformsUtils={merge:function(b){var c,e,f,g={};for(c=0;c=0)k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else if(j.morphTargetBase){c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer), -k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,t=j.morphTargetForcedOrder,o=j.morphTargetInfluences;fp&&(n=u,p=o[n]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=p;t[n]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m], -c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)): -k.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB, -4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES, -h.__webglFaceCount,k.UNSIGNED_SHORT,0)),T.data.vertices+=h.__webglFaceCount,T.data.faces+=h.__webglFaceCount/3,T.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),T.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),T.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),T.data.drawCalls++)}}function g(b, -e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&(k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,t,o,p,n,u,v=b.count*3;for(u= -0;u0&&w[0]0&&w[1]0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,x[2]=m.z,u=m.size*m.scale/W,v[0]=u*o,v[1]=u,k.uniform3fv(z.screenPosition,x),k.uniform2fv(z.scale,v),k.uniform1f(z.rotation,m.rotation),k.uniform1f(z.opacity,m.opacity),K(m.blending),V(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST); -k.depthMask(ga)}function H(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,X,m));ta&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),k.bufferData(k.ARRAY_BUFFER,Z,m));va&&ha.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,Y,m));xa&&Q>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));xa&&ga>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,$,m));sa&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER, -g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ia,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,la,m));O>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,na,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,aa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER, -ca,m));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;J(h)}else if(b instanceof THREE.Ribbon){f= -b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;z=b.vertices;g=b.colors;y=z.length;j=g.length;C=b.__vertexArray;m=b.__colorArray;H=b.__dirtyColors;if(b.__dirtyVertices){for(t=0;t=0;c--)b[c].object==e&&b.splice(c,1)}function P(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(n[m].counter+=1,t=n[m].hash+"_"+n[m].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]= -{faces:[],materials:k,vertices:0,numMorphTargets:o})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=j}function F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=qa){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD); -k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}qa=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,S(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,S(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,S(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,S(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S, -k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,Q(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function V(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit= -!0),I(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function E(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S, -S(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,S(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,S(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,S(b.minFilter));k.texImage2D(k.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&& -!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER, -null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=U,b=W);e!=Y&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,ja,c,b),Y=e)}function $(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST; -default:return k.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR; -case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0} -var T=this,k,L=[],fa=null,Y=null,ga=!0,ea=null,ia=null,qa=null,ha=null,M=null,ma=null,aa=null,ca=0,ja=0,U=0,W=0,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,na=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"), -Pa=b.stencil!==void 0?b.stencil:!0,Z=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=null;this.shadowMapEnabled= -!1;var ta,va=new THREE.Matrix4,b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(k=Ba.getContext("experimental-webgl",{antialias:Z,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+ -" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(la.r,la.g,la.b,ra);this.context=k;var Ea=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> -0;if(Pa){var X={};X.vertices=new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=-1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=k.createBuffer();X.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,X.vertexBuffer);k.bufferData(k.ARRAY_BUFFER, -X.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,X.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,X.faces,k.STATIC_DRAW);X.program=k.createProgram();k.attachShader(X.program,$("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(X.program,$("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(X.program);X.vertexLocation=k.getAttribLocation(X.program,"position");X.projectionLocation=k.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation= -k.getUniformLocation(X.program,"darkness")}var R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);Z=0;R.vertices[Z++]=-1;R.vertices[Z++]=-1;R.vertices[Z++]=0;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;Z=0;R.faces[Z++]=0;R.faces[Z++]=1;R.faces[Z++]=2;R.faces[Z++]=0;R.faces[Z++]=2;R.faces[Z++]=3; -R.vertexBuffer=k.createBuffer();R.elementBuffer=k.createBuffer();R.tempTexture=k.createTexture();R.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,R.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,R.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,R.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,R.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,R.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S, -k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,R.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST); -k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(R.hasVertexTexture=!1,R.program=k.createProgram(),k.attachShader(R.program,$("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),k.attachShader(R.program,$("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(R.hasVertexTexture=!0,R.program=k.createProgram(),k.attachShader(R.program,$("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(R.program,$("vertex", -THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.vertex=k.getAttribLocation(R.program,"position");R.attributes.uv=k.getAttribLocation(R.program,"UV");R.uniforms.renderType=k.getUniformLocation(R.program,"renderType");R.uniforms.map=k.getUniformLocation(R.program,"map");R.uniforms.occlusionMap=k.getUniformLocation(R.program,"occlusionMap");R.uniforms.opacity=k.getUniformLocation(R.program,"opacity");R.uniforms.scale=k.getUniformLocation(R.program, -"scale");R.uniforms.rotation=k.getUniformLocation(R.program,"rotation");R.uniforms.screenPosition=k.getUniformLocation(R.program,"screenPosition");var ua=!1,N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);Z=0;N.vertices[Z++]=-1;N.vertices[Z++]=-1;N.vertices[Z++]=0;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=-1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=0;N.vertices[Z++]=-1;N.vertices[Z++]=1;N.vertices[Z++]=0;Z= -N.vertices[Z++]=0;N.faces[Z++]=0;N.faces[Z++]=1;N.faces[Z++]=2;N.faces[Z++]=0;N.faces[Z++]=2;N.faces[Z++]=3;N.vertexBuffer=k.createBuffer();N.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,N.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,N.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,N.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,N.faces,k.STATIC_DRAW);N.program=k.createProgram();k.attachShader(N.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(N.program, -$("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=k.getAttribLocation(N.program,"position");N.attributes.uv=k.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=k.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=k.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=k.getUniformLocation(N.program,"rotation");N.uniforms.scale=k.getUniformLocation(N.program,"scale");N.uniforms.alignment=k.getUniformLocation(N.program, -"alignment");N.uniforms.map=k.getUniformLocation(N.program,"map");N.uniforms.opacity=k.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=k.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=k.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=k.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=k.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=k.getUniformLocation(N.program, -"projectionMatrix");var za=!1;this.setSize=function(b,e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ca=b;ja=e;U=c;W=f;k.viewport(ca,ja,U,W)};this.setScissor=function(b,e,c,f){k.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ga=b;k.depthMask(b)};this.setClearColorHex=function(b,e){la.setHex(b);ra=e;k.clearColor(la.r,la.g,la.b,ra)};this.setClearColor= -function(b,e){la.copy(b);ra=e;k.clearColor(la.r,la.g,la.b,ra)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){X.darkness=b};this.getContext=function(){return k};this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic": -b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var t,n,o;t=o=m=0;for(n=e.length;t=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal); -p.tangent>=0&&k.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(k.enableVertexAttribArray(p.skinVertexA),k.enableVertexAttribArray(p.skinVertexB),k.enableVertexAttribArray(p.skinIndex),k.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&k.enableVertexAttribArray(p[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,p.morphTarget0>=0&&(k.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++), -p.morphTarget1>=0&&(k.enableVertexAttribArray(p.morphTarget1),b.numSupportedMorphTargets++),p.morphTarget2>=0&&(k.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++),p.morphTarget3>=0&&(k.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++),p.morphTarget4>=0&&(k.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++),p.morphTarget5>=0&&(k.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++),p.morphTarget6>=0&&(k.enableVertexAttribArray(p.morphTarget6), -b.numSupportedMorphTargets++),p.morphTarget7>=0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,n,C){var A,U,G,F,W,J,I,L,M=b.lights,N=b.fog;this.shadowMapEnabled&&x(b,c);T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(na);ka.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ka);this.initWebGLObjects(b);E(n); -(this.autoClear||C)&&this.clear();W=b.__webglObjects.length;for(C=0;C0||u.faceVertexUvs.length>0)j.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(t*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(t*4), -j.__skinVertexBArray=new Float32Array(t*4),j.__skinIndexArray=new Float32Array(t*4),j.__skinWeightArray=new Float32Array(t*4);j.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(x*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];u=0;for(v=j.numMorphTargets;u=0)j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0);else if(k.morphTargetBase){c=g.program.attributes;k.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,p=k.morphTargetForcedOrder, +o=k.morphTargetInfluences;ft&&(n=u,t=o[n]);j.bindBuffer(j.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[n]);j.vertexAttribPointer(c["morphTarget"+ +f],3,j.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=t;p[n]=1;t=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(g.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[m],c.size,j.FLOAT,!1,0,0));b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT, +!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,h.__webglUV2Buffer), +j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex, +4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0));k instanceof THREE.Mesh?(g.wireframe?(j.lineWidth(g.wireframeLinewidth),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),j.drawElements(j.LINES,h.__webglLineCount,j.UNSIGNED_SHORT,0)):(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),j.drawElements(j.TRIANGLES,h.__webglFaceCount,j.UNSIGNED_SHORT,0)),T.data.vertices+=h.__webglFaceCount,T.data.faces+=h.__webglFaceCount/ +3,T.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?j.LINE_STRIP:j.LINES,j.lineWidth(g.linewidth),j.drawArrays(k,0,h.__webglLineCount),T.data.drawCalls++):k instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,h.__webglParticleCount),T.data.drawCalls++):k instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,h.__webglVertexCount),T.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=j.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer= +j.createBuffer();b.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,b.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,b.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(e.attributes.position),j.vertexAttribPointer(e.attributes.position,3,j.FLOAT,!1,0,0));if(b.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,k,m,p,o,t,n,u,v=b.count*3;for(u=0;u0&&w[0]0&&w[1]0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,x[2]=m.z,u=m.size*m.scale/W,v[0]=u*o,v[1]=u,j.uniform3fv(y.screenPosition,x),j.uniform2fv(y.scale,v),j.uniform1f(y.rotation,m.rotation),j.uniform1f(y.opacity,m.opacity),K(m.blending),V(m.texture,1),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0)}j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ga)}function H(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse, +b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglColorBuffer), +j.bufferData(j.ARRAY_BUFFER,X,m));ta&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglNormalBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m));ua&&ha.hasTangents&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglTangentBuffer),j.bufferData(j.ARRAY_BUFFER,Y,m));xa&&Q>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,fa,m));xa&&ga>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,$,m));sa&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER, +ia,m),j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,la,m));O>0&&(j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,na,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,ea,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,aa,m),j.bindBuffer(j.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ca,m));k.dynamic||(delete g.__inittedArrays, +delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;J(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices|| +f.__dirtyColors){b=f;e=j.DYNAMIC_DRAW;y=b.vertices;g=b.colors;z=y.length;k=g.length;C=b.__vertexArray;m=b.__colorArray;H=b.__dirtyColors;if(b.__dirtyVertices){for(p=0;p=0;c--)b[c].object==e&&b.splice(c,1)}function P(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(n[m].counter+=1,p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:j,vertices:0,numMorphTargets:o})), +b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=k}function F(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=qa){switch(b){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD, +j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}qa=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(j.texParameteri(b,j.TEXTURE_WRAP_S,S(e.wrapS)),j.texParameteri(b,j.TEXTURE_WRAP_T,S(e.wrapT)),j.texParameteri(b,j.TEXTURE_MAG_FILTER,S(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,S(e.minFilter)),j.generateMipmap(b)):(j.texParameteri(b,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(b,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(b, +j.TEXTURE_MAG_FILTER,Q(e.magFilter)),j.texParameteri(b,j.TEXTURE_MIN_FILTER,Q(e.minFilter)))}function V(b,e){if(b.needsUpdate)b.__webglInit?(j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image)):(b.__webglTexture=j.createTexture(),j.bindTexture(j.TEXTURE_2D,b.__webglTexture),j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,b.image),b.__webglInit=!0),I(j.TEXTURE_2D,b,b.image),j.bindTexture(j.TEXTURE_2D,null),b.needsUpdate=!1;j.activeTexture(j.TEXTURE0+ +e);j.bindTexture(j.TEXTURE_2D,b.__webglTexture)}function E(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=j.createFramebuffer();b.__webglRenderbuffer=j.createRenderbuffer();b.__webglTexture=j.createTexture();j.bindTexture(j.TEXTURE_2D,b.__webglTexture);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,S(b.wrapS));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,S(b.wrapT));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER, +S(b.magFilter));j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,S(b.minFilter));j.texImage2D(j.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);j.bindRenderbuffer(j.RENDERBUFFER,b.__webglRenderbuffer);j.bindFramebuffer(j.FRAMEBUFFER,b.__webglFramebuffer);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER, +j.DEPTH_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,b.__webglRenderbuffer)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height);j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null, +c=U,b=W);e!=Y&&(j.bindFramebuffer(j.FRAMEBUFFER,e),j.viewport(ca,ja,c,b),Y=e)}function $(b,e){var c;b=="fragment"?c=j.createShader(j.FRAGMENT_SHADER):b=="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,e);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(e),null;return c}function Q(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}} +function S(b){switch(b){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR; +case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0} +var T=this,j,L=[],fa=null,Y=null,ga=!0,ea=null,ia=null,qa=null,ha=null,M=null,ma=null,aa=null,ca=0,ja=0,U=0,W=0,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ka=new THREE.Matrix4,na=new Float32Array(16),xa=new Float32Array(16),Aa=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ba=b.canvas!==void 0?b.canvas:document.createElement("canvas"), +Pa=b.stencil!==void 0?b.stencil:!0,Z=b.antialias!==void 0?b.antialias:!1,la=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ra=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ba;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled= +!1;var ta,ua=[],b=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa}),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;ya._shadowPass=!0;try{if(!(j=Ba.getContext("experimental-webgl",{antialias:Z,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+ +" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}j.clearColor(0,0,0,1);j.clearDepth(1);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(la.r,la.g,la.b,ra);this.context=j;var Ea=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Pa){var X={};X.vertices= +new Float32Array(12);X.faces=new Uint16Array(6);X.darkness=0.5;X.vertices[0]=-20;X.vertices[1]=-20;X.vertices[2]=-1;X.vertices[3]=20;X.vertices[4]=-20;X.vertices[5]=-1;X.vertices[6]=20;X.vertices[7]=20;X.vertices[8]=-1;X.vertices[9]=-20;X.vertices[10]=20;X.vertices[11]=-1;X.faces[0]=0;X.faces[1]=1;X.faces[2]=2;X.faces[3]=0;X.faces[4]=2;X.faces[5]=3;X.vertexBuffer=j.createBuffer();X.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,X.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,X.vertices,j.STATIC_DRAW); +j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,X.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,X.faces,j.STATIC_DRAW);X.program=j.createProgram();j.attachShader(X.program,$("fragment",THREE.ShaderLib.shadowPost.fragmentShader));j.attachShader(X.program,$("vertex",THREE.ShaderLib.shadowPost.vertexShader));j.linkProgram(X.program);X.vertexLocation=j.getAttribLocation(X.program,"position");X.projectionLocation=j.getUniformLocation(X.program,"projectionMatrix");X.darknessLocation=j.getUniformLocation(X.program, +"darkness")}var R={};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);Z=0;R.vertices[Z++]=-1;R.vertices[Z++]=-1;R.vertices[Z++]=0;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=1;R.vertices[Z++]=-1;R.vertices[Z++]=1;R.vertices[Z++]=0;R.vertices[Z++]=1;Z=0;R.faces[Z++]=0;R.faces[Z++]=1;R.faces[Z++]=2;R.faces[Z++]=0;R.faces[Z++]=2;R.faces[Z++]=3;R.vertexBuffer=j.createBuffer(); +R.elementBuffer=j.createBuffer();R.tempTexture=j.createTexture();R.occlusionTexture=j.createTexture();j.bindBuffer(j.ARRAY_BUFFER,R.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,R.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,R.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R.faces,j.STATIC_DRAW);j.bindTexture(j.TEXTURE_2D,R.tempTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGB,16,16,0,j.RGB,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D, +j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST);j.bindTexture(j.TEXTURE_2D,R.occlusionTexture);j.texImage2D(j.TEXTURE_2D,0,j.RGBA,16,16,0,j.RGBA,j.UNSIGNED_BYTE,null);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST);j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER, +j.NEAREST);j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(R.hasVertexTexture=!1,R.program=j.createProgram(),j.attachShader(R.program,$("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),j.attachShader(R.program,$("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(R.hasVertexTexture=!0,R.program=j.createProgram(),j.attachShader(R.program,$("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),j.attachShader(R.program,$("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))); +j.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.vertex=j.getAttribLocation(R.program,"position");R.attributes.uv=j.getAttribLocation(R.program,"UV");R.uniforms.renderType=j.getUniformLocation(R.program,"renderType");R.uniforms.map=j.getUniformLocation(R.program,"map");R.uniforms.occlusionMap=j.getUniformLocation(R.program,"occlusionMap");R.uniforms.opacity=j.getUniformLocation(R.program,"opacity");R.uniforms.scale=j.getUniformLocation(R.program,"scale");R.uniforms.rotation=j.getUniformLocation(R.program, +"rotation");R.uniforms.screenPosition=j.getUniformLocation(R.program,"screenPosition");var va=!1,N={};N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);Z=0;N.vertices[Z++]=-1;N.vertices[Z++]=-1;N.vertices[Z++]=0;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=-1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=1;N.vertices[Z++]=0;N.vertices[Z++]=-1;N.vertices[Z++]=1;N.vertices[Z++]=0;Z=N.vertices[Z++]=0;N.faces[Z++]=0;N.faces[Z++]=1;N.faces[Z++]= +2;N.faces[Z++]=0;N.faces[Z++]=2;N.faces[Z++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);N.program=j.createProgram();j.attachShader(N.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,$("vertex",THREE.ShaderLib.sprite.vertexShader)); +j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.map=j.getUniformLocation(N.program, +"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,"projectionMatrix");var za=!1;this.setSize=function(b, +e){Ba.width=b;Ba.height=e;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(b,e,c,f){ca=b;ja=e;U=c;W=f;j.viewport(ca,ja,U,W)};this.setScissor=function(b,e,c,f){j.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ga=b;j.depthMask(b)};this.setClearColorHex=function(b,e){la.setHex(b);ra=e;j.clearColor(la.r,la.g,la.b,ra)};this.setClearColor=function(b,e){la.copy(b);ra=e;j.clearColor(la.r, +la.g,la.b,ra)};this.clear=function(){j.clear(j.COLOR_BUFFER_BIT|j.DEPTH_BUFFER_BIT|j.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){X.darkness=b};this.getContext=function(){return j};this.initMaterial=function(b,e,c,f){var h,g,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?k="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert": +b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,n,o;p=o=m=0;for(n=e.length;p=0&&j.enableVertexAttribArray(u.position);u.color>=0&&j.enableVertexAttribArray(u.color);u.normal>= +0&&j.enableVertexAttribArray(u.normal);u.tangent>=0&&j.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(j.enableVertexAttribArray(u.skinVertexA),j.enableVertexAttribArray(u.skinVertexB),j.enableVertexAttribArray(u.skinIndex),j.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(h in b.attributes)u[h]!==void 0&&u[h]>=0&&j.enableVertexAttribArray(u[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,u.morphTarget0>=0&&(j.enableVertexAttribArray(u.morphTarget0), +b.numSupportedMorphTargets++),u.morphTarget1>=0&&(j.enableVertexAttribArray(u.morphTarget1),b.numSupportedMorphTargets++),u.morphTarget2>=0&&(j.enableVertexAttribArray(u.morphTarget2),b.numSupportedMorphTargets++),u.morphTarget3>=0&&(j.enableVertexAttribArray(u.morphTarget3),b.numSupportedMorphTargets++),u.morphTarget4>=0&&(j.enableVertexAttribArray(u.morphTarget4),b.numSupportedMorphTargets++),u.morphTarget5>=0&&(j.enableVertexAttribArray(u.morphTarget5),b.numSupportedMorphTargets++),u.morphTarget6>= +0&&(j.enableVertexAttribArray(u.morphTarget6),b.numSupportedMorphTargets++),u.morphTarget7>=0&&(j.enableVertexAttribArray(u.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,c,n,C){var A,U,G,F,W,J,I,L,M=b.lights,N=b.fog;this.shadowMapEnabled&&x(b,c);T.data.vertices=0;T.data.faces=0;T.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(xa);c.projectionMatrix.flattenToArray(na);ka.multiply(c.projectionMatrix,c.matrixWorldInverse); +o(ka);this.initWebGLObjects(b);E(n);(this.autoClear||C)&&this.clear();W=b.__webglObjects.length;for(C=0;C0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(p*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(p*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(p*4), +k.__skinVertexBArray=new Float32Array(p*4),k.__skinIndexArray=new Float32Array(p*4),k.__skinWeightArray=new Float32Array(p*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(x*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u=0;h--)e[h]==c&&e.splice(h,1)}else c instanceof THREE.LensFlare?C(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&C(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=j;return c}, +THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,k=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==k)h=e=0;else{var m=k-h,h=m/k,e=e==k?(f-g)/m:f==k?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=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=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,h=g.vertices,m=b.faces,o=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=h.length;n25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c25&&(k=25);g=(k-1)*0.5;e=Array(k);for(c=f=0;c1)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=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== -"rot")THREE.Quaternion.slerp(g,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&n[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;vb.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];m=b[e[1]];o=b[e[2]];p=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],m[0],o[0],p[0],g,e,h);f[1]=this.interpolate(j[1],m[1],o[1],p[1],g,e,h);f[2]=this.interpolate(j[2],m[2],o[2],p[2],g,e,h);return f}; -THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*j+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=g,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== +"rot")THREE.Quaternion.slerp(g,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(k[0]-g[0])*f,e.y=g[1]+(k[1]-g[1])*f,e.z=g[2]+(k[2]-g[2])*f}}if(this.JITCompile&&n[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;vb.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];o=b[e[2]];t=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(k[0],m[0],o[0],t[0],g,e,h);f[1]=this.interpolate(k[1],m[1],o[1],t[1],g,e,h);f[2]=this.interpolate(k[2],m[2],o[2],t[2],g,e,h);return f}; +THREE.Animation.prototype.interpolate=function(b,c,e,f,g,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*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed= b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!== @@ -399,12 +400,12 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu", function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera; THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; -THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},g,j=e.getControlPointsArray(),m=e.getLength(),o=j.length,H=0;g=o-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[g]={time:f,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=h[1]-h[0];this.phi= +window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,k=Math.PI/180;this.update=function(b,e,c){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var m=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])/m)*m+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;m=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])/m)*m+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX= b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(o,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), @@ -413,164 +414,164 @@ THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,argument b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier= 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}}; this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break; -case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,j=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY- -c.offset[1]-j)/j;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff* +case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY- +c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff* this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward|| this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!= document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this, this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype; -THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,m=new THREE.Matrix4,o=!1,p=1,n=0,t=0,u=0,v=0,x=0,y=window.innerWidth/2,w=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*v),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*u);o&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); -else if(this.forward.y0||this.autoForward&&!(n<0)?1:n));this.translateX(b*p);this.translateY(b*u);o&&(this.roll+=this.rollSpeed*this.delta*t);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +else if(this.forward.y1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f}; -this.rotateCamera=function(){var b=Math.acos(j.dot(h)/j.length()/h.length());if(b){var e=(new THREE.Vector3).cross(j,h).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(h);this.staticMoving?j=h:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(o.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var b=n.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.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=n:p.addSelf(b.sub(n,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +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(g);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-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=o:m.y+=(o.y-m.y)*this.dynamicDampingFactor)}; +this.panCamera=function(){var b=n.clone().subSelf(t);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.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=n:t.addSelf(b.sub(n,t).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), g.lengthSq()j)break;f++}return f/g};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)}; -THREE.QuadraticBezierCurve=function(b,c,e,f,g,j){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=j};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)}; -THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,g,j,h,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=j;this.x3=h;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; +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.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;var c=[],e,f=this.getPoint(0),g,k=0;for(g=1;g<=b;g++)e=this.getPoint(g/b),k+=e.distanceTo(f),c.push(k),f=e;return this.cacheLengths=c}; +THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,k;for(k=c?c:b*e[g-1];fk)break;f++}return f/g};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)}; +THREE.QuadraticBezierCurve=function(b,c,e,f,g,k){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=k};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)}; +THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,g,k,h,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=k;this.x3=h;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve; THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.FontUtils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; -THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,j){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=j}; +THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,k){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;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)},tangentSpline:function(){},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,j=g*g;return(2*c-2*e+b+f)*g*j+(-3*c+3*e-2*b-f)*j+b*g+c}};THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"}; +THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,k=g*g;return(2*c-2*e+b+f)*g*k+(-3*c+3*e-2*b-f)*k+b*g+c}};THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"}; THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)y=h/b,j=THREE.FontUtils.b2(y,v,t,m),y=THREE.FontUtils.b2(y,x,u,o), -e.push(new THREE.Vector2(j,y));break;case THREE.PathActions.BEZIER_CURVE_TO:m=j[4];o=j[5];t=j[0];u=j[1];p=j[2];n=j[3];e.length>0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)y=h/b,j=THREE.FontUtils.b3(y,v,t,p,m),y=THREE.FontUtils.b3(y,x,u,n,o),e.push(new THREE.Vector2(j,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*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h); -for(h=1;h<=y;h++)e.push(j.getPointAt(h/y));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=j[0];o=j[1];p=j[2];t=j[3];y=j[4];u=!!j[5];n=h[h.length-2];v=h[h.length-1];h.length==0&&(n=v=0);x=y-t;var w=b*2;for(h=1;h<=w;h++)y=h/w,u||(y=1-y),y=t+y*x,j=n+m+p*Math.cos(y),y=v+o+p*Math.sin(y),e.push(new THREE.Vector2(j,y))}c&&e.push(e[0]);return e}; -THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,m;h=0;for(m=b.length;hc)c=j.x;else if(j.xe)e=j.y;else if(j.y=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null}; +THREE.Path.prototype.arc=function(b,c,e,f,g,k){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,k));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(b,c){b||(b=40);for(var e=[],f=0;f0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)z=h/b,k=THREE.FontUtils.b2(z,v,p,m),z=THREE.FontUtils.b2(z,x,u,o), +e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];o=k[5];p=k[0];u=k[1];t=k[2];n=k[3];e.length>0?(h=e[e.length-1],v=h.x,x=h.y):(h=this.actions[f-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=b;h++)z=h/b,k=THREE.FontUtils.b3(z,v,p,t,m),z=THREE.FontUtils.b3(z,x,u,n,o),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];z=b*k[0].length;h=h.concat(k[0]);k=new THREE.SplineCurve(h); +for(h=1;h<=z;h++)e.push(k.getPointAt(h/z));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;m=k[0];o=k[1];t=k[2];p=k[3];z=k[4];u=!!k[5];n=h[h.length-2];v=h[h.length-1];h.length==0&&(n=v=0);x=z-p;var y=b*2;for(h=1;h<=y;h++)z=h/y,u||(z=1-z),z=p+z*x,k=n+m+t*Math.cos(z),z=v+o+t*Math.sin(z),e.push(new THREE.Vector2(k,z))}c&&e.push(e[0]);return e}; +THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var k,h,m;h=0;for(m=b.length;hc)c=k.x;else if(k.xe)e=k.y;else if(k.y=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null}; THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e=0?m-1:e.length-1;j=h-1>=0?h-1:p.length-1;var y=[p[h],e[m],e[g]];t=THREE.FontUtils.Triangulate.area(y);var w=[p[h],p[j],e[m]];u=THREE.FontUtils.Triangulate.area(w);v=m;n=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=e.length; -h<0&&(h+=p.length);h%=p.length;g=m-1>=0?m-1:e.length-1;j=h-1>=0?h-1:p.length-1;y=[p[h],e[m],e[g]];y=THREE.FontUtils.Triangulate.area(y);w=[p[h],p[j],e[m]];w=THREE.FontUtils.Triangulate.area(w);t+u>y+w&&(m=v,h=n,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=p.length),h%=p.length,g=m-1>=0?m-1:e.length-1,j=h-1>=0?h-1:p.length-1);t=e.slice(0,m);u=e.slice(m);v=p.slice(h);n=p.slice(0,h);j=[p[h],p[j],e[m]];x.push([p[h],e[m],e[g]]);x.push(j);e=t.concat(v).concat(n).concat(u)}return{shape:e,isolatedPts:x,allpoints:f}}, -triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,m,o;for(j=0;j0){h(0,0,-n-(j||0));for(o=b;o0){h(0,0,n+ -(g||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o=0;){T=C;k=C-1;k<0&&(k=b.length-1);for(var e=0,e=0;e0;V--){y=V/n;$=m*y;E=o*(1-Math.sin((1-y)*Math.PI/2));C=0;for(P=G.length;C=0?m-1:e.length-1;k=h-1>=0?h-1:t.length-1;var z=[t[h],e[m],e[g]];p=THREE.FontUtils.Triangulate.area(z);var y=[t[h],t[k],e[m]];u=THREE.FontUtils.Triangulate.area(y);v=m;n=h;m+=1;h+=-1;m<0&&(m+=e.length);m%=e.length; +h<0&&(h+=t.length);h%=t.length;g=m-1>=0?m-1:e.length-1;k=h-1>=0?h-1:t.length-1;z=[t[h],e[m],e[g]];z=THREE.FontUtils.Triangulate.area(z);y=[t[h],t[k],e[m]];y=THREE.FontUtils.Triangulate.area(y);p+u>z+y&&(m=v,h=n,m<0&&(m+=e.length),m%=e.length,h<0&&(h+=t.length),h%=t.length,g=m-1>=0?m-1:e.length-1,k=h-1>=0?h-1:t.length-1);p=e.slice(0,m);u=e.slice(m);v=t.slice(h);n=t.slice(0,h);k=[t[h],t[k],e[m]];x.push([t[h],e[m],e[g]]);x.push(k);e=p.concat(v).concat(n).concat(u)}return{shape:e,isolatedPts:x,allpoints:f}}, +triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,h,m,o;for(k=0;k0){h(0,0,-n-(k||0));for(o=b;o0){h(0,0,n+ +(g||0));for(o=b+b/2;o<2*b;o++)m.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o=0;){T=C;j=C-1;j<0&&(j=b.length-1);for(var e=0,e=0;e0;V--){z=V/n;$=m*z;E=o*(1-Math.sin((1-z)*Math.PI/2));C=0;for(P=G.length;C0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,m,u)))-1);p.push(n)}c.push(p)}for(var v,x,y,g=c.length,e=0;e0)for(f=0;f1&&(v= -this.vertices[h].position.clone(),x=this.vertices[o].position.clone(),y=this.vertices[p].position.clone(),v.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(h,o,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([n,t,w]))}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,g=Math.PI,k=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,m,u)))-1);t.push(n)}c.push(t)}for(var v,x,z,g=c.length,e=0;e0)for(f=0;f1&&(v= +this.vertices[h].position.clone(),x=this.vertices[o].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),x.normalize(),z.normalize(),this.faces.push(new THREE.Face3(h,o,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([n,p,y]))}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){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; -THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,j=c.curveSegments!==void 0?c.curveSegments:4,h=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",o=c.style!==void 0?c.style:"normal",p=c.bevelThickness!==void 0?c.bevelThickness:10,n=c.bevelSize!==void 0?c.bevelSize:8,t=c.bevelEnabled!== -void 0?c.bevelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=j;THREE.FontUtils.face=h;THREE.FontUtils.weight=m;THREE.FontUtils.style=o;THREE.FontUtils.bevelSize=n;var m=THREE.FontUtils.drawText(b),j=m.points,u=m.faces,h=m.contour,v=m.bevel,x=this;x.vertices=[];x.faces=[];for(var y,o=j.length,w=u.length,n=v.length,m=0;m0;){if(z){if(z.equals(h[m])){z=null;continue}}else z=h[m];p=o*2+m;u=p-1;f(p,u,u+n,p+n);for(t=0;t0;){if(z){if(z.equals(h[m])){z=null;continue}}else z=h[m];for(t=0;t0;){if(w){if(w.equals(h[m])){w=null;continue}}else w=h[m];t=o*2+m;u=t-1;f(t,u,u+n,t+n);for(p=0;p0;){if(w){if(w.equals(h[m])){w=null;continue}}else w=h[m];for(p=0;p0&&m.push({shape:g,holes:f}),g=t,f=[]):f.push(t):this.Triangulate.area(t)<0?(m.push({shape:t,holes:f}),f=[]):f.push(t);e++}n&&m.push({shape:g,holes:f})}var u,v,x, -y,w,z;j=[];for(h=0;h=0?v-1:g.length-1;var t=u-1>=0?u-1:n.length-1,H=[];H.push(n[u]);H.push(g[v]);H.push(g[e]);x=this.Triangulate.area(H);var A=[];A.push(n[u]);A.push(n[t]);A.push(g[v]);w=this.Triangulate.area(A);y=v;z=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=n.length);u%=g.length;e=v- -1>=0?v-1:g.length-1;t=u-1>=0?u-1:n.length-1;H=[];H.push(n[u]);H.push(g[v]);H.push(g[e]);H=this.Triangulate.area(H);A=[];A.push(n[u]);A.push(n[t]);A.push(g[v]);A=this.Triangulate.area(A);x+w>H+A&&(v=y,u=z,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=n.length),u%=g.length,e=v-1>=0?v-1:g.length-1,t=u-1>=0?u-1:n.length-1);x=g.slice(0,v);w=g.slice(v);y=n.slice(u);z=n.slice(0,u);j.push(n[u]);j.push(g[v]);j.push(g[e]);j.push(n[u]);j.push(n[t]);j.push(g[v]);g=x.concat(y).concat(z).concat(w)}o.shape=g}u=[];v=[]; -for(h=p=0;h=0;){if(n){if(n.equals(e[b])){n=null;o=this.Triangulate.area(f)>0;h.push(o);j.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else n=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)o=e[b], -m=j[f],o=o.clone().subSelf(m),p=this.bevelSize/o.length(),h[f]?p+=1:p=1-p,p=o.multiplyScalar(p).addSelf(m),g.unshift(p),n?n.equals(e[b])&&(n=null,f++):n=e[b];c.bevel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b, -c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,m,o,p,n,t,u,v,x,y,w=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){c=w._cachedOutline||(w._cachedOutline=w.o.split(" "));o=c.length;for(b=0;b0)for(p=0;p2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return j}o=p;g<=o&&(o=0);p=o+1;g<=p&&(p=0);n=p+1;g<=n&&(n=0);var u;a:{u=b;var v=o,x=p,y=n,w=g,z=h,H=void 0,A=void 0,J=void 0, -G=void 0,C=void 0,P=void 0,F=void 0,K=void 0,I=void 0,A=u[z[v]].x,J=u[z[v]].y,G=u[z[x]].x,C=u[z[x]].y,P=u[z[y]].x,F=u[z[y]].y;if(1.0E-10>(G-A)*(F-J)-(C-J)*(P-A))u=!1;else{for(H=0;H=0&&$>=0&&S>=0){u=!1;break a}}u= -!0}}if(u){j.push([b[h[o]],b[h[p]],b[h[n]]]);m.push([h[o],h[p],h[n]]);o=p;for(n=p+1;n0&&m.push({shape:g,holes:f}),g=p,f=[]):f.push(p):this.Triangulate.area(p)<0?(m.push({shape:p,holes:f}),f=[]):f.push(p);e++}n&&m.push({shape:g,holes:f})}var u,v,x, +z,y,w;k=[];for(h=0;h=0?v-1:g.length-1;var p=u-1>=0?u-1:n.length-1,H=[];H.push(n[u]);H.push(g[v]);H.push(g[e]);x=this.Triangulate.area(H);var A=[];A.push(n[u]);A.push(n[p]);A.push(g[v]);y=this.Triangulate.area(A);z=v;w=u;v+=1;u+=-1;v<0&&(v+=g.length);v%=g.length;u<0&&(u+=n.length);u%=g.length;e=v- +1>=0?v-1:g.length-1;p=u-1>=0?u-1:n.length-1;H=[];H.push(n[u]);H.push(g[v]);H.push(g[e]);H=this.Triangulate.area(H);A=[];A.push(n[u]);A.push(n[p]);A.push(g[v]);A=this.Triangulate.area(A);x+y>H+A&&(v=z,u=w,v<0&&(v+=g.length),v%=g.length,u<0&&(u+=n.length),u%=g.length,e=v-1>=0?v-1:g.length-1,p=u-1>=0?u-1:n.length-1);x=g.slice(0,v);y=g.slice(v);z=n.slice(u);w=n.slice(0,u);k.push(n[u]);k.push(g[v]);k.push(g[e]);k.push(n[u]);k.push(n[p]);k.push(g[v]);g=x.concat(z).concat(w).concat(y)}o.shape=g}u=[];v=[]; +for(h=t=0;h=0;){if(n){if(n.equals(e[b])){n=null;o=this.Triangulate.area(f)>0;h.push(o);k.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else n=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=0;--b>=0;)o=e[b], +m=k[f],o=o.clone().subSelf(m),t=this.bevelSize/o.length(),h[f]?t+=1:t=1-t,t=o.multiplyScalar(t).addSelf(m),g.unshift(t),n?n.equals(e[b])&&(n=null,f++):n=e[b];c.bevel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b, +c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var k=[],h,m,o,t,n,p,u,v,x,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));o=c.length;for(b=0;b0)for(t=0;t2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}o=t;g<=o&&(o=0);t=o+1;g<=t&&(t=0);n=t+1;g<=n&&(n=0);var u;a:{u=b;var v=o,x=t,z=n,y=g,w=h,H=void 0,A=void 0,J=void 0, +G=void 0,C=void 0,P=void 0,F=void 0,K=void 0,I=void 0,A=u[w[v]].x,J=u[w[v]].y,G=u[w[x]].x,C=u[w[x]].y,P=u[w[z]].x,F=u[w[z]].y;if(1.0E-10>(G-A)*(F-J)-(C-J)*(P-A))u=!1;else{for(H=0;H=0&&$>=0&&S>=0){u=!1;break a}}u= +!0}}if(u){k.push([b[h[o]],b[h[t]],b[h[n]]]);m.push([h[o],h[t],h[n]]);o=t;for(n=t+1;n>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,e){var c=n(b,e),f=n(b,e+1),h=n(b,e+2);return(n(b,e+3)<<24)+(h<<16)+(f<<8)+c}function o(b,e){var c=n(b,e);return(n(b,e+1)<<8)+c}function p(b,e){var c=n(b,e);return c>127?c-256:c}function n(b, -e){return b.charCodeAt(e)&255}function t(e){var c,f,h;c=g(b,e);f=g(b,e+C);h=g(b,e+P);e=o(b,e+F);THREE.BinaryLoader.prototype.f3(z,c,f,h,e)}function u(e){var c,f,h,j,k,n;c=g(b,e);f=g(b,e+C);h=g(b,e+P);j=o(b,e+F);k=g(b,e+K);n=g(b,e+I);e=g(b,e+V);THREE.BinaryLoader.prototype.f3n(z,J,c,f,h,j,k,n,e)}function v(e){var c,f,h,j;c=g(b,e);f=g(b,e+E);h=g(b,e+$);j=g(b,e+Q);e=o(b,e+S);THREE.BinaryLoader.prototype.f4(z,c,f,h,j,e)}function x(e){var c,f,h,j,n,p,t,u;c=g(b,e);f=g(b,e+E);h=g(b,e+$);j=g(b,e+Q);n=o(b, -e+S);p=g(b,e+T);t=g(b,e+k);u=g(b,e+L);e=g(b,e+fa);THREE.BinaryLoader.prototype.f4n(z,J,c,f,h,j,n,p,t,u,e)}function y(e){var c,f;c=g(b,e);f=g(b,e+Y);e=g(b,e+ga);THREE.BinaryLoader.prototype.uv3(z.faceVertexUvs[0],G[c*2],G[c*2+1],G[f*2],G[f*2+1],G[e*2],G[e*2+1])}function w(e){var c,f,h;c=g(b,e);f=g(b,e+ea);h=g(b,e+ia);e=g(b,e+qa);THREE.BinaryLoader.prototype.uv4(z.faceVertexUvs[0],G[c*2],G[c*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[e*2],G[e*2+1])}var z=this,H=0,A,J=[],G=[],C,P,F,K,I,V,E,$,Q,S,T,k,L,fa, -Y,ga,ea,ia,qa,ha,M,ma,aa,ca,ja;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,f,e);A={signature:b.substr(H,8),header_bytes:n(b,H+8),vertex_coordinate_bytes:n(b,H+9),normal_coordinate_bytes:n(b,H+10),uv_coordinate_bytes:n(b,H+11),vertex_index_bytes:n(b,H+12),normal_index_bytes:n(b,H+13),uv_index_bytes:n(b,H+14),material_index_bytes:n(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b, +THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,o,t,n,p,u,v,x,z,y,w,H,A,J=b.faces;p=b.vertices;var G=b.normals,C=b.colors,P=0;for(c=0;c>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&j==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,j)}function g(b,c){var e=n(b,c),f=n(b,c+1),h=n(b,c+2);return(n(b,c+3)<<24)+(h<<16)+(f<<8)+e}function o(b,c){var e=n(b,c);return(n(b,c+1)<<8)+e}function t(b,c){var e=n(b,c);return e>127?e-256:e}function n(b, +c){return b.charCodeAt(c)&255}function p(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+P);c=o(b,c+F);THREE.BinaryLoader.prototype.f3(w,e,f,h,c)}function u(c){var e,f,h,k,j,n;e=g(b,c);f=g(b,c+C);h=g(b,c+P);k=o(b,c+F);j=g(b,c+K);n=g(b,c+I);c=g(b,c+V);THREE.BinaryLoader.prototype.f3n(w,J,e,f,h,k,j,n,c)}function v(c){var e,f,h,k;e=g(b,c);f=g(b,c+E);h=g(b,c+$);k=g(b,c+Q);c=o(b,c+S);THREE.BinaryLoader.prototype.f4(w,e,f,h,k,c)}function x(c){var e,f,h,k,n,p,t,u;e=g(b,c);f=g(b,c+E);h=g(b,c+$);k=g(b,c+Q);n=o(b, +c+S);p=g(b,c+T);t=g(b,c+j);u=g(b,c+L);c=g(b,c+fa);THREE.BinaryLoader.prototype.f4n(w,J,e,f,h,k,n,p,t,u,c)}function z(c){var e,f;e=g(b,c);f=g(b,c+Y);c=g(b,c+ga);THREE.BinaryLoader.prototype.uv3(w.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function y(c){var e,f,h;e=g(b,c);f=g(b,c+ea);h=g(b,c+ia);c=g(b,c+qa);THREE.BinaryLoader.prototype.uv4(w.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var w=this,H=0,A,J=[],G=[],C,P,F,K,I,V,E,$,Q,S,T,j,L,fa, +Y,ga,ea,ia,qa,ha,M,ma,aa,ca,ja;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,f,c);A={signature:b.substr(H,8),header_bytes:n(b,H+8),vertex_coordinate_bytes:n(b,H+9),normal_coordinate_bytes:n(b,H+10),uv_coordinate_bytes:n(b,H+11),vertex_index_bytes:n(b,H+12),normal_index_bytes:n(b,H+13),uv_index_bytes:n(b,H+14),material_index_bytes:n(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b, H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=A.header_bytes;C=A.vertex_index_bytes;P=A.vertex_index_bytes*2;F=A.vertex_index_bytes*3;K=A.vertex_index_bytes*3+A.material_index_bytes;I=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;V=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;E=A.vertex_index_bytes;$=A.vertex_index_bytes*2;Q=A.vertex_index_bytes*3;S=A.vertex_index_bytes*4;T=A.vertex_index_bytes* -4+A.material_index_bytes;k=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;L=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;fa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;Y=A.uv_index_bytes;ga=A.uv_index_bytes*2;ea=A.uv_index_bytes;ia=A.uv_index_bytes*2;qa=A.uv_index_bytes*3;e=A.vertex_index_bytes*3+A.material_index_bytes;ja=A.vertex_index_bytes*4+A.material_index_bytes;ha=A.ntri_flat*e;M=A.ntri_smooth*(e+A.normal_index_bytes*3);ma= -A.ntri_flat_uv*(e+A.uv_index_bytes*3);aa=A.ntri_smooth_uv*(e+A.normal_index_bytes*3+A.uv_index_bytes*3);ca=A.nquad_flat*ja;e=A.nquad_smooth*(ja+A.normal_index_bytes*4);ja=A.nquad_flat_uv*(ja+A.uv_index_bytes*4);H+=function(e){for(var f,g,j,k=A.vertex_coordinate_bytes*3,m=e+A.nvertices*k;e1&&(I=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,I);object.name=v;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;L.scene.addObject(object);L.objects[v]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b)); if(H.castsShadow)b=new THREE.ShadowVolume(C),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}}else A=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,L.scene.addObject(object),L.objects[v]=object,L.empties[v]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}function o(b){return function(c){L.geometries[b]=c;m();Q-=1;e.onLoadComplete();n()}}function p(b){return function(e){L.geometries[b]=e}}function n(){e.callbackProgress({totalModels:T,totalTextures:k,loadedModels:T-Q,loadedTextures:k-S},L);e.onLoadProgress();Q==0&&S==0&&c(L)}var t, -u,v,x,y,w,z,H,A,J,G,C,P,F,K,I,V,E,$,Q,S,T,k,L;E=b.data;K=new THREE.BinaryLoader;$=new THREE.JSONLoader;S=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in E.objects)if(H=E.objects[v],H.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(E.transform){b=E.transform.position;J=E.transform.rotation;var fa=E.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);J&&L.scene.rotation.set(J[0], -J[1],J[2]);fa&&L.scene.scale.set(fa[0],fa[1],fa[2]);(b||J||fa)&&L.scene.updateMatrix()}b=function(){S-=1;n();e.onLoadComplete()};for(y in E.cameras){J=E.cameras[y];if(J.type=="perspective")P=new THREE.Camera(J.fov,J.aspect,J.near,J.far);else if(J.type=="ortho")P=new THREE.Camera,P.projectionMatrix=THREE.Matrix4.makeOrtho(J.left,J.right,J.top,J.bottom,J.near,J.far);A=J.position;J=J.target;P.position.set(A[0],A[1],A[2]);P.target.position.set(J[0],J[1],J[2]);L.cameras[y]=P}for(x in E.lights)y=E.lights[x], -P=y.color!==void 0?y.color:16777215,J=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(A=y.direction,V=new THREE.DirectionalLight(P,J),V.position.set(A[0],A[1],A[2]),V.position.normalize()):y.type=="point"?(A=y.position,d=y.distance,V=new THREE.PointLight(P,J,d),V.position.set(A[0],A[1],A[2])):y.type=="ambient"&&(V=new THREE.AmbientLight(P)),L.scene.addLight(V),L.lights[x]=V;for(w in E.fogs)x=E.fogs[w],x.type=="linear"?F=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(F=new THREE.FogExp2(0, -x.density)),J=x.color,F.color.setRGB(J[0],J[1],J[2]),L.fogs[w]=F;if(L.cameras&&E.defaults.camera)L.currentCamera=L.cameras[E.defaults.camera];if(L.fogs&&E.defaults.fog)L.scene.fog=L.fogs[E.defaults.fog];J=E.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(J[0],J[1],J[2]);L.bgColorAlpha=E.defaults.bgalpha;for(t in E.geometries)if(w=E.geometries[t],w.type=="bin_mesh"||w.type=="ascii_mesh")Q+=1,e.onLoadStart();T=Q;for(t in E.geometries)w=E.geometries[t],w.type=="cube"?(C=new THREE.CubeGeometry(w.width, -w.height,w.depth,w.segmentsWidth,w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),L.geometries[t]=C):w.type=="plane"?(C=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),L.geometries[t]=C):w.type=="sphere"?(C=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),L.geometries[t]=C):w.type=="cylinder"?(C=new THREE.CylinderGeometry(w.numSegs,w.topRad,w.botRad,w.height,w.topOffset,w.botOffset),L.geometries[t]=C):w.type=="torus"?(C=new THREE.TorusGeometry(w.radius, -w.tube,w.segmentsR,w.segmentsT),L.geometries[t]=C):w.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(w.subdivisions),L.geometries[t]=C):w.type=="bin_mesh"?K.load({model:f(w.url,E.urlBaseType),callback:o(t)}):w.type=="ascii_mesh"?$.load({model:f(w.url,E.urlBaseType),callback:o(t)}):w.type=="embedded_mesh"&&(w=E.embeds[w.id])&&$.createModel(w,p(t),"");for(z in E.textures)if(t=E.textures[z],t.url instanceof Array){S+=t.url.length;for(K=0;K=this.maxCount-3&&m(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(o=this.size-1);var u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var v=Math.floor(n-m);v<1&&(v=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size- -1);for(var x,y,w,z,H,A;t0&&(this.field[w+x]+=z)}}};this.addPlaneX=function(b,c){var g,j,h,m,o,p=this.size,n=this.yd,t=this.zd,u=this.field,v=p*Math.sqrt(b/c);v>p&&(v=p);for(g=0;g0)for(j=0;jn&&(x=n);for(j=0;j0){o=j*t;for(g=0;gsize&&(dist=size);for(h=0;h0){o=zd*h;for(j=0;j=this.maxCount-3&&m(this)};this.begin=function(){this.count=0; +this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(o=this.size-1);var u=Math.floor(t-m);u<1&&(u=1);t=Math.floor(t+m);t>this.size-1&&(t=this.size-1);var v=Math.floor(n-m);v<1&&(v=1);m=Math.floor(n+m);m>this.size-1&&(m=this.size- +1);for(var x,z,y,w,H,A;p0&&(this.field[y+x]+=w)}}};this.addPlaneX=function(b,c){var g,k,h,m,o,t=this.size,n=this.yd,p=this.zd,u=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(g=0;g0)for(k=0;kn&&(x=n);for(k=0;k0){o=k*p;for(g=0;gsize&&(dist=size);for(h=0;h0){o=zd*h;for(k=0;kj?this.hits.push(g):this.hits.unshift(g),j=f;return this.hits}; +THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,k=0;c=0;for(e=this.colliders.length;ck?this.hits.push(g):this.hits.unshift(g),k=f;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.distc.length)return null;return c[e]}; THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,j=0;j=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(j.x)> -Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=m.y-c.y,j=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,j=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h}; +THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,k=0;k=m*g))return Number.MAX_VALUE;h/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(h);m.addSelf(b.origin);Math.abs(k.x)> +Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=m.y-c.y,k=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,k=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return 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,g=0,j=0,h=0,m=0,o=0,p=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,h=1);e.origin.yc.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y, -p=!1,m=1);e.origin.zc.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,p=!1,o=1);if(p)return-1;p=0;g>f&&(p=1,f=g);j>f&&(p=2,f=j);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(mc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(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* +THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,k=0,h=0,m=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&&(g=c.max.y-e.origin.y,g/=e.direction.y, +t=!1,m=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;g>f&&(t=1,f=g);k>f&&(t=2,f=k);switch(t){case 0:m=e.origin.y+e.direction.y*f;if(mc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(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,m,0);break;case 2:h=e.origin.x+e.direction.x*f;if(hc.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(mc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,o)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,o,p,n;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z= -2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||p!==e.near||n!==e.fov){o=e.aspect;p=e.near;n=e.fov;var z=e.projectionMatrix.clone(),H=125/30*0.5,A=H*p/125,J=p*Math.tan(n*Math.PI/360),G;h.n14=H;m.n14=-H;H=-J*o+A;G=J*o+A;z.n11=2*p/(G-H);z.n13=(G+H)/(G-H);g.projectionMatrix=z.clone();H=-J*o-A;G=J*o-A;z.n11=2*p/(G-H); -z.n13=(G+H)/(G-H);j.projectionMatrix=z.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,t,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=p;j.far=e.far;f.call(c,b,j,u,!0);f.call(c,x,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,g,j,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far; -h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,m,!1)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,k=new THREE.Camera,h=new THREE.Matrix4,m=new THREE.Matrix4,o,t,n;g.useTarget=k.useTarget=!1;g.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z= +2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:u}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;u.width=b;u.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||t!==e.near||n!==e.fov){o=e.aspect;t=e.near;n=e.fov;var w=e.projectionMatrix.clone(),H=125/30*0.5,A=H*t/125,J=t*Math.tan(n*Math.PI/360),G;h.n14=H;m.n14=-H;H=-J*o+A;G=J*o+A;w.n11=2*t/(G-H);w.n13=(G+H)/(G-H);g.projectionMatrix=w.clone();H=-J*o-A;G=J*o-A;w.n11=2*t/(G-H); +w.n13=(G+H)/(G-H);k.projectionMatrix=w.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,p,!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,u,!0);f.call(c,x,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,g,k,h=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=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);m.projectionMatrix=h.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,k);f.call(c,b,h);this.setViewport(g,0,g,k);f.call(c,b,m,!1)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index a8d141e0d8412ebb31aa184876160d1fd0154258..bfa4a7a1acd6c839a589009a44bdcf72dba3c377 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -1,6 +1,6 @@ // ThreeWebGL.js r42 - http://github.com/mrdoob/three.js var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)}; -THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,h,i,g,j,o;if(e==0)f=h=i=0;else switch(g=Math.floor(b*6),j=b*6-g,b=e*(1-d),o=e*(1-d*j),d=e*(1-d*(1-j)),g){case 1:f=o;h=e;i=b;break;case 2:f=b;h=e;i=d;break;case 3:f=b;h=o;i=e;break;case 4:f=d;h=b;i=e;break;case 5:f=e;h=b;i=o;break;case 6:case 0:f=e,h=d,i=b}this.setRGB(f, +THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,e){this.r=b;this.g=d;this.b=e;this.updateHex()},setHSV:function(b,d,e){var f,h,i,g,j,k;if(e==0)f=h=i=0;else switch(g=Math.floor(b*6),j=b*6-g,b=e*(1-d),k=e*(1-d*j),d=e*(1-d*(1-j)),g){case 1:f=k;h=e;i=b;break;case 2:f=b;h=e;i=d;break;case 3:f=b;h=k;i=e;break;case 4:f=d;h=b;i=e;break;case 5:f=e;h=b;i=k;break;case 6:case 0:f=e,h=d,i=b}this.setRGB(f, h,i)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)}; THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;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,d){this.x=b.x+d.x;this.y=b.y+d.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,d){this.x=b.x-d.x;this.y=b.y-d.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 d=this.x-b.x,b=this.y-b.y;return d*d+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)}, @@ -14,35 +14,35 @@ THREE.Vector4.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;this.w 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.set(0,0,0,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,d){this.x+=(b.x-this.x)*d;this.y+=(b.y-this.y)*d;this.z+=(b.z-this.z)*d;this.w+=(b.w-this.w)*d;return this}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,e,f=[];d=0;for(e=b.length;d0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,i,g,j,o,k,m,q,p,u,C=b.geometry, -D=C.vertices,E=[],f=0;for(h=C.faces.length;f0:q<0))if(m=m.dot((new THREE.Vector3).sub(g,p))/q,p=p.addSelf(u.multiplyScalar(m)), -i instanceof THREE.Face3)e(p,g,j,o)&&(i={distance:this.origin.distanceTo(p),point:p,face:i,object:b},E.push(i));else if(i instanceof THREE.Face4&&(e(p,g,j,k)||e(p,j,o,k)))i={distance:this.origin.distanceTo(p),point:p,face:i,object:b},E.push(i);return E}else return[]}}; -THREE.Rectangle=function(){function b(){i=f-d;g=h-e}var d,e,f,h,i,g,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return g};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,i,m,q){j=!1;d=g;e=i;f=m;h=q;b()};this.addPoint=function(g,i){j?(j=!1,d=g,e=i,f=g,h=i):(d=dg?f:g,h=h>i?h:i);b()};this.add3Points= -function(g,i,m,q,p,u){j?(j=!1,d=gm?g>p?g:p:m>p?m:p,h=i>q?i>u?i:u:q>u?q:u):(d=gm?g>p?g>f?g:f:p>f?p:f:m>p?m>f?m:f:p>f?p:f,h=i>q?i>u?i>h?i:h:u>h?u:h:q>u?q>h?q:h:u>h?u:h);b()};this.addRectangle=function(g){j?(j=!1,d=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(d=dg.getRight()?f:g.getRight(),h=h> +h=b.clone().subSelf(d),b=f.dot(f),d=f.dot(e),f=f.dot(h),g=e.dot(e),e=e.dot(h),h=1/(b*g-d*d),g=(g*f-d*e)*h,b=(b*e-d*f)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var f=d(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=d(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var h,i,g,j,k,n,p,q,o,r,F=b.geometry, +v=F.vertices,G=[],f=0;for(h=F.faces.length;f0:q<0))if(p=p.dot((new THREE.Vector3).sub(g,o))/q,o=o.addSelf(r.multiplyScalar(p)), +i instanceof THREE.Face3)e(o,g,j,k)&&(i={distance:this.origin.distanceTo(o),point:o,face:i,object:b},G.push(i));else if(i instanceof THREE.Face4&&(e(o,g,j,n)||e(o,j,k,n)))i={distance:this.origin.distanceTo(o),point:o,face:i,object:b},G.push(i);return G}else return[]}}; +THREE.Rectangle=function(){function b(){i=f-d;g=h-e}var d,e,f,h,i,g,j=!0;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return g};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(g,i,p,q){j=!1;d=g;e=i;f=p;h=q;b()};this.addPoint=function(g,i){j?(j=!1,d=g,e=i,f=g,h=i):(d=dg?f:g,h=h>i?h:i);b()};this.add3Points= +function(g,i,p,q,o,r){j?(j=!1,d=gp?g>o?g:o:p>o?p:o,h=i>q?i>r?i:r:q>r?q:r):(d=gp?g>o?g>f?g:f:o>f?o:f:p>o?p>f?p:f:o>f?o:f,h=i>q?i>r?i>h?i:h:r>h?r:h:q>r?q>h?q:h:r>h?r:h);b()};this.addRectangle=function(g){j?(j=!1,d=g.getLeft(),e=g.getTop(),f=g.getRight(),h=g.getBottom()):(d=dg.getRight()?f:g.getRight(),h=h> g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){d-=g;e-=g;f+=g;h+=g;b()};this.minSelf=function(g){d=d>g.getLeft()?d:g.getLeft();e=e>g.getTop()?e:g.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){j=!0;h=f=e=d=0;b()};this.isEmpty=function(){return j}};THREE.Matrix3=function(){this.m=[]}; -THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,h,i,g,j,o,k,m,q,p,u,C,D){this.set(b||1,d||0,e||0,f||0,h||0,i||1,g||0,j||0,o||0,k||0,m||1,q||0,p||0,u||0,C||0,D||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={set:function(b,d,e,f,h,i,g,j,o,k,m,q,p,u,C,D){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=o;this.n32=k;this.n33=m;this.n34=q;this.n41=p;this.n42=u;this.n43=C;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, +THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};THREE.Matrix4=function(b,d,e,f,h,i,g,j,k,n,p,q,o,r,F,v){this.set(b||1,d||0,e||0,f||0,h||0,i||1,g||0,j||0,k||0,n||0,p||1,q||0,o||0,r||0,F||0,v||1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={set:function(b,d,e,f,h,i,g,j,k,n,p,q,o,r,F,v){this.n11=b;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=k;this.n32=n;this.n33=p;this.n34=q;this.n41=o;this.n42=r;this.n43=F;this.n44=v;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,e){var f=THREE.Matrix4.__v1, h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,d).normalize();if(i.length()===0)i.z=1;f.cross(e,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(e,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var d=b.x,e=b.y,f=b.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;b.y=(this.n21*d+this.n22*e+this.n23* f+this.n24)*h;b.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var d=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*d+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var d=b.x,e=b.y,f=b.z;b.x=d*this.n11+e*this.n12+f*this.n13;b.y=d*this.n21+e*this.n22+f*this.n23;b.z=d*this.n31+e*this.n32+f*this.n33;b.normalize(); -return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,o=b.n23,k=b.n24,m=b.n31,q=b.n32,p=b.n33,u=b.n34,C=b.n41,D=b.n42,E=b.n43,A=b.n44,T=d.n11,sa=d.n12,ea=d.n13,F=d.n14,v=d.n21,O=d.n22, -G=d.n23,M=d.n24,P=d.n31,ra=d.n32,ja=d.n33,$=d.n34,ua=d.n41,N=d.n42,H=d.n43,c=d.n44;this.n11=e*T+f*v+h*P+i*ua;this.n12=e*sa+f*O+h*ra+i*N;this.n13=e*ea+f*G+h*ja+i*H;this.n14=e*F+f*M+h*$+i*c;this.n21=g*T+j*v+o*P+k*ua;this.n22=g*sa+j*O+o*ra+k*N;this.n23=g*ea+j*G+o*ja+k*H;this.n24=g*F+j*M+o*$+k*c;this.n31=m*T+q*v+p*P+u*ua;this.n32=m*sa+q*O+p*ra+u*N;this.n33=m*ea+q*G+p*ja+u*H;this.n34=m*F+q*M+p*$+u*c;this.n41=C*T+D*v+E*P+A*ua;this.n42=C*sa+D*O+E*ra+A*N;this.n43=C*ea+D*G+E*ja+A*H;this.n44=C*F+D*M+E*$+A* +return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,n=b.n24,p=b.n31,q=b.n32,o=b.n33,r=b.n34,F=b.n41,v=b.n42,G=b.n43,D=b.n44,T=d.n11,sa=d.n12,ea=d.n13,H=d.n14,w=d.n21,O=d.n22, +I=d.n23,L=d.n24,P=d.n31,qa=d.n32,ja=d.n33,$=d.n34,ua=d.n41,N=d.n42,J=d.n43,c=d.n44;this.n11=e*T+f*w+h*P+i*ua;this.n12=e*sa+f*O+h*qa+i*N;this.n13=e*ea+f*I+h*ja+i*J;this.n14=e*H+f*L+h*$+i*c;this.n21=g*T+j*w+k*P+n*ua;this.n22=g*sa+j*O+k*qa+n*N;this.n23=g*ea+j*I+k*ja+n*J;this.n24=g*H+j*L+k*$+n*c;this.n31=p*T+q*w+o*P+r*ua;this.n32=p*sa+q*O+o*qa+r*N;this.n33=p*ea+q*I+o*ja+r*J;this.n34=p*H+q*L+o*$+r*c;this.n41=F*T+v*w+G*P+D*ua;this.n42=F*sa+v*O+G*qa+D*N;this.n43=F*ea+v*I+G*ja+D*J;this.n44=F*H+v*L+G*$+D* c;return this},multiplyToArray:function(b,d,e){this.multiply(b,d);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*= -b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,o=this.n31,k=this.n32,m=this.n33,q=this.n34,p=this.n41,u=this.n42,C=this.n43,D=this.n44;return f*g*k*p-e*j*k*p-f*i*m*p+d*j*m*p+e*i*q*p-d*g*q*p-f*g*o*u+e*j*o*u+f*h*m*u-b*j*m*u-e*h*q*u+b*g*q*u+f*i*o*C-d*j*o*C-f*h*k*C+b*j*k*C+d*h*q*C-b*i*q*C-e*i*o*D+d*g*o*D+e*h*k*D-b*g*k*D-d*h*m*D+b*i*m*D}, +b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,k=this.n31,n=this.n32,p=this.n33,q=this.n34,o=this.n41,r=this.n42,F=this.n43,v=this.n44;return f*g*n*o-e*j*n*o-f*i*p*o+d*j*p*o+e*i*q*o-d*g*q*o-f*g*k*r+e*j*k*r+f*h*p*r-b*j*p*r-e*h*q*r+b*g*q*r+f*i*k*F-d*j*k*F-f*h*n*F+b*j*n*F+d*h*q*F-b*i*q*F-e*i*k*v+d*g*k*v+e*h*n*v-b*g*n*v-d*h*p*v+b*i*p*v}, transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34; b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11; b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34; b[d+15]=this.n44;return b},setTranslation:function(b,d,e){this.set(1,0,0,b,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(b,d,e){this.set(b,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b),b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0, -0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),h=1-e,i=b.x,g=b.y,j=b.z,o=h*i,k=h*g;this.set(o*i+e,o*g-f*j,o*j+f*g,0,o*g+f*j,k*g+e,k*j-f*i,0,o*j-f*g,k*j+f*i,h*j*j+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,d){var e=b.x,f=b.y,h=b.z,i=Math.cos(e),e=Math.sin(e),g=Math.cos(f),f=Math.sin(f),j=Math.cos(h),h=Math.sin(h);switch(d){case "YXZ":var o= -g*j,k=g*h,m=f*j,q=f*h;this.n11=o+q*e;this.n12=m*e-k;this.n13=i*f;this.n21=i*h;this.n22=i*j;this.n23=-e;this.n31=k*e-m;this.n32=q+o*e;this.n33=i*g;break;case "ZXY":o=g*j;k=g*h;m=f*j;q=f*h;this.n11=o-q*e;this.n12=-i*h;this.n13=m+k*e;this.n21=k+m*e;this.n22=i*j;this.n23=q-o*e;this.n31=-i*f;this.n32=e;this.n33=i*g;break;case "ZYX":o=i*j;k=i*h;m=e*j;q=e*h;this.n11=g*j;this.n12=m*f-k;this.n13=o*f+q;this.n21=g*h;this.n22=q*f+o;this.n23=k*f-m;this.n31=-f;this.n32=e*g;this.n33=i*g;break;case "YZX":o=i*g;k= -i*f;m=e*g;q=e*f;this.n11=g*j;this.n12=q-o*h;this.n13=m*h+k;this.n21=h;this.n22=i*j;this.n23=-e*j;this.n31=-f*j;this.n32=k*h+m;this.n33=o-q*h;break;case "XZY":o=i*g;k=i*f;m=e*g;q=e*f;this.n11=g*j;this.n12=-h;this.n13=f*j;this.n21=o*h+q;this.n22=i*j;this.n23=k*h-m;this.n31=m*h-k;this.n32=e*j;this.n33=q*h+o;break;default:o=i*j,k=i*h,m=e*j,q=e*h,this.n11=g*j,this.n12=-g*h,this.n13=f,this.n21=k+m*f,this.n22=o-q*f,this.n23=-e*g,this.n31=q-o*f,this.n32=m+k*f,this.n33=i*g}return this},setRotationFromQuaternion:function(b){var d= -b.x,e=b.y,f=b.z,h=b.w,i=d+d,g=e+e,j=f+f,b=d*i,o=d*g;d*=j;var k=e*g;e*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(k+f);this.n12=o-h;this.n13=d+g;this.n21=o+h;this.n22=1-(b+f);this.n23=e-i;this.n31=d-g;this.n32=e+i;this.n33=1-(b+k);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34}, +0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var e=Math.cos(d),f=Math.sin(d),h=1-e,i=b.x,g=b.y,j=b.z,k=h*i,n=h*g;this.set(k*i+e,k*g-f*j,k*j+f*g,0,k*g+f*j,n*g+e,n*j-f*i,0,k*j-f*g,n*j+f*i,h*j*j+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,d){var e=b.x,f=b.y,h=b.z,i=Math.cos(e),e=Math.sin(e),g=Math.cos(f),f=Math.sin(f),j=Math.cos(h),h=Math.sin(h);switch(d){case "YXZ":var k= +g*j,n=g*h,p=f*j,q=f*h;this.n11=k+q*e;this.n12=p*e-n;this.n13=i*f;this.n21=i*h;this.n22=i*j;this.n23=-e;this.n31=n*e-p;this.n32=q+k*e;this.n33=i*g;break;case "ZXY":k=g*j;n=g*h;p=f*j;q=f*h;this.n11=k-q*e;this.n12=-i*h;this.n13=p+n*e;this.n21=n+p*e;this.n22=i*j;this.n23=q-k*e;this.n31=-i*f;this.n32=e;this.n33=i*g;break;case "ZYX":k=i*j;n=i*h;p=e*j;q=e*h;this.n11=g*j;this.n12=p*f-n;this.n13=k*f+q;this.n21=g*h;this.n22=q*f+k;this.n23=n*f-p;this.n31=-f;this.n32=e*g;this.n33=i*g;break;case "YZX":k=i*g;n= +i*f;p=e*g;q=e*f;this.n11=g*j;this.n12=q-k*h;this.n13=p*h+n;this.n21=h;this.n22=i*j;this.n23=-e*j;this.n31=-f*j;this.n32=n*h+p;this.n33=k-q*h;break;case "XZY":k=i*g;n=i*f;p=e*g;q=e*f;this.n11=g*j;this.n12=-h;this.n13=f*j;this.n21=k*h+q;this.n22=i*j;this.n23=n*h-p;this.n31=p*h-n;this.n32=e*j;this.n33=q*h+k;break;default:k=i*j,n=i*h,p=e*j,q=e*h,this.n11=g*j,this.n12=-g*h,this.n13=f,this.n21=n+p*f,this.n22=k-q*f,this.n23=-e*g,this.n31=q-k*f,this.n32=p+n*f,this.n33=i*g}return this},setRotationFromQuaternion:function(b){var d= +b.x,e=b.y,f=b.z,h=b.w,i=d+d,g=e+e,j=f+f,b=d*i,k=d*g;d*=j;var n=e*g;e*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(n+f);this.n12=k-h;this.n13=d+g;this.n21=k+h;this.n22=1-(b+f);this.n23=e-i;this.n31=d-g;this.n32=e+i;this.n33=1-(b+n);return this},scale:function(b){var d=b.x,e=b.y,b=b.z;this.n11*=d;this.n12*=e;this.n13*=b;this.n21*=d;this.n22*=e;this.n23*=b;this.n31*=d;this.n32*=e;this.n33*=b;this.n41*=d;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34}, extractRotation:function(b,d){var e=1/d.x,f=1/d.y,h=1/d.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,o=b.n23,k=b.n24,m=b.n31,q=b.n32,p=b.n33,u=b.n34,C=b.n41,D=b.n42,E=b.n43,A=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=o*u*D-k*p*D+k*q*E-j*u*E-o*q*A+j*p*A;d.n12=i*p*D-h*u*D-i*q*E+f*u*E+h*q*A-f*p*A;d.n13=h*k*D-i*o*D+i*j*E-f*k*E-h*j*A+f*o*A;d.n14=i*o*q-h*k*q-i*j*p+f*k*p+h*j*u-f*o*u;d.n21=k*p*C-o*u*C-k*m*E+g*u*E+o*m*A-g*p*A;d.n22=h*u*C-i*p*C+i*m*E-e*u*E-h*m*A+e*p*A;d.n23=i*o*C-h*k*C-i*g*E+e*k*E+h*g*A-e*o*A;d.n24= -h*k*m-i*o*m+i*g*p-e*k*p-h*g*u+e*o*u;d.n31=j*u*C-k*q*C+k*m*D-g*u*D-j*m*A+g*q*A;d.n32=i*q*C-f*u*C-i*m*D+e*u*D+f*m*A-e*q*A;d.n33=h*k*C-i*j*C+i*g*D-e*k*D-f*g*A+e*j*A;d.n34=i*j*m-f*k*m-i*g*q+e*k*q+f*g*u-e*j*u;d.n41=o*q*C-j*p*C-o*m*D+g*p*D+j*m*E-g*q*E;d.n42=f*p*C-h*q*C+h*m*D-e*p*D-f*m*E+e*q*E;d.n43=h*j*C-f*o*C-h*g*D+e*o*D+f*g*E-e*j*E;d.n44=f*o*m-h*j*m+h*g*q-e*o*q-f*g*p+e*j*p;d.multiplyScalar(1/b.determinant());return d}; -THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,k=b.n23*b.n12-b.n22*b.n13,m=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*k;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*i;e[3]=b*g;e[4]=b*j;e[5]=b*o;e[6]=b*k;e[7]=b*m;e[8]=b*q;return d}; +THREE.Matrix4.makeInvert=function(b,d){var e=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,n=b.n24,p=b.n31,q=b.n32,o=b.n33,r=b.n34,F=b.n41,v=b.n42,G=b.n43,D=b.n44;d===void 0&&(d=new THREE.Matrix4);d.n11=k*r*v-n*o*v+n*q*G-j*r*G-k*q*D+j*o*D;d.n12=i*o*v-h*r*v-i*q*G+f*r*G+h*q*D-f*o*D;d.n13=h*n*v-i*k*v+i*j*G-f*n*G-h*j*D+f*k*D;d.n14=i*k*q-h*n*q-i*j*o+f*n*o+h*j*r-f*k*r;d.n21=n*o*F-k*r*F-n*p*G+g*r*G+k*p*D-g*o*D;d.n22=h*r*F-i*o*F+i*p*G-e*r*G-h*p*D+e*o*D;d.n23=i*k*F-h*n*F-i*g*G+e*n*G+h*g*D-e*k*D;d.n24= +h*n*p-i*k*p+i*g*o-e*n*o-h*g*r+e*k*r;d.n31=j*r*F-n*q*F+n*p*v-g*r*v-j*p*D+g*q*D;d.n32=i*q*F-f*r*F-i*p*v+e*r*v+f*p*D-e*q*D;d.n33=h*n*F-i*j*F+i*g*v-e*n*v-f*g*D+e*j*D;d.n34=i*j*p-f*n*p-i*g*q+e*n*q+f*g*r-e*j*r;d.n41=k*q*F-j*o*F-k*p*v+g*o*v+j*p*G-g*q*G;d.n42=f*o*F-h*q*F+h*p*v-e*o*v-f*p*G+e*q*G;d.n43=h*j*F-f*k*F-h*g*v+e*k*v+f*g*G-e*j*G;d.n44=f*k*p-h*j*p+h*g*q-e*k*q-f*g*o+e*j*o;d.multiplyScalar(1/b.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,e=d.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,i=b.n32*b.n21-b.n31*b.n22,g=-b.n33*b.n12+b.n32*b.n13,j=b.n33*b.n11-b.n31*b.n13,k=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*g+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*i;e[3]=b*g;e[4]=b*j;e[5]=b*k;e[6]=b*n;e[7]=b*p;e[8]=b*q;return d}; THREE.Matrix4.makeFrustum=function(b,d,e,f,h,i){var g;g=new THREE.Matrix4;g.n11=2*h/(d-b);g.n12=0;g.n13=(d+b)/(d-b);g.n14=0;g.n21=0;g.n22=2*h/(f-e);g.n23=(f+e)/(f-e);g.n24=0;g.n31=0;g.n32=0;g.n33=-(i+h)/(i-h);g.n34=-2*i*h/(i-h);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(b,d,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*d,b*d,h,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,d,e,f,h,i){var g,j,o,k;g=new THREE.Matrix4;j=d-b;o=e-f;k=i-h;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((d+b)/j);g.n21=0;g.n22=2/o;g.n23=0;g.n24=-((e+f)/o);g.n31=0;g.n32=0;g.n33=-2/k;g.n34=-((i+h)/k);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; +THREE.Matrix4.makeOrtho=function(b,d,e,f,h,i){var g,j,k,n;g=new THREE.Matrix4;j=d-b;k=e-f;n=i-h;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((d+b)/j);g.n21=0;g.n22=2/k;g.n23=0;g.n24=-((e+f)/k);g.n31=0;g.n32=0;g.n33=-2/n;g.n34=-((i+h)/n);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3; THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion; this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""}; THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)=== @@ -51,27 +51,27 @@ this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.m this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,d=!0;for(var b=0,f=this.children.length;b=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var i=Math.acos(h),g=Math.sqrt(1-h*h);if(Math.abs(g)<0.0010)return e.w=0.5*(b.w+d.w),e.x=0.5*(b.x+d.x),e.y=0.5*(b.y+d.y),e.z=0.5*(b.z+d.z),e;h=Math.sin((1-f)*i)/g;f=Math.sin(f*i)/g;e.w=b.w*h+d.w*f;e.x=b.x*h+d.x*f;e.y=b.y*h+d.y*f;e.z=b.z*h+d.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3}; THREE.Face3=function(b,d,e,f,h,i){this.a=b;this.b=d;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,d,e,f,h,i,g){this.a=b;this.b=d;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)}; THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var b,d,e;b=0;for(d=this.faces.length;b0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var d=1,e=this.vertices.length;dthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,d=0,e=this.vertices.length;dthis.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;k=this.points[e[0]];m=this.points[e[1]]; -q=this.points[e[2]];p=this.points[e[3]];j=g*g;o=g*j;f.x=d(k.x,m.x,q.x,p.x,g,j,o);f.y=d(k.y,m.y,q.y,p.y,g,j,o);f.z=d(k.z,m.z,q.z,p.z,g,j,o);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;bthis.points.length-2?i:i+1;e[3]=i>this.points.length-3?i:i+2;n=this.points[e[0]];p=this.points[e[1]]; +q=this.points[e[2]];o=this.points[e[3]];j=g*g;k=g*j;f.x=d(n.x,p.x,q.x,o.x,g,j,k);f.y=d(n.y,p.y,q.y,o.y,g,j,k);f.z=d(n.z,p.z,q.z,o.z,g,j,k);return f};this.getControlPointsArray=function(){var b,d,e=this.points.length,f=[];for(b=0;b1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1, this.LODs[f].object3D.visible=!0;else break;for(;fq&&(e=m,m=q,q=e):mu&&(e=p,p=u,u=e):pq&&(e=p,p=q,q=e):pr&&(e=o,o=r,r=e):o=0&&g>=0&&c>=0&&i>=0?!0:h<0&&g<0||c<0&&i<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),c<0?e=Math.max(e,c/(c-i)):i<0&&(f=Math.min(f,c/(c-i))),fN&&g.positionScreen.z0&&F.z<1))ta=sa[T]=sa[T]||new THREE.RenderableParticle,T++,A=ta,A.x=F.x/F.w,A.y=F.y/F.w,A.z=F.z,A.rotation=R.rotation.z,A.scale.x=R.scale.x*Math.abs(A.x- -(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),A.scale.y=R.scale.y*Math.abs(A.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),A.materials=R.materials,ea.push(A);i&&ea.sort(d);return ea}}; +THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function d(b,d){return d.z-b.z}function e(b,d){var e=0,f=1,h=b.z+b.w,g=d.z+d.w,c=-b.z+b.w,i=-d.z+d.w;return h>=0&&g>=0&&c>=0&&i>=0?!0:h<0&&g<0||c<0&&i<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),c<0?e=Math.max(e,c/(c-i)):i<0&&(f=Math.min(f,c/(c-i))),fN&&g.positionScreen.z0&&H.z<1))ta=sa[T]=sa[T]||new THREE.RenderableParticle,T++,D=ta,D.x=H.x/H.w,D.y=H.y/H.w,D.z=H.z,D.rotation=R.rotation.z,D.scale.x=R.scale.x*Math.abs(D.x- +(H.x+h.projectionMatrix.n11)/(H.w+h.projectionMatrix.n14)),D.scale.y=R.scale.y*Math.abs(D.y-(H.y+h.projectionMatrix.n22)/(H.w+h.projectionMatrix.n24)),D.materials=R.materials,ea.push(D);i&&ea.sort(d);return ea}}; THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif", -envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", +envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif", lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif", -lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\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 );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}", -lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", +lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\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 );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}", +lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif", -default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap;\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord;\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif", -shadowmap_fragment:"#ifdef USE_SHADOWMAP\nvec3 shadowCoord = vShadowCoord.xyz / vShadowCoord.w;\nvec4 rgbaDepth = texture2D( shadowMap, shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) && ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )\ngl_FragColor = gl_FragColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord;\nuniform mat4 shadowMatrix;\n#endif", -shadowmap_vertex:"#ifdef USE_SHADOWMAP\nvShadowCoord = shadowMatrix * objectMatrix * vec4( position, 1.0 );\n#endif"}; +default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif", +shadowmap_fragment:"#ifdef USE_SHADOWMAP\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) && ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\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"}; THREE.UniformsUtils={merge:function(b){var d,e,f,h={};for(d=0;d=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else if(i.morphTargetBase){d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer), -c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;fm&&(s=L,m=o[s]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]);c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=m;k[s]=1;m=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j], -d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer),c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)): -c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB, -4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.drawElements(c.TRIANGLES, -g.__webglFaceCount,c.UNSIGNED_SHORT,0)),H.data.vertices+=g.__webglFaceCount,H.data.faces+=g.__webglFaceCount/3,H.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),H.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),H.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),H.data.drawCalls++)}}function h(b, -d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,o,s,m,p,q=b.count*3;for(p= -0;p0&&v[0]0&&v[1]0.0010&&j.scale>0.0010)u[0]=j.x,u[1]=j.y,u[2]=j.z,p=j.size*j.scale/pa,q[0]=p*o,q[1]=p,c.uniform3fv(y.screenPosition,u),c.uniform2fv(y.scale,q),c.uniform1f(y.rotation,j.rotation),c.uniform1f(y.opacity,j.opacity),M(j.blending),ra(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT, -0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(I)}function T(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function sa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b0&&(c.bindBuffer(c.ARRAY_BUFFER, -h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ia,j));oa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER,P,j));pa&&na.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ga&&Q>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ga&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ma&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER, -O,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,S,j));z>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));i.dynamic||(delete h.__inittedArrays, -delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;ea(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices|| -f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;v=b.vertices;h=b.colors;y=v.length;i=h.length;A=b.__vertexArray;j=b.__colorArray;C=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k=0;d--)b[d].object==c&&b.splice(d,1)}function O(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(s[j].counter+=1,k=s[j].hash+"_"+s[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o})), -b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=g}function G(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD, -c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}ca=b}}function P(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,N(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,N(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,N(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,N(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b, -c.TEXTURE_MAG_FILTER,ua(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,ua(d.minFilter)))}function ra(b,d){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),P(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+ -d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function ja(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER, -N(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,N(b.format),b.width,b.height,0,N(b.format),N(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER, -c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null, -e=ka,b=pa);d!=oa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(Ga,Ha,e,b),oa=d)}function $(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function ua(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST; -default:return c.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR; -case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0} -var H=this,c,ga=[],Q=null,oa=null,I=!0,aa=null,J=null,ca=null,S=null,R=null,ta=null,Fa=null,Ga=0,Ha=0,ka=0,pa=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Matrix4,Ja=new Float32Array(16),Ka=new Float32Array(16),Ia=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},wa=b.canvas!==void 0?b.canvas:document.createElement("canvas"), -Pa=b.stencil!==void 0?b.stencil:!0,x=b.antialias!==void 0?b.antialias:!1,qa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),La=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=wa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=null;this.shadowMapEnabled= -!1;var ma,Ma=new THREE.Matrix4,b=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(b.uniforms),Na=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va}),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va,morphTargets:!0});Na._shadowPass=!0;Sa._shadowPass=!0;try{if(!(c=wa.getContext("experimental-webgl",{antialias:x,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+ -" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Xa){console.error(Xa)}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(qa.r,qa.g,qa.b,La);this.context=c;var Wa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> -0;if(Pa){var w={};w.vertices=new Float32Array(12);w.faces=new Uint16Array(6);w.darkness=0.5;w.vertices[0]=-20;w.vertices[1]=-20;w.vertices[2]=-1;w.vertices[3]=20;w.vertices[4]=-20;w.vertices[5]=-1;w.vertices[6]=20;w.vertices[7]=20;w.vertices[8]=-1;w.vertices[9]=-20;w.vertices[10]=20;w.vertices[11]=-1;w.faces[0]=0;w.faces[1]=1;w.faces[2]=2;w.faces[3]=0;w.faces[4]=2;w.faces[5]=3;w.vertexBuffer=c.createBuffer();w.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,w.vertexBuffer);c.bufferData(c.ARRAY_BUFFER, -w.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,w.faces,c.STATIC_DRAW);w.program=c.createProgram();c.attachShader(w.program,$("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(w.program,$("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(w.program);w.vertexLocation=c.getAttribLocation(w.program,"position");w.projectionLocation=c.getUniformLocation(w.program,"projectionMatrix");w.darknessLocation= -c.getUniformLocation(w.program,"darkness")}var r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);x=0;r.vertices[x++]=-1;r.vertices[x++]=-1;r.vertices[x++]=0;r.vertices[x++]=0;r.vertices[x++]=1;r.vertices[x++]=-1;r.vertices[x++]=1;r.vertices[x++]=0;r.vertices[x++]=1;r.vertices[x++]=1;r.vertices[x++]=1;r.vertices[x++]=1;r.vertices[x++]=-1;r.vertices[x++]=1;r.vertices[x++]=0;r.vertices[x++]=1;x=0;r.faces[x++]=0;r.faces[x++]=1;r.faces[x++]=2;r.faces[x++]=0;r.faces[x++]=2;r.faces[x++]=3; -r.vertexBuffer=c.createBuffer();r.elementBuffer=c.createBuffer();r.tempTexture=c.createTexture();r.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,r.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,r.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,r.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,r.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S, -c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,r.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST); -c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(r.hasVertexTexture=!1,r.program=c.createProgram(),c.attachShader(r.program,$("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(r.program,$("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(r.hasVertexTexture=!0,r.program=c.createProgram(),c.attachShader(r.program,$("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(r.program,$("vertex", -THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.vertex=c.getAttribLocation(r.program,"position");r.attributes.uv=c.getAttribLocation(r.program,"UV");r.uniforms.renderType=c.getUniformLocation(r.program,"renderType");r.uniforms.map=c.getUniformLocation(r.program,"map");r.uniforms.occlusionMap=c.getUniformLocation(r.program,"occlusionMap");r.uniforms.opacity=c.getUniformLocation(r.program,"opacity");r.uniforms.scale=c.getUniformLocation(r.program, -"scale");r.uniforms.rotation=c.getUniformLocation(r.program,"rotation");r.uniforms.screenPosition=c.getUniformLocation(r.program,"screenPosition");var Ua=!1,y={};y.vertices=new Float32Array(16);y.faces=new Uint16Array(6);x=0;y.vertices[x++]=-1;y.vertices[x++]=-1;y.vertices[x++]=0;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=-1;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=1;y.vertices[x++]=0;y.vertices[x++]=-1;y.vertices[x++]=1;y.vertices[x++]=0;x= -y.vertices[x++]=0;y.faces[x++]=0;y.faces[x++]=1;y.faces[x++]=2;y.faces[x++]=0;y.faces[x++]=2;y.faces[x++]=3;y.vertexBuffer=c.createBuffer();y.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,y.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,y.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y.faces,c.STATIC_DRAW);y.program=c.createProgram();c.attachShader(y.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(y.program, -$("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(y.program);y.attributes={};y.uniforms={};y.attributes.position=c.getAttribLocation(y.program,"position");y.attributes.uv=c.getAttribLocation(y.program,"uv");y.uniforms.uvOffset=c.getUniformLocation(y.program,"uvOffset");y.uniforms.uvScale=c.getUniformLocation(y.program,"uvScale");y.uniforms.rotation=c.getUniformLocation(y.program,"rotation");y.uniforms.scale=c.getUniformLocation(y.program,"scale");y.uniforms.alignment=c.getUniformLocation(y.program, -"alignment");y.uniforms.map=c.getUniformLocation(y.program,"map");y.uniforms.opacity=c.getUniformLocation(y.program,"opacity");y.uniforms.useScreenCoordinates=c.getUniformLocation(y.program,"useScreenCoordinates");y.uniforms.affectedByDistance=c.getUniformLocation(y.program,"affectedByDistance");y.uniforms.screenPosition=c.getUniformLocation(y.program,"screenPosition");y.uniforms.modelViewMatrix=c.getUniformLocation(y.program,"modelViewMatrix");y.uniforms.projectionMatrix=c.getUniformLocation(y.program, -"projectionMatrix");var Ta=!1;this.setSize=function(b,c){wa.width=b;wa.height=c;this.setViewport(0,0,wa.width,wa.height)};this.setViewport=function(b,d,e,f){Ga=b;Ha=d;ka=e;pa=f;c.viewport(Ga,Ha,ka,pa)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){I=b;c.depthMask(b)};this.setClearColorHex=function(b,d){qa.setHex(b);La=d;c.clearColor(qa.r,qa.g,qa.b,La)};this.setClearColor= -function(b,d){qa.copy(b);La=d;c.clearColor(qa.r,qa.g,qa.b,La)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){w.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var h,g,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic": -b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,o,s;k=s=j=0;for(o=d.length;k=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,3,c.FLOAT,!1,0,0);else if(i.morphTargetBase){d=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0)):d.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(d.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f= +0,k=i.morphTargetForcedOrder,n=i.morphTargetInfluences;fE&&(s=p,E=n[s]);c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[s]); +c.vertexAttribPointer(d["morphTarget"+f],3,c.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[f]=E;k[s]=1;E=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&c.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(j in g.__webglCustomAttributes)b[j]>=0&&(d=g.__webglCustomAttributes[j],c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.vertexAttribPointer(b[j],d.size,c.FLOAT,!1,0,0));b.color>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglColorBuffer), +c.vertexAttribPointer(b.color,3,c.FLOAT,!1,0,0));b.normal>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglNormalBuffer),c.vertexAttribPointer(b.normal,3,c.FLOAT,!1,0,0));b.tangent>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglTangentBuffer),c.vertexAttribPointer(b.tangent,4,c.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglUVBuffer),c.vertexAttribPointer(b.uv,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv)):c.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(c.bindBuffer(c.ARRAY_BUFFER, +g.__webglUV2Buffer),c.vertexAttribPointer(b.uv2,2,c.FLOAT,!1,0,0),c.enableVertexAttribArray(b.uv2)):c.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexABuffer),c.vertexAttribPointer(b.skinVertexA,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.vertexAttribPointer(b.skinVertexB,4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),c.vertexAttribPointer(b.skinIndex, +4,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),c.vertexAttribPointer(b.skinWeight,4,c.FLOAT,!1,0,0));i instanceof THREE.Mesh?(h.wireframe?(c.lineWidth(h.wireframeLinewidth),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),c.drawElements(c.LINES,g.__webglLineCount,c.UNSIGNED_SHORT,0)):(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),c.drawElements(c.TRIANGLES,g.__webglFaceCount,c.UNSIGNED_SHORT,0)),J.data.vertices+=g.__webglFaceCount,J.data.faces+=g.__webglFaceCount/ +3,J.data.drawCalls++):i instanceof THREE.Line?(i=i.type==THREE.LineStrip?c.LINE_STRIP:c.LINES,c.lineWidth(h.linewidth),c.drawArrays(i,0,g.__webglLineCount),J.data.drawCalls++):i instanceof THREE.ParticleSystem?(c.drawArrays(c.POINTS,0,g.__webglParticleCount),J.data.drawCalls++):i instanceof THREE.Ribbon&&(c.drawArrays(c.TRIANGLE_STRIP,0,g.__webglVertexCount),J.data.drawCalls++)}}function h(b,d,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=c.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer= +c.createBuffer();b.hasPos&&(c.bindBuffer(c.ARRAY_BUFFER,b.__webglVertexBuffer),c.bufferData(c.ARRAY_BUFFER,b.positionArray,c.DYNAMIC_DRAW),c.enableVertexAttribArray(d.attributes.position),c.vertexAttribPointer(d.attributes.position,3,c.FLOAT,!1,0,0));if(b.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,i,j,k,n,s,p,B,q=b.count*3;for(B=0;B0&&o[0]0&&o[1]0.0010&&j.scale>0.0010)r[0]=j.x,r[1]=j.y,r[2]=j.z,B=j.size*j.scale/pa,q[0]=B*n,q[1]=B,c.uniform3fv(w.screenPosition,r),c.uniform2fv(w.scale,q),c.uniform1f(w.rotation,j.rotation),c.uniform1f(w.opacity,j.opacity),L(j.blending),qa(j.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0)}c.enable(c.CULL_FACE);c.enable(c.DEPTH_TEST);c.depthMask(K)}function T(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse, +b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function sa(b){var c,d,e,f;f=b.__materials;b=0;for(d=f.length;b0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglColorBuffer),c.bufferData(c.ARRAY_BUFFER,ia,j));oa&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglNormalBuffer),c.bufferData(c.ARRAY_BUFFER, +P,j));pa&&na.hasTangents&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglTangentBuffer),c.bufferData(c.ARRAY_BUFFER,V,j));ga&&Q>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUVBuffer),c.bufferData(c.ARRAY_BUFFER,$,j));ga&&R>0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglUV2Buffer),c.bufferData(c.ARRAY_BUFFER,aa,j));ma&&(c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,O,j),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,S,j));A> +0&&(c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexABuffer),c.bufferData(c.ARRAY_BUFFER,W,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),c.bufferData(c.ARRAY_BUFFER,X,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),c.bufferData(c.ARRAY_BUFFER,Y,j),c.bindBuffer(c.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),c.bufferData(c.ARRAY_BUFFER,Z,j));i.dynamic||(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array, +delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;ea(g)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=c.DYNAMIC_DRAW;w=b.vertices;h=b.colors;z=w.length;i=h.length;x=b.__vertexArray;j=b.__colorArray; +D=b.__dirtyColors;if(b.__dirtyVertices){for(k=0;k=0;d--)b[d].object==c&&b.splice(d,1)}function O(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(s[j].counter+=1,k=s[j].hash+"_"+s[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:n})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=g}function I(b,c,d){b.push({buffer:c,object:d, +opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}ca= +b}}function P(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,N(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,N(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,N(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,N(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,ua(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,ua(d.minFilter)))} +function qa(b,d){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),P(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,b.__webglTexture)}function ja(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer=== +void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,N(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,N(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,N(b.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,N(b.minFilter));c.texImage2D(c.TEXTURE_2D, +0,N(b.format),b.width,b.height,0,N(b.format),N(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER, +c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,e=ka,b=pa);d!=oa&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(Ha,Ia,e,b),oa=d)}function $(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER): +b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function ua(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;default:return c.LINEAR}}function N(b){switch(b){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT; +case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT; +case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var J=this,c,ga=[],Q=null,oa=null,K=!0,aa=null,M=null,ca=null,S=null,R=null,ta=null,Ga=null,Ha=0,Ia=0,ka=0,pa=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, +new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],va=new THREE.Matrix4,Ka=new Float32Array(16),La=new Float32Array(16),Ja=new THREE.Vector4,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},wa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Pa=b.stencil!==void 0?b.stencil:!0,u=b.antialias!==void 0?b.antialias:!1,ra=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ma=b.clearAlpha!== +void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=wa;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;var ma,Na=[],b=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(b.uniforms),Oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader, +vertexShader:b.vertexShader,uniforms:Va}),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Va,morphTargets:!0});Oa._shadowPass=!0;Sa._shadowPass=!0;try{if(!(c=wa.getContext("experimental-webgl",{antialias:u,stencil:Pa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+c.getParameter(c.VERSION)+" | "+c.getParameter(c.VENDOR)+" | "+c.getParameter(c.RENDERER)+" | "+c.getParameter(c.SHADING_LANGUAGE_VERSION))}catch(Xa){console.error(Xa)}c.clearColor(0, +0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);c.clearColor(ra.r,ra.g,ra.b,Ma);this.context=c;var Wa=c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Pa){var y={};y.vertices=new Float32Array(12);y.faces=new Uint16Array(6);y.darkness=0.5;y.vertices[0]=-20;y.vertices[1]=-20;y.vertices[2]=-1;y.vertices[3]=20;y.vertices[4]=-20; +y.vertices[5]=-1;y.vertices[6]=20;y.vertices[7]=20;y.vertices[8]=-1;y.vertices[9]=-20;y.vertices[10]=20;y.vertices[11]=-1;y.faces[0]=0;y.faces[1]=1;y.faces[2]=2;y.faces[3]=0;y.faces[4]=2;y.faces[5]=3;y.vertexBuffer=c.createBuffer();y.elementBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,y.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,y.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,y.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,y.faces,c.STATIC_DRAW);y.program=c.createProgram(); +c.attachShader(y.program,$("fragment",THREE.ShaderLib.shadowPost.fragmentShader));c.attachShader(y.program,$("vertex",THREE.ShaderLib.shadowPost.vertexShader));c.linkProgram(y.program);y.vertexLocation=c.getAttribLocation(y.program,"position");y.projectionLocation=c.getUniformLocation(y.program,"projectionMatrix");y.darknessLocation=c.getUniformLocation(y.program,"darkness")}var z={};z.vertices=new Float32Array(16);z.faces=new Uint16Array(6);u=0;z.vertices[u++]=-1;z.vertices[u++]=-1;z.vertices[u++]= +0;z.vertices[u++]=0;z.vertices[u++]=1;z.vertices[u++]=-1;z.vertices[u++]=1;z.vertices[u++]=0;z.vertices[u++]=1;z.vertices[u++]=1;z.vertices[u++]=1;z.vertices[u++]=1;z.vertices[u++]=-1;z.vertices[u++]=1;z.vertices[u++]=0;z.vertices[u++]=1;u=0;z.faces[u++]=0;z.faces[u++]=1;z.faces[u++]=2;z.faces[u++]=0;z.faces[u++]=2;z.faces[u++]=3;z.vertexBuffer=c.createBuffer();z.elementBuffer=c.createBuffer();z.tempTexture=c.createTexture();z.occlusionTexture=c.createTexture();c.bindBuffer(c.ARRAY_BUFFER,z.vertexBuffer); +c.bufferData(c.ARRAY_BUFFER,z.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,z.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,z.faces,c.STATIC_DRAW);c.bindTexture(c.TEXTURE_2D,z.tempTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGB,16,16,0,c.RGB,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER, +c.NEAREST);c.bindTexture(c.TEXTURE_2D,z.occlusionTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,16,16,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(z.hasVertexTexture=!1,z.program=c.createProgram(),c.attachShader(z.program, +$("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),c.attachShader(z.program,$("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(z.hasVertexTexture=!0,z.program=c.createProgram(),c.attachShader(z.program,$("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),c.attachShader(z.program,$("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));c.linkProgram(z.program);z.attributes={};z.uniforms={};z.attributes.vertex=c.getAttribLocation(z.program,"position");z.attributes.uv= +c.getAttribLocation(z.program,"UV");z.uniforms.renderType=c.getUniformLocation(z.program,"renderType");z.uniforms.map=c.getUniformLocation(z.program,"map");z.uniforms.occlusionMap=c.getUniformLocation(z.program,"occlusionMap");z.uniforms.opacity=c.getUniformLocation(z.program,"opacity");z.uniforms.scale=c.getUniformLocation(z.program,"scale");z.uniforms.rotation=c.getUniformLocation(z.program,"rotation");z.uniforms.screenPosition=c.getUniformLocation(z.program,"screenPosition");var Ua=!1,x={};x.vertices= +new Float32Array(16);x.faces=new Uint16Array(6);u=0;x.vertices[u++]=-1;x.vertices[u++]=-1;x.vertices[u++]=0;x.vertices[u++]=1;x.vertices[u++]=1;x.vertices[u++]=-1;x.vertices[u++]=1;x.vertices[u++]=1;x.vertices[u++]=1;x.vertices[u++]=1;x.vertices[u++]=1;x.vertices[u++]=0;x.vertices[u++]=-1;x.vertices[u++]=1;x.vertices[u++]=0;u=x.vertices[u++]=0;x.faces[u++]=0;x.faces[u++]=1;x.faces[u++]=2;x.faces[u++]=0;x.faces[u++]=2;x.faces[u++]=3;x.vertexBuffer=c.createBuffer();x.elementBuffer=c.createBuffer(); +c.bindBuffer(c.ARRAY_BUFFER,x.vertexBuffer);c.bufferData(c.ARRAY_BUFFER,x.vertices,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,x.elementBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,x.faces,c.STATIC_DRAW);x.program=c.createProgram();c.attachShader(x.program,$("fragment",THREE.ShaderLib.sprite.fragmentShader));c.attachShader(x.program,$("vertex",THREE.ShaderLib.sprite.vertexShader));c.linkProgram(x.program);x.attributes={};x.uniforms={};x.attributes.position=c.getAttribLocation(x.program,"position"); +x.attributes.uv=c.getAttribLocation(x.program,"uv");x.uniforms.uvOffset=c.getUniformLocation(x.program,"uvOffset");x.uniforms.uvScale=c.getUniformLocation(x.program,"uvScale");x.uniforms.rotation=c.getUniformLocation(x.program,"rotation");x.uniforms.scale=c.getUniformLocation(x.program,"scale");x.uniforms.alignment=c.getUniformLocation(x.program,"alignment");x.uniforms.map=c.getUniformLocation(x.program,"map");x.uniforms.opacity=c.getUniformLocation(x.program,"opacity");x.uniforms.useScreenCoordinates= +c.getUniformLocation(x.program,"useScreenCoordinates");x.uniforms.affectedByDistance=c.getUniformLocation(x.program,"affectedByDistance");x.uniforms.screenPosition=c.getUniformLocation(x.program,"screenPosition");x.uniforms.modelViewMatrix=c.getUniformLocation(x.program,"modelViewMatrix");x.uniforms.projectionMatrix=c.getUniformLocation(x.program,"projectionMatrix");var Ta=!1;this.setSize=function(b,c){wa.width=b;wa.height=c;this.setViewport(0,0,wa.width,wa.height)};this.setViewport=function(b,d, +e,f){Ha=b;Ia=d;ka=e;pa=f;c.viewport(Ha,Ia,ka,pa)};this.setScissor=function(b,d,e,f){c.scissor(b,d,e,f)};this.enableScissorTest=function(b){b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){K=b;c.depthMask(b)};this.setClearColorHex=function(b,d){ra.setHex(b);Ma=d;c.clearColor(ra.r,ra.g,ra.b,Ma)};this.setClearColor=function(b,d){ra.copy(b);Ma=d;c.clearColor(ra.r,ra.g,ra.b,Ma)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT|c.STENCIL_BUFFER_BIT)}; +this.setStencilShadowDarkness=function(b){y.darkness=b};this.getContext=function(){return c};this.initMaterial=function(b,d,e,f){var h,g,i;b instanceof THREE.MeshDepthMaterial?i="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?i="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?i="normal":b instanceof THREE.MeshBasicMaterial?i="basic":b instanceof THREE.MeshLambertMaterial?i="lambert":b instanceof THREE.MeshPhongMaterial?i="phong":b instanceof THREE.LineBasicMaterial?i="basic":b instanceof +THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];b.uniforms=THREE.UniformsUtils.clone(j.uniforms);b.vertexShader=j.vertexShader;b.fragmentShader=j.fragmentShader}var k,n,s;k=s=j=0;for(n=d.length;k=0&&c.enableVertexAttribArray(m.position);m.color>=0&&c.enableVertexAttribArray(m.color);m.normal>=0&&c.enableVertexAttribArray(m.normal); -m.tangent>=0&&c.enableVertexAttribArray(m.tangent);b.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0&&(c.enableVertexAttribArray(m.skinVertexA),c.enableVertexAttribArray(m.skinVertexB),c.enableVertexAttribArray(m.skinIndex),c.enableVertexAttribArray(m.skinWeight));if(b.attributes)for(h in b.attributes)m[h]!==void 0&&m[h]>=0&&c.enableVertexAttribArray(m[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,m.morphTarget0>=0&&(c.enableVertexAttribArray(m.morphTarget0),b.numSupportedMorphTargets++), -m.morphTarget1>=0&&(c.enableVertexAttribArray(m.morphTarget1),b.numSupportedMorphTargets++),m.morphTarget2>=0&&(c.enableVertexAttribArray(m.morphTarget2),b.numSupportedMorphTargets++),m.morphTarget3>=0&&(c.enableVertexAttribArray(m.morphTarget3),b.numSupportedMorphTargets++),m.morphTarget4>=0&&(c.enableVertexAttribArray(m.morphTarget4),b.numSupportedMorphTargets++),m.morphTarget5>=0&&(c.enableVertexAttribArray(m.morphTarget5),b.numSupportedMorphTargets++),m.morphTarget6>=0&&(c.enableVertexAttribArray(m.morphTarget6), -b.numSupportedMorphTargets++),m.morphTarget7>=0&&(c.enableVertexAttribArray(m.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,d,m,r){var v,y,w,x,F,G,s,L,I=b.lights,J=b.fog;this.shadowMapEnabled&&C(b,d);H.data.vertices=0;H.data.faces=0;H.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(Ka);d.projectionMatrix.flattenToArray(Ja);va.multiply(d.projectionMatrix,d.matrixWorldInverse);o(va);this.initWebGLObjects(b);ja(m); -(this.autoClear||r)&&this.clear();F=b.__webglObjects.length;for(r=0;r=0&&c.enableVertexAttribArray(o.position);o.color>=0&&c.enableVertexAttribArray(o.color);o.normal>= +0&&c.enableVertexAttribArray(o.normal);o.tangent>=0&&c.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(c.enableVertexAttribArray(o.skinVertexA),c.enableVertexAttribArray(o.skinVertexB),c.enableVertexAttribArray(o.skinIndex),c.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(h in b.attributes)o[h]!==void 0&&o[h]>=0&&c.enableVertexAttribArray(o[h]);if(b.morphTargets)b.numSupportedMorphTargets=0,o.morphTarget0>=0&&(c.enableVertexAttribArray(o.morphTarget0), +b.numSupportedMorphTargets++),o.morphTarget1>=0&&(c.enableVertexAttribArray(o.morphTarget1),b.numSupportedMorphTargets++),o.morphTarget2>=0&&(c.enableVertexAttribArray(o.morphTarget2),b.numSupportedMorphTargets++),o.morphTarget3>=0&&(c.enableVertexAttribArray(o.morphTarget3),b.numSupportedMorphTargets++),o.morphTarget4>=0&&(c.enableVertexAttribArray(o.morphTarget4),b.numSupportedMorphTargets++),o.morphTarget5>=0&&(c.enableVertexAttribArray(o.morphTarget5),b.numSupportedMorphTargets++),o.morphTarget6>= +0&&(c.enableVertexAttribArray(o.morphTarget6),b.numSupportedMorphTargets++),o.morphTarget7>=0&&(c.enableVertexAttribArray(o.morphTarget7),b.numSupportedMorphTargets++)};this.render=function(b,d,p,w){var u,z,y,x,H,E,s,I,B=b.lights,K=b.fog;this.shadowMapEnabled&&F(b,d);J.data.vertices=0;J.data.faces=0;J.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,!0);b.update(void 0,!1,d);d.matrixWorldInverse.flattenToArray(La);d.projectionMatrix.flattenToArray(Ka);va.multiply(d.projectionMatrix,d.matrixWorldInverse); +k(va);this.initWebGLObjects(b);ja(p);(this.autoClear||w)&&this.clear();H=b.__webglObjects.length;for(w=0;w0||r.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(r.faceUvs.length>1||r.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4), -i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(x*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];r=0;for(q=i.numMorphTargets;r0||q.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(j.geometry.skinWeights.length&&j.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4), +i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.length*6:0));i.__lineArray=new Uint16Array(x*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];q=0;for(r=i.numMorphTargets;q=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof THREE.LensFlare?v(d.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&v(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof THREE.LensFlare?w(d.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&w(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d 0", - "for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {", + "for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {", "vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );", "float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );", @@ -287,7 +287,7 @@ THREE.ShaderChunk = { "#if MAX_POINT_LIGHTS > 0", - "for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {", + "for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {", "vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );", @@ -369,7 +369,7 @@ THREE.ShaderChunk = { "vec4 dirDiffuse = vec4( 0.0 );", "vec4 dirSpecular = vec4( 0.0 );" , - "for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {", + "for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {", "vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );", @@ -536,12 +536,12 @@ THREE.ShaderChunk = { "#ifdef USE_SHADOWMAP", - "uniform sampler2D shadowMap;", + "uniform sampler2D shadowMap[ MAX_SHADOWS ];", "uniform float shadowDarkness;", "uniform float shadowBias;", - "varying vec4 vShadowCoord;", + "varying vec4 vShadowCoord[ MAX_SHADOWS ];", "float unpackDepth( const in vec4 rgba_depth ) {", @@ -559,18 +559,30 @@ THREE.ShaderChunk = { "#ifdef USE_SHADOWMAP", - "vec3 shadowCoord = vShadowCoord.xyz / vShadowCoord.w;", + "vec4 shadowColor = vec4( 1.0 );", - "vec4 rgbaDepth = texture2D( shadowMap, shadowCoord.xy );", - "float fDepth = unpackDepth( rgbaDepth );", + "for( int i = 0; i < MAX_SHADOWS; i ++ ) {", - "if ( fDepth < ( shadowCoord.z + shadowBias ) && ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )", - "gl_FragColor = gl_FragColor * vec4( vec3( shadowDarkness ), 1.0 );", + "vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;", - // uncomment to see light frustum boundaries - //"if ( !( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )", - // "gl_FragColor = gl_FragColor * vec4( 1.0, 0.0, 0.0, 1.0 );", + "vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );", + "float fDepth = unpackDepth( rgbaDepth );", + "if ( fDepth < ( shadowCoord.z + shadowBias ) && ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )", + + // spot with multiple shadows is darker + "shadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );", + + // spot with multiple shadows has the same color as single shadow spot + //"shadowColor = min( shadowColor, vec4( vec3( shadowDarkness ), 1.0 ) );", + + // uncomment to see light frustum boundaries + //"if ( !( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) )", + // "gl_FragColor = gl_FragColor * vec4( 1.0, 0.0, 0.0, 1.0 );", + + "}", + + "gl_FragColor = gl_FragColor * shadowColor;", "#endif" @@ -580,8 +592,8 @@ THREE.ShaderChunk = { "#ifdef USE_SHADOWMAP", - "varying vec4 vShadowCoord;", - "uniform mat4 shadowMatrix;", + "varying vec4 vShadowCoord[ MAX_SHADOWS ];", + "uniform mat4 shadowMatrix[ MAX_SHADOWS ];", "#endif" @@ -591,7 +603,11 @@ THREE.ShaderChunk = { "#ifdef USE_SHADOWMAP", - "vShadowCoord = shadowMatrix * objectMatrix * vec4( position, 1.0 );", + "for( int i = 0; i < MAX_SHADOWS; i ++ ) {", + + "vShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );", + + "}", "#endif" @@ -722,8 +738,8 @@ THREE.UniformsLib = { shadowmap: { - "shadowMap": { type: "t", value: 3, texture: null }, - "shadowMatrix" : { type: "m4", value: new THREE.Matrix4() }, + "shadowMap": { type: "tv", value: 3, texture: [] }, + "shadowMatrix" : { type: "m4v", value: [] }, "shadowBias" : { type: "f", value: 0.0039 }, "shadowDarkness": { type: "f", value: 0.2 }