123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- // ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
- THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},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 g,f,h,i,m,o;if(d==0)g=f=h=0;else{i=Math.floor(a*6);m=a*6-i;a=d*(1-c);o=d*(1-c*m);c=d*(1-c*(1-m));switch(i){case 1:g=o;f=d;h=a;break;case 2:g=a;f=d;h=c;break;case 3:g=a;f=o;h=d;break;case 4:g=c;f=a;h=d;break;case 5:g=d;f=a;
- h=o;break;case 6:case 0:g=d;f=c;h=a}}this.r=g;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},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},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
- 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
- THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
- this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,d){this.set(a||0,c||0,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.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
- c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.set(d*a.z-g*a.y,g*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
- a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(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.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
- this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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)}};THREE.Vector4=function(a,c,d,g){this.set(a||0,c||0,d||0,g||1)};
- THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
- a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(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)}};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,g=a.objects,f=[];a=0;for(c=g.length;a<c;a++){d=g[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,i){return h.distance-i.distance});return f},intersectObject:function(a){function c(Q,K,ia,la){la=la.clone().subSelf(K);ia=ia.clone().subSelf(K);var wa=Q.clone().subSelf(K);Q=la.dot(la);K=la.dot(ia);la=la.dot(wa);var S=ia.dot(ia);ia=ia.dot(wa);wa=1/(Q*S-K*K);S=(S*la-K*ia)*wa;Q=(Q*ia-K*la)*wa;return S>0&&Q>0&&S+Q<
- 1}var d,g,f,h,i,m,o,t,x,y,B,z=a.geometry,H=z.vertices,J=[];d=0;for(g=z.faces.length;d<g;d++){f=z.faces[d];y=this.origin.clone();B=this.direction.clone();o=a.matrixWorld;h=o.multiplyVector3(H[f.a].position.clone());i=o.multiplyVector3(H[f.b].position.clone());m=o.multiplyVector3(H[f.c].position.clone());o=f instanceof THREE.Face4?o.multiplyVector3(H[f.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(f.normal.clone());x=B.dot(t);if(x<0){t=t.dot((new THREE.Vector3).sub(h,y))/x;y=y.addSelf(B.multiplyScalar(t));
- if(f instanceof THREE.Face3){if(c(y,h,i,m)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}else if(f instanceof THREE.Face4&&(c(y,h,i,o)||c(y,i,m,o))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}}return J}};
- THREE.Rectangle=function(){function a(){h=g-c;i=f-d}var c,d,g,f,h,i,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return f};this.set=function(o,t,x,y){m=!1;c=o;d=t;g=x;f=y;a()};this.addPoint=function(o,t){if(m){m=!1;c=o;d=t;g=o;f=t}else{c=c<o?c:o;d=d<t?d:t;g=g>o?g:o;f=f>t?f:t}a()};
- this.add3Points=function(o,t,x,y,B,z){if(m){m=!1;c=o<x?o<B?o:B:x<B?x:B;d=t<y?t<z?t:z:y<z?y:z;g=o>x?o>B?o:B:x>B?x:B;f=t>y?t>z?t:z:y>z?y:z}else{c=o<x?o<B?o<c?o:c:B<c?B:c:x<B?x<c?x:c:B<c?B:c;d=t<y?t<z?t<d?t:d:z<d?z:d:y<z?y<d?y:d:z<d?z:d;g=o>x?o>B?o>g?o:g:B>g?B:g:x>B?x>g?x:g:B>g?B:g;f=t>y?t>z?t>f?t:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(o){if(m){m=!1;c=o.getLeft();d=o.getTop();g=o.getRight();f=o.getBottom()}else{c=c<o.getLeft()?c:o.getLeft();d=d<o.getTop()?d:o.getTop();g=g>o.getRight()?
- g:o.getRight();f=f>o.getBottom()?f:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;g+=o;f+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();g=g<o.getRight()?g:o.getRight();f=f<o.getBottom()?f:o.getBottom();a()};this.instersects=function(o){return Math.min(g,o.getRight())-Math.max(c,o.getLeft())>=0&&Math.min(f,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){m=!0;f=g=d=c=0;a()};this.isEmpty=function(){return m}};
- 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},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
- THREE.Matrix4=function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.set(a||1,c||0,d||0,g||0,f||0,h||1,i||0,m||0,o||0,t||0,x||1,y||0,B||0,z||0,H||0,J||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={set:function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=h;this.n23=i;this.n24=m;this.n31=o;this.n32=t;this.n33=x;this.n34=y;this.n41=B;this.n42=z;this.n43=H;this.n44=J;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__v1,
- f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;g.cross(d,h).normalize();if(g.length()===0){h.x+=1.0E-4;g.cross(d,h).normalize()}f.cross(h,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=h.x;this.n21=g.y;this.n22=f.y;this.n23=h.y;this.n31=g.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,f=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*
- g+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*f;return a},rotateAxis:function(a){var c=a.x,d=a.y,g=a.z;a.x=c*this.n11+d*this.n12+g*this.n13;a.y=c*this.n21+d*this.n22+g*this.n23;a.z=c*this.n31+d*this.n32+g*this.n33;a.normalize();
- 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,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44,ia=c.n11,la=c.n12,wa=c.n13,S=c.n14,E=c.n21,fa=c.n22,
- Y=c.n23,b=c.n24,ra=c.n31,R=c.n32,N=c.n33,pa=c.n34;this.n11=d*ia+g*E+f*ra;this.n12=d*la+g*fa+f*R;this.n13=d*wa+g*Y+f*N;this.n14=d*S+g*b+f*pa+h;this.n21=i*ia+m*E+o*ra;this.n22=i*la+m*fa+o*R;this.n23=i*wa+m*Y+o*N;this.n24=i*S+m*b+o*pa+t;this.n31=x*ia+y*E+B*ra;this.n32=x*la+y*fa+B*R;this.n33=x*wa+y*Y+B*N;this.n34=x*S+y*b+B*pa+z;this.n41=H*ia+J*E+Q*ra;this.n42=H*la+J*fa+Q*R;this.n43=H*wa+J*Y+Q*N;this.n44=H*S+J*b+Q*pa+K;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=
- this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,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,g=this.n14,f=this.n21,h=this.n22,i=this.n23,m=this.n24,o=this.n31,t=this.n32,x=this.n33,y=this.n34,B=this.n41,z=this.n42,H=this.n43,J=this.n44;return g*i*t*B-d*m*t*B-g*h*x*B+c*m*x*B+d*h*y*B-c*i*y*B-g*i*o*z+d*m*o*z+g*f*x*z-a*m*x*z-d*f*y*z+a*i*y*z+g*h*o*H-c*m*o*H-g*f*t*H+a*m*t*H+c*f*y*H-a*h*y*H-d*h*o*J+c*i*o*J+d*f*t*J-a*i*t*J-c*f*x*J+a*h*x*J},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
- this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;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(){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(a){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},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+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},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f=
- 1-d,h=a.x,i=a.y,m=a.z,o=f*h,t=f*i;this.set(o*h+d,o*i-g*m,o*m+g*i,0,o*i+g*m,t*i+d,t*m-g*h,0,o*m-g*i,t*m+g*h,f*m*m+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,g=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(g);g=Math.sin(g);var i=a*d,m=c*d;this.n11=f*h;this.n12=-f*g;this.n13=d;this.n21=m*h+a*g;this.n22=-m*g+a*h;this.n23=-c*f;this.n31=-i*h+c*g;this.n32=i*g+c*h;this.n33=
- a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,h=c+c,i=d+d,m=g+g;a=c*h;var o=c*i;c*=m;var t=d*i;d*=m;g*=m;h*=f;i*=f;f*=m;this.n11=1-(t+g);this.n12=o-f;this.n13=c+i;this.n21=o+f;this.n22=1-(a+g);this.n23=d-h;this.n31=c-i;this.n32=d+h;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
- a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,g=1/c.y,f=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*g;this.n22=a.n22*g;this.n32=a.n32*g;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
- THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=o*z*J-t*B*J+t*y*Q-m*z*Q-o*y*K+m*B*K;c.n12=h*B*J-f*z*J-h*y*Q+g*z*Q+f*y*K-g*B*K;c.n13=f*t*J-h*o*J+h*m*Q-g*t*Q-f*m*K+g*o*K;c.n14=h*o*y-f*t*y-h*m*B+g*t*B+f*m*z-g*o*z;c.n21=t*B*H-o*z*H-t*x*Q+i*z*Q+o*x*K-i*B*K;c.n22=f*z*H-h*B*H+h*x*Q-d*z*Q-f*x*K+d*B*K;c.n23=h*o*H-f*t*H-h*i*Q+d*t*Q+f*i*K-d*o*K;
- c.n24=f*t*x-h*o*x+h*i*B-d*t*B-f*i*z+d*o*z;c.n31=m*z*H-t*y*H+t*x*J-i*z*J-m*x*K+i*y*K;c.n32=h*y*H-g*z*H-h*x*J+d*z*J+g*x*K-d*y*K;c.n33=f*t*H-h*m*H+h*i*J-d*t*J-g*i*K+d*m*K;c.n34=h*m*x-g*t*x-h*i*y+d*t*y+g*i*z-d*m*z;c.n41=o*y*H-m*B*H-o*x*J+i*B*J+m*x*Q-i*y*Q;c.n42=g*B*H-f*y*H+f*x*J-d*B*J-g*x*Q+d*y*Q;c.n43=f*m*H-g*o*H-f*i*J+d*o*J+g*i*Q-d*m*Q;c.n44=g*o*x-f*m*x+f*i*y-d*o*y-g*i*B+d*m*B;c.multiplyScalar(1/a.determinant());return c};
- THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,g=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*i+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*h;d[3]=a*i;d[4]=a*m;d[5]=a*o;d[6]=a*t;d[7]=a*x;d[8]=a*y;return c};
- THREE.Matrix4.makeFrustum=function(a,c,d,g,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(c-a);i.n12=0;i.n13=(c+a)/(c-a);i.n14=0;i.n21=0;i.n22=2*f/(g-d);i.n23=(g+d)/(g-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,c,d,g){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,g)};
- THREE.Matrix4.makeOrtho=function(a,c,d,g,f,h){var i,m,o,t;i=new THREE.Matrix4;m=c-a;o=d-g;t=h-f;i.n11=2/m;i.n12=0;i.n13=0;i.n14=-((c+a)/m);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((d+g)/o);i.n31=0;i.n32=0;i.n33=-2/t;i.n34=-((h+f)/t);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
- THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
- !0;this._vector=new THREE.Vector3};
- THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
- undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
- 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var g=this.children.length;a<g;a++)this.children[a].update(this.matrixWorld,
- c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?g:1)};
- THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,m=g*f;this.w=i*h-m*d;this.x=i*d+m*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
- -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,m=a.z;a=a.w;this.x=c*a+f*h+d*m-g*i;this.y=d*a+f*i+g*h-c*m;this.z=g*a+f*m+c*i-d*h;this.w=f*a-c*h-d*i-g*m;return this},
- multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,m=this.z,o=this.w,t=o*d+i*f-m*g,x=o*g+m*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-m*f;c.x=t*o+d*-h+x*-m-y*-i;c.y=x*o+d*-i+y*-h-t*-m;c.z=y*o+d*-m+t*-i-x*-h;return c}};
- THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
- THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
- THREE.Face4=function(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;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.UV=function(a,c){this.set(a||0,c||0)};
- THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
- THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
- d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,g,f,h,i,m=new THREE.Vector3,o=new THREE.Vector3;g=0;for(f=this.faces.length;g<f;g++){h=this.faces[g];if(a&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];m.sub(i.position,d.position);o.sub(c.position,d.position);m.crossSelf(o)}m.isZero()||
- m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var a,c,d,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)g[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{g=
- this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)g[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal);g[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)g[a].normalize();a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(g[d.a]);
- d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(g[d.a]);d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c]);d.vertexNormals[3].copy(g[d.d])}}},computeTangents:function(){function a(T,ga,ha,ja,O,ma,ka){m=T.vertices[ga].position;o=T.vertices[ha].position;t=T.vertices[ja].position;x=i[O];y=i[ma];B=i[ka];z=o.x-m.x;H=t.x-m.x;J=o.y-m.y;Q=t.y-m.y;K=o.z-m.z;ia=t.z-m.z;la=y.u-x.u;wa=B.u-x.u;S=y.v-x.v;E=B.v-x.v;fa=1/(la*E-
- wa*S);R.set((E*z-S*H)*fa,(E*J-S*Q)*fa,(E*K-S*ia)*fa);N.set((la*H-wa*z)*fa,(la*Q-wa*J)*fa,(la*ia-wa*K)*fa);b[ga].addSelf(R);b[ha].addSelf(R);b[ja].addSelf(R);ra[ga].addSelf(N);ra[ha].addSelf(N);ra[ja].addSelf(N)}var c,d,g,f,h,i,m,o,t,x,y,B,z,H,J,Q,K,ia,la,wa,S,E,fa,Y,b=[],ra=[],R=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,Aa=new THREE.Vector3,Ba=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;ra[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
- this.faces[c];i=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var sa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(g=0;g<h.vertexNormals.length;g++){Ba.copy(h.vertexNormals[g]);f=h[sa[g]];Y=b[f];pa.copy(Y);pa.subSelf(Ba.multiplyScalar(Ba.dot(Y))).normalize();Aa.cross(h.vertexNormals[g],Y);f=Aa.dot(ra[f]);f=f<0?-1:1;h.vertexTangents[g]=new THREE.Vector4(pa.x,
- pa.y,pa.z,f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){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;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
- if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else 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;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
- {radius:a}}};THREE.GeometryIdCounter=0;
- THREE.AnimationHandler=function(){var a=[],c={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var i=0;i<f.hierarchy[h].keys.length;i++){if(f.hierarchy[h].keys[i].time<
- 0)f.hierarchy[h].keys[i].time=0;if(f.hierarchy[h].keys[i].rot!==undefined&&!(f.hierarchy[h].keys[i].rot instanceof THREE.Quaternion)){var m=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){m={};for(i=0;i<f.hierarchy[h].keys.length;i++)for(var o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++){var t=f.hierarchy[h].keys[i].morphTargets[o];m[t]=-1}f.hierarchy[h].usedMorphTargets=m;for(i=0;i<f.hierarchy[h].keys.length;i++){var x=
- {};for(t in m){for(o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++)if(f.hierarchy[h].keys[i].morphTargets[o]===t){x[t]=f.hierarchy[h].keys[i].morphTargetsInfluences[o];break}o===f.hierarchy[h].keys[i].morphTargets.length&&(x[t]=0)}f.hierarchy[h].keys[i].morphTargetsInfluences=x}}for(i=1;i<f.hierarchy[h].keys.length;i++)if(f.hierarchy[h].keys[i].time===f.hierarchy[h].keys[i-1].time){f.hierarchy[h].keys.splice(i,1);i--}for(i=1;i<f.hierarchy[h].keys.length;i++)f.hierarchy[h].keys[i].index=i}i=parseInt(f.length*
- f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(i));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var i=0;i<f.bones.length;i++)h.push(f.bones[i]);else g(f,h);return h};var g=function(f,h){h.push(f);for(var i=0;i<f.children.length;i++)g(f.children[i],h)};d.LINEAR=
- 0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,c,d,g){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==undefined?g:!0;this.points=[];this.target=new THREE.Vector3};
- THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var d,g=this.hierarchy.length,f;for(d=0;d<g;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
- f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
- THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
- THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
- THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],d,g,f,h,i,m,o,t,x=this.data.JIT.hierarchy,y,B;this.currentTime+=a*this.timeScale;B=this.currentTime;y=this.currentTime%=this.data.length;t=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,H=this.hierarchy.length;z<H;z++){a=this.hierarchy[z];o=a.animationCache;if(this.JITCompile&&x[z][t]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
- !1}else{a.matrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var J=0;J<3;J++){d=c[J];i=o.prevKey[d];m=o.nextKey[d];if(m.time<=B){if(y<B)if(this.loop){i=this.data.hierarchy[z].keys[0];for(m=this.getNextKeyWith(d,z,1);m.time<y;){i=m;m=this.getNextKeyWith(d,z,m.index+1)}}else{this.stop();return}else{do{i=m;m=this.getNextKeyWith(d,z,m.index+1)}while(m.time<
- y)}o.prevKey[d]=i;o.nextKey[d]=m}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-i.time)/(m.time-i.time);f=i[d];h=m[d];if(g<0||g>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+z);g=g<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
- this.getPrevKeyWith("pos",z,i.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",z,m.index+1).pos;g=g*0.33+0.33;f=this.interpolateCatmullRom(this.points,g);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){g=this.interpolateCatmullRom(this.points,g*1.01);this.target.set(g[0],g[1],g[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();g=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,g,0)}}}else if(d===
- "rot")THREE.Quaternion.slerp(f,h,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}}}}if(this.JITCompile&&x[0][t]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)x[z][t]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var d=[],g=[],f,h,i,m,o,t;f=(a.length-1)*c;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];m=a[d[1]];o=a[d[2]];t=a[d[3]];d=f*f;i=f*d;g[0]=this.interpolate(h[0],m[0],o[0],t[0],f,d,i);g[1]=this.interpolate(h[1],m[1],o[1],t[1],f,d,i);g[2]=this.interpolate(h[2],m[2],o[2],t[2],f,d,i);return g};
- THREE.Animation.prototype.interpolate=function(a,c,d,g,f,h,i){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*i+(-3*(c-d)-2*a-g)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<g.length-1?d:g.length-1;else d%=g.length;for(;d<g.length;d++)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[0]};
- THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
- THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
- THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
- THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
- !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;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.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
- THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
- THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
- a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
- if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
- if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
- if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
- !1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
- if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
- if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
- this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;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.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=
- a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;
- if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;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;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;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;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=!1;this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==
- undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;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.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
- if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
- a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
- THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
- !1};THREE.Texture=function(a,c,d,g,f,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=g!==undefined?g:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
- 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.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter: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,g,f={};for(c in a){f[c]={};for(d in a[c]){g=a[c][d];f[c][d]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return f},merge:function(a){var c,d,g,f={};for(c=0;c<a.length;c++){g=this.clone(a[c]);for(d in g)f[d]=g[d]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};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];this.sortParticles=!1};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&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
- this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(g=0;g<f;g++)this.children[g].update(this.skinMatrix,
- c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
- THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,g,f,h,i,m;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;i=f.rotq;m=f.scl;g=this.addBone();g.name=f.name;g.position.set(h[0],h[1],h[2]);g.quaternion.set(i[0],i[1],i[2],i[3]);g.useQuaternion=!0;m!==undefined?g.scale.set(m[0],m[1],m[2]):g.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
- g=this.bones[d];f.parent===-1?this.addChild(g):this.bones[f.parent].addChild(g)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,c,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
- c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],d=0;d<this.bones.length;d++){a=this.bones[d];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var g;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
- g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(g));g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(g));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
- THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
- THREE.Sound=function(a,c,d,g){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=g!==undefined?g:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
- "audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
- THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
- THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
- THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g=this.children.length;for(a=0;a<g;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
- THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
- THREE.LOD.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g<this.LODs.length;g++)if(a>=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible=
- !1;this.LODs[g].object3D.visible=!0}else break;for(;g<this.LODs.length;g++)this.LODs[g].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
- THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
- THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,g=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var h=f.length,i,m,o,t,x,y=["a","b","c","d"];for(o=0;o<h;o++){m=c.length;i=f[o];if(i instanceof THREE.Face4){t=4;m=new THREE.Face4(m,m+1,m+2,m+3)}else{t=3;m=new THREE.Face3(m,m+1,m+2)}m.normal.copy(i.normal);d.push(m);for(m=
- 0;m<t;m++){x=a[i[y[m]]];c.push(new THREE.Vertex(x.position.clone()))}}for(h=0;h<f.length-1;h++){a=d[h];for(i=h+1;i<f.length;i++){m=d[i];m=this.facesShareEdge(c,a,m);if(m!==undefined){m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]);m.normal.set(1,0,0);g.push(m)}}}};
- THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,h,i,m,o,t,x,y,B,z,H,J,Q=0,K=["a","b","c","d"];g=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(H=0;H<g;H++){h=c[K[H]];m=a[h];for(J=0;J<f;J++){i=d[K[J]];o=a[i];if(Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4){Q++;if(Q===1){t=m;x=o;y=h;B=i;z=K[H]}if(Q===2){z+=K[H];return z==="ad"||z==="ac"?{faces:[c,d],vertices:[t,x,o,m],indices:[y,
- B,i,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[t,m,o,x],indices:[y,h,i,B],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
- THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
- THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
- THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
- THREE.Projector=function(){function a(){var R=o[m]=o[m]||new THREE.RenderableVertex;m++;return R}function c(R,N){return N.z-R.z}function d(R,N){var pa=0,Aa=1,Ba=R.z+R.w,sa=N.z+N.w,T=-R.z+R.w,ga=-N.z+N.w;if(Ba>=0&&sa>=0&&T>=0&&ga>=0)return!0;else if(Ba<0&&sa<0||T<0&&ga<0)return!1;else{if(Ba<0)pa=Math.max(pa,Ba/(Ba-sa));else sa<0&&(Aa=Math.min(Aa,Ba/(Ba-sa)));if(T<0)pa=Math.max(pa,T/(T-ga));else ga<0&&(Aa=Math.min(Aa,T/(T-ga)));if(Aa<pa)return!1;else{R.lerpSelf(N,pa);N.lerpSelf(R,1-Aa);return!0}}}var g,
- f,h=[],i,m,o=[],t,x,y=[],B,z=[],H,J,Q=[],K,ia,la=[],wa=new THREE.Vector4,S=new THREE.Vector4,E=new THREE.Matrix4,fa=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],b=new THREE.Vector4,ra=new THREE.Vector4;this.projectVector=function(R,N){E.multiply(N.projectionMatrix,N.matrixWorldInverse);E.multiplyVector3(R);return R};this.unprojectVector=function(R,N){E.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
- E.multiplyVector3(R);return R};this.projectObjects=function(R,N,pa){N=[];var Aa,Ba,sa;f=0;Ba=R.objects;R=0;for(Aa=Ba.length;R<Aa;R++){sa=Ba[R];var T;if(!(T=!sa.visible))if(T=sa instanceof THREE.Mesh){a:{T=void 0;for(var ga=sa.matrixWorld,ha=-sa.geometry.boundingSphere.radius*Math.max(sa.scale.x,Math.max(sa.scale.y,sa.scale.z)),ja=0;ja<6;ja++){T=Y[ja].x*ga.n14+Y[ja].y*ga.n24+Y[ja].z*ga.n34+Y[ja].w;if(T<=ha){T=!1;break a}}T=!0}T=!T}if(!T){T=h[f]=h[f]||new THREE.RenderableObject;f++;g=T;wa.copy(sa.position);
- E.multiplyVector3(wa);g.object=sa;g.z=wa.z;N.push(g)}}pa&&N.sort(c);return N};this.projectScene=function(R,N,pa){var Aa=[],Ba=N.near,sa=N.far,T,ga,ha,ja,O,ma,ka,Ca,Fa,na,Ea,Wa,Ya,xa,e,p,n;ia=J=B=x=0;N.matrixAutoUpdate&&N.updateMatrix();R.update(undefined,!1,N);E.multiply(N.projectionMatrix,N.matrixWorldInverse);Y[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);Y[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);Y[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);Y[3].set(E.n41-
- E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);Y[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);Y[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(T=0;T<6;T++){Fa=Y[T];Fa.divideScalar(Math.sqrt(Fa.x*Fa.x+Fa.y*Fa.y+Fa.z*Fa.z))}Fa=this.projectObjects(R,N,!0);R=0;for(T=Fa.length;R<T;R++){na=Fa[R].object;if(na.visible){Ea=na.matrixWorld;Wa=na.matrixRotationWorld;Ya=na.materials;xa=na.overdraw;m=0;if(na instanceof THREE.Mesh){e=na.geometry;ja=e.vertices;p=e.faces;e=e.faceVertexUvs;ga=0;
- for(ha=ja.length;ga<ha;ga++){i=a();i.positionWorld.copy(ja[ga].position);Ea.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);E.multiplyVector4(i.positionScreen);i.positionScreen.x/=i.positionScreen.w;i.positionScreen.y/=i.positionScreen.w;i.visible=i.positionScreen.z>Ba&&i.positionScreen.z<sa}ja=0;for(ga=p.length;ja<ga;ja++){ha=p[ja];if(ha instanceof THREE.Face3){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];if(O.visible&&ma.visible&&ka.visible&&(na.doubleSided||na.flipSided!=(ka.positionScreen.x-
- O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(ka.positionScreen.y-O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0)){Ca=y[x]=y[x]||new THREE.RenderableFace3;x++;t=Ca;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka)}else continue}else if(ha instanceof THREE.Face4){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];Ca=o[ha.d];if(O.visible&&ma.visible&&ka.visible&&Ca.visible&&(na.doubleSided||na.flipSided!=((Ca.positionScreen.x-O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(Ca.positionScreen.y-
- O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0||(ma.positionScreen.x-ka.positionScreen.x)*(Ca.positionScreen.y-ka.positionScreen.y)-(ma.positionScreen.y-ka.positionScreen.y)*(Ca.positionScreen.x-ka.positionScreen.x)<0))){n=z[B]=z[B]||new THREE.RenderableFace4;B++;t=n;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka);t.v4.copy(Ca)}else continue}t.normalWorld.copy(ha.normal);Wa.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);Ea.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);
- E.multiplyVector3(t.centroidScreen);ka=ha.vertexNormals;O=0;for(ma=ka.length;O<ma;O++){Ca=t.vertexNormalsWorld[O];Ca.copy(ka[O]);Wa.multiplyVector3(Ca)}O=0;for(ma=e.length;O<ma;O++)if(n=e[O][ja]){ka=0;for(Ca=n.length;ka<Ca;ka++)t.uvs[O][ka]=n[ka]}t.meshMaterials=Ya;t.faceMaterials=ha.materials;t.overdraw=xa;t.z=t.centroidScreen.z;Aa.push(t)}}else if(na instanceof THREE.Line){fa.multiply(E,Ea);ja=na.geometry.vertices;O=a();O.positionScreen.copy(ja[0].position);fa.multiplyVector4(O.positionScreen);
- ga=1;for(ha=ja.length;ga<ha;ga++){O=a();O.positionScreen.copy(ja[ga].position);fa.multiplyVector4(O.positionScreen);ma=o[m-2];b.copy(O.positionScreen);ra.copy(ma.positionScreen);if(d(b,ra)){b.multiplyScalar(1/b.w);ra.multiplyScalar(1/ra.w);Ea=Q[J]=Q[J]||new THREE.RenderableLine;J++;H=Ea;H.v1.positionScreen.copy(b);H.v2.positionScreen.copy(ra);H.z=Math.max(b.z,ra.z);H.materials=na.materials;Aa.push(H)}}}else if(na instanceof THREE.Particle){S.set(na.position.x,na.position.y,na.position.z,1);E.multiplyVector4(S);
- S.z/=S.w;if(S.z>0&&S.z<1){Ea=la[ia]=la[ia]||new THREE.RenderableParticle;ia++;K=Ea;K.x=S.x/S.w;K.y=S.y/S.w;K.z=S.z;K.rotation=na.rotation.z;K.scale.x=na.scale.x*Math.abs(K.x-(S.x+N.projectionMatrix.n11)/(S.w+N.projectionMatrix.n14));K.scale.y=na.scale.y*Math.abs(K.y-(S.y+N.projectionMatrix.n22)/(S.w+N.projectionMatrix.n24));K.materials=na.materials;Aa.push(K)}}}}pa&&Aa.sort(c);return Aa}};
- THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var g,f=d.length;for(g=0;g<f;g++){a=d[g];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
- 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",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_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\ngl_FragColor = gl_FragColor * 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 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 ];\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 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( 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\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"};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{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)},morphTargetInfluences:{type:"f",
- value:0}},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:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{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={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
- depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
- fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"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,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
- THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
- THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
- THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
- THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].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}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
- vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
- THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_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.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
- THREE.WebGLRenderer=function(a){function c(e,p,n){var j,q,s,v=e.vertices,r=v.length,k=e.colors,A=k.length,u=e.__vertexArray,G=e.__colorArray,F=e.__sortArray,L=e.__dirtyVertices,M=e.__dirtyColors;if(n.sortParticles){ma.multiplySelf(n.matrixWorld);for(j=0;j<r;j++){q=v[j].position;Fa.copy(q);ma.multiplyVector3(Fa);F[j]=[Fa.z,j]}F.sort(function(V,P){return P[0]-V[0]});for(j=0;j<r;j++){q=v[F[j][1]].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}for(j=0;j<A;j++){s=j*3;color=k[F[j][1]];G[s]=color.r;G[s+1]=
- color.g;G[s+2]=color.b}}else{if(L)for(j=0;j<r;j++){q=v[j].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}if(M)for(j=0;j<A;j++){color=k[j];s=j*3;G[s]=color.r;G[s+1]=color.g;G[s+2]=color.b}}if(L||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,u,p)}if(M||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,G,p)}}function d(e,p){e.uniforms=Uniforms.clone(p.uniforms);e.vertexShader=p.vertexShader;e.fragmentShader=
- p.fragmentShader}function g(e,p,n,j,q){j.__webglProgram||N.initMaterial(j,p,n,q);var s=j.program,v=s.uniforms,r=j.uniforms;if(s!=ra){b.useProgram(s);ra=s}b.uniformMatrix4fv(v.projectionMatrix,!1,ka);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=
- n.far}else if(n instanceof THREE.FogExp2)r.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,V,P=na,U=P.directional.colors,C=P.directional.positions,D=P.point.colors,I=P.point.positions,W=0,oa=0;n=A=A=0;for(k=p.length;n<k;n++){A=p[n];L=A.color;M=A.position;V=A.intensity;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){A=W*3;U[A]=L.r*V;U[A+1]=L.g*V;U[A+2]=
- L.b*V;C[A]=M.x;C[A+1]=M.y;C[A+2]=M.z;W+=1}else if(A instanceof THREE.PointLight){A=oa*3;D[A]=L.r*V;D[A+1]=L.g*V;D[A+2]=L.b*V;I[A]=M.x;I[A+1]=M.y;I[A+2]=M.z;oa+=1}}for(n=W*3;n<U.length;n++)U[n]=0;for(n=oa*3;n<D.length;n++)D[n]=0;P.point.length=oa;P.directional.length=W;P.ambient[0]=u;P.ambient[1]=G;P.ambient[2]=F;n=na;r.enableLighting.value=n.directional.length+n.point.length;r.ambientLightColor.value=n.ambient;r.directionalLightColor.value=n.directional.colors;r.directionalLightDirection.value=n.directional.positions;
- r.pointLightColor.value=n.point.colors;r.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r,j.color.g,j.color.b);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=j.envMap&&j.envMap.mapping instanceof
- THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Y.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);
- r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var Na in r)if(G=s.uniforms[Na]){k=r[Na];u=k.type;n=k.value;if(u=="i")b.uniform1i(G,n);else if(u=="f")b.uniform1f(G,n);else if(u=="fv1")b.uniform1fv(G,n);else if(u=="fv")b.uniform3fv(G,n);else if(u=="v2")b.uniform2f(G,n.x,
- n.y);else if(u=="v3")b.uniform3f(G,n.x,n.y,n.z);else if(u=="c")b.uniform3f(G,n.r,n.g,n.b);else if(u=="t"){b.uniform1i(G,n);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image[u])}else{k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);
- for(u=0;u<6;++u)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[u]);k.__wasSetOnce=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=b.createTexture();
- b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);b.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.envMap)&&b.uniform3f(v.cameraPosition,
- e.position.x,e.position.y,e.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&b.uniformMatrix4fv(v.viewMatrix,!1,Ca);if(j instanceof THREE.ShadowVolumeDynamicMaterial){e=r.directionalLightDirection.value;e[0]=-p.position.x;e[1]=-p.position.y;e[2]=-p.position.z;b.uniform3fv(v.directionalLightDirection,
- e);b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);b.uniformMatrix4fv(v.viewMatrix,!1,Ca)}if(j.skinning){b.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return s}function f(e,p,n,j,q,s){if(j.opacity!=0){e=g(e,p,n,j,s).attributes;if(j.morphTargets){p=j.program.attributes;s.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[s.morphTargetBase]):b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(p.position,
- 3,b.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[v[n]]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[v[n]];n++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;n=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]=!0);n<j.numSupportedMorphTargets;){for(u=0;u<G;u++)if(!v[u]&&
- r[u]>k){A=u;k=r[A]}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=k;v[A]=1;k=-1;n++}}b.uniform1fv(j.program.uniforms.morphTargetInfluences,s.__webGLMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=
- 0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,
- 2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(j.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,4,b.FLOAT,!1,0,0);
- b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(b.LINES,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?b.LINE_STRIP:
- b.LINES;b.lineWidth(j.linewidth);b.drawArrays(s,0,q.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,q.__webGLParticleCount);else s instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function h(e,p){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,
- b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.position);b.vertexAttribPointer(p.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.normal);b.vertexAttribPointer(p.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function i(e){if(pa!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);pa=
- e.doubleSided}if(Aa!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);Aa=e.flipSided}}function m(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){O[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);O[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);O[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);O[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);O[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);O[5].set(e.n41+e.n31,
- e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var p;for(e=0;e<6;e++){p=O[e];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function t(e){for(var p=e.matrixWorld,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=O[j].x*p.n14+O[j].y*p.n24+O[j].z*p.n34+O[j].w;if(e<=n)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,n,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){n=j.materials[e];
- n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?x(s,n):x(q,n)}}function B(e){var p,n,j,q,s=e.object,v=e.buffer,r=e.opaque,k=e.transparent;k.count=0;e=r.count=0;for(j=s.materials.length;e<j;e++){p=s.materials[e];if(p instanceof THREE.MeshFaceMaterial){p=0;for(n=v.materials.length;p<n;p++)(q=v.materials[p])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q))}else{q=p;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q)}}}function z(e,p){return p.z-e.z}
- function H(e,p){e._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function J(e){var p,n,j;if(e instanceof THREE.Mesh){n=e.geometry;for(p in n.geometryGroups){j=n.geometryGroups[p];if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){var q=b.DYNAMIC_DRAW,s=void 0,v=void 0,r=void 0,k=void 0;
- r=void 0;var A=void 0,u=void 0,G=void 0,F=void 0,L=void 0,M=void 0,V=void 0,P=void 0,U=void 0,C=void 0,D=void 0,I=void 0,W=void 0;u=void 0;G=void 0;k=void 0;F=void 0;k=void 0;C=void 0;D=void 0;u=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;k=void 0;F=void 0;A=void 0;r=void 0;r=void 0;var oa=void 0,Na=void 0,ta=void 0,Z=0,ua=0,Qa=0,Ra=0,Ga=0,Ha=0,X=0,Ia=0,qa=0,w=0,va=0,ya=j.__vertexArray,Za=j.__uvArray,
- $a=j.__uv2Array,La=j.__normalArray,$=j.__tangentArray,za=j.__colorArray,aa=j.__skinVertexAArray,ca=j.__skinVertexBArray,da=j.__skinIndexArray,ea=j.__skinWeightArray,ab=j.__morphTargetsArrays,Ja=j.__faceArray,Ka=j.__lineArray,hb=j.__needsSmoothNormals;M=j.__vertexColorType;L=j.__uvType;V=j.__normalType;var Da=e.geometry,bb=Da.__dirtyVertices,cb=Da.__dirtyElements,Xa=Da.__dirtyUvs,db=Da.__dirtyNormals,eb=Da.__dirtyTangents,fb=Da.__dirtyColors,gb=Da.__dirtyMorphTargets,Sa=Da.vertices,ib=j.faces,lb=Da.faces,
- jb=Da.faceVertexUvs[0],kb=Da.faceVertexUvs[1],Ta=Da.skinVerticesA,Ua=Da.skinVerticesB,Va=Da.skinIndices,Oa=Da.skinWeights,Pa=Da.edgeFaces,Ma=Da.morphTargets;s=0;for(v=ib.length;s<v;s++){r=ib[s];k=lb[r];jb&&(P=jb[r]);kb&&(U=kb[r]);r=k.vertexNormals;A=k.normal;u=k.vertexColors;G=k.color;F=k.vertexTangents;if(k instanceof THREE.Face3){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+6]=I.x;ya[ua+7]=I.y;ya[ua+
- 8]=I.z;ua+=9}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z}va+=9}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];ea[w]=C.x;ea[w+1]=C.y;ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];
- da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;w+=12}if(fb&&M){if(u.length==
- 3&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2]}else D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;qa+=9}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;X+=12}if(db&&V)if(r.length==3&&hb)for(F=0;F<3;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<3;F++){La[Ha]=A.x;La[Ha+1]=A.y;
- La[Ha+2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<3;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<3;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+2;Ga+=3;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+2;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ia+=6;Z+=3}}else if(k instanceof THREE.Face4){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;W=Sa[k.d].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+
- 6]=I.x;ya[ua+7]=I.y;ya[ua+8]=I.z;ya[ua+9]=W.x;ya[ua+10]=W.y;ya[ua+11]=W.z;ua+=12}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;W=Ma[oa].vertices[k.d].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z;ta[va+9]=W.x;ta[va+10]=W.y;ta[va+11]=W.z}va+=12}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];W=Oa[k.d];ea[w]=C.x;ea[w+1]=C.y;
- ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;ea[w+12]=W.x;ea[w+13]=W.y;ea[w+14]=W.z;ea[w+15]=W.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];W=Va[k.d];da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;da[w+12]=W.x;da[w+13]=W.y;da[w+14]=W.z;da[w+15]=W.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];W=Ta[k.d];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=
- D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;aa[w+12]=W.x;aa[w+13]=W.y;aa[w+14]=W.z;aa[w+15]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];k=Ua[k.d];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;ca[w+12]=k.x;ca[w+13]=k.y;ca[w+14]=k.z;ca[w+15]=1;w+=16}if(fb&&M){if(u.length==4&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2];u=u[3]}else u=D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+
- 3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;za[qa+9]=u.r;za[qa+10]=u.g;za[qa+11]=u.b;qa+=12}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];F=F[3];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;$[X+12]=F.x;$[X+13]=F.y;$[X+14]=F.z;$[X+15]=F.w;X+=16}if(db&&V)if(r.length==4&&hb)for(F=0;F<4;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<4;F++){La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+
- 2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<4;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<4;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+3;Ja[Ga+3]=Z+1;Ja[Ga+4]=Z+2;Ja[Ga+5]=Z+3;Ga+=6;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+3;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ka[Ia+6]=Z+2;Ka[Ia+7]=Z+3;Ia+=8;Z+=4}}}if(Pa){s=0;for(v=Pa.length;s<v;s++){Ja[Ga]=Pa[s].a;Ja[Ga+1]=Pa[s].b;Ja[Ga+2]=Pa[s].c;Ja[Ga+3]=Pa[s].a;Ja[Ga+4]=Pa[s].c;Ja[Ga+5]=Pa[s].d;
- Ga+=6}}if(bb){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ya,q)}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLMorphTargetsBuffers[oa]);b.bufferData(b.ARRAY_BUFFER,ab[oa],q)}}if(fb&&qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,za,q)}if(db){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,La,q)}if(eb&&Da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);
- b.bufferData(b.ARRAY_BUFFER,$,q)}if(Xa&&Qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Za,q)}if(Xa&&Ra>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,$a,q)}if(cb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,q)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,
- aa,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,ca,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,da,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ea,q)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=
- n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof
- THREE.Line){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,
- v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){n=e.geometry;(n.__dirtyVertices||n.__dirtyColors||e.sortParticles)&&c(n,b.DYNAMIC_DRAW,e);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function Q(e){function p(F){var L=[];n=0;for(j=F.length;n<j;n++)F[n]==undefined?L.push("undefined"):L.push(F[n].id);return L.join("_")}var n,j,q,s,v,r,k,A,u={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};q=0;for(s=e.faces.length;q<s;q++){v=e.faces[q];r=
- v.materials;k=p(r);u[k]==undefined&&(u[k]={hash:k,counter:0});A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G});v=v instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+v>65535){u[k].counter+=1;A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(q);e.geometryGroups[A].vertices+=v}}function K(e,p,
- n){e.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ia(e){if(e!=Ba){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD,b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA,
- b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)}Ba=e}}function la(e,p,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,fa(p.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,fa(p.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,fa(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,fa(p.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_MAG_FILTER,
- E(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,E(p.minFilter))}}function wa(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,fa(e.wrapS));b.texParameteri(b.TEXTURE_2D,
- b.TEXTURE_WRAP_T,fa(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,fa(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,fa(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,fa(e.format),e.width,e.height,0,fa(e.format),fa(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
- null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var p,n;if(e){p=e.__webGLFramebuffer;n=e.width;e=e.height}else{p=null;n=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(T,ga,n,e);R=p}}function S(e,p){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,p);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(n));console.error(p);
- return null}return n}function E(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function fa(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
- case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
- case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var Y=document.createElement("canvas"),b,ra=null,R=null,N=this,pa=null,Aa=null,Ba=null,sa=null,T=0,ga=0,ha=0,ja=0,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Matrix4,ka=new Float32Array(16),Ca=new Float32Array(16),Fa=new THREE.Vector4,na=
- {ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ea=!0,Wa=new THREE.Color(0),Ya=0;if(a){if(a.antialias!==undefined)Ea=a.antialias;a.clearColor!==undefined&&Wa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ya=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(e,p,n){try{if(!(b=Y.getContext("experimental-webgl",{antialias:e,stencil:!0})))throw"Error creating WebGL context.";}catch(j){console.error(j)}b.clearColor(0,
- 0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.clearColor(p.r,p.g,p.b,n)})(Ea,Wa,Ya);this.context=b;var xa={};a=[];Ea=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Ea[0]=0;Ea[1]=1;Ea[2]=2;Ea[3]=0;Ea[4]=2;Ea[5]=3;xa.vertexBuffer=b.createBuffer();xa.elementBuffer=b.createBuffer();
- b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ea),b.STATIC_DRAW);xa.program=b.createProgram();b.attachShader(xa.program,S("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(xa.program,S("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(xa.program);xa.vertexLocation=b.getAttribLocation(xa.program,"position");
- xa.projectionLocation=b.getUniformLocation(xa.program,"projectionMatrix");this.setSize=function(e,p){Y.width=e;Y.height=p;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(e,p,n,j){T=e;ga=p;ha=n;ja=j;b.viewport(T,ga,ha,ja)};this.setScissor=function(e,p,n,j){b.scissor(e,p,n,j)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)};this.enableDepthBufferWrite=function(e){b.depthMask(e)};this.setClearColorHex=function(e,p){var n=new THREE.Color(e);b.clearColor(n.r,
- n.g,n.b,p)};this.setClearColor=function(e,p){b.clearColor(e.r,e.g,e.b,p)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.initMaterial=function(e,p,n,j){var q,s,v,r;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.ShadowVolumeDynamicMaterial)d(e,THREE.ShaderLib.shadowVolumeDynamic);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);
- else if(e instanceof THREE.MeshLambertMaterial)d(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);if(!e.program){var k,A,u;k=u=r=0;for(v=p.length;k<v;k++){A=p[k];A instanceof THREE.DirectionalLight&&u++;A instanceof THREE.PointLight&&r++}if(r+u<=4)p=u;else{p=Math.ceil(4*u/(r+u));r=4-p}r={directional:p,
- point:r};p=50;if(j!==undefined&&j instanceof THREE.SkinnedMesh)p=j.bones.length;v={fog:n,map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:r.directional,maxPointLights:r.point,maxBones:p};n=e.fragmentShader;r=e.vertexShader;p=b.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?
- "#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,"#define MAX_BONES "+v.maxBones,v.map?"#define USE_MAP":
- "",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"",v.morphTargets?"#define USE_MORPHTARGETS":"",v.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
- b.attachShader(p,S("fragment",k+n));b.attachShader(p,S("vertex",v+r));b.linkProgram(p);b.getProgramParameter(p,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(p,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");p.uniforms={};p.attributes={};e.program=p;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in e.uniforms)n.push(q);
- q=e.program;r=0;for(p=n.length;r<p;r++){k=n[r];q.uniforms[k]=b.getUniformLocation(q,k)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)n.push("morphTarget"+q);for(s in e.attributes)n.push(s);s=e.program;q=n;n=0;for(r=q.length;n<r;n++){p=q[n];s.attributes[p]=b.getAttribLocation(s,p)}s=e.program.attributes;b.enableVertexAttribArray(s.position);s.color>=0&&b.enableVertexAttribArray(s.color);s.normal>=0&&b.enableVertexAttribArray(s.normal);
- s.tangent>=0&&b.enableVertexAttribArray(s.tangent);if(e.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){b.enableVertexAttribArray(s.skinVertexA);b.enableVertexAttribArray(s.skinVertexB);b.enableVertexAttribArray(s.skinIndex);b.enableVertexAttribArray(s.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(s.morphTarget0>=0){b.enableVertexAttribArray(s.morphTarget0);e.numSupportedMorphTargets++}if(s.morphTarget1>=0){b.enableVertexAttribArray(s.morphTarget1);
- e.numSupportedMorphTargets++}if(s.morphTarget2>=0){b.enableVertexAttribArray(s.morphTarget2);e.numSupportedMorphTargets++}if(s.morphTarget3>=0){b.enableVertexAttribArray(s.morphTarget3);e.numSupportedMorphTargets++}if(s.morphTarget4>=0){b.enableVertexAttribArray(s.morphTarget4);e.numSupportedMorphTargets++}if(s.morphTarget5>=0){b.enableVertexAttribArray(s.morphTarget5);e.numSupportedMorphTargets++}if(s.morphTarget6>=0){b.enableVertexAttribArray(s.morphTarget6);e.numSupportedMorphTargets++}if(s.morphTarget7>=
- 0){b.enableVertexAttribArray(s.morphTarget7);e.numSupportedMorphTargets++}j.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q<this.maxMorphTargets;q++)j.__webGLMorphTargetInfluences[q]=0}}e.__webglProgram=!0};this.render=function(e,p,n,j){var q,s,v,r,k,A,u,G,F=e.lights,L=e.fog;p.matrixAutoUpdate&&p.updateMatrix();e.update(undefined,!1,p);p.matrixWorldInverse.flattenToArray(Ca);p.projectionMatrix.flattenToArray(ka);ma.multiply(p.projectionMatrix,p.matrixWorldInverse);o(ma);
- this.initWebGLObjects(e);wa(n);(this.autoClear||j)&&this.clear();j=e.__webglObjects.length;for(k=0;k<j;k++){r=e.__webglObjects[k];u=r.object;if(u.visible)if(!(u instanceof THREE.Mesh)||t(u)){u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);B(r);r.render=!0;if(this.sortObjects){Fa.copy(u.position);ma.multiplyVector3(Fa);r.z=Fa.z}}else r.render=!1;else r.render=!1}this.sortObjects&&e.__webglObjects.sort(z);A=e.__webglObjectsImmediate.length;for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=
- r.object;if(u.visible){u.matrixAutoUpdate&&u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);y(r)}}ia(THREE.NormalBlending);for(k=0;k<j;k++){r=e.__webglObjects[k];if(r.render){u=r.object;G=r.buffer;v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}for(k=0;k<j;k++){r=e.__webglObjects[k];
- if(r.render){u=r.object;G=r.buffer;v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}if(e.__webglShadowVolumes.length&&e.lights.length){b.enable(b.POLYGON_OFFSET_FILL);b.polygonOffset(0.1,1);b.enable(b.STENCIL_TEST);b.depthMask(!1);b.colorMask(!1,
- !1,!1,!1);b.stencilFunc(b.ALWAYS,1,255);b.stencilOpSeparate(b.BACK,b.KEEP,b.INCR,b.KEEP);b.stencilOpSeparate(b.FRONT,b.KEEP,b.DECR,b.KEEP);A=e.lights.length;G=[];j=e.__webglShadowVolumes.length;for(p=0;p<A;p++){k=e.lights[p];if(k instanceof THREE.DirectionalLight){G[0]=-k.position.x;G[1]=-k.position.y;G[2]=-k.position.z;for(k=0;k<j;k++){u=e.__webglShadowVolumes[k].object;q=e.__webglShadowVolumes[k].buffer;r=u.materials[0];r.program||N.initMaterial(r,F,L,u);s=r.program;r=s.uniforms;v=s.attributes;
- if(ra!==s){b.useProgram(s);ra=s;b.uniformMatrix4fv(r.projectionMatrix,!1,ka);b.uniformMatrix4fv(r.viewMatrix,!1,Ca);b.uniform3fv(r.directionalLightDirection,G)}u.matrixWorld.flattenToArray(u._objectMatrixArray);b.uniformMatrix4fv(r.objectMatrix,!1,u._objectMatrixArray);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
- q.__webGLFaceBuffer);b.cullFace(b.FRONT);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0);b.cullFace(b.BACK);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}}}b.disable(b.POLYGON_OFFSET_FILL);b.colorMask(!0,!0,!0,!0);b.stencilFunc(b.NOTEQUAL,0,255);b.stencilOp(b.KEEP,b.KEEP,b.KEEP);b.disable(b.DEPTH_TEST);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.blendEquation(b.FUNC_ADD);Ba="";ra=xa.program;b.useProgram(xa.program);b.uniformMatrix4fv(xa.projectionLocation,
- !1,ka);b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);b.vertexAttribPointer(xa.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(xa.vertexLocation);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST);b.enable(b.DEPTH_TEST);b.disable(b.BLEND);b.depthMask(!0)}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
- null)}};this.initWebGLObjects=function(e){if(!e.__webglObjects){e.__webglObjects=[];e.__webglObjectsImmediate=[];e.__webglShadowVolumes=[]}for(;e.__objectsAdded.length;){var p=e.__objectsAdded[0],n=e,j=void 0,q=void 0,s=void 0;if(p._modelViewMatrix==undefined){p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);p._objectMatrixArray=new Float32Array(16);p.matrixWorld.flattenToArray(p._objectMatrixArray)}if(p instanceof THREE.Mesh){q=
- p.geometry;q.geometryGroups==undefined&&Q(q);for(j in q.geometryGroups){s=q.geometryGroups[j];if(!s.__webGLVertexBuffer){var v=s;v.__webGLVertexBuffer=b.createBuffer();v.__webGLNormalBuffer=b.createBuffer();v.__webGLTangentBuffer=b.createBuffer();v.__webGLColorBuffer=b.createBuffer();v.__webGLUVBuffer=b.createBuffer();v.__webGLUV2Buffer=b.createBuffer();v.__webGLSkinVertexABuffer=b.createBuffer();v.__webGLSkinVertexBBuffer=b.createBuffer();v.__webGLSkinIndicesBuffer=b.createBuffer();v.__webGLSkinWeightsBuffer=
- b.createBuffer();v.__webGLFaceBuffer=b.createBuffer();v.__webGLLineBuffer=b.createBuffer();if(v.numMorphTargets){var r=void 0,k=void 0;v.__webGLMorphTargetsBuffers=[];r=0;for(k=v.numMorphTargets;r<k;r++)v.__webGLMorphTargetsBuffers.push(b.createBuffer())}v=s;r=p;var A=void 0,u=void 0,G=void 0;G=void 0;var F=k=0,L=0;A=void 0;u=void 0;var M=void 0;u=void 0;var V=r.geometry;M=V.faces;var P=v.faces;A=0;for(u=P.length;A<u;A++){G=P[A];G=M[G];if(G instanceof THREE.Face3){k+=3;F+=1;L+=3}else if(G instanceof
- THREE.Face4){k+=4;F+=2;L+=4}}A=v;u=r;M=void 0;P=void 0;var U=void 0,C=void 0;U=void 0;G=[];M=0;for(P=u.materials.length;M<P;M++){U=u.materials[M];if(U instanceof THREE.MeshFaceMaterial){U=0;for(l=A.materials.length;U<l;U++)(C=A.materials[U])&&G.push(C)}else(C=U)&&G.push(C)}u=G;a:{A=void 0;M=void 0;P=u.length;for(A=0;A<P;A++){M=u[A];if(M.map||M.lightMap||M instanceof THREE.MeshShaderMaterial){A=!0;break a}}A=!1}a:{M=void 0;P=void 0;G=u.length;for(M=0;M<G;M++){P=u[M];if(!(P instanceof THREE.MeshBasicMaterial&&
- !P.envMap||P instanceof THREE.MeshDepthMaterial)){M=P&&P.shading!=undefined&&P.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}M=!1}a:{P=void 0;G=void 0;U=u.length;for(P=0;P<U;P++){G=u[P];if(G.vertexColors){u=G.vertexColors;break a}}u=!1}v.__vertexArray=new Float32Array(k*3);if(M)v.__normalArray=new Float32Array(k*3);if(V.hasTangents)v.__tangentArray=new Float32Array(k*4);if(u)v.__colorArray=new Float32Array(k*3);if(A){if(V.faceUvs.length>0||V.faceVertexUvs.length>0)v.__uvArray=
- new Float32Array(k*2);if(V.faceUvs.length>1||V.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(k*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(k*4);v.__skinVertexBArray=new Float32Array(k*4);v.__skinIndexArray=new Float32Array(k*4);v.__skinWeightArray=new Float32Array(k*4)}v.__faceArray=new Uint16Array(F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(L*2);if(v.numMorphTargets){V=void 0;P=void 0;
- v.__morphTargetsArrays=[];V=0;for(P=v.numMorphTargets;V<P;V++)v.__morphTargetsArrays.push(new Float32Array(k*3))}v.__needsSmoothNormals=M==THREE.SmoothShading;v.__uvType=A;v.__vertexColorType=u;v.__normalType=M;v.__webGLFaceCount=F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0);v.__webGLLineCount=L*2;q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}p instanceof THREE.ShadowVolume?K(n.__webglShadowVolumes,
- s,p):K(n.__webglObjects,s,p)}}else if(p instanceof THREE.Ribbon){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLVertexCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.Line){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=
- b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLLineCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.ParticleSystem){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__sortArray=[];j.__webGLParticleCount=
- s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){p=e.__objectsRemoved[0];n=e;q=void 0;j=void 0;for(q=n.__webglObjects.length-1;q>=0;q--){j=n.__webglObjects[q].object;p==j&&n.__webglObjects.splice(q,1)}e.__objectsRemoved.splice(0,1)}p=0;for(n=e.__webglObjects.length;p<
- n;p++)J(e.__webglObjects[p].object,e);p=0;for(n=e.__webglShadowVolumes.length;p<n;p++)J(e.__webglShadowVolumes[p].object,e)};this.setFaceCulling=function(e,p){if(e){!p||p=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="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}};
|