// ThreeExtras.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,g,b,l,j,h;if(d==0)e=g=b=0;else{l=Math.floor(a*6);j=a*6-l;a=d*(1-c);h=d*(1-c*j);c=d*(1-c*(1-j));switch(l){case 1:e=h;g=d;b=a;break;case 2:e=a;g=d;b=c;break;case 3:e=a;g=h;b=d;break;case 4:e=c;g=a;b=d;break;case 5:e=d;g=a;b=h;break;case 6:case 0:e=d;g=c;b=a}}this.r=e;this.g=g;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1}; THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a0&&G>0&&n+G<1}var d,e,g,b,l,j,h,o,v,z, u,q=a.geometry,x=q.vertices,B=[];d=0;for(e=q.faces.length;dh?e:h;g=g>o? g:o}a()};this.add3Points=function(h,o,v,z,u,q){if(j){j=false;c=hv?h>u?h:u:v>u?v:u;g=o>z?o>q?o:q:z>q?z:q}else{c=hv?h>u?h>e?h:e:u>e?u:e:v>u?v>e?v:e:u>e?u:e;g=o>z?o>q?o>g?o:g:q>g?q:g:z>q?z>g?z:g:q>g?q:g}a()};this.addRectangle=function(h){if(j){j=false;c=h.getLeft();d=h.getTop();e=h.getRight();g=h.getBottom()}else{c=ch.getRight()?e:h.getRight();g=g>h.getBottom()?g:h.getBottom()}a()};this.inflate=function(h){c-=h;d-=h;e+=h;g+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(g,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){j=true;g=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString= function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+b+", height: "+l+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; THREE.Matrix4=function(a,c,d,e,g,b,l,j,h,o,v,z,u,q,x,B){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=b||1;this.n23=l||0;this.n24=j||0;this.n31=h||0;this.n32=o||0;this.n33=v||1;this.n34=z||0;this.n41=u||0;this.n42=q||0;this.n43=x||0;this.n44=B||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,g,b,l,j,h,o,v,z,u,q,x,B){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=b;this.n23=l;this.n24=j;this.n31=h;this.n32=o;this.n33=v;this.n34=z;this.n41=u;this.n42=q;this.n43=x;this.n44=B;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();g.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23* e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,b=a.n14,l=a.n21,j=a.n22,h=a.n23,o=a.n24,v=a.n31, z=a.n32,u=a.n33,q=a.n34,x=a.n41,B=a.n42,G=a.n43,t=a.n44,k=c.n11,f=c.n12,m=c.n13,n=c.n14,C=c.n21,w=c.n22,p=c.n23,F=c.n24,y=c.n31,J=c.n32,E=c.n33,A=c.n34,M=c.n41,aa=c.n42,N=c.n43,U=c.n44;this.n11=d*k+e*C+g*y+b*M;this.n12=d*f+e*w+g*J+b*aa;this.n13=d*m+e*p+g*E+b*N;this.n14=d*n+e*F+g*A+b*U;this.n21=l*k+j*C+h*y+o*M;this.n22=l*f+j*w+h*J+o*aa;this.n23=l*m+j*p+h*E+o*N;this.n24=l*n+j*F+h*A+o*U;this.n31=v*k+z*C+u*y+q*M;this.n32=v*f+z*w+u*J+q*aa;this.n33=v*m+z*p+u*E+q*N;this.n34=v*n+z*F+u*A+q*U;this.n41=x*k+ B*C+G*y+t*M;this.n42=x*f+B*w+G*J+t*aa;this.n43=x*m+B*p+G*E+t*N;this.n44=x*n+B*F+G*A+t*U;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,b=this.n21,l=this.n22,j=this.n23,h=this.n24,o=this.n31,v=this.n32,z=this.n33,u=this.n34,q=this.n41,x=this.n42,B=this.n43,G=this.n44,t=a.n11,k=a.n21,f=a.n31,m=a.n41,n=a.n12,C=a.n22,w=a.n32,p=a.n42,F=a.n13,y=a.n23,J=a.n33,E=a.n43,A=a.n14,M=a.n24,aa=a.n34;a=a.n44;this.n11=c*t+d*k+e*f+g*m;this.n12=c*n+d*C+e*w+g*p;this.n13=c*F+d*y+ e*J+g*E;this.n14=c*A+d*M+e*aa+g*a;this.n21=b*t+l*k+j*f+h*m;this.n22=b*n+l*C+j*w+h*p;this.n23=b*F+l*y+j*J+h*E;this.n24=b*A+l*M+j*aa+h*a;this.n31=o*t+v*k+z*f+u*m;this.n32=o*n+v*C+z*w+u*p;this.n33=o*F+v*y+z*J+u*E;this.n34=o*A+v*M+z*aa+u*a;this.n41=q*t+x*k+B*f+G*m;this.n42=q*n+x*C+B*w+G*p;this.n43=q*F+x*y+B*J+G*E;this.n44=q*A+x*M+B*aa+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*= a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,g=this.n21,b=this.n22,l=this.n23,j=this.n24,h=this.n31,o=this.n32,v=this.n33,z=this.n34,u=this.n41,q=this.n42,x=this.n43,B=this.n44;return e*l*o*u-d*j*o*u-e*b*v*u+c*j*v*u+d*b*z*u-c*l*z*u-e*l*h*q+d*j*h*q+e*g*v*q-a*j*v*q-d*g*z*q+a*l*z*q+e*b*h*x-c*j*h*x-e*g*o*x+a*j*o*x+c*g*z*x-a*b*z*x-d*b*h*B+c*l*h*B+d*g*o*B-a*l*o*B-c*g*v*B+a*b*v*B},transpose:function(){function a(c, d,e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,b=a.x,l=a.y,j=a.z,h=g*b,o=g*l;this.set(h*b+d,h*l-e*j,h*j+e*l,0,h*l+e*j,o*l+d,o*j-e*b,0,h*j-e*l,o*j+e*b,g*j*j+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,b=a.n21,l=a.n22,j=a.n23,h=a.n24,o=a.n31,v=a.n32,z=a.n33,u=a.n34,q=a.n41,x=a.n42,B=a.n43,G=a.n44,t=new THREE.Matrix4;t.n11=j*u*x-h*z*x+h*v*B-l*u*B-j*v*G+l*z*G;t.n12=g*z*x-e*u*x-g*v*B+d*u*B+e*v*G-d*z*G;t.n13=e*h*x-g*j*x+g*l*B-d*h*B-e*l*G+d*j*G;t.n14=g*j*v-e*h*v-g*l*z+d*h*z+e*l*u-d*j*u;t.n21=h*z*q-j*u*q-h*o*B+b*u*B+j*o*G-b*z*G;t.n22=e*u*q-g*z*q+g*o*B-c*u*B-e*o*G+c*z*G;t.n23=g*j*q-e*h*q-g*b*B+c*h*B+e*b*G-c*j*G;t.n24=e*h*o-g*j*o+ g*b*z-c*h*z-e*b*u+c*j*u;t.n31=l*u*q-h*v*q+h*o*x-b*u*x-l*o*G+b*v*G;t.n32=g*v*q-d*u*q-g*o*x+c*u*x+d*o*G-c*v*G;t.n33=e*h*q-g*l*q+g*b*x-c*h*x-d*b*G+c*l*G;t.n34=g*l*o-d*h*o-g*b*v+c*h*v+d*b*u-c*l*u;t.n41=j*v*q-l*z*q-j*o*x+b*z*x+l*o*B-b*v*B;t.n42=d*z*q-e*v*q+e*o*x-c*z*x-d*o*B+c*v*B;t.n43=e*l*q-d*j*q-e*b*x+c*j*x+d*b*B-c*l*B;t.n44=d*j*o-e*l*o+e*b*v-c*j*v-d*b*z+c*l*z;t.multiplyScalar(1/a.determinant());return t}; THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],l=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],h=-c[6]*c[0]+c[2]*c[4],o=c[9]*c[4]-c[5]*c[8],v=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*l+c[2]*o;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*g;d[2]=c*b;d[3]=c*l;d[4]=c*j;d[5]=c*h;d[6]=c*o;d[7]=c*v;d[8]=c*z;return a}; THREE.Matrix4.makeFrustum=function(a,c,d,e,g,b){var l,j,h;l=new THREE.Matrix4;j=2*g/(c-a);h=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+g)/(b-g);g=-2*b*g/(b-g);l.n11=j;l.n12=0;l.n13=a;l.n14=0;l.n21=0;l.n22=h;l.n23=d;l.n24=0;l.n31=0;l.n32=0;l.n33=e;l.n34=g;l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)}; THREE.Matrix4.makeOrtho=function(a,c,d,e,g,b){var l,j,h,o;l=new THREE.Matrix4;j=c-a;h=d-e;o=b-g;a=(c+a)/j;d=(d+e)/h;g=(b+g)/o;l.n11=2/j;l.n12=0;l.n13=0;l.n14=-a;l.n21=0;l.n22=2/h;l.n23=0;l.n24=-d;l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-g;l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,c,d,e,g){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; THREE.Face4=function(a,c,d,e,g,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){o[j].counter+=1;h=o[j].hash+"_"+o[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:l,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0}; THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c]};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2; THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}}; THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
)"}}; THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!== undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!== undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (
id: "+this.id+"
color: "+this.color+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
opacity: "+this.opacity+"
blending: "+this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+ this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshBasicMaterialCounter={value:0}; THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color); if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending; if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
map: "+this.map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
opacity: "+this.opacity+"
shading: "+this.shading+"
blending: "+this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+ this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshLambertMaterialCounter={value:0}; THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.light_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth= 1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map; if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth; if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (
id: "+this.id+"
color: "+this.color+"
ambient: "+this.ambient+"
specular: "+this.specular+"
shininess: "+this.shininess+"
map: "+this.map+"
specular_map: "+this.specular_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
opacity: "+this.opacity+"
shading: "+this.shading+"
wireframe: "+ this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshPhongMaterialCounter={value:0}; THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}}; THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!== undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
)"}}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,g,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; var Uniforms={clone:function(a){var c,d,e,g={};for(c in a){g[c]={};for(d in a[c]){e=a[c][d];g[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var c,d,e,g={};for(c=0;c=0&&E>=0&&A>=0&&M>=0)return true;else if(J<0&&E<0||A<0&&M<0)return false;else{if(J<0)F=Math.max(F,J/(J-E));else if(E<0)y=Math.min(y,J/(J-E));if(A<0)F=Math.max(F,A/(A-M));else if(M<0)y=Math.min(y,A/(A-M));if(yJ&&N.z0&&G.z<1){u=x[q]=x[q]||new THREE.RenderableParticle;u.x=G.x/G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x-(G.x+p.projectionMatrix.n11)/(G.w+p.projectionMatrix.n14)); u.scale.y=R.scale.y*Math.abs(u.y-(G.y+p.projectionMatrix.n22)/(G.w+p.projectionMatrix.n24));u.materials=R.materials;y.push(u);q++}}}}F&&y.sort(a);return y};this.unprojectVector=function(w,p){var F=THREE.Matrix4.makeInvert(p.matrix);F.multiplySelf(THREE.Matrix4.makeInvert(p.projectionMatrix));F.multiplyVector3(w);return w}}; THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,b;this.domElement=document.createElement("div");this.setSize=function(l,j){d=l;e=j;g=d/2;b=e/2};this.render=function(l,j){var h,o,v,z,u,q,x,B;a=c.projectScene(l,j);h=0;for(o=a.length;h0){O.r+=ma.r*ga;O.g+=ma.g*ga;O.b+=ma.b*ga}}else if(ga instanceof THREE.PointLight){K.sub(ga.position,ea);K.normalize();ga=$.dot(K)*na;if(ga>0){O.r+=ma.r*ga;O.g+=ma.g*ga;O.b+=ma.b*ga}}}}function Qa(L,ea,$){if($.opacity!=0){a($.opacity); c($.blending);var O,Y,ga,ma,na,oa;if($ instanceof THREE.ParticleBasicMaterial){if($.map&&$.map.image.loaded){ma=$.map.image;na=ma.width>>1;oa=ma.height>>1;Y=ea.scale.x*j;ga=ea.scale.y*h;$=Y*na;O=ga*oa;I.set(L.x-$,L.y-O,L.x+$,L.y+O);if(ba.instersects(I)){o.save();o.translate(L.x,L.y);o.rotate(-ea.rotation);o.scale(Y,-ga);o.translate(-na,-oa);o.drawImage(ma,0,0);o.restore()}}}else if($ instanceof THREE.ParticleCircleMaterial){if(Q){V.r=ha.r+ka.r+D.r;V.g=ha.g+ka.g+D.g;V.b=ha.b+ka.b+D.b;y.r=$.color.r* V.r;y.g=$.color.g*V.g;y.b=$.color.b*V.b;y.updateStyleString()}else y.__styleString=$.color.__styleString;$=ea.scale.x*j;O=ea.scale.y*h;I.set(L.x-$,L.y-O,L.x+$,L.y+O);if(ba.instersects(I)){Y=y.__styleString;if(B!=Y)o.fillStyle=B=Y;o.save();o.translate(L.x,L.y);o.rotate(-ea.rotation);o.scale($,O);o.beginPath();o.arc(0,0,1,0,H,true);o.closePath();o.fill();o.restore()}}}}function Ra(L,ea,$,O){if(O.opacity!=0){a(O.opacity);c(O.blending);o.beginPath();o.moveTo(L.positionScreen.x,L.positionScreen.y);o.lineTo(ea.positionScreen.x, ea.positionScreen.y);o.closePath();if(O instanceof THREE.LineBasicMaterial){y.__styleString=O.color.__styleString;L=O.linewidth;if(G!=L)o.lineWidth=G=L;L=y.__styleString;if(x!=L)o.strokeStyle=x=L;o.stroke();I.inflate(O.linewidth*2)}}}function La(L,ea,$,O,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);m=L.positionScreen.x;n=L.positionScreen.y;C=ea.positionScreen.x;w=ea.positionScreen.y;p=$.positionScreen.x;F=$.positionScreen.y;o.beginPath();o.moveTo(m,n);o.lineTo(C,w);o.lineTo(p,F);o.lineTo(m,n); o.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(m,n,C,w,p,F,Y.map.image,O.uvs[0].u,O.uvs[0].v,O.uvs[1].u,O.uvs[1].v,O.uvs[2].u,O.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){L=xa.matrix;K.copy(O.vertexNormalsWorld[0]);T=(K.x*L.n11+K.y*L.n12+K.z*L.n13)*0.5+0.5;R=-(K.x*L.n21+K.y*L.n22+K.z*L.n23)*0.5+0.5;K.copy(O.vertexNormalsWorld[1]);Z=(K.x*L.n11+ K.y*L.n12+K.z*L.n13)*0.5+0.5;ca=-(K.x*L.n21+K.y*L.n22+K.z*L.n23)*0.5+0.5;K.copy(O.vertexNormalsWorld[2]);W=(K.x*L.n11+K.y*L.n12+K.z*L.n13)*0.5+0.5;S=-(K.x*L.n21+K.y*L.n22+K.z*L.n23)*0.5+0.5;Aa(m,n,C,w,p,F,Y.env_map.image,T,R,Z,ca,W,S)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(m,n,C,w,p,F,Y.map.image,O.uvs[0].u,O.uvs[0].v,O.uvs[1].u, O.uvs[1].v,O.uvs[2].u,O.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){J.r=E.r=A.r=ha.r;J.g=E.g=A.g=ha.g;J.b=E.b=A.b=ha.b;Da(ga,O.v1.positionWorld,O.vertexNormalsWorld[0],J);Da(ga,O.v2.positionWorld,O.vertexNormalsWorld[1],E);Da(ga,O.v3.positionWorld,O.vertexNormalsWorld[2],A);M.r=(E.r+A.r)*0.5;M.g=(E.g+A.g)*0.5;M.b=(E.b+A.b)*0.5;U=Ma(J,E,A,M);Aa(m,n,C,w,p,F,U,0,0,1,0,0,1)}else{V.r=ha.r;V.g=ha.g;V.b=ha.b;Da(ga,O.centroidWorld, O.normalWorld,V);y.r=Y.color.r*V.r;y.g=Y.color.g*V.g;y.b=Y.color.b*V.b;y.updateStyleString();Y.wireframe?Ea(y.__styleString,Y.wireframe_linewidth):Fa(y.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){aa=xa.near;N=xa.far;J.r=J.g=J.b=1-Ha(L.positionScreen.z,aa,N);E.r=E.g=E.b=1-Ha(ea.positionScreen.z,aa,N);A.r=A.g=A.b=1-Ha($.positionScreen.z,aa,N);M.r=(E.r+A.r)*0.5;M.g=(E.g+A.g)*0.5;M.b=(E.b+A.b)* 0.5;U=Ma(J,E,A,M);Aa(m,n,C,w,p,F,U,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){y.r=Ia(O.normalWorld.x);y.g=Ia(O.normalWorld.y);y.b=Ia(O.normalWorld.z);y.updateStyleString();Y.wireframe?Ea(y.__styleString,Y.wireframe_linewidth):Fa(y.__styleString)}}}function Ea(L,ea){if(x!=L)o.strokeStyle=x=L;if(G!=ea)o.lineWidth=G=ea;o.stroke();I.inflate(ea*2)}function Fa(L){if(B!=L)o.fillStyle=B=L;o.fill()}function Aa(L,ea,$,O,Y,ga,ma,na,oa,ta,pa,ua,Ba){var ya,va;ya=ma.width-1;va=ma.height-1;na*= ya;oa*=va;ta*=ya;pa*=va;ua*=ya;Ba*=va;$-=L;O-=ea;Y-=L;ga-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);ya=(Ba*$-pa*Y)*va;pa=(Ba*O-pa*ga)*va;$=(ta*Y-ua*$)*va;O=(ta*ga-ua*O)*va;L=L-ya*na-$*oa;ea=ea-pa*na-O*oa;o.save();o.transform(ya,pa,$,O,L,ea);o.clip();o.drawImage(ma,0,0);o.restore()}function Ma(L,ea,$,O){var Y=~~(L.r*255),ga=~~(L.g*255);L=~~(L.b*255);var ma=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~($.r*255),ta=~~($.g*255);$=~~($.b*255);var pa=~~(O.r*255),ua=~~(O.g*255);O=~~(O.b* 255);fa[0]=Y<0?0:Y>255?255:Y;fa[1]=ga<0?0:ga>255?255:ga;fa[2]=L<0?0:L>255?255:L;fa[4]=ma<0?0:ma>255?255:ma;fa[5]=na<0?0:na>255?255:na;fa[6]=ea<0?0:ea>255?255:ea;fa[8]=oa<0?0:oa>255?255:oa;fa[9]=ta<0?0:ta>255?255:ta;fa[10]=$<0?0:$>255?255:$;fa[12]=pa<0?0:pa>255?255:pa;fa[13]=ua<0?0:ua>255?255:ua;fa[14]=O<0?0:O>255?255:O;da.putImageData(ia,0,0);sa.drawImage(P,0,0);return qa}function Ha(L,ea,$){L=(L-ea)/($-ea);return L*L*(3-2*L)}function Ia(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Ja(L,ea){var $= ea.x-L.x,O=ea.y-L.y,Y=1/Math.sqrt($*$+O*O);$*=Y;O*=Y;ea.x+=$;ea.y+=O;L.x-=$;L.y-=O}var Ga,Na,ja,ra,za,Ka,Oa,Ca;this.autoClear?this.clear():o.setTransform(1,0,0,-1,j,h);d=e.projectScene(la,xa,this.sortElements);(Q=la.lights.length>0)&&Pa(la);Ga=0;for(Na=d.length;Ga0){Z.r+=S.color.r*ba;Z.g+=S.color.g*ba;Z.b+=S.color.b*ba}}else if(S instanceof THREE.PointLight){F.sub(S.position,R.centroidWorld);F.normalize();ba=R.normalWorld.dot(F)*S.intensity;if(ba>0){Z.r+=S.color.r*ba;Z.g+=S.color.g*ba;Z.b+=S.color.b*ba}}}}function c(T,R,Z,ca,W,S){A=e(M++);A.setAttribute("d", "M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(W instanceof THREE.MeshBasicMaterial)f.__styleString=W.color.__styleString;else if(W instanceof THREE.MeshLambertMaterial)if(k){m.r=n.r;m.g=n.g;m.b=n.b;a(S,ca,m);f.r=W.color.r*m.r;f.g=W.color.g*m.g;f.b=W.color.b*m.b;f.updateStyleString()}else f.__styleString=W.color.__styleString;else if(W instanceof THREE.MeshDepthMaterial){p=1-W.__2near/(W.__farPlusNear- ca.z*W.__farMinusNear);f.setRGB(p,p,p)}else W instanceof THREE.MeshNormalMaterial&&f.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));W.wireframe?A.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+W.wireframe_linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframe_linecap+"; stroke-linejoin: "+W.wireframe_linejoin):A.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+W.opacity);j.appendChild(A)}function d(T,R,Z,ca,W, S,ba){A=e(M++);A.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)f.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(k){m.r=n.r;m.g=n.g;m.b=n.b;a(ba,W,m);f.r=S.color.r*m.r;f.g=S.color.g*m.g;f.b=S.color.b*m.b;f.updateStyleString()}else f.__styleString=S.color.__styleString; else if(S instanceof THREE.MeshDepthMaterial){p=1-S.__2near/(S.__farPlusNear-W.z*S.__farMinusNear);f.setRGB(p,p,p)}else S instanceof THREE.MeshNormalMaterial&&f.setRGB(g(W.normalWorld.x),g(W.normalWorld.y),g(W.normalWorld.z));S.wireframe?A.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):A.setAttribute("style","fill: "+f.__styleString+ "; fill-opacity: "+S.opacity);j.appendChild(A)}function e(T){if(y[T]==null){y[T]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&y[T].setAttribute("shape-rendering","crispEdges");return y[T]}return y[T]}function g(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var b=null,l=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,o,v,z,u,q,x,B,G=new THREE.Rectangle,t=new THREE.Rectangle,k=false,f=new THREE.Color(16777215),m=new THREE.Color(16777215), n=new THREE.Color(0),C=new THREE.Color(0),w=new THREE.Color(0),p,F=new THREE.Vector3,y=[],J=[],E=[],A,M,aa,N,U=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":U=1;break;case "low":U=0}};this.setSize=function(T,R){h=T;o=R;v=h/2;z=o/2;j.setAttribute("viewBox",-v+" "+-z+" "+h+" "+o);j.setAttribute("width",h);j.setAttribute("height",o);G.set(-v,-z,v,z)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])}; this.render=function(T,R){var Z,ca,W,S,ba,X,I,Q;this.autoClear&&this.clear();b=l.projectScene(T,R,this.sortElements);N=aa=M=0;if(k=T.lights.length>0){I=T.lights;n.setRGB(0,0,0);C.setRGB(0,0,0);w.setRGB(0,0,0);Z=0;for(ca=I.length;Z0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,ha,m)}if(w&&S>0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER, ka,m)}if(C){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,K,m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,P,m)}};this.setLineBuffers=function(k,f,m,n){var C,w,p=k.vertices,F=p.length,y=k.__vertexArray,J=k.__lineArray;if(m)for(m=0;m0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.map?"#define USE_MAP": "",w.env_map?"#define USE_ENVMAP":"",w.light_map?"#define USE_LIGHTMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(m,d("fragment",C+y));b.attachShader(m,d("vertex",w+f));b.linkProgram(m);b.getProgramParameter(m,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+ b.getProgramParameter(m,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");m.uniforms={};m.attributes={};k.program=m;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(n in k.uniforms)m.push(n);n=k.program;y=0;for(f=m.length;y=0){b.bindBuffer(b.ARRAY_BUFFER,C.__webGLNormalBuffer); b.vertexAttribPointer(p.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.normal)}if(p.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,C.__webGLTangentBuffer);b.vertexAttribPointer(p.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(C.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,C.__webGLUVBuffer);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv)}else b.disableVertexAttribArray(p.uv);if(p.uv2>=0)if(C.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER, C.__webGLUV2Buffer);b.vertexAttribPointer(p.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv2)}else b.disableVertexAttribArray(p.uv2);if(n.wireframe||n instanceof THREE.LineBasicMaterial){p=n.wireframe_linewidth!==undefined?n.wireframe_linewidth:n.linewidth!==undefined?n.linewidth:1;n=n instanceof THREE.LineBasicMaterial&&w.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(p);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);b.drawElements(n,C.__webGLLineCount,b.UNSIGNED_SHORT, 0)}else if(n instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,C.__webGLParticleBuffer);b.drawElements(b.POINTS,C.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,C.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(k,f,m,n,C,w,p){var F,y,J,E,A;J=0;for(E=n.materials.length;J=0;m--){n=k.__webGLObjects[m].object;f==n&&k.__webGLObjects.splice(m,1)}};this.setupMatrices=function(k,f){k.autoUpdateMatrix&&k.updateMatrix();h.multiply(f.matrix,k.matrix);z.set(h.flatten());o=THREE.Matrix4.makeInvert3x3(h).transpose();q.set(o.m);x.set(k.matrix.flatten())};this.loadMatrices=function(k){b.uniformMatrix4fv(k.uniforms.viewMatrix,false,v);b.uniformMatrix4fv(k.uniforms.modelViewMatrix, false,z);b.uniformMatrix4fv(k.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(k.uniforms.normalMatrix,false,q);b.uniformMatrix4fv(k.uniforms.objectMatrix,false,x)};this.loadCamera=function(k,f){b.uniform3f(k.uniforms.cameraPosition,f.position.x,f.position.y,f.position.z)};this.setBlending=function(k){switch(k){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD); b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(k,f){if(k){!f||f=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(k=="back")b.cullFace(b.BACK);else k=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={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, 1.0 ), fogFactor );\n#endif", envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\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\nmapColor = texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", lightmap_fragment:"#ifdef USE_LIGHTMAP\nlightmapColor = texture2D( light_map, 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 ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ 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 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\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 vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\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( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\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;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"}; THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i", value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}}; THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}", vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}, lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment, "gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex, "vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:"uniform float size;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"}}; THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]}; THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,g=d?c.geometry:c,b=a.vertices,l=g.vertices,j=a.faces,h=g.faces,o=a.uvs;g=g.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var v=0,z=l.length;v= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"}, cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t", value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\n#define KERNEL_SIZE 25.0\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\n#define KERNEL_SIZE 25\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25)b=25;g=(b-1)*0.5;d=Array(b);for(c=e=0;c0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,j,u)))-1);o.push(v)}c.push(o)}var q,x,B;g=c.length;for(d=0;d0)for(e=0;e1){q=this.vertices[l].position.clone(); x=this.vertices[h].position.clone();B=this.vertices[o].position.clone();q.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(l,h,o,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([v,z,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,c,d,e){this.radius=a||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= 1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,l=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,g,b,l));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[b][0],a[b][1]),new THREE.UV(a[l][0],a[l][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; var Icosahedron=function(a){function c(z,u,q){var x=Math.sqrt(z*z+u*u+q*q);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(z/x,u/x,q/x)))-1}function d(z,u,q,x){x.faces.push(new THREE.Face3(z,u,q))}function e(z,u){var q=g.vertices[z].position,x=g.vertices[u].position;return c((q.x+x.x)/2,(q.y+x.y)/2,(q.z+x.z)/2)}var g=this,b=new THREE.Geometry,l;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);d(0,11,5,b);d(0,5,1,b);d(0,1,7,b);d(0,7,10,b);d(0,10,11,b);d(1,5,9,b);d(5,11,4,b);d(11,10,2,b);d(10,7,6,b);d(7,1,8,b);d(3,9,4,b);d(3,4,2,b);d(3,2,6,b);d(3,6,8,b);d(3,8,9,b);d(4,9,5,b);d(2,4,11,b);d(6,2,10,b);d(8,6,7,b);d(9,8,1,b);for(a=0;a>7)-127;K=(da&127)<<16|P<<8|K;if(K==0&&fa==-127)return 0;return(1-2*(ia>>7))*(1+K*Math.pow(2,-23))*Math.pow(2,fa)}function j(D,H){var K=v(D,H),P=v(D,H+1),da=v(D,H+2);return(v(D,H+3)<<24)+(da<<16)+(P<<8)+K}function h(D,H){var K=v(D,H);return(v(D,H+1)<<8)+K}function o(D,H){var K=v(D,H);return K>127?K-256:K}function v(D,H){return D.charCodeAt(H)&255}function z(D){var H, K,P;H=j(a,D);K=j(a,D+C);P=j(a,D+w);D=h(a,D+p);THREE.Loader.prototype.f3(t,H,K,P,D)}function u(D){var H,K,P,da,ia,fa;H=j(a,D);K=j(a,D+C);P=j(a,D+w);da=h(a,D+p);ia=j(a,D+F);fa=j(a,D+y);D=j(a,D+J);THREE.Loader.prototype.f3n(t,m,H,K,P,da,ia,fa,D)}function q(D){var H,K,P,da;H=j(a,D);K=j(a,D+E);P=j(a,D+A);da=j(a,D+M);D=h(a,D+aa);THREE.Loader.prototype.f4(t,H,K,P,da,D)}function x(D){var H,K,P,da,ia,fa,qa,sa;H=j(a,D);K=j(a,D+E);P=j(a,D+A);da=j(a,D+M);ia=h(a,D+aa);fa=j(a,D+N);qa=j(a,D+U);sa=j(a,D+T);D=j(a, D+R);THREE.Loader.prototype.f4n(t,m,H,K,P,da,ia,fa,qa,sa,D)}function B(D){var H,K;H=j(a,D);K=j(a,D+Z);D=j(a,D+ca);THREE.Loader.prototype.uv3(t.uvs,n[H*2],n[H*2+1],n[K*2],n[K*2+1],n[D*2],n[D*2+1])}function G(D){var H,K,P;H=j(a,D);K=j(a,D+W);P=j(a,D+S);D=j(a,D+ba);THREE.Loader.prototype.uv4(t.uvs,n[H*2],n[H*2+1],n[K*2],n[K*2+1],n[P*2],n[P*2+1],n[D*2],n[D*2+1])}var t=this,k=0,f,m=[],n=[],C,w,p,F,y,J,E,A,M,aa,N,U,T,R,Z,ca,W,S,ba,X,I,Q,V,ha,ka;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(t, e,b);f={signature:a.substr(k,8),header_bytes:v(a,k+8),vertex_coordinate_bytes:v(a,k+9),normal_coordinate_bytes:v(a,k+10),uv_coordinate_bytes:v(a,k+11),vertex_index_bytes:v(a,k+12),normal_index_bytes:v(a,k+13),uv_index_bytes:v(a,k+14),material_index_bytes:v(a,k+15),nvertices:j(a,k+16),nnormals:j(a,k+16+4),nuvs:j(a,k+16+8),ntri_flat:j(a,k+16+12),ntri_smooth:j(a,k+16+16),ntri_flat_uv:j(a,k+16+20),ntri_smooth_uv:j(a,k+16+24),nquad_flat:j(a,k+16+28),nquad_smooth:j(a,k+16+32),nquad_flat_uv:j(a,k+16+36), nquad_smooth_uv:j(a,k+16+40)};k+=f.header_bytes;C=f.vertex_index_bytes;w=f.vertex_index_bytes*2;p=f.vertex_index_bytes*3;F=f.vertex_index_bytes*3+f.material_index_bytes;y=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes;J=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes*2;E=f.vertex_index_bytes;A=f.vertex_index_bytes*2;M=f.vertex_index_bytes*3;aa=f.vertex_index_bytes*4;N=f.vertex_index_bytes*4+f.material_index_bytes;U=f.vertex_index_bytes*4+f.material_index_bytes+ f.normal_index_bytes;T=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*2;R=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*3;Z=f.uv_index_bytes;ca=f.uv_index_bytes*2;W=f.uv_index_bytes;S=f.uv_index_bytes*2;ba=f.uv_index_bytes*3;b=f.vertex_index_bytes*3+f.material_index_bytes;ka=f.vertex_index_bytes*4+f.material_index_bytes;X=f.ntri_flat*b;I=f.ntri_smooth*(b+f.normal_index_bytes*3);Q=f.ntri_flat_uv*(b+f.uv_index_bytes*3);V=f.ntri_smooth_uv*(b+f.normal_index_bytes* 3+f.uv_index_bytes*3);ha=f.nquad_flat*ka;b=f.nquad_smooth*(ka+f.normal_index_bytes*4);ka=f.nquad_flat_uv*(ka+f.uv_index_bytes*4);k+=function(D){var H,K,P,da=f.vertex_coordinate_bytes*3,ia=D+f.nvertices*da;for(D=D;D