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