123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- // Three.js r34 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
- THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var d,f,g,h,j,k;if(c==0)d=f=g=0;else{h=Math.floor(a*6);j=a*6-h;a=c*(1-b);k=c*(1-b*j);b=c*(1-b*(1-j));switch(h){case 1:d=k;f=c;g=a;break;case 2:d=a;f=c;g=b;break;case 3:d=a;f=k;g=c;break;case 4:d=b;f=a;g=c;break;case 5:d=c;f=a;g=k;break;case 6:case 0:d=c;f=b;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();
- this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
- THREE.Vector2=function(a,b){this.set(a||0,b||0)};
- THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
- this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
- THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
- b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
- a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
- this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
- THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
- a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(G,v,E,w){w=w.clone().subSelf(v);E=E.clone().subSelf(v);var J=G.clone().subSelf(v);G=w.dot(w);v=w.dot(E);w=w.dot(J);var I=E.dot(E);E=E.dot(J);J=1/(G*I-v*v);I=(I*w-v*E)*J;G=(G*E-v*w)*J;return I>0&&G>0&&I+G<1}var c,d,f,g,h,j,k,m,o,z,
- q,t=a.geometry,B=t.vertices,D=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];z=this.origin.clone();q=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(B[f.a].position.clone());h=k.multiplyVector3(B[f.b].position.clone());j=k.multiplyVector3(B[f.c].position.clone());k=f instanceof THREE.Face4?k.multiplyVector3(B[f.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(f.normal.clone());o=q.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,z))/o;z=z.addSelf(q.multiplyScalar(m));
- if(f instanceof THREE.Face3){if(b(z,g,h,j)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};D.push(f)}}else if(f instanceof THREE.Face4&&(b(z,g,h,k)||b(z,h,j,k))){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};D.push(f)}}}return D}};
- THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(k,m,o,z){j=!1;b=k;c=m;d=o;f=z;a()};this.addPoint=function(k,m){if(j){j=!1;b=k;c=m;d=k;f=m}else{b=b<k?b:k;c=c<m?c:m;d=d>k?d:k;f=f>m?f:m}a()};
- this.add3Points=function(k,m,o,z,q,t){if(j){j=!1;b=k<o?k<q?k:q:o<q?o:q;c=m<z?m<t?m:t:z<t?z:t;d=k>o?k>q?k:q:o>q?o:q;f=m>z?m>t?m:t:z>t?z:t}else{b=k<o?k<q?k<b?k:b:q<b?q:b:o<q?o<b?o:b:q<b?q:b;c=m<z?m<t?m<c?m:c:t<c?t:c:z<t?z<c?z:c:t<c?t:c;d=k>o?k>q?k>d?k:d:q>d?q:d:o>q?o>d?o:d:q>d?q:d;f=m>z?m>t?m>f?m:f:t>f?t:f:z>t?z>f?z:f:t>f?t:f}a()};this.addRectangle=function(k){if(j){j=!1;b=k.getLeft();c=k.getTop();d=k.getRight();f=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();c=c<k.getTop()?c:k.getTop();d=d>k.getRight()?
- d:k.getRight();f=f>k.getBottom()?f:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;d+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();d=d<k.getRight()?d:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(f,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){j=!0;f=d=c=b=0;a()};this.isEmpty=function(){return j}};
- THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
- THREE.Matrix4=function(a,b,c,d,f,g,h,j,k,m,o,z,q,t,B,D){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,j||0,k||0,m||0,o||1,z||0,q||0,t||0,B||0,D||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,j,k,m,o,z,q,t,B,D){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=o;this.n34=z;this.n41=q;this.n42=t;this.n43=B;this.n44=D;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,
- f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n14=a.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n24=a.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*
- b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;
- b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,D=a.n42,G=a.n43,v=a.n44,E=b.n11,w=b.n12,J=b.n13,I=b.n14,e=b.n21,M=b.n22,N=b.n23,U=b.n24,Q=b.n31,Z=b.n32,ca=b.n33,K=b.n34;this.n11=
- c*E+d*e+f*Q;this.n12=c*w+d*M+f*Z;this.n13=c*J+d*N+f*ca;this.n14=c*I+d*U+f*K+g;this.n21=h*E+j*e+k*Q;this.n22=h*w+j*M+k*Z;this.n23=h*J+j*N+k*ca;this.n24=h*I+j*U+k*K+m;this.n31=o*E+z*e+q*Q;this.n32=o*w+z*M+q*Z;this.n33=o*J+z*N+q*ca;this.n34=o*I+z*U+q*K+t;this.n41=B*E+D*e+G*Q;this.n42=B*w+D*M+G*Z;this.n43=B*J+D*N+G*ca;this.n44=B*I+D*U+G*K+v;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,j=a.n21,k=a.n22,m=a.n23,o=a.n24,z=a.n31,q=a.n32,t=a.n33,B=a.n34,D=a.n41,G=a.n42,v=
- a.n43;a=a.n44;var E=b.n11,w=b.n12,J=b.n13,I=b.n14,e=b.n21,M=b.n22,N=b.n23,U=b.n24,Q=b.n31,Z=b.n32,ca=b.n33,K=b.n34,W=b.n41,la=b.n42,ba=b.n43;b=b.n44;this.n11=d*E+f*e+g*Q+h*W;this.n12=d*w+f*M+g*Z+h*la;this.n13=d*J+f*N+g*ca+h*ba;this.n14=d*I+f*U+g*K+h*b;this.n21=j*E+k*e+m*Q+o*W;this.n22=j*w+k*M+m*Z+o*la;this.n23=j*J+k*N+m*ca+o*ba;this.n24=j*I+k*U+m*K+o*b;this.n31=z*E+q*e+t*Q+B*W;this.n32=z*w+q*M+t*Z+B*la;this.n33=z*J+q*N+t*ca+B*ba;this.n34=z*I+q*U+t*K+B*b;this.n41=D*E+G*e+v*Q+a*W;this.n42=D*w+G*M+v*
- Z+a*la;this.n43=D*J+G*N+v*ca+a*ba;this.n44=D*I+G*U+v*K+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,z=this.n33,q=this.n34,t=this.n41,B=this.n42,D=this.n43,G=this.n44,
- v=a.n11,E=a.n21,w=a.n31,J=a.n12,I=a.n22,e=a.n32,M=a.n13,N=a.n23,U=a.n33,Q=a.n14,Z=a.n24;a=a.n34;this.n11=b*v+c*E+d*w;this.n12=b*J+c*I+d*e;this.n13=b*M+c*N+d*U;this.n14=b*Q+c*Z+d*a+f;this.n21=g*v+h*E+j*w;this.n22=g*J+h*I+j*e;this.n23=g*M+h*N+j*U;this.n24=g*Q+h*Z+j*a+k;this.n31=m*v+o*E+z*w;this.n32=m*J+o*I+z*e;this.n33=m*M+o*N+z*U;this.n34=m*Q+o*Z+z*a+q;this.n41=t*v+B*E+D*w;this.n42=t*J+B*I+D*e;this.n43=t*M+B*N+D*U;this.n44=t*Q+B*Z+D*a+G;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=
- a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,o=this.n33,z=this.n34,q=this.n41,t=this.n42,B=this.n43,D=this.n44;return d*h*m*q-c*j*m*q-d*g*o*q+b*j*o*q+c*g*z*q-b*h*z*q-d*h*k*t+c*j*k*t+d*f*o*t-a*j*o*t-c*f*z*t+a*h*z*t+d*g*k*B-b*j*
- k*B-d*f*m*B+a*j*m*B+b*f*z*B-a*g*z*B-c*g*k*D+b*h*k*D+c*f*m*D-a*h*m*D-b*f*o*D+a*g*o*D},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=
- this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,
- b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
- 0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,j=a.z,k=f*g,m=f*h;this.set(k*g+c,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+c,m*j-d*g,0,k*j-d*h,m*j+d*g,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=
- a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,j=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,j=d+d;a=b*g;var k=b*h;b*=j;var m=c*h;c*=j;d*=j;g*=f;h*=f;f*=j;this.n11=1-(m+d);this.n12=k-f;this.n13=
- b+h;this.n21=k+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};
- THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
- THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,D=a.n42,G=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*t*D-m*q*D+m*z*G-j*t*G-k*z*v+j*q*v;b.n12=g*q*D-f*t*D-g*z*G+d*t*G+f*z*v-d*q*v;b.n13=f*m*D-g*k*D+g*j*G-d*m*G-f*j*v+d*k*v;b.n14=g*k*z-f*m*z-g*j*q+d*m*q+f*j*t-d*k*t;b.n21=m*q*B-k*t*B-m*o*G+h*t*G+k*o*v-h*q*v;b.n22=f*t*B-g*q*B+g*o*G-c*t*G-f*o*v+c*q*v;b.n23=g*k*B-f*m*B-g*h*G+c*m*G+f*h*v-c*k*v;
- b.n24=f*m*o-g*k*o+g*h*q-c*m*q-f*h*t+c*k*t;b.n31=j*t*B-m*z*B+m*o*D-h*t*D-j*o*v+h*z*v;b.n32=g*z*B-d*t*B-g*o*D+c*t*D+d*o*v-c*z*v;b.n33=f*m*B-g*j*B+g*h*D-c*m*D-d*h*v+c*j*v;b.n34=g*j*o-d*m*o-g*h*z+c*m*z+d*h*t-c*j*t;b.n41=k*z*B-j*q*B-k*o*D+h*q*D+j*o*G-h*z*G;b.n42=d*q*B-f*z*B+f*o*D-c*q*D-d*o*G+c*z*G;b.n43=f*j*B-d*k*B-f*h*D+c*k*D+d*h*G-c*j*G;b.n44=d*k*o-f*j*o+f*h*z-c*k*z-d*h*q+c*j*q;b.multiplyScalar(1/a.determinant());return b};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*j;c[5]=a*k;c[6]=a*m;c[7]=a*o;c[8]=a*z;return b};
- THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
- THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,j,k,m;h=new THREE.Matrix4;j=b-a;k=c-d;m=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((b+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
- THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
- this.visible=!0};
- THREE.Object3D.prototype={addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,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))}return!0},update:function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);b=1/this.scale.x;a=1/this.scale.y;var d=1/this.scale.z;this.matrixRotationWorld.n11=this.matrixWorld.n11*b;this.matrixRotationWorld.n21=
- this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.matrixRotationWorld.n12=this.matrixWorld.n12*a;this.matrixRotationWorld.n22=this.matrixWorld.n22*a;this.matrixRotationWorld.n32=this.matrixWorld.n32*a;this.matrixRotationWorld.n13=this.matrixWorld.n13*d;this.matrixRotationWorld.n23=this.matrixWorld.n23*d;this.matrixRotationWorld.n33=this.matrixWorld.n33*d;this.matrixNeedsUpdate=!1;b=!0}a=0;for(d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};
- THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
- THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,j=d*f;this.w=h*g-j*c;this.x=h*c+j*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
- -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=b*a+f*g+c*j-d*h;this.y=c*a+f*h+d*g-b*j;this.z=d*a+f*j+b*h-c*g;this.w=f*a-b*g-c*h-d*j;return this},
- multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*c+h*f-j*d,o=k*d+j*c-g*f,z=k*f+g*d-h*c;c=-g*c-h*d-j*f;b.x=m*k+c*-g+o*-j-z*-h;b.y=o*k+c*-h+z*-g-m*-j;b.z=z*k+c*-j+m*-h-o*-g;return b}};
- THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
- THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
- THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
- THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
- THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
- c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)j.addSelf(g.vertexNormals[b]);j.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,
- c.position);k.sub(b.position,c.position);j.crossSelf(k)}j.isZero()||j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
- b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(K,W,la,ba,na,ga,ha){g=K.vertices[W].position;h=K.vertices[la].position;j=K.vertices[ba].position;k=f[na];m=f[ga];o=f[ha];z=h.x-g.x;q=j.x-g.x;t=h.y-g.y;
- B=j.y-g.y;D=h.z-g.z;G=j.z-g.z;v=m.u-k.u;E=o.u-k.u;w=m.v-k.v;J=o.v-k.v;I=1/(v*J-E*w);N.set((J*z-w*q)*I,(J*t-w*B)*I,(J*D-w*G)*I);U.set((v*q-E*z)*I,(v*B-E*t)*I,(v*G-E*D)*I);e[W].addSelf(N);e[la].addSelf(N);e[ba].addSelf(N);M[W].addSelf(U);M[la].addSelf(U);M[ba].addSelf(U)}var b,c,d,f,g,h,j,k,m,o,z,q,t,B,D,G,v,E,w,J,I,e=[],M=[],N=new THREE.Vector3,U=new THREE.Vector3,Q=new THREE.Vector3,Z=new THREE.Vector3,ca=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){e[b]=new THREE.Vector3;M[b]=new THREE.Vector3}b=
- 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
- this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ca.copy(this.vertices[b].normal);d=e[b];Q.copy(d);Q.subSelf(ca.multiplyScalar(ca.dot(d))).normalize();Z.cross(this.vertices[b].normal,d);d=Z.dot(M[b]);d=d<0?-1:1;this.vertices[b].tangent.set(Q.x,Q.y,Q.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
- z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
- this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
- THREE.Spline=function(){function a(q,t,B,D,G,v,E){q=(B-q)*0.5;D=(D-t)*0.5;return(2*(t-B)+q+D)*E+(-3*(t-B)-2*q-D)*v+q*G+t}var b=[],c={x:0,y:0,z:0},d,f,g,h,j,k,m,o,z;this.get2DPoint=function(q,t){d=(q.length-1)*t;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>q.length-2?f:f+1;b[3]=f>q.length-3?f:f+2;k=q[b[0]];m=q[b[1]];o=q[b[2]];z=q[b[3]];h=g*g;j=g*h;c.x=a(k.x,m.x,o.x,z.x,g,h,j);c.y=a(k.y,m.y,o.y,z.y,g,h,j);c.z=a(k.z,m.z,o.z,z.z,g,h,j);return c}};
- THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
- THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
- THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
- THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.001;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
- this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
- THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,j=this.data.JIT.hierarchy,k=(new Date).getTime()*0.001-this.startTime+this.offset,m=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.001-k;k=(new Date).getTime()*0.001-this.startTime}h=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,z=this.hierarchy.length;o<z;o++){g=this.hierarchy[o];if(j[o][h]!==undefined){g.skinMatrix=
- j[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var q=0;q<3;q++){c=a[q];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(k<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<k)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(k-d.time)/(f.time-d.time);d=d[c];f=f[c];if(c==="rot"){if(b<
- 0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(j[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)j[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
- THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
- THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
- this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
- THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
- this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};function bind(a,b){return function(){b.apply(a,arguments)}}function clamp_bottom(a,b){return a<b?b:a}function clamp(a,b,c){return a<b?b:a>c?c:a}
- THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==
- undefined)this.autoForward=a.autoForward;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phy=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX=
- window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
- !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?(clamp(this.position.y,this.heightMin,this.heightMax)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&
- this.translateZ(-(this.movementSpeed+this.autoSpeedFactor),this.noFly);this.moveBackward&&this.translateZ(this.movementSpeed,this.noFly);this.moveLeft&&this.translateX(-this.movementSpeed,this.noFly);this.moveRight&&this.translateX(this.movementSpeed,this.noFly);this.lon+=this.mouseX*this.lookSpeed;this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,c=this.position;
- b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",bind(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",bind(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",bind(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",
- bind(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",bind(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;
- THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
- THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=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(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
- a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
- this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
- a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
- this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=
- a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
- this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==
- undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==
- undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==undefined)this.vertexShader=
- a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==
- undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning}};
- THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==
- undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
- THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};
- THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
- THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
- THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var b,c,d,f={};for(b in a){f[b]={};for(c in a[b]){d=a[b][c];f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++){d=this.clone(a[b]);for(c in d)f[c]=d[c]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
- THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
- THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
- b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
- THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,h,j;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){f=this.geometry.bones[c];g=f.pos;h=f.rotq;j=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);j!==undefined?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){f=this.geometry.bones[c];d=this.bones[c];
- f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}}};
- THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
- d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
- THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
- THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var f;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)f=
- "audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
- THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
- THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
- THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
- THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
- THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(a>=this.LODs[d].visibleAtDistance){this.LODs[d-1].object3D.visible=!1;this.LODs[d].object3D.visible=
- !0}else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
- THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
- THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
- THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
- THREE.Projector=function(){function a(M,N){return N.z-M.z}function b(M,N){var U=0,Q=1,Z=M.z+M.w,ca=N.z+N.w,K=-M.z+M.w,W=-N.z+N.w;if(Z>=0&&ca>=0&&K>=0&&W>=0)return!0;else if(Z<0&&ca<0||K<0&&W<0)return!1;else{if(Z<0)U=Math.max(U,Z/(Z-ca));else ca<0&&(Q=Math.min(Q,Z/(Z-ca)));if(K<0)U=Math.max(U,K/(K-W));else W<0&&(Q=Math.min(Q,K/(K-W)));if(Q<U)return!1;else{M.lerpSelf(N,U);N.lerpSelf(M,1-Q);return!0}}}var c,d,f=[],g,h,j,k=[],m,o,z=[],q,t,B=[],D=new THREE.Vector4,G=new THREE.Vector4,v=new THREE.Matrix4,
- E=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,I=new THREE.Vector4,e;this.projectObjects=function(M,N,U){N=[];var Q,Z,ca;d=0;Z=M.objects;M=0;for(Q=Z.length;M<Q;M++){ca=Z[M];var K;if(!(K=!ca.visible))if(K=ca instanceof THREE.Mesh){a:{K=void 0;for(var W=ca.matrixWorld,la=-ca.geometry.boundingSphere.radius*Math.max(ca.scale.x,Math.max(ca.scale.y,ca.scale.z)),ba=0;ba<6;ba++){K=w[ba].x*W.n14+w[ba].y*
- W.n24+w[ba].z*W.n34+w[ba].w;if(K<=la){K=!1;break a}}K=!0}K=!K}if(!K){c=f[d]=f[d]||new THREE.RenderableObject;D.copy(ca.position);v.multiplyVector3(D);c.object=ca;c.z=D.z;N.push(c);d++}}U&&N.sort(a);return N};this.projectScene=function(M,N,U){var Q=[],Z=N.near,ca=N.far,K,W,la,ba,na,ga,ha,qa,wa,l,x,y,n,p,C,F;j=o=t=0;N.matrixAutoUpdate&&N.update();v.multiply(N.projectionMatrix,N.matrixWorldInverse);w[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);w[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,
- v.n44+v.n14);w[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);w[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);w[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);w[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(K=0;K<6;K++){ga=w[K];ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z))}M.update(undefined,!1,N);ga=this.projectObjects(M,N,!0);M=0;for(K=ga.length;M<K;M++){ha=ga[M].object;if(ha.visible){qa=ha.matrixWorld;x=ha.matrixRotationWorld;wa=ha.materials;
- l=ha.overdraw;if(ha instanceof THREE.Mesh){y=ha.geometry;n=y.vertices;W=0;for(la=n.length;W<la;W++){p=n[W];p.positionWorld.copy(p.position);qa.multiplyVector3(p.positionWorld);ba=p.positionScreen;ba.copy(p.positionWorld);v.multiplyVector4(ba);ba.x/=ba.w;ba.y/=ba.w;p.__visible=ba.z>Z&&ba.z<ca}y=y.faces;W=0;for(la=y.length;W<la;W++){p=y[W];if(p instanceof THREE.Face3){ba=n[p.a];na=n[p.b];C=n[p.c];if(ba.__visible&&na.__visible&&C.__visible&&(ha.doubleSided||ha.flipSided!=(C.positionScreen.x-ba.positionScreen.x)*
- (na.positionScreen.y-ba.positionScreen.y)-(C.positionScreen.y-ba.positionScreen.y)*(na.positionScreen.x-ba.positionScreen.x)<0)){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);g.v2.positionWorld.copy(na.positionWorld);g.v3.positionWorld.copy(C.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(na.positionScreen);g.v3.positionScreen.copy(C.positionScreen);g.normalWorld.copy(p.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(p.centroid);
- qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);C=p.vertexNormals;e=g.vertexNormalsWorld;ba=0;for(na=C.length;ba<na;ba++){F=e[ba]=e[ba]||new THREE.Vector3;F.copy(C[ba]);x.multiplyVector3(F)}g.z=g.centroidScreen.z;g.meshMaterials=wa;g.faceMaterials=p.materials;g.overdraw=l;if(ha.geometry.uvs[W]){g.uvs[0]=ha.geometry.uvs[W][0];g.uvs[1]=ha.geometry.uvs[W][1];g.uvs[2]=ha.geometry.uvs[W][2]}Q.push(g);j++}}else if(p instanceof THREE.Face4){ba=
- n[p.a];na=n[p.b];C=n[p.c];F=n[p.d];if(ba.__visible&&na.__visible&&C.__visible&&F.__visible&&(ha.doubleSided||ha.flipSided!=((F.positionScreen.x-ba.positionScreen.x)*(na.positionScreen.y-ba.positionScreen.y)-(F.positionScreen.y-ba.positionScreen.y)*(na.positionScreen.x-ba.positionScreen.x)<0||(na.positionScreen.x-C.positionScreen.x)*(F.positionScreen.y-C.positionScreen.y)-(na.positionScreen.y-C.positionScreen.y)*(F.positionScreen.x-C.positionScreen.x)<0))){g=k[j]=k[j]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);
- g.v2.positionWorld.copy(na.positionWorld);g.v3.positionWorld.copy(F.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(na.positionScreen);g.v3.positionScreen.copy(F.positionScreen);g.normalWorld.copy(p.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(p.centroid);qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=wa;g.faceMaterials=p.materials;g.overdraw=
- l;if(ha.geometry.uvs[W]){g.uvs[0]=ha.geometry.uvs[W][0];g.uvs[1]=ha.geometry.uvs[W][1];g.uvs[2]=ha.geometry.uvs[W][3]}Q.push(g);j++;h=k[j]=k[j]||new THREE.RenderableFace3;h.v1.positionWorld.copy(na.positionWorld);h.v2.positionWorld.copy(C.positionWorld);h.v3.positionWorld.copy(F.positionWorld);h.v1.positionScreen.copy(na.positionScreen);h.v2.positionScreen.copy(C.positionScreen);h.v3.positionScreen.copy(F.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
- h.z=h.centroidScreen.z;h.meshMaterials=wa;h.faceMaterials=p.materials;h.overdraw=l;if(ha.geometry.uvs[W]){h.uvs[0]=ha.geometry.uvs[W][1];h.uvs[1]=ha.geometry.uvs[W][2];h.uvs[2]=ha.geometry.uvs[W][3]}Q.push(h);j++}}}}else if(ha instanceof THREE.Line){E.multiply(v,qa);n=ha.geometry.vertices;p=n[0];p.positionScreen.copy(p.position);E.multiplyVector4(p.positionScreen);W=1;for(la=n.length;W<la;W++){ba=n[W];ba.positionScreen.copy(ba.position);E.multiplyVector4(ba.positionScreen);na=n[W-1];J.copy(ba.positionScreen);
- I.copy(na.positionScreen);if(b(J,I)){J.multiplyScalar(1/J.w);I.multiplyScalar(1/I.w);m=z[o]=z[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(J);m.v2.positionScreen.copy(I);m.z=Math.max(J.z,I.z);m.materials=ha.materials;Q.push(m);o++}}}else if(ha instanceof THREE.Particle){G.set(ha.position.x,ha.position.y,ha.position.z,1);v.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){q=B[t]=B[t]||new THREE.RenderableParticle;q.x=G.x/G.w;q.y=G.y/G.w;q.z=G.z;q.rotation=ha.rotation.z;q.scale.x=ha.scale.x*Math.abs(q.x-
- (G.x+N.projectionMatrix.n11)/(G.w+N.projectionMatrix.n14));q.scale.y=ha.scale.y*Math.abs(q.y-(G.y+N.projectionMatrix.n22)/(G.w+N.projectionMatrix.n24));q.materials=ha.materials;Q.push(q);t++}}}}U&&Q.sort(a);return Q};this.unprojectVector=function(M,N){var U=N.matrixWorld.clone();U.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));U.multiplyVector3(M);return M}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,j){c=h;d=j;f=c/2;g=d/2};this.render=function(h,j){var k,m,o,z,q,t,B,D;a=b.projectScene(h,j);k=0;for(m=a.length;k<m;k++){q=a[k];if(q instanceof THREE.RenderableParticle){B=q.x*f+f;D=q.y*g+g;o=0;for(z=q.material.length;o<z;o++){t=q.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=B+"px";t.style.top=D+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(ma){if(q!=ma)m.globalAlpha=q=ma}function b(ma){if(t!=ma){switch(ma){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=ma}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,j,k,m=f.getContext("2d"),o=new THREE.Color(0),z=0,q=1,t=0,B=null,D=null,G=1,v,E,w,J,I,e,M,N,U,Q=new THREE.Color,
- Z=new THREE.Color,ca=new THREE.Color,K=new THREE.Color,W=new THREE.Color,la,ba,na,ga,ha,qa,wa,l,x,y=new THREE.Rectangle,n=new THREE.Rectangle,p=new THREE.Rectangle,C=!1,F=new THREE.Color,O=new THREE.Color,T=new THREE.Color,u=new THREE.Color,A=Math.PI*2,H=new THREE.Vector3,S,X,da,ja,xa,P,Ea=16;S=document.createElement("canvas");S.width=S.height=2;X=S.getContext("2d");X.fillStyle="rgba(0,0,0,1)";X.fillRect(0,0,2,2);da=X.getImageData(0,0,2,2);ja=da.data;xa=document.createElement("canvas");xa.width=xa.height=
- Ea;P=xa.getContext("2d");P.translate(-Ea/2,-Ea/2);P.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ma,Aa){g=ma;h=Aa;j=g/2;k=h/2;f.width=g;f.height=h;y.set(-j,-k,j,k);q=1;t=0;D=B=null;G=1};this.setClearColor=function(ma,Aa){o=ma;z=Aa};this.setClearColorHex=function(ma,Aa){o.setHex(ma);z=Aa};this.clear=function(){m.setTransform(1,0,0,-1,j,k);if(!n.isEmpty()){n.inflate(1);n.minSelf(y);if(o.hex==0&&z==0)m.clearRect(n.getX(),n.getY(),
- n.getWidth(),n.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+z+")";m.fillRect(n.getX(),n.getY(),n.getWidth(),n.getHeight())}n.empty()}};this.render=function(ma,Aa){function $(R){var fa,ia,V,ea=R.lights;O.setRGB(0,0,0);T.setRGB(0,0,0);u.setRGB(0,0,0);R=0;for(fa=ea.length;R<fa;R++){ia=ea[R];V=ia.color;if(ia instanceof THREE.AmbientLight){O.r+=V.r;O.g+=V.g;O.b+=V.b}else if(ia instanceof THREE.DirectionalLight){T.r+=
- V.r;T.g+=V.g;T.b+=V.b}else if(ia instanceof THREE.PointLight){u.r+=V.r;u.g+=V.g;u.b+=V.b}}}function Y(R,fa,ia,V){var ea,pa,Da,Fa,ya=R.lights;R=0;for(ea=ya.length;R<ea;R++){pa=ya[R];Da=pa.color;Fa=pa.intensity;if(pa instanceof THREE.DirectionalLight){pa=ia.dot(pa.position)*Fa;if(pa>0){V.r+=Da.r*pa;V.g+=Da.g*pa;V.b+=Da.b*pa}}else if(pa instanceof THREE.PointLight){H.sub(pa.position,fa);H.normalize();pa=ia.dot(H)*Fa;if(pa>0){V.r+=Da.r*pa;V.g+=Da.g*pa;V.b+=Da.b*pa}}}}function aa(R,fa,ia){if(ia.opacity!=
- 0){a(ia.opacity);b(ia.blending);var V,ea,pa,Da,Fa,ya;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){Da=ia.map.image;Fa=Da.width>>1;ya=Da.height>>1;ea=fa.scale.x*j;pa=fa.scale.y*k;ia=ea*Fa;V=pa*ya;p.set(R.x-ia,R.y-V,R.x+ia,R.y+V);if(y.instersects(p)){m.save();m.translate(R.x,R.y);m.rotate(-fa.rotation);m.scale(ea,-pa);m.translate(-Fa,-ya);m.drawImage(Da,0,0);m.restore()}}}else if(ia instanceof THREE.ParticleCircleMaterial){if(C){F.r=O.r+T.r+u.r;F.g=O.g+T.g+u.g;F.b=O.b+T.b+u.b;Q.r=ia.color.r*
- F.r;Q.g=ia.color.g*F.g;Q.b=ia.color.b*F.b;Q.updateStyleString()}else Q.__styleString=ia.color.__styleString;ia=fa.scale.x*j;V=fa.scale.y*k;p.set(R.x-ia,R.y-V,R.x+ia,R.y+V);if(y.instersects(p)){ea=Q.__styleString;if(D!=ea)m.fillStyle=D=ea;m.save();m.translate(R.x,R.y);m.rotate(-fa.rotation);m.scale(ia,V);m.beginPath();m.arc(0,0,1,0,A,!0);m.closePath();m.fill();m.restore()}}}}function ta(R,fa,ia,V){if(V.opacity!=0){a(V.opacity);b(V.blending);m.beginPath();m.moveTo(R.positionScreen.x,R.positionScreen.y);
- m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(V instanceof THREE.LineBasicMaterial){Q.__styleString=V.color.__styleString;R=V.linewidth;if(G!=R)m.lineWidth=G=R;R=Q.__styleString;if(B!=R)m.strokeStyle=B=R;m.stroke();p.inflate(V.linewidth*2)}}}function ua(R,fa,ia,V,ea,pa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=R.positionScreen.x;I=R.positionScreen.y;e=fa.positionScreen.x;M=fa.positionScreen.y;N=ia.positionScreen.x;U=ia.positionScreen.y;m.beginPath();m.moveTo(J,I);m.lineTo(e,
- M);m.lineTo(N,U);m.lineTo(J,I);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.mapping instanceof THREE.UVMapping&&L(J,I,e,M,N,U,ea.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);else if(ea.envMap){if(ea.envMap.mapping instanceof THREE.SphericalReflectionMapping){R=Aa.matrixWorldInverse;H.copy(V.vertexNormalsWorld[0]);ga=(H.x*R.n11+H.y*R.n12+H.z*R.n13)*0.5+0.5;ha=-(H.x*R.n21+H.y*R.n22+H.z*R.n23)*0.5+0.5;H.copy(V.vertexNormalsWorld[1]);qa=(H.x*
- R.n11+H.y*R.n12+H.z*R.n13)*0.5+0.5;wa=-(H.x*R.n21+H.y*R.n22+H.z*R.n23)*0.5+0.5;H.copy(V.vertexNormalsWorld[2]);l=(H.x*R.n11+H.y*R.n12+H.z*R.n13)*0.5+0.5;x=-(H.x*R.n21+H.y*R.n22+H.z*R.n23)*0.5+0.5;L(J,I,e,M,N,U,ea.envMap.image,ga,ha,qa,wa,l,x)}}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&L(J,I,e,M,N,U,ea.map.image,V.uvs[0].u,V.uvs[0].v,
- V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);b(THREE.SubtractiveBlending)}if(C)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3){Z.r=ca.r=K.r=O.r;Z.g=ca.g=K.g=O.g;Z.b=ca.b=K.b=O.b;Y(pa,V.v1.positionWorld,V.vertexNormalsWorld[0],Z);Y(pa,V.v2.positionWorld,V.vertexNormalsWorld[1],ca);Y(pa,V.v3.positionWorld,V.vertexNormalsWorld[2],K);W.r=(ca.r+K.r)*0.5;W.g=(ca.g+K.g)*0.5;W.b=(ca.b+K.b)*0.5;na=Ba(Z,ca,K,W);L(J,I,e,M,N,U,na,0,0,1,0,0,1)}else{F.r=O.r;F.g=O.g;F.b=O.b;Y(pa,
- V.centroidWorld,V.normalWorld,F);Q.r=ea.color.r*F.r;Q.g=ea.color.g*F.g;Q.b=ea.color.b*F.b;Q.updateStyleString();ea.wireframe?Ga(Q.__styleString,ea.wireframeLinewidth):za(Q.__styleString)}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){la=Aa.near;ba=Aa.far;Z.r=Z.g=Z.b=1-Pa(R.positionScreen.z,la,ba);ca.r=ca.g=ca.b=1-Pa(fa.positionScreen.z,la,ba);K.r=K.g=K.b=1-Pa(ia.positionScreen.z,la,ba);W.r=(ca.r+K.r)*0.5;
- W.g=(ca.g+K.g)*0.5;W.b=(ca.b+K.b)*0.5;na=Ba(Z,ca,K,W);L(J,I,e,M,N,U,na,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){Q.r=Qa(V.normalWorld.x);Q.g=Qa(V.normalWorld.y);Q.b=Qa(V.normalWorld.z);Q.updateStyleString();ea.wireframe?Ga(Q.__styleString,ea.wireframeLinewidth):za(Q.__styleString)}}}function Ga(R,fa){if(B!=R)m.strokeStyle=B=R;if(G!=fa)m.lineWidth=G=fa;m.stroke();p.inflate(fa*2)}function za(R){if(D!=R)m.fillStyle=D=R;m.fill()}function L(R,fa,ia,V,ea,pa,Da,Fa,ya,Na,La,Oa,Sa){var Ha,
- Ja;Ha=Da.width-1;Ja=Da.height-1;Fa*=Ha;ya*=Ja;Na*=Ha;La*=Ja;Oa*=Ha;Sa*=Ja;ia-=R;V-=fa;ea-=R;pa-=fa;Na-=Fa;La-=ya;Oa-=Fa;Sa-=ya;Ha=Na*Sa-Oa*La;if(Ha!=0){Ja=1/Ha;Ha=(Sa*ia-La*ea)*Ja;La=(Sa*V-La*pa)*Ja;ia=(Na*ea-Oa*ia)*Ja;V=(Na*pa-Oa*V)*Ja;R=R-Ha*Fa-ia*ya;fa=fa-La*Fa-V*ya;m.save();m.transform(Ha,La,ia,V,R,fa);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ba(R,fa,ia,V){var ea=~~(R.r*255),pa=~~(R.g*255);R=~~(R.b*255);var Da=~~(fa.r*255),Fa=~~(fa.g*255);fa=~~(fa.b*255);var ya=~~(ia.r*255),Na=~~(ia.g*
- 255);ia=~~(ia.b*255);var La=~~(V.r*255),Oa=~~(V.g*255);V=~~(V.b*255);ja[0]=ea<0?0:ea>255?255:ea;ja[1]=pa<0?0:pa>255?255:pa;ja[2]=R<0?0:R>255?255:R;ja[4]=Da<0?0:Da>255?255:Da;ja[5]=Fa<0?0:Fa>255?255:Fa;ja[6]=fa<0?0:fa>255?255:fa;ja[8]=ya<0?0:ya>255?255:ya;ja[9]=Na<0?0:Na>255?255:Na;ja[10]=ia<0?0:ia>255?255:ia;ja[12]=La<0?0:La>255?255:La;ja[13]=Oa<0?0:Oa>255?255:Oa;ja[14]=V<0?0:V>255?255:V;X.putImageData(da,0,0);P.drawImage(S,0,0);return xa}function Pa(R,fa,ia){R=(R-fa)/(ia-fa);return R*R*(3-2*R)}function Qa(R){R=
- (R+1)*0.5;return R<0?0:R>1?1:R}function Ka(R,fa){var ia=fa.x-R.x,V=fa.y-R.y,ea=1/Math.sqrt(ia*ia+V*V);ia*=ea;V*=ea;fa.x+=ia;fa.y+=V;R.x-=ia;R.y-=V}var sa,Ca,ka,oa,ra,va,Ma,Ia;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);c=d.projectScene(ma,Aa,this.sortElements);(C=ma.lights.length>0)&&$(ma);sa=0;for(Ca=c.length;sa<Ca;sa++){ka=c[sa];p.empty();if(ka instanceof THREE.RenderableParticle){v=ka;v.x*=j;v.y*=k;oa=0;for(ra=ka.materials.length;oa<ra;oa++)aa(v,ka,ka.materials[oa],ma)}else if(ka instanceof
- THREE.RenderableLine){v=ka.v1;E=ka.v2;v.positionScreen.x*=j;v.positionScreen.y*=k;E.positionScreen.x*=j;E.positionScreen.y*=k;p.addPoint(v.positionScreen.x,v.positionScreen.y);p.addPoint(E.positionScreen.x,E.positionScreen.y);if(y.instersects(p)){oa=0;for(ra=ka.materials.length;oa<ra;)ta(v,E,ka,ka.materials[oa++],ma)}}else if(ka instanceof THREE.RenderableFace3){v=ka.v1;E=ka.v2;w=ka.v3;v.positionScreen.x*=j;v.positionScreen.y*=k;E.positionScreen.x*=j;E.positionScreen.y*=k;w.positionScreen.x*=j;w.positionScreen.y*=
- k;if(ka.overdraw){Ka(v.positionScreen,E.positionScreen);Ka(E.positionScreen,w.positionScreen);Ka(w.positionScreen,v.positionScreen)}p.add3Points(v.positionScreen.x,v.positionScreen.y,E.positionScreen.x,E.positionScreen.y,w.positionScreen.x,w.positionScreen.y);if(y.instersects(p)){oa=0;for(ra=ka.meshMaterials.length;oa<ra;){Ia=ka.meshMaterials[oa++];if(Ia instanceof THREE.MeshFaceMaterial){va=0;for(Ma=ka.faceMaterials.length;va<Ma;)(Ia=ka.faceMaterials[va++])&&ua(v,E,w,ka,Ia,ma)}else ua(v,E,w,ka,Ia,
- ma)}}}n.addRectangle(p)}m.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(ga,ha,qa){var wa,l,x,y;wa=0;for(l=ga.lights.length;wa<l;wa++){x=ga.lights[wa];if(x instanceof THREE.DirectionalLight){y=ha.normalWorld.dot(x.position)*x.intensity;if(y>0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}else if(x instanceof THREE.PointLight){U.sub(x.position,ha.centroidWorld);U.normalize();y=ha.normalWorld.dot(U)*x.intensity;if(y>0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}}}function b(ga,ha,qa,wa,l,x){K=d(W++);K.setAttribute("d",
- "M "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)w.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(E){J.r=I.r;J.g=I.g;J.b=I.b;a(x,wa,J);w.r=l.color.r*J.r;w.g=l.color.g*J.g;w.b=l.color.b*J.b;w.updateStyleString()}else w.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){N=1-l.__2near/(l.__farPlusNear-
- wa.z*l.__farMinusNear);w.setRGB(N,N,N)}else l instanceof THREE.MeshNormalMaterial&&w.setRGB(f(wa.normalWorld.x),f(wa.normalWorld.y),f(wa.normalWorld.z));l.wireframe?K.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):K.setAttribute("style","fill: "+w.__styleString+"; fill-opacity: "+l.opacity);j.appendChild(K)}function c(ga,ha,qa,wa,l,
- x,y){K=d(W++);K.setAttribute("d","M "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)w.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(E){J.r=I.r;J.g=I.g;J.b=I.b;a(y,l,J);w.r=x.color.r*J.r;w.g=x.color.g*J.g;w.b=x.color.b*J.b;w.updateStyleString()}else w.__styleString=x.color.__styleString;
- else if(x instanceof THREE.MeshDepthMaterial){N=1-x.__2near/(x.__farPlusNear-l.z*x.__farMinusNear);w.setRGB(N,N,N)}else x instanceof THREE.MeshNormalMaterial&&w.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));x.wireframe?K.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):K.setAttribute("style","fill: "+w.__styleString+
- "; fill-opacity: "+x.opacity);j.appendChild(K)}function d(ga){if(Q[ga]==null){Q[ga]=document.createElementNS("http://www.w3.org/2000/svg","path");na==0&&Q[ga].setAttribute("shape-rendering","crispEdges")}return Q[ga]}function f(ga){return ga<0?Math.min((1+ga)*0.5,0.5):0.5+Math.min(ga*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,o,z,q,t,B,D,G=new THREE.Rectangle,v=new THREE.Rectangle,E=!1,w=new THREE.Color(16777215),J=new THREE.Color(16777215),
- I=new THREE.Color(0),e=new THREE.Color(0),M=new THREE.Color(0),N,U=new THREE.Vector3,Q=[],Z=[],ca=[],K,W,la,ba,na=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ga){switch(ga){case "high":na=1;break;case "low":na=0}};this.setSize=function(ga,ha){k=ga;m=ha;o=k/2;z=m/2;j.setAttribute("viewBox",-o+" "+-z+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);G.set(-o,-z,o,z)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};
- this.render=function(ga,ha){var qa,wa,l,x,y,n,p,C;this.autoClear&&this.clear();g=h.projectScene(ga,ha,this.sortElements);ba=la=W=0;if(E=ga.lights.length>0){p=ga.lights;I.setRGB(0,0,0);e.setRGB(0,0,0);M.setRGB(0,0,0);qa=0;for(wa=p.length;qa<wa;qa++){l=p[qa];x=l.color;if(l instanceof THREE.AmbientLight){I.r+=x.r;I.g+=x.g;I.b+=x.b}else if(l instanceof THREE.DirectionalLight){e.r+=x.r;e.g+=x.g;e.b+=x.b}else if(l instanceof THREE.PointLight){M.r+=x.r;M.g+=x.g;M.b+=x.b}}}qa=0;for(wa=g.length;qa<wa;qa++){p=
- g[qa];v.empty();if(p instanceof THREE.RenderableParticle){q=p;q.x*=o;q.y*=-z;l=0;for(x=p.materials.length;l<x;l++)if(C=p.materials[l]){y=q;n=p;var F=la++;if(Z[F]==null){Z[F]=document.createElementNS("http://www.w3.org/2000/svg","circle");na==0&&Z[F].setAttribute("shape-rendering","crispEdges")}K=Z[F];K.setAttribute("cx",y.x);K.setAttribute("cy",y.y);K.setAttribute("r",n.scale.x*o);if(C instanceof THREE.ParticleCircleMaterial){if(E){J.r=I.r+e.r+M.r;J.g=I.g+e.g+M.g;J.b=I.b+e.b+M.b;w.r=C.color.r*J.r;
- w.g=C.color.g*J.g;w.b=C.color.b*J.b;w.updateStyleString()}else w=C.color;K.setAttribute("style","fill: "+w.__styleString)}j.appendChild(K)}}else if(p instanceof THREE.RenderableLine){q=p.v1;t=p.v2;q.positionScreen.x*=o;q.positionScreen.y*=-z;t.positionScreen.x*=o;t.positionScreen.y*=-z;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);if(G.instersects(v)){l=0;for(x=p.materials.length;l<x;)if(C=p.materials[l++]){y=q;n=t;F=ba++;if(ca[F]==null){ca[F]=
- document.createElementNS("http://www.w3.org/2000/svg","line");na==0&&ca[F].setAttribute("shape-rendering","crispEdges")}K=ca[F];K.setAttribute("x1",y.positionScreen.x);K.setAttribute("y1",y.positionScreen.y);K.setAttribute("x2",n.positionScreen.x);K.setAttribute("y2",n.positionScreen.y);if(C instanceof THREE.LineBasicMaterial){w.__styleString=C.color.__styleString;K.setAttribute("style","fill: none; stroke: "+w.__styleString+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+
- C.linecap+"; stroke-linejoin: "+C.linejoin);j.appendChild(K)}}}}else if(p instanceof THREE.RenderableFace3){q=p.v1;t=p.v2;B=p.v3;q.positionScreen.x*=o;q.positionScreen.y*=-z;t.positionScreen.x*=o;t.positionScreen.y*=-z;B.positionScreen.x*=o;B.positionScreen.y*=-z;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(B.positionScreen.x,B.positionScreen.y);if(G.instersects(v)){l=0;for(x=p.meshMaterials.length;l<x;){C=p.meshMaterials[l++];if(C instanceof
- THREE.MeshFaceMaterial){y=0;for(n=p.faceMaterials.length;y<n;)(C=p.faceMaterials[y++])&&b(q,t,B,p,C,ga)}else C&&b(q,t,B,p,C,ga)}}}else if(p instanceof THREE.RenderableFace4){q=p.v1;t=p.v2;B=p.v3;D=p.v4;q.positionScreen.x*=o;q.positionScreen.y*=-z;t.positionScreen.x*=o;t.positionScreen.y*=-z;B.positionScreen.x*=o;B.positionScreen.y*=-z;D.positionScreen.x*=o;D.positionScreen.y*=-z;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(B.positionScreen.x,
- B.positionScreen.y);v.addPoint(D.positionScreen.x,D.positionScreen.y);if(G.instersects(v)){l=0;for(x=p.meshMaterials.length;l<x;){C=p.meshMaterials[l++];if(C instanceof THREE.MeshFaceMaterial){y=0;for(n=p.faceMaterials.length;y<n;)(C=p.faceMaterials[y++])&&c(q,t,B,D,p,C,ga)}else C&&c(q,t,B,D,p,C,ga)}}}}}};
- THREE.WebGLRenderer=function(a){function b(l,x,y){var n,p,C,F=l.vertices,O=F.length,T=l.colors,u=T.length,A=l.__vertexArray,H=l.__colorArray,S=l.__sortArray,X=l.__dirtyVertices,da=l.__dirtyColors;if(y.sortParticles){la.multiplySelf(y.matrixWorld);for(n=0;n<O;n++){p=F[n].position;ga.copy(p);la.multiplyVector3(ga);S[n]=[ga.z,n]}S.sort(function(ja,xa){return xa[0]-ja[0]});for(n=0;n<O;n++){p=F[S[n][1]].position;C=n*3;A[C]=p.x;A[C+1]=p.y;A[C+2]=p.z}for(n=0;n<u;n++){C=n*3;color=T[S[n][1]];H[C]=color.r;
- H[C+1]=color.g;H[C+2]=color.b}}else{if(X)for(n=0;n<O;n++){p=F[n].position;C=n*3;A[C]=p.x;A[C+1]=p.y;A[C+2]=p.z}if(da)for(n=0;n<u;n++){color=T[n];C=n*3;H[C]=color.r;H[C+1]=color.g;H[C+2]=color.b}}if(X||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,A,x)}if(da||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,H,x)}}function c(l,x){l.fragmentShader=x.fragmentShader;l.vertexShader=x.vertexShader;l.uniforms=
- Uniforms.clone(x.uniforms)}function d(l,x,y,n,p){n.program||U.initMaterial(n,x,y);var C=n.program,F=C.uniforms,O=n.uniforms;if(C!=M){e.useProgram(C);M=C;e.uniformMatrix4fv(F.projectionMatrix,!1,ba)}if(y&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){O.fogColor.value.setHex(y.color.hex);if(y instanceof THREE.Fog){O.fogNear.value=y.near;O.fogFar.value=
- y.far}else if(y instanceof THREE.FogExp2)O.fogDensity.value=y.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){var T,u,A=0,H=0,S=0,X,da,ja,xa=U.lights,P=xa.directional.colors,Ea=xa.directional.positions,ma=xa.point.colors,Aa=xa.point.positions,$=0,Y=0;y=u=u=0;for(T=x.length;y<T;y++){u=x[y];X=u.color;da=u.position;ja=u.intensity;if(u instanceof THREE.AmbientLight){A+=X.r;H+=X.g;S+=X.b}else if(u instanceof THREE.DirectionalLight){u=$*3;P[u]=X.r*ja;P[u+1]=X.g*
- ja;P[u+2]=X.b*ja;Ea[u]=da.x;Ea[u+1]=da.y;Ea[u+2]=da.z;$+=1}else if(u instanceof THREE.PointLight){u=Y*3;ma[u]=X.r*ja;ma[u+1]=X.g*ja;ma[u+2]=X.b*ja;Aa[u]=da.x;Aa[u+1]=da.y;Aa[u+2]=da.z;Y+=1}}for(y=$*3;y<P.length;y++)P[y]=0;for(y=Y*3;y<ma.length;y++)ma[y]=0;xa.point.length=Y;xa.directional.length=$;xa.ambient[0]=A;xa.ambient[1]=H;xa.ambient[2]=S;x=U.lights;O.enableLighting.value=x.directional.length+x.point.length;O.ambientLightColor.value=x.ambient;O.directionalLightColor.value=x.directional.colors;
- O.directionalLightDirection.value=x.directional.positions;O.pointLightColor.value=x.point.colors;O.pointLightPosition.value=x.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){O.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);O.opacity.value=n.opacity;O.map.texture=n.map;O.lightMap.texture=n.lightMap;O.envMap.texture=n.envMap;O.reflectivity.value=n.reflectivity;O.refractionRatio.value=
- n.refractionRatio;O.combine.value=n.combine;O.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){O.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);O.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){O.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);O.opacity.value=n.opacity;O.size.value=n.size;O.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){O.ambient.value.setRGB(n.ambient.r,
- n.ambient.g,n.ambient.b);O.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);O.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){O.mNear.value=l.near;O.mFar.value=l.far;O.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)O.opacity.value=n.opacity;for(var aa in O)if(A=C.uniforms[aa]){y=O[aa];T=y.type;x=y.value;if(T=="i")e.uniform1i(A,x);else if(T=="f")e.uniform1f(A,x);else if(T=="fv1")e.uniform1fv(A,x);else if(T=="fv")e.uniform3fv(A,x);else if(T==
- "v2")e.uniform2f(A,x.x,x.y);else if(T=="v3")e.uniform3f(A,x.x,x.y,x.z);else if(T=="c")e.uniform3f(A,x.r,x.g,x.b);else if(T=="t"){e.uniform1i(A,x);if(y=y.texture)if(y.image instanceof Array&&y.image.length==6){if(y.image.length==6){if(y.needsUpdate){if(!y.image.__webGLTextureCube)y.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,y.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,
- e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(T=0;T<6;++T)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+T,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image[T]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);y.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,y.image.__webGLTextureCube)}}else{if(y.needsUpdate){if(y.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
- y.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,J(y.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,J(y.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,J(y.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,J(y.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{y.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
- 0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,J(y.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,J(y.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,J(y.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,J(y.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);y.__wasSetOnce=!0}y.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_2D,y.__webGLTexture)}}}e.uniformMatrix4fv(F.modelViewMatrix,
- !1,p._modelViewMatrixArray);e.uniformMatrix3fv(F.normalMatrix,!1,p._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&e.uniform3f(F.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&e.uniformMatrix4fv(F.objectMatrix,!1,p._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&e.uniformMatrix4fv(F.viewMatrix,
- !1,na);if(n.skinning){e.uniformMatrix4fv(F.cameraInverseMatrix,!1,na);e.uniformMatrix4fv(F.boneGlobalMatrices,!1,p.boneMatrices)}return C}function f(l,x,y,n,p,C){l=d(l,x,y,n,C).attributes;e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,
- 3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(p.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
- if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
- 4,e.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(C,0,p.__webGLLineCount)}else if(C instanceof
- THREE.ParticleSystem)e.drawArrays(e.POINTS,0,p.__webGLParticleCount);else C instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,p.__webGLVertexCount)}function g(l,x){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.position);e.vertexAttribPointer(x.attributes.position,
- 3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.normal);e.vertexAttribPointer(x.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(Q!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);Q=l.doubleSided}if(Z!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);Z=l.flipSided}}function j(l){if(K!=
- l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);K=l}}function k(l){W[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);W[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);W[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);W[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);W[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);W[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var x;for(l=0;l<6;l++){x=W[l];x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z))}}
- function m(l){for(var x=l.matrixWorld,y=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=W[n].x*x.n14+W[n].y*x.n24+W[n].z*x.n34+W[n].w;if(l<=y)return!1}return!0}function o(l,x){l.list[l.count]=x;l.count+=1}function z(l){var x,y,n=l.object,p=l.opaque,C=l.transparent;C.count=0;l=p.count=0;for(x=n.materials.length;l<x;l++){y=n.materials[l];y.opacity&&y.opacity<1||y.blending!=THREE.NormalBlending?o(C,y):o(p,y)}}function q(l){var x,y,n,p,C=l.object,F=l.buffer,
- O=l.opaque,T=l.transparent;T.count=0;l=O.count=0;for(n=C.materials.length;l<n;l++){x=C.materials[l];if(x instanceof THREE.MeshFaceMaterial){x=0;for(y=F.materials.length;x<y;x++)(p=F.materials[x])&&(p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?o(T,p):o(O,p))}else{p=x;p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?o(T,p):o(O,p)}}}function t(l,x){return x.z-l.z}function B(l,x){l._modelViewMatrix.multiplyToArray(x.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
- function D(l){function x(H){var S=[];y=0;for(n=H.length;y<n;y++)H[y]==undefined?S.push("undefined"):S.push(H[y].id);return S.join("_")}var y,n,p,C,F,O,T,u,A={};l.geometryGroups={};p=0;for(C=l.faces.length;p<C;p++){F=l.faces[p];O=F.materials;T=x(O);A[T]==undefined&&(A[T]={hash:T,counter:0});u=A[T].hash+"_"+A[T].counter;l.geometryGroups[u]==undefined&&(l.geometryGroups[u]={faces:[],materials:O,vertices:0});F=F instanceof THREE.Face3?3:4;if(l.geometryGroups[u].vertices+F>65535){A[T].counter+=1;u=A[T].hash+
- "_"+A[T].counter;l.geometryGroups[u]==undefined&&(l.geometryGroups[u]={faces:[],materials:O,vertices:0})}l.geometryGroups[u].faces.push(p);l.geometryGroups[u].vertices+=F}}function G(l,x,y){l.push({buffer:x,object:y,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);
- e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function E(l,x){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,
- e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,J(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,J(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,J(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,J(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,J(l.format),l.width,l.height,0,J(l.format),J(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,
- e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,n,p;if(l){y=l.__webGLFramebuffer;n=l.width;p=l.height}else{y=null;n=I.width;p=I.height}if(y!=N){e.bindFramebuffer(e.FRAMEBUFFER,y);e.viewport(0,0,n,p);x&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);N=y}}function w(l,x){var y;if(l==
- "fragment")y=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(y=e.createShader(e.VERTEX_SHADER));e.shaderSource(y,x);e.compileShader(y);if(!e.getShaderParameter(y,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(y));return null}return y}function J(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;
- case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;
- case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var I=document.createElement("canvas"),e,M=null,N=null,U=this,Q=null,Z=null,ca=null,K=null,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],la=new THREE.Matrix4,ba=new Float32Array(16),na=new Float32Array(16),ga=new THREE.Vector4,
- ha=!0,qa=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)ha=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=I;this.autoClear=!0;this.sortObjects=!1;(function(l,x,y){try{e=I.getContext("experimental-webgl",{antialias:l})}catch(n){console.log(n)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
- e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(x.r,x.g,x.b,y);_cullEnabled=!0})(ha,qa,wa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,x){I.width=l;I.height=x;e.viewport(0,0,I.width,I.height)};this.setClearColorHex=function(l,x){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,x)};this.setClearColor=function(l,x){e.clearColor(l.r,l.g,l.b,x)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
- e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,x,y){var n,p;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
- THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var C,F,O,T;p=O=T=0;for(C=x.length;p<C;p++){F=x[p];F instanceof THREE.DirectionalLight&&O++;F instanceof THREE.PointLight&&T++}if(T+O<=4)x=O;else{x=Math.ceil(4*O/(T+O));T=4-x}p={directional:x,point:T};T=l.fragmentShader;x=l.vertexShader;C={fog:y,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:p.directional,maxPointLights:p.point};y=e.createProgram();p=["#ifdef GL_ES\nprecision highp float;\n#endif",
- "#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.fog?"#define USE_FOG":"",C.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");C=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+
- C.maxPointLights,C.map?"#define USE_MAP":"",C.envMap?"#define USE_ENVMAP":"",C.lightMap?"#define USE_LIGHTMAP":"",C.vertexColors?"#define USE_COLOR":"",C.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
- e.attachShader(y,w("fragment",p+T));e.attachShader(y,w("vertex",C+x));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(n in l.uniforms)y.push(n);n=l.program;T=0;for(x=y.length;T<
- x;T++){p=y[T];n.uniforms[p]=e.getUniformLocation(n,p)}n=l.program;y=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];T=0;for(x=y.length;T<x;T++){p=y[T];n.attributes[p]=e.getAttribLocation(n,p)}n=l.program.attributes;e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);if(l.skinning&&n.skinVertexA>=0&&n.skinVertexB>=
- 0&&n.skinIndex>=0&&n.skinWeight>=0){e.enableVertexAttribArray(n.skinVertexA);e.enableVertexAttribArray(n.skinVertexB);e.enableVertexAttribArray(n.skinIndex);e.enableVertexAttribArray(n.skinWeight)}};this.render=function(l,x,y,n){var p,C,F,O,T,u,A,H,S=l.lights,X=l.fog;x.matrixAutoUpdate&&x.update();x.matrixWorldInverse.flattenToArray(na);x.projectionMatrix.flattenToArray(ba);la.multiply(x.projectionMatrix,x.matrixWorldInverse);k(la);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,
- !1,x);this.initWebGLObjects(l,x);E(y,n!==undefined?n:!0);this.autoClear&&this.clear();T=l.__webglObjects.length;for(n=0;n<T;n++){p=l.__webglObjects[n];A=p.object;if(A.visible)if(!(A instanceof THREE.Mesh)||m(A)){A.matrixWorld.flattenToArray(A._objectMatrixArray);B(A,x);q(p);p.render=!0;if(this.sortObjects){ga.copy(A.position);la.multiplyVector3(ga);p.z=ga.z}}else p.render=!1;else p.render=!1}this.sortObjects&&l.__webglObjects.sort(t);u=l.__webglObjectsImmediate.length;for(n=0;n<u;n++){p=l.__webglObjectsImmediate[n];
- A=p.object;if(A.visible){A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray);B(A,x);z(p)}}v(THREE.NormalBlending);for(n=0;n<T;n++){p=l.__webglObjects[n];if(p.render){A=p.object;H=p.buffer;F=p.opaque;h(A);for(p=0;p<F.count;p++){O=F.list[p];j(O.depthTest);f(x,S,X,O,H,A)}}}for(n=0;n<u;n++){p=l.__webglObjectsImmediate[n];A=p.object;if(A.visible){F=p.opaque;h(A);for(p=0;p<F.count;p++){O=F.list[p];j(O.depthTest);C=d(x,S,X,O,A);A.render(function(da){g(da,C)})}}}for(n=0;n<T;n++){p=l.__webglObjects[n];
- if(p.render){A=p.object;H=p.buffer;F=p.transparent;h(A);for(p=0;p<F.count;p++){O=F.list[p];v(O.blending);j(O.depthTest);f(x,S,X,O,H,A)}}}for(n=0;n<u;n++){p=l.__webglObjectsImmediate[n];A=p.object;if(A.visible){F=p.transparent;h(A);for(p=0;p<F.count;p++){O=F.list[p];v(O.blending);j(O.depthTest);C=d(x,S,X,O,A);A.render(function(da){g(da,C)})}}}if(y&&y.minFilter!==THREE.NearestFilter&&y.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
- null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsRemoved.length;){var x=l.__objectsRemoved[0],y=l,n=void 0,p=void 0;for(n=y.__webglObjects.length-1;n>=0;n--){p=y.__webglObjects[n].object;x==p&&y.__webglObjects.splice(n,1)}l.__objectsRemoved.splice(0,1)}for(;l.__objectsAdded.length;){x=l.__objectsAdded[0];var C=l;n=void 0;y=void 0;p=void 0;if(x._modelViewMatrix==undefined){x._modelViewMatrix=new THREE.Matrix4;x._normalMatrixArray=
- new Float32Array(9);x._modelViewMatrixArray=new Float32Array(16);x._objectMatrixArray=new Float32Array(16);x.matrixWorld.flattenToArray(x._objectMatrixArray)}objlist=C.__webglObjects;if(x instanceof THREE.Mesh){y=x.geometry;y.geometryGroups==undefined&&D(y);for(n in y.geometryGroups){p=y.geometryGroups[n];if(!p.__webGLVertexBuffer){C=p;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=
- e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=p;var F=x,O=void 0,T=void 0,u=0,A=0,H=0,S=F.geometry.faces,X=C.faces;O=0;for(T=X.length;O<T;O++){fi=X[O];face=S[fi];if(face instanceof THREE.Face3){u+=3;A+=1;H+=3}else if(face instanceof THREE.Face4){u+=
- 4;A+=2;H+=4}}C.__vertexArray=new Float32Array(u*3);C.__normalArray=new Float32Array(u*3);C.__tangentArray=new Float32Array(u*4);C.__colorArray=new Float32Array(u*3);C.__uvArray=new Float32Array(u*2);C.__uv2Array=new Float32Array(u*2);C.__skinVertexAArray=new Float32Array(u*4);C.__skinVertexBArray=new Float32Array(u*4);C.__skinIndexArray=new Float32Array(u*4);C.__skinWeightArray=new Float32Array(u*4);C.__faceArray=new Uint16Array(A*3);C.__lineArray=new Uint16Array(H*2);T=O=C;u=void 0;S=void 0;var da=
- void 0,ja=void 0;da=void 0;X=!1;u=0;for(S=F.materials.length;u<S;u++){da=F.materials[u];if(da instanceof THREE.MeshFaceMaterial){da=0;for(ja=T.materials.length;da<ja;da++)if(T.materials[da]&&T.materials[da].shading!=undefined&&T.materials[da].shading==THREE.SmoothShading){X=!0;break}}else if(da&&da.shading!=undefined&&da.shading==THREE.SmoothShading){X=!0;break}if(X)break}O.__needsSmoothNormals=X;C.__webGLFaceCount=A*3;C.__webGLLineCount=H*2;y.__dirtyVertices=!0;y.__dirtyElements=!0;y.__dirtyUvs=
- !0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}G(objlist,p,x)}}else if(x instanceof THREE.Ribbon){y=x.geometry;if(!y.__webGLVertexBuffer){n=y;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=y;p=n.vertices.length;n.__vertexArray=new Float32Array(p*3);n.__colorArray=new Float32Array(p*3);n.__webGLVertexCount=p;y.__dirtyVertices=!0;y.__dirtyColors=!0}G(objlist,y,x)}else if(x instanceof THREE.Line){y=x.geometry;if(!y.__webGLVertexBuffer){n=y;n.__webGLVertexBuffer=
- e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=y;p=n.vertices.length;n.__vertexArray=new Float32Array(p*3);n.__colorArray=new Float32Array(p*3);n.__webGLLineCount=p;y.__dirtyVertices=!0;y.__dirtyColors=!0}G(objlist,y,x)}else if(x instanceof THREE.ParticleSystem){y=x.geometry;if(!y.__webGLVertexBuffer){n=y;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=y;p=n.vertices.length;n.__vertexArray=new Float32Array(p*3);n.__colorArray=new Float32Array(p*3);n.__sortArray=
- [];n.__webGLParticleCount=p;y.__dirtyVertices=!0;y.__dirtyColors=!0}G(objlist,y,x)}else THREE.MarchingCubes!==undefined&&x instanceof THREE.MarchingCubes&&C.__webglObjectsImmediate.push({object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,1)}x=0;for(y=l.__webglObjects.length;x<y;x++){p=void 0;n=void 0;A=void 0;C=void 0;C=l.__webglObjects[x].object;if(C instanceof THREE.Mesh){n=C.geometry;for(p in n.geometryGroups){A=n.geometryGroups[p];if(n.__dirtyVertices||
- n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){H=e.DYNAMIC_DRAW;O=void 0;T=void 0;var xa=void 0,P=void 0,Ea=void 0,ma=void 0,Aa=void 0;xa=void 0;var $=void 0,Y=void 0,aa=void 0,ta=void 0;$=void 0;Y=void 0;aa=void 0;P=void 0;$=void 0;Y=void 0;aa=void 0;ta=void 0;$=void 0;Y=void 0;aa=void 0;ta=void 0;$=void 0;Y=void 0;aa=void 0;ta=void 0;$=void 0;Y=void 0;aa=void 0;ta=void 0;$=void 0;Y=void 0;aa=void 0;ta=void 0;P=void 0;ma=void 0;Ea=void 0;Aa=void 0;var ua=ja=
- da=X=S=u=F=0,Ga=0,za=0,L=0,Ba=A.__vertexArray,Pa=A.__uvArray,Qa=A.__uv2Array,Ka=A.__normalArray,sa=A.__tangentArray,Ca=A.__colorArray,ka=A.__skinVertexAArray,oa=A.__skinVertexBArray,ra=A.__skinIndexArray,va=A.__skinWeightArray,Ma=A.__faceArray,Ia=A.__lineArray,R=A.__needsSmoothNormals,fa=C.geometry,ia=fa.__dirtyVertices,V=fa.__dirtyElements,ea=fa.__dirtyUvs,pa=fa.__dirtyNormals,Da=fa.__dirtyTangents,Fa=fa.__dirtyColors,ya=fa.vertices,Na=A.faces,La=fa.faces,Oa=fa.uvs,Sa=fa.uvs2,Ha=fa.colors,Ja=fa.skinVerticesA,
- Ta=fa.skinVerticesB,Ua=fa.skinIndices,Ra=fa.skinWeights;O=0;for(T=Na.length;O<T;O++){xa=Na[O];P=La[xa];Aa=Oa[xa];xa=Sa[xa];Ea=P.vertexNormals;ma=P.normal;if(P instanceof THREE.Face3){if(ia){$=ya[P.a].position;Y=ya[P.b].position;aa=ya[P.c].position;Ba[u]=$.x;Ba[u+1]=$.y;Ba[u+2]=$.z;Ba[u+3]=Y.x;Ba[u+4]=Y.y;Ba[u+5]=Y.z;Ba[u+6]=aa.x;Ba[u+7]=aa.y;Ba[u+8]=aa.z;u+=9}if(Ra.length){$=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sa[ua+4]=Y.x;sa[ua+5]=Y.y;sa[ua+6]=Y.z;sa[ua+7]=Y.w;sa[ua+8]=aa.x;sa[ua+9]=aa.y;sa[ua+10]=aa.z;sa[ua+11]=aa.w;sa[ua+12]=P.x;sa[ua+13]=P.y;sa[ua+14]=P.z;sa[ua+15]=P.w;ua+=16}if(pa)if(Ea.length==4&&R)for(P=0;P<4;P++){ma=Ea[P];Ka[ja]=ma.x;Ka[ja+1]=ma.y;Ka[ja+2]=ma.z;ja+=3}else for(P=0;P<4;P++){Ka[ja]=ma.x;Ka[ja+1]=ma.y;Ka[ja+2]=ma.z;ja+=3}if(ea&&Aa)for(P=0;P<4;P++){Ea=Aa[P];Pa[S]=Ea.u;Pa[S+1]=Ea.v;S+=2}if(ea&&xa)for(P=0;P<4;P++){Aa=xa[P];Qa[X]=Aa.u;Qa[X+1]=Aa.v;X+=2}if(V){Ma[da]=
- F;Ma[da+1]=F+1;Ma[da+2]=F+2;Ma[da+3]=F;Ma[da+4]=F+2;Ma[da+5]=F+3;da+=6;Ia[Ga]=F;Ia[Ga+1]=F+1;Ia[Ga+2]=F;Ia[Ga+3]=F+3;Ia[Ga+4]=F+1;Ia[Ga+5]=F+2;Ia[Ga+6]=F+2;Ia[Ga+7]=F+3;Ga+=8;F+=4}}}if(ia){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,H)}if(Fa&&Ha.length){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Ca,H)}if(pa){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,H)}if(Da&&fa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
- A.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,sa,H)}if(ea&&S>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,H)}if(ea&&X>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Qa,H)}if(V){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ma,H);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,H)}if(L>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);
- e.bufferData(e.ARRAY_BUFFER,ka,H);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,oa,H);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ra,H);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,H)}}}n.__dirtyVertices=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(C instanceof THREE.Ribbon){n=C.geometry;if(n.__dirtyVertices||n.__dirtyColors){p=
- n;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;u=void 0;A=void 0;S=p.vertices;H=p.colors;X=S.length;O=H.length;da=p.__vertexArray;T=p.__colorArray;ja=p.__dirtyColors;if(p.__dirtyVertices){for(F=0;F<X;F++){u=S[F].position;A=F*3;da[A]=u.x;da[A+1]=u.y;da[A+2]=u.z}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,da,C)}if(ja){for(F=0;F<O;F++){color=H[F];A=F*3;T[A]=color.r;T[A+1]=color.g;T[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,C)}}n.__dirtyVertices=
- !1;n.__dirtyColors=!1}else if(C instanceof THREE.Line){n=C.geometry;if(n.__dirtyVertices||n.__dirtyColors){p=n;C=e.DYNAMIC_DRAW;F=void 0;F=void 0;u=void 0;A=void 0;S=p.vertices;H=p.colors;X=S.length;O=H.length;da=p.__vertexArray;T=p.__colorArray;ja=p.__dirtyColors;if(p.__dirtyVertices){for(F=0;F<X;F++){u=S[F].position;A=F*3;da[A]=u.x;da[A+1]=u.y;da[A+2]=u.z}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,da,C)}if(ja){for(F=0;F<O;F++){color=H[F];A=F*3;T[A]=color.r;T[A+
- 1]=color.g;T[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,C)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(C instanceof THREE.ParticleSystem){n=C.geometry;(n.__dirtyVertices||n.__dirtyColors||C.sortParticles)&&b(n,e.DYNAMIC_DRAW,C);n.__dirtyVertices=!1;n.__dirtyColors=!1}}};this.setFaceCulling=function(l,x){if(l){!x||x=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);
- e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
- THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
- lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\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#else\ngl_Position = projectionMatrix * mvPosition;\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)}},lights:{enableLighting:{type:"i",
- value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},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.Snippets.color_pars_fragment,
- THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
- THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
- THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
- THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_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.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
- THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
- THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.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.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;",
- THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
- THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
- THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
- THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
- var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,j=a.faces,k=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,z=h.length;o<z;o++){var q=new THREE.Vertex(h[o].position.clone());c&&b.matrix.multiplyVector3(q.position);g.push(q)}o=0;for(z=k.length;o<z;o++){h=k[o];var t,B=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
- d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=B.length;c<g;c++){q=B[c];t.vertexNormals.push(q.clone())}t.materials=h.materials.slice();j.push(t)}o=0;for(z=f.length;o<z;o++){d=f[o];j=[];c=0;for(g=d.length;c<g;c++)j.push(new THREE.UV(d[c].u,d[c].v));m.push(j)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
- b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in M.objects)if(!K.objects[o]){D=M.objects[o];if(w=K.geometries[D.geometry]){e=[];for(i=0;i<D.materials.length;i++)e[i]=K.materials[D.materials[i]];G=D.position;r=D.rotation;s=D.scale;object=new THREE.Mesh(w,e);object.position.set(G[0],
- G[1],G[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;K.scene.addObject(object);K.objects[o]=object}}}function h(W){return function(la){K.geometries[W]=la;g();U-=1;j()}}function j(){d({total_models:Z,total_textures:ca,loaded_models:Z-U,loaded_textures:ca-Q},K);U==0&&Q==0&&c(K)}var k,m,o,z,q,t,B,D,G,v,E,w,J,I,e,M,N,U,Q,Z,ca,K;M=f.data;N=new THREE.Loader;Q=U=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
- fogs:{}};f=function(){Q-=1;j()};for(q in M.cameras){v=M.cameras[q];if(v.type=="perspective")J=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){J=new THREE.Camera;J.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}G=v.position;v=v.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(v[0],v[1],v[2]);K.cameras[q]=J}for(z in M.lights){q=M.lights[z];if(q.type=="directional"){G=q.direction;light=new THREE.DirectionalLight;light.position.set(G[0],
- G[1],G[2]);light.position.normalize()}else if(q.type=="point"){G=q.position;light=new THREE.PointLight;light.position.set(G[0],G[1],G[2])}v=q.color;i=q.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);K.scene.addLight(light);K.lights[z]=light}for(t in M.fogs){z=M.fogs[t];if(z.type=="linear")I=new THREE.Fog(0,z.near,z.far);else z.type=="exp2"&&(I=new THREE.FogExp2(0,z.density));v=z.color;I.color.setRGB(v[0],v[1],v[2]);K.fogs[t]=I}if(K.cameras&&M.defaults.camera)K.currentCamera=K.cameras[M.defaults.camera];
- if(K.fogs&&M.defaults.fog)K.scene.fog=K.fogs[M.defaults.fog];v=M.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(v[0],v[1],v[2]);K.bgColorAlpha=M.defaults.bgalpha;for(k in M.geometries){t=M.geometries[k];if(t.type=="bin_mesh"||t.type=="ascii_mesh")U+=1}Z=U;for(k in M.geometries){t=M.geometries[k];if(t.type=="cube"){w=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,null,t.flipped,t.sides);K.geometries[k]=w}else if(t.type=="plane"){w=new Plane(t.width,t.height,t.segmentsWidth,
- t.segmentsHeight);K.geometries[k]=w}else if(t.type=="sphere"){w=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);K.geometries[k]=w}else if(t.type=="cylinder"){w=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);K.geometries[k]=w}else if(t.type=="torus"){w=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);K.geometries[k]=w}else if(t.type=="icosahedron"){w=new Icosahedron(t.subdivisions);K.geometries[k]=w}else if(t.type=="bin_mesh")N.loadBinary({model:t.url,callback:h(k)});
- else t.type=="ascii_mesh"&&N.loadAscii({model:t.url,callback:h(k)})}for(B in M.textures){k=M.textures[B];Q+=k.url instanceof Array?k.url.length:1}ca=Q;for(B in M.textures){k=M.textures[B];if(k.mapping!=undefined&&THREE[k.mapping]!=undefined)k.mapping=new THREE[k.mapping];if(k.url instanceof Array)t=ImageUtils.loadTextureCube(k.url,k.mapping,f);else{t=ImageUtils.loadTexture(k.url,k.mapping,f);if(THREE[k.minFilter]!=undefined)t.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=undefined)t.magFilter=
- THREE[k.magFilter]}K.textures[B]=t}for(m in M.materials){B=M.materials[m];for(E in B.parameters)if(E=="envMap"||E=="map"||E=="lightMap")B.parameters[E]=K.textures[B.parameters[E]];else if(E=="shading")B.parameters[E]=B.parameters[E]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(E=="blending")B.parameters[E]=THREE[B.parameters[E]]?THREE[B.parameters[E]]:THREE.NormalBlending;else E=="combine"&&(B.parameters[E]=B.parameters[E]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);B=new THREE[B.type](B.parameters);
- K.materials[m]=B}g();b(K)}},addMesh:function(a,b,c,d,f,g,h,j,k,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=j;b.rotation.z=k;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,1,null,!0),c);a.addObject(b);
- return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
- a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
- SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
- vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
- normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
- uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
- vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
- cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
- value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
- film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
- screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
- fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,j,k){function m(G,v,E,w,J,I,e,M){var N,U,Q=d||1,Z=f||1,ca=J/2,K=I/2,W=o.vertices.length;if(G=="x"&&v=="y"||G=="y"&&v=="x")N="z";else if(G=="x"&&v=="z"||G=="z"&&v=="x"){N="y";Z=g||1}else if(G=="z"&&v==
- "y"||G=="y"&&v=="z"){N="x";Q=g||1}var la=Q+1,ba=Z+1;J/=Q;var na=I/Z;for(U=0;U<ba;U++)for(I=0;I<la;I++){var ga=new THREE.Vector3;ga[G]=(I*J-ca)*E;ga[v]=(U*na-K)*w;ga[N]=e;o.vertices.push(new THREE.Vertex(ga))}for(U=0;U<Z;U++)for(I=0;I<Q;I++){o.faces.push(new THREE.Face4(I+la*U+W,I+la*(U+1)+W,I+1+la*(U+1)+W,I+1+la*U+W,null,M));o.uvs.push([new THREE.UV(I/Q,U/Z),new THREE.UV(I/Q,(U+1)/Z),new THREE.UV((I+1)/Q,(U+1)/Z),new THREE.UV((I+1)/Q,U/Z)])}}THREE.Geometry.call(this);var o=this,z=a/2,q=b/2,t=c/2;
- j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var D in k)this.sides[D]!=undefined&&(this.sides[D]=k[D]);this.sides.px&&m("z","y",1*j,-1,c,b,-z,this.materials[0]);this.sides.nx&&m("z","y",-1*j,-1,c,b,z,this.materials[1]);this.sides.py&&m("x","z",1*j,1,a,c,q,this.materials[2]);this.sides.ny&&m("x","z",1*j,-1,a,c,-q,this.materials[3]);
- this.sides.pz&&m("x","y",1*j,-1,a,b,t,this.materials[4]);this.sides.nz&&m("x","y",-1*j,-1,a,b,-t,this.materials[5]);(function(){for(var G=[],v=[],E=0,w=o.vertices.length;E<w;E++){for(var J=o.vertices[E],I=!1,e=0,M=G.length;e<M;e++){var N=G[e];if(J.position.x==N.position.x&&J.position.y==N.position.y&&J.position.z==N.position.z){v[E]=e;I=!0;break}}if(!I){v[E]=G.length;G.push(new THREE.Vertex(J.position.clone()))}}E=0;for(w=o.faces.length;E<w;E++){J=o.faces[E];J.a=v[J.a];J.b=v[J.b];J.c=v[J.c];J.d=v[J.d]}o.vertices=
- G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,b,c,d,f){function g(m,o,z){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,z)))}THREE.Geometry.call(this);var h=this,j=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*b,Math.cos(2*j*k/a)*b,0);for(k=0;k<a;k++)g(Math.sin(2*j*k/a)*c,Math.cos(2*j*k/a)*c,d);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(c!=0){g(0,0,-f);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(k=a+a/2;k<
- 2*a;k++)h.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var j=c+1,k=d+1;a/=c;var m=b/d;for(f=0;f<k;f++)for(b=0;b<j;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+j*f,b+j*(f+1),b+1+j*(f+1),b+1+j*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var j=a*Math.cos(d*f),k=a*Math.sin(d*f),m=[],o=0;for(d=0;d<g;d++){var z=2*d/g,q=k*Math.sin(z*f);z=k*Math.cos(z*f);(c==0||c==h)&&d>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,j,q)))-1);m.push(o)}b.push(m)}var t,B,D;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];j=b[c][m?g-1:d];k=b[c-1][m?g-1:d];m=b[c-1][m?
- 0:d+1];q=c/(f-1);t=(c-1)/(f-1);B=(d+1)/g;z=d/g;o=new THREE.UV(1-B,q);q=new THREE.UV(1-z,q);z=new THREE.UV(1-z,t);var G=new THREE.UV(1-B,t);if(c<b.length-1){t=this.vertices[h].position.clone();B=this.vertices[j].position.clone();D=this.vertices[k].position.clone();t.normalize();B.normalize();D.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([o,q,z])}if(c>1){t=this.vertices[h].position.clone();
- B=this.vertices[k].position.clone();D=this.vertices[m].position.clone();t.normalize();B.normalize();D.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(D.x,D.y,D.z)]));this.uvs.push([o,z,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
- 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
- var Icosahedron=function(a){function b(z,q,t){var B=Math.sqrt(z*z+q*q+t*t);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(z/B,q/B,t/B)))-1}function c(z,q,t,B){B.faces.push(new THREE.Face3(z,q,t))}function d(z,q){var t=f.vertices[z].position,B=f.vertices[q].position;return b((t.x+B.x)/2,(t.y+B.y)/2,(t.z+B.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
- 1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),m=d(g.faces[j].b,g.faces[j].c),o=d(g.faces[j].c,g.faces[j].a);c(g.faces[j].a,k,o,h);c(g.faces[j].b,m,k,h);c(g.faces[j].c,
- o,m,h);c(k,m,o,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));f[j]=this.vertices.length-1;d[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var k=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(j=0;j<d.length;j++)if(m<c){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));
- g[j]=this.vertices.length-1}else g=h;m==0&&(h=f);for(j=0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.uvs.push([new THREE.UV(m/c,j/a.length),new THREE.UV(m/c,(j+1)/a.length),new THREE.UV((m-b)/c,(j+1)/a.length),new THREE.UV((m-b)/c,j/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
- if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
- THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
- 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,j,k,m,o,z){h=(h-o)/(z-o);o=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,j,k,m,o,z){h=(h-o)/(z-o);o=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
- 2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,j,k,m,o,z){h=(h-o)/(z-o);o=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
- this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,j){var k=g+1,m=g+this.yd,o=g+this.zd,z=k+this.yd,q=k+this.zd,t=g+this.yd+this.zd,B=k+this.yd+this.zd,D=0,G=this.field[g],v=this.field[k],E=this.field[m],w=this.field[z],J=this.field[o],I=this.field[q],e=this.field[t],M=this.field[B];G<h&&(D|=1);v<h&&(D|=2);E<h&&(D|=8);w<h&&(D|=4);J<h&&(D|=16);I<h&&(D|=32);e<h&&(D|=128);M<h&&(D|=64);var N=THREE.edgeTable[D];if(N==0)return 0;
- var U=this.delta,Q=c+U,Z=d+U;U=f+U;if(N&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,G,v)}if(N&2){this.compNorm(k);this.compNorm(z);this.VIntY(k*3,this.vlist,this.nlist,3,h,Q,d,f,v,w)}if(N&4){this.compNorm(m);this.compNorm(z);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,Z,f,E,w)}if(N&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,G,E)}if(N&16){this.compNorm(o);this.compNorm(q);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,U,
- J,I)}if(N&32){this.compNorm(q);this.compNorm(B);this.VIntY(q*3,this.vlist,this.nlist,15,h,Q,d,U,I,M)}if(N&64){this.compNorm(t);this.compNorm(B);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,Z,U,e,M)}if(N&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,U,J,e)}if(N&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,G,J)}if(N&512){this.compNorm(k);this.compNorm(q);this.VIntZ(k*3,this.vlist,this.nlist,27,h,Q,d,f,v,I)}if(N&1024){this.compNorm(z);
- this.compNorm(B);this.VIntZ(z*3,this.vlist,this.nlist,30,h,Q,Z,f,w,M)}if(N&2048){this.compNorm(m);this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,Z,f,E,e)}D<<=4;for(h=g=0;THREE.triTable[D+h]!=-1;){c=D+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],j);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,j){var k=this.count*3;this.positionArray[k]=c[f];this.positionArray[k+1]=c[f+1];this.positionArray[k+2]=c[f+2];this.positionArray[k+
- 3]=c[g];this.positionArray[k+4]=c[g+1];this.positionArray[k+5]=c[g+2];this.positionArray[k+6]=c[h];this.positionArray[k+7]=c[h+1];this.positionArray[k+8]=c[h+2];this.normalArray[k]=d[f];this.normalArray[k+1]=d[f+1];this.normalArray[k+2]=d[f+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&j(this)};this.begin=
- function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var j=this.size*Math.sqrt(g/h),k=f*this.size,m=d*this.size,o=c*this.size,z=Math.floor(k-j);z<1&&(z=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var q=Math.floor(m-j);q<1&&(q=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-j);t<1&&(t=1);j=Math.floor(o+j);
- j>this.size-1&&(j=this.size-1);for(var B,D,G,v,E,w;z<k;z++){o=this.size2*z;D=z/this.size-f;E=D*D;for(D=q;D<m;D++){G=o+this.size*D;B=D/this.size-d;w=B*B;for(B=t;B<j;B++){v=B/this.size-c;v=g/(1.0E-6+v*v+w+E)-h;v>0&&(this.field[G+B]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,j,k,m=this.size,o=this.yd,z=this.zd,q=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f<t;f++){g=f/m;g*=g;j=c/(1.0E-4+g)-d;if(j>0)for(g=0;g<m;g++){k=f+g*o;for(h=0;h<m;h++)q[z*h+k]+=j}}};this.addPlaneY=function(c,d){var f,g,
- h,j,k,m,o=this.size,z=this.yd,q=this.zd,t=this.field,B=o*Math.sqrt(c/d);B>o&&(B=o);for(g=0;g<B;g++){f=g/o;f*=f;j=c/(1.0E-4+f)-d;if(j>0){k=g*z;for(f=0;f<o;f++){m=k+f;for(h=0;h<o;h++)t[q*h+m]+=j}}}};this.addPlaneZ=function(c,d){var f,g,h,j,k,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;j=c/(1.0E-4+f)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){m=k+g*yd;for(f=0;f<size;f++)field[m+f]+=j}}}};this.reset=function(){var c;
- for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,j,k,m,o,z,q=this.size-2;for(h=1;h<q;h++){z=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<q;g++){o=z+this.size*g;k=(g-this.halfsize)/this.halfsize;for(f=1;f<q;f++){j=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(j,k,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,j,k,m,o,z,q;for(g=
- 0;g<f.count;g++){m=g*3;z=m+1;q=m+2;h=f.positionArray[m];j=f.positionArray[z];k=f.positionArray[q];o=new THREE.Vector3(h,j,k);h=f.normalArray[m];j=f.normalArray[z];k=f.normalArray[q];m=new THREE.Vector3(h,j,k);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;z=m+1;q=m+2;o=d.vertices[m].normal;h=d.vertices[z].normal;j=d.vertices[q].normal;m=new THREE.Face3(m,z,q,[o,h,j]);d.faces.push(m)}c+=nfaces;f.count=0});return d};this.init(a)};
- THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
- THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
- 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
- 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
- THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,1,11,2,1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8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
- THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
- b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
- THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;
- h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
- createBinModel:function(a,b,c,d){var f=function(g){function h(u,A){var H=o(u,A),S=o(u,A+1),X=o(u,A+2),da=o(u,A+3),ja=(da<<1&255|X>>7)-127;H|=(X&127)<<16|S<<8;if(H==0&&ja==-127)return 0;return(1-2*(da>>7))*(1+H*Math.pow(2,-23))*Math.pow(2,ja)}function j(u,A){var H=o(u,A),S=o(u,A+1),X=o(u,A+2);return(o(u,A+3)<<24)+(X<<16)+(S<<8)+H}function k(u,A){var H=o(u,A);return(o(u,A+1)<<8)+H}function m(u,A){var H=o(u,A);return H>127?H-256:H}function o(u,A){return u.charCodeAt(A)&255}function z(u){var A,H,S;A=
- j(a,u);H=j(a,u+e);S=j(a,u+M);u=k(a,u+N);THREE.Loader.prototype.f3(v,A,H,S,u)}function q(u){var A,H,S,X,da,ja;A=j(a,u);H=j(a,u+e);S=j(a,u+M);X=k(a,u+N);da=j(a,u+U);ja=j(a,u+Q);u=j(a,u+Z);THREE.Loader.prototype.f3n(v,J,A,H,S,X,da,ja,u)}function t(u){var A,H,S,X;A=j(a,u);H=j(a,u+ca);S=j(a,u+K);X=j(a,u+W);u=k(a,u+la);THREE.Loader.prototype.f4(v,A,H,S,X,u)}function B(u){var A,H,S,X,da,ja,xa,P;A=j(a,u);H=j(a,u+ca);S=j(a,u+K);X=j(a,u+W);da=k(a,u+la);ja=j(a,u+ba);xa=j(a,u+na);P=j(a,u+ga);u=j(a,u+ha);THREE.Loader.prototype.f4n(v,
- J,A,H,S,X,da,ja,xa,P,u)}function D(u){var A,H;A=j(a,u);H=j(a,u+qa);u=j(a,u+wa);THREE.Loader.prototype.uv3(v.uvs,I[A*2],I[A*2+1],I[H*2],I[H*2+1],I[u*2],I[u*2+1])}function G(u){var A,H,S;A=j(a,u);H=j(a,u+l);S=j(a,u+x);u=j(a,u+y);THREE.Loader.prototype.uv4(v.uvs,I[A*2],I[A*2+1],I[H*2],I[H*2+1],I[S*2],I[S*2+1],I[u*2],I[u*2+1])}var v=this,E=0,w,J=[],I=[],e,M,N,U,Q,Z,ca,K,W,la,ba,na,ga,ha,qa,wa,l,x,y,n,p,C,F,O,T;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);w={signature:a.substr(E,
- 8),header_bytes:o(a,E+8),vertex_coordinate_bytes:o(a,E+9),normal_coordinate_bytes:o(a,E+10),uv_coordinate_bytes:o(a,E+11),vertex_index_bytes:o(a,E+12),normal_index_bytes:o(a,E+13),uv_index_bytes:o(a,E+14),material_index_bytes:o(a,E+15),nvertices:j(a,E+16),nnormals:j(a,E+16+4),nuvs:j(a,E+16+8),ntri_flat:j(a,E+16+12),ntri_smooth:j(a,E+16+16),ntri_flat_uv:j(a,E+16+20),ntri_smooth_uv:j(a,E+16+24),nquad_flat:j(a,E+16+28),nquad_smooth:j(a,E+16+32),nquad_flat_uv:j(a,E+16+36),nquad_smooth_uv:j(a,E+16+40)};
- E+=w.header_bytes;e=w.vertex_index_bytes;M=w.vertex_index_bytes*2;N=w.vertex_index_bytes*3;U=w.vertex_index_bytes*3+w.material_index_bytes;Q=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes;Z=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*2;ca=w.vertex_index_bytes;K=w.vertex_index_bytes*2;W=w.vertex_index_bytes*3;la=w.vertex_index_bytes*4;ba=w.vertex_index_bytes*4+w.material_index_bytes;na=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes;ga=
- w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*2;ha=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*3;qa=w.uv_index_bytes;wa=w.uv_index_bytes*2;l=w.uv_index_bytes;x=w.uv_index_bytes*2;y=w.uv_index_bytes*3;g=w.vertex_index_bytes*3+w.material_index_bytes;T=w.vertex_index_bytes*4+w.material_index_bytes;n=w.ntri_flat*g;p=w.ntri_smooth*(g+w.normal_index_bytes*3);C=w.ntri_flat_uv*(g+w.uv_index_bytes*3);F=w.ntri_smooth_uv*(g+w.normal_index_bytes*3+w.uv_index_bytes*
- 3);O=w.nquad_flat*T;g=w.nquad_smooth*(T+w.normal_index_bytes*4);T=w.nquad_flat_uv*(T+w.uv_index_bytes*4);E+=function(u){for(var A,H,S,X=w.vertex_coordinate_bytes*3,da=u+w.nvertices*X;u<da;u+=X){A=h(a,u);H=h(a,u+w.vertex_coordinate_bytes);S=h(a,u+w.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,A,H,S)}return w.nvertices*X}(E);E+=function(u){for(var A,H,S,X=w.normal_coordinate_bytes*3,da=u+w.nnormals*X;u<da;u+=X){A=m(a,u);H=m(a,u+w.normal_coordinate_bytes);S=m(a,u+w.normal_coordinate_bytes*2);
- J.push(A/127,H/127,S/127)}return w.nnormals*X}(E);E+=function(u){for(var A,H,S=w.uv_coordinate_bytes*2,X=u+w.nuvs*S;u<X;u+=S){A=h(a,u);H=h(a,u+w.uv_coordinate_bytes);I.push(A,H)}return w.nuvs*S}(E);n=E+n;p=n+p;C=p+C;F=C+F;O=F+O;g=O+g;T=g+T;(function(u){var A,H=w.vertex_index_bytes*3+w.material_index_bytes,S=H+w.uv_index_bytes*3,X=u+w.ntri_flat_uv*S;for(A=u;A<X;A+=S){z(A);D(A+H)}return X-u})(p);(function(u){var A,H=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,S=H+w.uv_index_bytes*
- 3,X=u+w.ntri_smooth_uv*S;for(A=u;A<X;A+=S){q(A);D(A+H)}return X-u})(C);(function(u){var A,H=w.vertex_index_bytes*4+w.material_index_bytes,S=H+w.uv_index_bytes*4,X=u+w.nquad_flat_uv*S;for(A=u;A<X;A+=S){t(A);G(A+H)}return X-u})(g);(function(u){var A,H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,S=H+w.uv_index_bytes*4,X=u+w.nquad_smooth_uv*S;for(A=u;A<X;A+=S){B(A);G(A+H)}return X-u})(T);(function(u){var A,H=w.vertex_index_bytes*3+w.material_index_bytes,S=u+w.ntri_flat*H;for(A=
- u;A<S;A+=H)z(A);return S-u})(E);(function(u){var A,H=w.vertex_index_bytes*3+w.material_index_bytes+w.normal_index_bytes*3,S=u+w.ntri_smooth*H;for(A=u;A<S;A+=H)q(A);return S-u})(n);(function(u){var A,H=w.vertex_index_bytes*4+w.material_index_bytes,S=u+w.nquad_flat*H;for(A=u;A<S;A+=H)t(A);return S-u})(F);(function(u){var A,H=w.vertex_index_bytes*4+w.material_index_bytes+w.normal_index_bytes*4,S=u+w.nquad_smooth*H;for(A=u;A<S;A+=H)B(A);return S-u})(O);this.computeCentroids();this.computeFaceNormals()};
- f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,j,k,m,o;h=0;for(j=a.vertices.length;h<j;h+=3){k=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,k,m,o)}if(a.colors){h=0;for(j=a.colors.length;h<j;h+=3){k=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,k,m,o)}}})();(function(){function h(B,
- D){THREE.Loader.prototype.f3(g,B[D],B[D+1],B[D+2],B[D+3])}function j(B,D){THREE.Loader.prototype.f3n(g,a.normals,B[D],B[D+1],B[D+2],B[D+3],B[D+4],B[D+5],B[D+6])}function k(B,D){THREE.Loader.prototype.f4(g,B[D],B[D+1],B[D+2],B[D+3],B[D+4])}function m(B,D){THREE.Loader.prototype.f4n(g,a.normals,B[D],B[D+1],B[D+2],B[D+3],B[D+4],B[D+5],B[D+6],B[D+7],B[D+8])}function o(B,D){var G,v,E,w,J,I,e,M,N;G=B[D];v=B[D+1];E=B[D+2];w=a.uvs[G*2];e=a.uvs[G*2+1];J=a.uvs[v*2];M=a.uvs[v*2+1];I=a.uvs[E*2];N=a.uvs[E*2+1];
- THREE.Loader.prototype.uv3(g.uvs,w,e,J,M,I,N);if(a.uvs2&&a.uvs2.length){w=a.uvs2[G*2];e=a.uvs2[G*2+1];J=a.uvs2[v*2];M=a.uvs2[v*2+1];I=a.uvs2[E*2];N=a.uvs2[E*2+1];THREE.Loader.prototype.uv3(g.uvs2,w,1-e,J,1-M,I,1-N)}}function z(B,D){var G,v,E,w,J,I,e,M,N,U,Q,Z;G=B[D];v=B[D+1];E=B[D+2];w=B[D+3];J=a.uvs[G*2];N=a.uvs[G*2+1];I=a.uvs[v*2];U=a.uvs[v*2+1];e=a.uvs[E*2];Q=a.uvs[E*2+1];M=a.uvs[w*2];Z=a.uvs[w*2+1];THREE.Loader.prototype.uv4(g.uvs,J,N,I,U,e,Q,M,Z);if(a.uvs2){J=a.uvs2[G*2];N=a.uvs2[G*2+1];I=a.uvs2[v*
- 2];U=a.uvs2[v*2+1];e=a.uvs2[E*2];Q=a.uvs2[E*2+1];M=a.uvs2[w*2];Z=a.uvs2[w*2+1];THREE.Loader.prototype.uv4(g.uvs2,J,1-N,I,1-U,e,1-Q,M,1-Z)}}var q,t;q=0;for(t=a.trianglesUvs.length;q<t;q+=7){h(a.trianglesUvs,q);o(a.trianglesUvs,q+4)}q=0;for(t=a.trianglesNormalsUvs.length;q<t;q+=10){j(a.trianglesNormalsUvs,q);o(a.trianglesNormalsUvs,q+7)}q=0;for(t=a.quadsUvs.length;q<t;q+=9){k(a.quadsUvs,q);z(a.quadsUvs,q+5)}q=0;for(t=a.quadsNormalsUvs.length;q<t;q+=13){m(a.quadsNormalsUvs,q);z(a.quadsNormalsUvs,q+9)}q=
- 0;for(t=a.triangles.length;q<t;q+=4)h(a.triangles,q);q=0;for(t=a.trianglesNormals.length;q<t;q+=7)j(a.trianglesNormals,q);q=0;for(t=a.quads.length;q<t;q+=5)k(a.quads,q);q=0;for(t=a.quadsNormals.length;q<t;q+=9)m(a.quadsNormals,q)})();(function(){var h,j,k,m;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<j;h+=2){k=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,k,m,0,0)}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,
- k,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
- c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,j,k){g=a.materials[g];var m=b[j*3],o=b[j*3+1];j=b[j*3+2];var z=b[k*3],q=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,j),new THREE.Vector3(z,
- q,k)],g))},f4n:function(a,b,c,d,f,g,h,j,k,m,o){h=a.materials[h];var z=b[k*3],q=b[k*3+1];k=b[k*3+2];var t=b[m*3],B=b[m*3+1];m=b[m*3+2];var D=b[o*3],G=b[o*3+1];o=b[o*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(z,q,k),new THREE.Vector3(t,B,m),new THREE.Vector3(D,G,o)],h))},uv3:function(a,b,c,d,f,g,h){var j=[];j.push(new THREE.UV(b,c));j.push(new THREE.UV(d,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,b,c,d,f,g,h,j,k){var m=[];m.push(new THREE.UV(b,
- c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(j,k));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),z=Math.pow(2,Math.round(Math.log(this.height)/
- Math.LN2));j.image.width=o;j.image.height=z;j.image.getContext("2d").drawImage(this,0,0,o,z)}else j.image=this;j.needsUpdate=!0};m.src=k}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*
- 255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|