123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- // ThreeExtras.js r32 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
- THREE.Color.prototype={setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
- ","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
- THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
- this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,d){this.x=a||0;this.y=b||0;this.z=d||0};
- THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
- cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
- a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
- -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
- THREE.Vector4=function(a,b,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1};
- THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
- return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){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)},toString:function(){return"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,d,e=a.objects,f=[];a=0;for(b=e.length;a<b;a++){d=e[a];if(d instanceof THREE.Mesh)f=f.concat(this.intersectObject(d))}f.sort(function(h,j){return h.distance-j.distance});return f},intersectObject:function(a){function b(K,t,L,m){m=m.clone().subSelf(t);L=L.clone().subSelf(t);var g=K.clone().subSelf(t);K=m.dot(m);t=m.dot(L);m=m.dot(g);var o=L.dot(L);L=L.dot(g);g=1/(K*o-t*t);o=(o*m-t*L)*g;K=(K*L-t*m)*g;return o>0&&K>0&&o+K<1}var d,e,f,h,j,c,k,l,n,C,
- p,x=a.geometry,z=x.vertices,u=[];d=0;for(e=x.faces.length;d<e;d++){f=x.faces[d];C=this.origin.clone();p=this.direction.clone();h=a.matrix.multiplyVector3(z[f.a].position.clone());j=a.matrix.multiplyVector3(z[f.b].position.clone());c=a.matrix.multiplyVector3(z[f.c].position.clone());k=f instanceof THREE.Face4?a.matrix.multiplyVector3(z[f.d].position.clone()):null;l=a.rotationMatrix.multiplyVector3(f.normal.clone());n=p.dot(l);if(n<0){l=l.dot((new THREE.Vector3).sub(h,C))/n;C=C.addSelf(p.multiplyScalar(l));
- if(f instanceof THREE.Face3){if(b(C,h,j,c)){f={distance:this.origin.distanceTo(C),point:C,face:f,object:a};u.push(f)}}else if(f instanceof THREE.Face4)if(b(C,h,j,k)||b(C,j,c,k)){f={distance:this.origin.distanceTo(C),point:C,face:f,object:a};u.push(f)}}}return u}};
- THREE.Rectangle=function(){function a(){h=e-b;j=f-d}var b,d,e,f,h,j,c=true;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,l,n,C){c=false;b=k;d=l;e=n;f=C;a()};this.addPoint=function(k,l){if(c){c=false;b=k;d=l;e=k;f=l}else{b=b<k?b:k;d=d<l?d:l;e=e>k?e:k;f=f>l?
- f:l}a()};this.add3Points=function(k,l,n,C,p,x){if(c){c=false;b=k<n?k<p?k:p:n<p?n:p;d=l<C?l<x?l:x:C<x?C:x;e=k>n?k>p?k:p:n>p?n:p;f=l>C?l>x?l:x:C>x?C:x}else{b=k<n?k<p?k<b?k:b:p<b?p:b:n<p?n<b?n:b:p<b?p:b;d=l<C?l<x?l<d?l:d:x<d?x:d:C<x?C<d?C:d:x<d?x:d;e=k>n?k>p?k>e?k:e:p>e?p:e:n>p?n>e?n:e:p>e?p:e;f=l>C?l>x?l>f?l:f:x>f?x:f:C>x?C>f?C:f:x>f?x:f}a()};this.addRectangle=function(k){if(c){c=false;b=k.getLeft();d=k.getTop();e=k.getRight();f=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();
- e=e>k.getRight()?e:k.getRight();f=f>k.getBottom()?f:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(f,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){c=true;f=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString=
- function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", bottom: "+f+", width: "+h+", height: "+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}};
- THREE.Matrix4=function(a,b,d,e,f,h,j,c,k,l,n,C,p,x,z,u){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=h||1;this.n23=j||0;this.n24=c||0;this.n31=k||0;this.n32=l||0;this.n33=n||1;this.n34=C||0;this.n41=p||0;this.n42=x||0;this.n43=z||0;this.n44=u||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,d,e,f,h,j,c,k,l,n,C,p,x,z,u){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=f;this.n22=h;this.n23=j;this.n24=c;this.n31=k;this.n32=l;this.n33=n;this.n34=C;this.n41=p;this.n42=x;this.n43=z;this.n44=u;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
- a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,b).normalize();e.cross(d,h).normalize();f.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
- this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,f=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*d+this.n23*
- e+this.n24*f;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*d+this.n43*e+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 d=a.n11,e=a.n12,f=a.n13,h=a.n14,j=a.n21,c=a.n22,k=a.n23,l=a.n24,n=a.n31,
- C=a.n32,p=a.n33,x=a.n34,z=a.n41,u=a.n42,K=a.n43,t=a.n44,L=b.n11,m=b.n12,g=b.n13,o=b.n14,B=b.n21,q=b.n22,A=b.n23,N=b.n24,v=b.n31,D=b.n32,G=b.n33,E=b.n34,y=b.n41,I=b.n42,F=b.n43,T=b.n44;this.n11=d*L+e*B+f*v+h*y;this.n12=d*m+e*q+f*D+h*I;this.n13=d*g+e*A+f*G+h*F;this.n14=d*o+e*N+f*E+h*T;this.n21=j*L+c*B+k*v+l*y;this.n22=j*m+c*q+k*D+l*I;this.n23=j*g+c*A+k*G+l*F;this.n24=j*o+c*N+k*E+l*T;this.n31=n*L+C*B+p*v+x*y;this.n32=n*m+C*q+p*D+x*I;this.n33=n*g+C*A+p*G+x*F;this.n34=n*o+C*N+p*E+x*T;this.n41=z*L+u*B+
- K*v+t*y;this.n42=z*m+u*q+K*D+t*I;this.n43=z*g+u*A+K*G+t*F;this.n44=z*o+u*N+K*E+t*T;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,f=this.n14,h=this.n21,j=this.n22,c=this.n23,k=this.n24,l=this.n31,n=this.n32,C=this.n33,p=this.n34,x=this.n41,z=this.n42,u=this.n43,K=this.n44,t=a.n11,L=a.n21,m=a.n31,g=a.n41,o=a.n12,B=a.n22,q=a.n32,A=a.n42,N=a.n13,v=a.n23,D=a.n33,G=a.n43,E=a.n14,y=a.n24,I=a.n34;a=a.n44;this.n11=b*t+d*L+e*m+f*g;this.n12=b*o+d*B+e*q+f*A;this.n13=b*N+d*v+e*D+f*
- G;this.n14=b*E+d*y+e*I+f*a;this.n21=h*t+j*L+c*m+k*g;this.n22=h*o+j*B+c*q+k*A;this.n23=h*N+j*v+c*D+k*G;this.n24=h*E+j*y+c*I+k*a;this.n31=l*t+n*L+C*m+p*g;this.n32=l*o+n*B+C*q+p*A;this.n33=l*N+n*v+C*D+p*G;this.n34=l*E+n*y+C*I+p*a;this.n41=x*t+z*L+u*m+K*g;this.n42=x*o+z*B+u*q+K*A;this.n43=x*N+z*v+u*D+K*G;this.n44=x*E+z*y+u*I+K*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=
- a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,f=this.n21,h=this.n22,j=this.n23,c=this.n24,k=this.n31,l=this.n32,n=this.n33,C=this.n34,p=this.n41,x=this.n42,z=this.n43,u=this.n44;return e*j*l*p-d*c*l*p-e*h*n*p+b*c*n*p+d*h*C*p-b*j*C*p-e*j*k*x+d*c*k*x+e*f*n*x-a*c*n*x-d*f*C*x+a*j*C*x+e*h*k*z-b*c*k*z-e*f*l*z+a*c*l*z+b*f*C*z-a*h*C*z-d*h*k*u+b*j*k*u+d*f*l*u-a*j*l*u-b*f*n*u+a*h*n*u},transpose:function(){function a(b,d,
- e){var f=b[d];b[d]=b[e];b[e]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;
- a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,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 d=Math.cos(b),e=Math.sin(b),f=1-d,h=a.x,j=a.y,c=a.z,k=f*h,l=f*j;this.set(k*h+d,k*j-e*c,k*c+e*j,0,k*j+e*c,l*j+d,l*c-e*h,0,k*c-e*j,l*c+e*h,f*c*c+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+
- this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};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 d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
- THREE.Matrix4.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,f=a.n14,h=a.n21,j=a.n22,c=a.n23,k=a.n24,l=a.n31,n=a.n32,C=a.n33,p=a.n34,x=a.n41,z=a.n42,u=a.n43,K=a.n44,t=new THREE.Matrix4;t.n11=c*p*z-k*C*z+k*n*u-j*p*u-c*n*K+j*C*K;t.n12=f*C*z-e*p*z-f*n*u+d*p*u+e*n*K-d*C*K;t.n13=e*k*z-f*c*z+f*j*u-d*k*u-e*j*K+d*c*K;t.n14=f*c*n-e*k*n-f*j*C+d*k*C+e*j*p-d*c*p;t.n21=k*C*x-c*p*x-k*l*u+h*p*u+c*l*K-h*C*K;t.n22=e*p*x-f*C*x+f*l*u-b*p*u-e*l*K+b*C*K;t.n23=f*c*x-e*k*x-f*h*u+b*k*u+e*h*K-b*c*K;t.n24=e*k*l-f*c*l+
- f*h*C-b*k*C-e*h*p+b*c*p;t.n31=j*p*x-k*n*x+k*l*z-h*p*z-j*l*K+h*n*K;t.n32=f*n*x-d*p*x-f*l*z+b*p*z+d*l*K-b*n*K;t.n33=e*k*x-f*j*x+f*h*z-b*k*z-d*h*K+b*j*K;t.n34=f*j*l-d*k*l-f*h*n+b*k*n+d*h*p-b*j*p;t.n41=c*n*x-j*C*x-c*l*z+h*C*z+j*l*u-h*n*u;t.n42=d*C*x-e*n*x+e*l*z-b*C*z-d*l*u+b*n*u;t.n43=e*j*x-d*c*x-e*h*z+b*c*z+d*h*u-b*j*u;t.n44=d*c*l-e*j*l+e*h*n-b*c*n-d*h*C+b*j*C;t.multiplyScalar(1/a.determinant());return t};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],f=-b[10]*b[1]+b[2]*b[9],h=b[6]*b[1]-b[2]*b[5],j=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],k=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],n=-b[9]*b[0]+b[1]*b[8],C=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*j+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*h;d[3]=b*j;d[4]=b*c;d[5]=b*k;d[6]=b*l;d[7]=b*n;d[8]=b*C;return a};
- THREE.Matrix4.makeFrustum=function(a,b,d,e,f,h){var j,c,k;j=new THREE.Matrix4;c=2*f/(b-a);k=2*f/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(h+f)/(h-f);f=-2*h*f/(h-f);j.n11=c;j.n12=0;j.n13=a;j.n14=0;j.n21=0;j.n22=k;j.n23=d;j.n24=0;j.n31=0;j.n32=0;j.n33=e;j.n34=f;j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,d,e)};
- THREE.Matrix4.makeOrtho=function(a,b,d,e,f,h){var j,c,k,l;j=new THREE.Matrix4;c=b-a;k=d-e;l=h-f;a=(b+a)/c;d=(d+e)/k;f=(h+f)/l;j.n11=2/c;j.n12=0;j.n13=0;j.n14=-a;j.n21=0;j.n22=2/k;j.n23=0;j.n24=-d;j.n31=0;j.n32=0;j.n33=-2/l;j.n34=-f;j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
- 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=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
- THREE.Face3=function(a,b,d,e,f){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,b,d,e,f,h){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
- THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
- THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
- d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,f,h,j,c=new THREE.Vector3,k=new THREE.Vector3;e=0;for(f=this.vertices.length;e<f;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){c.set(0,0,0);b=0;for(d=h.normal.length;b<d;b++)c.addSelf(h.vertexNormals[b]);c.divideScalar(3)}else{b=this.vertices[h.a];d=this.vertices[h.b];j=this.vertices[h.c];c.sub(j.position,
- d.position);k.sub(b.position,d.position);c.crossSelf(k)}c.isZero()||c.normalize();h.normal.copy(c)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
- b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(E,y,I,F,T,V,P){h=E.vertices[y].position;j=E.vertices[I].position;c=E.vertices[F].position;k=f[T];l=f[V];n=f[P];C=j.x-h.x;p=c.x-h.x;x=j.y-h.y;z=c.y-h.y;
- u=j.z-h.z;K=c.z-h.z;t=l.u-k.u;L=n.u-k.u;m=l.v-k.v;g=n.v-k.v;o=1/(t*g-L*m);A.set((g*C-m*p)*o,(g*x-m*z)*o,(g*u-m*K)*o);N.set((t*p-L*C)*o,(t*z-L*x)*o,(t*K-L*u)*o);B[y].addSelf(A);B[I].addSelf(A);B[F].addSelf(A);q[y].addSelf(N);q[I].addSelf(N);q[F].addSelf(N)}var b,d,e,f,h,j,c,k,l,n,C,p,x,z,u,K,t,L,m,g,o,B=[],q=[],A=new THREE.Vector3,N=new THREE.Vector3,v=new THREE.Vector3,D=new THREE.Vector3,G=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){B[b]=new THREE.Vector3;q[b]=new THREE.Vector3}b=0;
- for(d=this.faces.length;b<d;b++){e=this.faces[b];f=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
- this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){G.copy(this.vertices[b].normal);e=B[b];v.copy(e);v.subSelf(G.multiplyScalar(G.dot(e))).normalize();D.cross(this.vertices[b].normal,e);e=D.dot(q[b]);e=e<0?-1:1;this.vertices[b].tangent.set(v.x,v.y,v.z,e)}this.hasTangents=true},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,d=this.vertices.length;b<d;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,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(n){var C=[];b=0;for(d=n.length;b<d;b++)n[b]==undefined?C.push("undefined"):C.push(n[b].toString());return C.join("_")}var b,d,e,f,h,j,c,k,l={};e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];
- j=h.materials;c=a(j);if(l[c]==undefined)l[c]={hash:c,counter:0};k=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:j,vertices:0};h=h instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+h>65535){l[c].counter+=1;k=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:j,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
- this.translateZ=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
- THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,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.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
- THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,b=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(b.x);if(b.y!=0){e.setRotY(b.y);this.rotationMatrix.multiplySelf(e)}if(b.z!=0){e.setRotZ(b.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0};
- THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
- THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};
- THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
- THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
- THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
- a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+
- "<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
- a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
- this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
- THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=
- this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
- a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
- undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
- this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
- THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
- THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
- undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
- THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
- THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
- THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
- THREE.Texture=function(a,b,d,e,f,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter};
- THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};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,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var b,d,e,f={};for(b in a){f[b]={};for(d in a[b]){e=a[b][d];f[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var b,d,e,f={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)f[d]=e[d]}return f}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
- THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
- THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
- THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
- THREE.Projector=function(){function a(q,A){return A.z-q.z}function b(q,A){var N=0,v=1,D=q.z+q.w,G=A.z+A.w,E=-q.z+q.w,y=-A.z+A.w;if(D>=0&&G>=0&&E>=0&&y>=0)return true;else if(D<0&&G<0||E<0&&y<0)return false;else{if(D<0)N=Math.max(N,D/(D-G));else if(G<0)v=Math.min(v,D/(D-G));if(E<0)N=Math.max(N,E/(E-y));else if(y<0)v=Math.min(v,E/(E-y));if(v<N)return false;else{q.lerpSelf(A,N);A.lerpSelf(q,1-v);return true}}}var d,e,f=[],h,j,c,k=[],l,n,C=[],p,x,z=[],u=new THREE.Vector4,K=new THREE.Vector4,t=new THREE.Matrix4,
- L=new THREE.Matrix4,m=[],g=new THREE.Vector4,o=new THREE.Vector4,B;this.projectObjects=function(q,A,N){var v=[],D,G;e=0;t.multiply(A.projectionMatrix,A.matrix);m[0]=new THREE.Vector4(t.n41-t.n11,t.n42-t.n12,t.n43-t.n13,t.n44-t.n14);m[1]=new THREE.Vector4(t.n41+t.n11,t.n42+t.n12,t.n43+t.n13,t.n44+t.n14);m[2]=new THREE.Vector4(t.n41+t.n21,t.n42+t.n22,t.n43+t.n23,t.n44+t.n24);m[3]=new THREE.Vector4(t.n41-t.n21,t.n42-t.n22,t.n43-t.n23,t.n44-t.n24);m[4]=new THREE.Vector4(t.n41-t.n31,t.n42-t.n32,t.n43-
- t.n33,t.n44-t.n34);m[5]=new THREE.Vector4(t.n41+t.n31,t.n42+t.n32,t.n43+t.n33,t.n44+t.n34);A=0;for(D=m.length;A<D;A++){G=m[A];G.divideScalar(Math.sqrt(G.x*G.x+G.y*G.y+G.z*G.z))}D=q.objects;q=0;for(A=D.length;q<A;q++){G=D[q];var E;if(!(E=!G.visible)){if(E=G instanceof THREE.Mesh){a:{E=void 0;for(var y=G.position,I=-G.geometry.boundingSphere.radius*Math.max(G.scale.x,Math.max(G.scale.y,G.scale.z)),F=0;F<6;F++){E=m[F].x*y.x+m[F].y*y.y+m[F].z*y.z+m[F].w;if(E<=I){E=false;break a}}E=true}E=!E}E=E}if(!E){d=
- f[e]=f[e]||new THREE.RenderableObject;u.copy(G.position);t.multiplyVector3(u);d.object=G;d.z=u.z;v.push(d);e++}}N&&v.sort(a);return v};this.projectScene=function(q,A,N){var v=[],D=A.near,G=A.far,E,y,I,F,T,V,P,da,X,R,U,ba,Y,H,S,W;c=n=x=0;A.autoUpdateMatrix&&A.updateMatrix();t.multiply(A.projectionMatrix,A.matrix);V=this.projectObjects(q,A,true);q=0;for(E=V.length;q<E;q++){P=V[q].object;if(P.visible){P.autoUpdateMatrix&&P.updateMatrix();da=P.matrix;X=P.rotationMatrix;R=P.materials;U=P.overdraw;if(P instanceof
- THREE.Mesh){ba=P.geometry;Y=ba.vertices;y=0;for(I=Y.length;y<I;y++){H=Y[y];H.positionWorld.copy(H.position);da.multiplyVector3(H.positionWorld);F=H.positionScreen;F.copy(H.positionWorld);t.multiplyVector4(F);F.x/=F.w;F.y/=F.w;H.__visible=F.z>D&&F.z<G}ba=ba.faces;y=0;for(I=ba.length;y<I;y++){H=ba[y];if(H instanceof THREE.Face3){F=Y[H.a];T=Y[H.b];S=Y[H.c];if(F.__visible&&T.__visible&&S.__visible)if(P.doubleSided||P.flipSided!=(S.positionScreen.x-F.positionScreen.x)*(T.positionScreen.y-F.positionScreen.y)-
- (S.positionScreen.y-F.positionScreen.y)*(T.positionScreen.x-F.positionScreen.x)<0){h=k[c]=k[c]||new THREE.RenderableFace3;h.v1.positionWorld.copy(F.positionWorld);h.v2.positionWorld.copy(T.positionWorld);h.v3.positionWorld.copy(S.positionWorld);h.v1.positionScreen.copy(F.positionScreen);h.v2.positionScreen.copy(T.positionScreen);h.v3.positionScreen.copy(S.positionScreen);h.normalWorld.copy(H.normal);X.multiplyVector3(h.normalWorld);h.centroidWorld.copy(H.centroid);da.multiplyVector3(h.centroidWorld);
- h.centroidScreen.copy(h.centroidWorld);t.multiplyVector3(h.centroidScreen);S=H.vertexNormals;B=h.vertexNormalsWorld;F=0;for(T=S.length;F<T;F++){W=B[F]=B[F]||new THREE.Vector3;W.copy(S[F]);X.multiplyVector3(W)}h.z=h.centroidScreen.z;h.meshMaterials=R;h.faceMaterials=H.materials;h.overdraw=U;if(P.geometry.uvs[y]){h.uvs[0]=P.geometry.uvs[y][0];h.uvs[1]=P.geometry.uvs[y][1];h.uvs[2]=P.geometry.uvs[y][2]}v.push(h);c++}}else if(H instanceof THREE.Face4){F=Y[H.a];T=Y[H.b];S=Y[H.c];W=Y[H.d];if(F.__visible&&
- T.__visible&&S.__visible&&W.__visible)if(P.doubleSided||P.flipSided!=((W.positionScreen.x-F.positionScreen.x)*(T.positionScreen.y-F.positionScreen.y)-(W.positionScreen.y-F.positionScreen.y)*(T.positionScreen.x-F.positionScreen.x)<0||(T.positionScreen.x-S.positionScreen.x)*(W.positionScreen.y-S.positionScreen.y)-(T.positionScreen.y-S.positionScreen.y)*(W.positionScreen.x-S.positionScreen.x)<0)){h=k[c]=k[c]||new THREE.RenderableFace3;h.v1.positionWorld.copy(F.positionWorld);h.v2.positionWorld.copy(T.positionWorld);
- h.v3.positionWorld.copy(W.positionWorld);h.v1.positionScreen.copy(F.positionScreen);h.v2.positionScreen.copy(T.positionScreen);h.v3.positionScreen.copy(W.positionScreen);h.normalWorld.copy(H.normal);X.multiplyVector3(h.normalWorld);h.centroidWorld.copy(H.centroid);da.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);t.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=R;h.faceMaterials=H.materials;h.overdraw=U;if(P.geometry.uvs[y]){h.uvs[0]=P.geometry.uvs[y][0];
- h.uvs[1]=P.geometry.uvs[y][1];h.uvs[2]=P.geometry.uvs[y][3]}v.push(h);c++;j=k[c]=k[c]||new THREE.RenderableFace3;j.v1.positionWorld.copy(T.positionWorld);j.v2.positionWorld.copy(S.positionWorld);j.v3.positionWorld.copy(W.positionWorld);j.v1.positionScreen.copy(T.positionScreen);j.v2.positionScreen.copy(S.positionScreen);j.v3.positionScreen.copy(W.positionScreen);j.normalWorld.copy(h.normalWorld);j.centroidWorld.copy(h.centroidWorld);j.centroidScreen.copy(h.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterials=
- R;j.faceMaterials=H.materials;j.overdraw=U;if(P.geometry.uvs[y]){j.uvs[0]=P.geometry.uvs[y][1];j.uvs[1]=P.geometry.uvs[y][2];j.uvs[2]=P.geometry.uvs[y][3]}v.push(j);c++}}}}else if(P instanceof THREE.Line){L.multiply(t,da);Y=P.geometry.vertices;H=Y[0];H.positionScreen.copy(H.position);L.multiplyVector4(H.positionScreen);y=1;for(I=Y.length;y<I;y++){F=Y[y];F.positionScreen.copy(F.position);L.multiplyVector4(F.positionScreen);T=Y[y-1];g.copy(F.positionScreen);o.copy(T.positionScreen);if(b(g,o)){g.multiplyScalar(1/
- g.w);o.multiplyScalar(1/o.w);l=C[n]=C[n]||new THREE.RenderableLine;l.v1.positionScreen.copy(g);l.v2.positionScreen.copy(o);l.z=Math.max(g.z,o.z);l.materials=P.materials;v.push(l);n++}}}else if(P instanceof THREE.Particle){K.set(P.position.x,P.position.y,P.position.z,1);t.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){p=z[x]=z[x]||new THREE.RenderableParticle;p.x=K.x/K.w;p.y=K.y/K.w;p.z=K.z;p.rotation=P.rotation.z;p.scale.x=P.scale.x*Math.abs(p.x-(K.x+A.projectionMatrix.n11)/(K.w+A.projectionMatrix.n14));
- p.scale.y=P.scale.y*Math.abs(p.y-(K.y+A.projectionMatrix.n22)/(K.w+A.projectionMatrix.n24));p.materials=P.materials;v.push(p);x++}}}}N&&v.sort(a);return v};this.unprojectVector=function(q,A){var N=THREE.Matrix4.makeInvert(A.matrix);N.multiplySelf(THREE.Matrix4.makeInvert(A.projectionMatrix));N.multiplyVector3(q);return q}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,f,h;this.domElement=document.createElement("div");this.setSize=function(j,c){d=j;e=c;f=d/2;h=e/2};this.render=function(j,c){var k,l,n,C,p,x,z,u;a=b.projectScene(j,c);k=0;for(l=a.length;k<l;k++){p=a[k];if(p instanceof THREE.RenderableParticle){z=p.x*f+f;u=p.y*h+h;n=0;for(C=p.material.length;n<C;n++){x=p.material[n];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=z+"px";x.style.top=u+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(ma){if(p!=ma)l.globalAlpha=p=ma}function b(ma){if(x!=ma){switch(ma){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}x=ma}}var d=null,e=new THREE.Projector,f=document.createElement("canvas"),h,j,c,k,l=f.getContext("2d"),n=null,C=null,p=1,x=0,z=null,u=null,K=1,t,L,m,g,o,B,q,A,N,v=new THREE.Color,
- D=new THREE.Color,G=new THREE.Color,E=new THREE.Color,y=new THREE.Color,I,F,T,V,P,da,X,R,U,ba=new THREE.Rectangle,Y=new THREE.Rectangle,H=new THREE.Rectangle,S=false,W=new THREE.Color,ia=new THREE.Color,ha=new THREE.Color,w=new THREE.Color,M=Math.PI*2,J=new THREE.Vector3,Z,ca,ga,ja,qa,sa,ya=16;Z=document.createElement("canvas");Z.width=Z.height=2;ca=Z.getContext("2d");ca.fillStyle="rgba(0,0,0,1)";ca.fillRect(0,0,2,2);ga=ca.getImageData(0,0,2,2);ja=ga.data;qa=document.createElement("canvas");qa.width=
- qa.height=ya;sa=qa.getContext("2d");sa.translate(-ya/2,-ya/2);sa.scale(ya,ya);ya--;this.domElement=f;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ma,wa){h=ma;j=wa;c=h/2;k=j/2;f.width=h;f.height=j;ba.set(-c,-k,c,k);p=1;x=0;u=z=null;K=1};this.setClearColor=function(ma,wa){n=ma!==null?new THREE.Color(ma):null;C=wa;Y.set(-c,-k,c,k);l.setTransform(1,0,0,-1,c,k);this.clear()};this.clear=function(){if(!Y.isEmpty()){Y.inflate(1);Y.minSelf(ba);if(n!==null){b(THREE.NormalBlending);
- a(1);l.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+C+")";l.fillRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight())}else l.clearRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight());Y.empty()}};this.render=function(ma,wa){function Pa(O){var ea,aa,Q,$=O.lights;ia.setRGB(0,0,0);ha.setRGB(0,0,0);w.setRGB(0,0,0);O=0;for(ea=$.length;O<ea;O++){aa=$[O];Q=aa.color;if(aa instanceof THREE.AmbientLight){ia.r+=Q.r;ia.g+=Q.g;ia.b+=Q.b}else if(aa instanceof THREE.DirectionalLight){ha.r+=
- Q.r;ha.g+=Q.g;ha.b+=Q.b}else if(aa instanceof THREE.PointLight){w.r+=Q.r;w.g+=Q.g;w.b+=Q.b}}}function Da(O,ea,aa,Q){var $,fa,la,na,oa=O.lights;O=0;for($=oa.length;O<$;O++){fa=oa[O];la=fa.color;na=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=aa.dot(fa.position)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){J.sub(fa.position,ea);J.normalize();fa=aa.dot(J)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(O,ea,aa){if(aa.opacity!=
- 0){a(aa.opacity);b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*k;aa=$*na;Q=fa*oa;H.set(O.x-aa,O.y-Q,O.x+aa,O.y+Q);if(ba.instersects(H)){l.save();l.translate(O.x,O.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){W.r=ia.r+ha.r+w.r;W.g=ia.g+ha.g+w.g;W.b=ia.b+ha.b+w.b;v.r=aa.color.r*
- W.r;v.g=aa.color.g*W.g;v.b=aa.color.b*W.b;v.updateStyleString()}else v.__styleString=aa.color.__styleString;aa=ea.scale.x*c;Q=ea.scale.y*k;H.set(O.x-aa,O.y-Q,O.x+aa,O.y+Q);if(ba.instersects(H)){$=v.__styleString;if(u!=$)l.fillStyle=u=$;l.save();l.translate(O.x,O.y);l.rotate(-ea.rotation);l.scale(aa,Q);l.beginPath();l.arc(0,0,1,0,M,true);l.closePath();l.fill();l.restore()}}}}function Ra(O,ea,aa,Q){if(Q.opacity!=0){a(Q.opacity);b(Q.blending);l.beginPath();l.moveTo(O.positionScreen.x,O.positionScreen.y);
- l.lineTo(ea.positionScreen.x,ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){v.__styleString=Q.color.__styleString;O=Q.linewidth;if(K!=O)l.lineWidth=K=O;O=v.__styleString;if(z!=O)l.strokeStyle=z=O;l.stroke();H.inflate(Q.linewidth*2)}}}function La(O,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);g=O.positionScreen.x;o=O.positionScreen.y;B=ea.positionScreen.x;q=ea.positionScreen.y;A=aa.positionScreen.x;N=aa.positionScreen.y;l.beginPath();l.moveTo(g,o);l.lineTo(B,
- q);l.lineTo(A,N);l.lineTo(g,o);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(g,o,B,q,A,N,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){O=wa.matrix;J.copy(Q.vertexNormalsWorld[0]);V=(J.x*O.n11+J.y*O.n12+J.z*O.n13)*0.5+0.5;P=-(J.x*O.n21+J.y*O.n22+J.z*O.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[1]);
- da=(J.x*O.n11+J.y*O.n12+J.z*O.n13)*0.5+0.5;X=-(J.x*O.n21+J.y*O.n22+J.z*O.n23)*0.5+0.5;J.copy(Q.vertexNormalsWorld[2]);R=(J.x*O.n11+J.y*O.n12+J.z*O.n13)*0.5+0.5;U=-(J.x*O.n21+J.y*O.n22+J.z*O.n23)*0.5+0.5;Aa(g,o,B,q,A,N,$.env_map.image,V,P,da,X,R,U)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(g,o,B,q,A,N,$.map.image,Q.uvs[0].u,Q.uvs[0].v,
- Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){D.r=G.r=E.r=ia.r;D.g=G.g=E.g=ia.g;D.b=G.b=E.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],D);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],G);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],E);y.r=(G.r+E.r)*0.5;y.g=(G.g+E.g)*0.5;y.b=(G.b+E.b)*0.5;T=Ma(D,G,E,y);Aa(g,o,B,q,A,N,T,0,0,1,0,0,1)}else{W.r=ia.r;W.g=ia.g;W.b=ia.b;Da(fa,
- Q.centroidWorld,Q.normalWorld,W);v.r=$.color.r*W.r;v.g=$.color.g*W.g;v.b=$.color.b*W.b;v.updateStyleString();$.wireframe?Ea(v.__styleString,$.wireframe_linewidth):Fa(v.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){I=wa.near;F=wa.far;D.r=D.g=D.b=1-Ha(O.positionScreen.z,I,F);G.r=G.g=G.b=1-Ha(ea.positionScreen.z,I,F);E.r=E.g=E.b=1-Ha(aa.positionScreen.z,I,F);y.r=(G.r+E.r)*0.5;y.g=(G.g+E.g)*0.5;y.b=
- (G.b+E.b)*0.5;T=Ma(D,G,E,y);Aa(g,o,B,q,A,N,T,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){v.r=Ia(Q.normalWorld.x);v.g=Ia(Q.normalWorld.y);v.b=Ia(Q.normalWorld.z);v.updateStyleString();$.wireframe?Ea(v.__styleString,$.wireframe_linewidth):Fa(v.__styleString)}}}function Ea(O,ea){if(z!=O)l.strokeStyle=z=O;if(K!=ea)l.lineWidth=K=ea;l.stroke();H.inflate(ea*2)}function Fa(O){if(u!=O)l.fillStyle=u=O;l.fill()}function Aa(O,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height-
- 1;na*=xa;oa*=va;ta*=xa;pa*=va;ua*=xa;Ba*=va;aa-=O;Q-=ea;$-=O;fa-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);xa=(Ba*aa-pa*$)*va;pa=(Ba*Q-pa*fa)*va;aa=(ta*$-ua*aa)*va;Q=(ta*fa-ua*Q)*va;O=O-xa*na-aa*oa;ea=ea-pa*na-Q*oa;l.save();l.transform(xa,pa,aa,Q,O,ea);l.clip();l.drawImage(la,0,0);l.restore()}function Ma(O,ea,aa,Q){var $=~~(O.r*255),fa=~~(O.g*255);O=~~(O.b*255);var la=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~(aa.r*255),ta=~~(aa.g*255);aa=~~(aa.b*255);var pa=~~(Q.r*255),ua=~~(Q.g*
- 255);Q=~~(Q.b*255);ja[0]=$<0?0:$>255?255:$;ja[1]=fa<0?0:fa>255?255:fa;ja[2]=O<0?0:O>255?255:O;ja[4]=la<0?0:la>255?255:la;ja[5]=na<0?0:na>255?255:na;ja[6]=ea<0?0:ea>255?255:ea;ja[8]=oa<0?0:oa>255?255:oa;ja[9]=ta<0?0:ta>255?255:ta;ja[10]=aa<0?0:aa>255?255:aa;ja[12]=pa<0?0:pa>255?255:pa;ja[13]=ua<0?0:ua>255?255:ua;ja[14]=Q<0?0:Q>255?255:Q;ca.putImageData(ga,0,0);sa.drawImage(Z,0,0);return qa}function Ha(O,ea,aa){O=(O-ea)/(aa-ea);return O*O*(3-2*O)}function Ia(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function Ja(O,
- ea){var aa=ea.x-O.x,Q=ea.y-O.y,$=1/Math.sqrt(aa*aa+Q*Q);aa*=$;Q*=$;ea.x+=aa;ea.y+=Q;O.x-=aa;O.y-=Q}var Ga,Na,ka,ra,za,Ka,Oa,Ca;l.setTransform(1,0,0,-1,c,k);this.autoClear&&this.clear();d=e.projectScene(ma,wa,this.sortElements);(S=ma.lights.length>0)&&Pa(ma);Ga=0;for(Na=d.length;Ga<Na;Ga++){ka=d[Ga];H.empty();if(ka instanceof THREE.RenderableParticle){t=ka;t.x*=c;t.y*=k;ra=0;for(za=ka.materials.length;ra<za;ra++)Qa(t,ka,ka.materials[ra],ma)}else if(ka instanceof THREE.RenderableLine){t=ka.v1;L=ka.v2;
- t.positionScreen.x*=c;t.positionScreen.y*=k;L.positionScreen.x*=c;L.positionScreen.y*=k;H.addPoint(t.positionScreen.x,t.positionScreen.y);H.addPoint(L.positionScreen.x,L.positionScreen.y);if(ba.instersects(H)){ra=0;for(za=ka.materials.length;ra<za;)Ra(t,L,ka,ka.materials[ra++],ma)}}else if(ka instanceof THREE.RenderableFace3){t=ka.v1;L=ka.v2;m=ka.v3;t.positionScreen.x*=c;t.positionScreen.y*=k;L.positionScreen.x*=c;L.positionScreen.y*=k;m.positionScreen.x*=c;m.positionScreen.y*=k;if(ka.overdraw){Ja(t.positionScreen,
- L.positionScreen);Ja(L.positionScreen,m.positionScreen);Ja(m.positionScreen,t.positionScreen)}H.add3Points(t.positionScreen.x,t.positionScreen.y,L.positionScreen.x,L.positionScreen.y,m.positionScreen.x,m.positionScreen.y);if(ba.instersects(H)){ra=0;for(za=ka.meshMaterials.length;ra<za;){Ca=ka.meshMaterials[ra++];if(Ca instanceof THREE.MeshFaceMaterial){Ka=0;for(Oa=ka.faceMaterials.length;Ka<Oa;)(Ca=ka.faceMaterials[Ka++])&&La(t,L,m,ka,Ca,ma)}else La(t,L,m,ka,Ca,ma)}}}Y.addRectangle(H)}l.setTransform(1,
- 0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(V,P,da){var X,R,U,ba;X=0;for(R=V.lights.length;X<R;X++){U=V.lights[X];if(U instanceof THREE.DirectionalLight){ba=P.normalWorld.dot(U.position)*U.intensity;if(ba>0){da.r+=U.color.r*ba;da.g+=U.color.g*ba;da.b+=U.color.b*ba}}else if(U instanceof THREE.PointLight){N.sub(U.position,P.centroidWorld);N.normalize();ba=P.normalWorld.dot(N)*U.intensity;if(ba>0){da.r+=U.color.r*ba;da.g+=U.color.g*ba;da.b+=U.color.b*ba}}}}function b(V,P,da,X,R,U){E=e(y++);E.setAttribute("d",
- "M "+V.positionScreen.x+" "+V.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(L){g.r=o.r;g.g=o.g;g.b=o.b;a(U,X,g);m.r=R.color.r*g.r;m.g=R.color.g*g.g;m.b=R.color.b*g.b;m.updateStyleString()}else m.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){A=1-R.__2near/(R.__farPlusNear-
- X.z*R.__farMinusNear);m.setRGB(A,A,A)}else R instanceof THREE.MeshNormalMaterial&&m.setRGB(f(X.normalWorld.x),f(X.normalWorld.y),f(X.normalWorld.z));R.wireframe?E.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):E.setAttribute("style","fill: "+m.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(E)}function d(V,P,da,X,R,U,ba){E=
- e(y++);E.setAttribute("d","M "+V.positionScreen.x+" "+V.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(U instanceof THREE.MeshBasicMaterial)m.__styleString=U.color.__styleString;else if(U instanceof THREE.MeshLambertMaterial)if(L){g.r=o.r;g.g=o.g;g.b=o.b;a(ba,R,g);m.r=U.color.r*g.r;m.g=U.color.g*g.g;m.b=U.color.b*g.b;m.updateStyleString()}else m.__styleString=U.color.__styleString;
- else if(U instanceof THREE.MeshDepthMaterial){A=1-U.__2near/(U.__farPlusNear-R.z*U.__farMinusNear);m.setRGB(A,A,A)}else U instanceof THREE.MeshNormalMaterial&&m.setRGB(f(R.normalWorld.x),f(R.normalWorld.y),f(R.normalWorld.z));U.wireframe?E.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+U.wireframe_linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.wireframe_linecap+"; stroke-linejoin: "+U.wireframe_linejoin):E.setAttribute("style","fill: "+m.__styleString+
- "; fill-opacity: "+U.opacity);c.appendChild(E)}function e(V){if(v[V]==null){v[V]=document.createElementNS("http://www.w3.org/2000/svg","path");T==0&&v[V].setAttribute("shape-rendering","crispEdges");return v[V]}return v[V]}function f(V){return V<0?Math.min((1+V)*0.5,0.5):0.5+Math.min(V*0.5,0.5)}var h=null,j=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,n,C,p,x,z,u,K=new THREE.Rectangle,t=new THREE.Rectangle,L=false,m=new THREE.Color(16777215),g=new THREE.Color(16777215),
- o=new THREE.Color(0),B=new THREE.Color(0),q=new THREE.Color(0),A,N=new THREE.Vector3,v=[],D=[],G=[],E,y,I,F,T=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(V){switch(V){case "high":T=1;break;case "low":T=0}};this.setSize=function(V,P){k=V;l=P;n=k/2;C=l/2;c.setAttribute("viewBox",-n+" "+-C+" "+k+" "+l);c.setAttribute("width",k);c.setAttribute("height",l);K.set(-n,-C,n,C)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])};
- this.render=function(V,P){var da,X,R,U,ba,Y,H,S;this.autoClear&&this.clear();h=j.projectScene(V,P,this.sortElements);F=I=y=0;if(L=V.lights.length>0){H=V.lights;o.setRGB(0,0,0);B.setRGB(0,0,0);q.setRGB(0,0,0);da=0;for(X=H.length;da<X;da++){R=H[da];U=R.color;if(R instanceof THREE.AmbientLight){o.r+=U.r;o.g+=U.g;o.b+=U.b}else if(R instanceof THREE.DirectionalLight){B.r+=U.r;B.g+=U.g;B.b+=U.b}else if(R instanceof THREE.PointLight){q.r+=U.r;q.g+=U.g;q.b+=U.b}}}da=0;for(X=h.length;da<X;da++){H=h[da];t.empty();
- if(H instanceof THREE.RenderableParticle){p=H;p.x*=n;p.y*=-C;R=0;for(U=H.materials.length;R<U;R++)if(S=H.materials[R]){ba=p;Y=H;S=S;var W=I++;if(D[W]==null){D[W]=document.createElementNS("http://www.w3.org/2000/svg","circle");T==0&&D[W].setAttribute("shape-rendering","crispEdges")}E=D[W];E.setAttribute("cx",ba.x);E.setAttribute("cy",ba.y);E.setAttribute("r",Y.scale.x*n);if(S instanceof THREE.ParticleCircleMaterial){if(L){g.r=o.r+B.r+q.r;g.g=o.g+B.g+q.g;g.b=o.b+B.b+q.b;m.r=S.color.r*g.r;m.g=S.color.g*
- g.g;m.b=S.color.b*g.b;m.updateStyleString()}else m=S.color;E.setAttribute("style","fill: "+m.__styleString)}c.appendChild(E)}}else if(H instanceof THREE.RenderableLine){p=H.v1;x=H.v2;p.positionScreen.x*=n;p.positionScreen.y*=-C;x.positionScreen.x*=n;x.positionScreen.y*=-C;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);if(K.instersects(t)){R=0;for(U=H.materials.length;R<U;)if(S=H.materials[R++]){ba=p;Y=x;S=S;W=F++;if(G[W]==null){G[W]=document.createElementNS("http://www.w3.org/2000/svg",
- "line");T==0&&G[W].setAttribute("shape-rendering","crispEdges")}E=G[W];E.setAttribute("x1",ba.positionScreen.x);E.setAttribute("y1",ba.positionScreen.y);E.setAttribute("x2",Y.positionScreen.x);E.setAttribute("y2",Y.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){m.__styleString=S.color.__styleString;E.setAttribute("style","fill: none; stroke: "+m.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);
- c.appendChild(E)}}}}else if(H instanceof THREE.RenderableFace3){p=H.v1;x=H.v2;z=H.v3;p.positionScreen.x*=n;p.positionScreen.y*=-C;x.positionScreen.x*=n;x.positionScreen.y*=-C;z.positionScreen.x*=n;z.positionScreen.y*=-C;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(z.positionScreen.x,z.positionScreen.y);if(K.instersects(t)){R=0;for(U=H.meshMaterials.length;R<U;){S=H.meshMaterials[R++];if(S instanceof THREE.MeshFaceMaterial){ba=0;for(Y=
- H.faceMaterials.length;ba<Y;)(S=H.faceMaterials[ba++])&&b(p,x,z,H,S,V)}else S&&b(p,x,z,H,S,V)}}}else if(H instanceof THREE.RenderableFace4){p=H.v1;x=H.v2;z=H.v3;u=H.v4;p.positionScreen.x*=n;p.positionScreen.y*=-C;x.positionScreen.x*=n;x.positionScreen.y*=-C;z.positionScreen.x*=n;z.positionScreen.y*=-C;u.positionScreen.x*=n;u.positionScreen.y*=-C;t.addPoint(p.positionScreen.x,p.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(z.positionScreen.x,z.positionScreen.y);t.addPoint(u.positionScreen.x,
- u.positionScreen.y);if(K.instersects(t)){R=0;for(U=H.meshMaterials.length;R<U;){S=H.meshMaterials[R++];if(S instanceof THREE.MeshFaceMaterial){ba=0;for(Y=H.faceMaterials.length;ba<Y;)(S=H.faceMaterials[ba++])&&d(p,x,z,u,H,S,V)}else S&&d(p,x,z,u,H,S,V)}}}}}};
- THREE.WebGLRenderer=function(a){function b(g,o){g.fragment_shader=o.fragment_shader;g.vertex_shader=o.vertex_shader;g.uniforms=Uniforms.clone(o.uniforms)}function d(g,o){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;g.uniforms.map.texture=g.map;g.uniforms.env_map.texture=g.env_map;g.uniforms.reflectivity.value=g.reflectivity;g.uniforms.refraction_ratio.value=g.refraction_ratio;g.uniforms.combine.value=g.combine;g.uniforms.useRefract.value=
- g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;if(o){g.uniforms.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){g.uniforms.fogNear.value=o.near;g.uniforms.fogFar.value=o.far}else if(o instanceof THREE.FogExp2)g.uniforms.fogDensity.value=o.density}}function e(g,o){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;if(o){g.uniforms.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){g.uniforms.fogNear.value=
- o.near;g.uniforms.fogFar.value=o.far}else if(o instanceof THREE.FogExp2)g.uniforms.fogDensity.value=o.density}}function f(g,o){var B;if(g=="fragment")B=c.createShader(c.FRAGMENT_SHADER);else if(g=="vertex")B=c.createShader(c.VERTEX_SHADER);c.shaderSource(B,o);c.compileShader(B);if(!c.getShaderParameter(B,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(B));return null}return B}function h(g){switch(g){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
- case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
- case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var j=document.createElement("canvas"),c,k=null,l=null,n=new THREE.Matrix4,C,p=new Float32Array(16),x=new Float32Array(16),z=new Float32Array(16),u=new Float32Array(9),
- K=new Float32Array(16),t=true,L=new THREE.Color(0),m=0;if(a){if(a.antialias!==undefined)t=a.antialias;a.clearColor!==undefined&&L.setHex(a.clearColor);if(a.clearAlpha!==undefined)m=a.clearAlpha}this.domElement=j;this.autoClear=true;(function(g,o,B){try{c=j.getContext("experimental-webgl",{antialias:g})}catch(q){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);
- c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(o.r,o.g,o.b,B)})(t,L,m);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(g,o){j.width=g;j.height=o;c.viewport(0,0,j.width,j.height)};this.setClearColor=function(g,o){var B=new THREE.Color(g);c.clearColor(B.r,B.g,B.b,o)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=
- function(g,o){var B,q,A,N=0,v=0,D=0,G,E,y,I=this.lights,F=I.directional.colors,T=I.directional.positions,V=I.point.colors,P=I.point.positions,da=0,X=0;B=0;for(q=o.length;B<q;B++){A=o[B];G=A.color;E=A.position;y=A.intensity;if(A instanceof THREE.AmbientLight){N+=G.r;v+=G.g;D+=G.b}else if(A instanceof THREE.DirectionalLight){F[da*3]=G.r*y;F[da*3+1]=G.g*y;F[da*3+2]=G.b*y;T[da*3]=E.x;T[da*3+1]=E.y;T[da*3+2]=E.z;da+=1}else if(A instanceof THREE.PointLight){V[X*3]=G.r*y;V[X*3+1]=G.g*y;V[X*3+2]=G.b*y;P[X*
- 3]=E.x;P[X*3+1]=E.y;P[X*3+2]=E.z;X+=1}}I.point.length=X;I.directional.length=da;I.ambient[0]=N;I.ambient[1]=v;I.ambient[2]=D};this.createParticleBuffers=function(g){g.__webGLVertexBuffer=c.createBuffer();g.__webGLFaceBuffer=c.createBuffer()};this.createLineBuffers=function(g){g.__webGLVertexBuffer=c.createBuffer();g.__webGLLineBuffer=c.createBuffer()};this.createMeshBuffers=function(g){g.__webGLVertexBuffer=c.createBuffer();g.__webGLNormalBuffer=c.createBuffer();g.__webGLTangentBuffer=c.createBuffer();
- g.__webGLUVBuffer=c.createBuffer();g.__webGLFaceBuffer=c.createBuffer();g.__webGLLineBuffer=c.createBuffer()};this.initLineBuffers=function(g){var o=g.vertices.length;g.__vertexArray=new Float32Array(o*3);g.__lineArray=new Uint16Array(o);g.__webGLLineCount=o};this.initMeshBuffers=function(g,o){var B,q,A=0,N=0,v=0,D=o.geometry.faces,G=g.faces;B=0;for(q=G.length;B<q;B++){fi=G[B];face=D[fi];if(face instanceof THREE.Face3){A+=3;N+=1;v+=3}else if(face instanceof THREE.Face4){A+=4;N+=2;v+=4}}g.__vertexArray=
- new Float32Array(A*3);g.__normalArray=new Float32Array(A*3);g.__tangentArray=new Float32Array(A*4);g.__uvArray=new Float32Array(A*2);g.__faceArray=new Uint16Array(N*3);g.__lineArray=new Uint16Array(v*2);A=false;B=0;for(q=o.materials.length;B<q;B++){D=o.materials[B];if(D instanceof THREE.MeshFaceMaterial){D=0;for(G=g.materials.length;D<G;D++)if(g.materials[D]&&g.materials[D].shading!=undefined&&g.materials[D].shading==THREE.SmoothShading){A=true;break}}else if(D&&D.shading!=undefined&&D.shading==THREE.SmoothShading){A=
- true;break}if(A)break}g.__needsSmoothNormals=A;g.__webGLFaceCount=N*3;g.__webGLLineCount=v*2};this.setMeshBuffers=function(g,o,B,q,A,N,v,D){var G,E,y,I,F,T,V,P,da,X=0,R=0,U=0,ba=0,Y=0,H=0,S=0,W=g.__vertexArray,ia=g.__uvArray,ha=g.__normalArray,w=g.__tangentArray,M=g.__faceArray,J=g.__lineArray,Z=g.__needsSmoothNormals,ca=o.geometry,ga=ca.vertices,ja=g.faces,qa=ca.faces,sa=ca.uvs;o=0;for(G=ja.length;o<G;o++){E=ja[o];y=qa[E];E=sa[E];I=y.vertexNormals;F=y.normal;if(y instanceof THREE.Face3){if(q){T=
- ga[y.a].position;V=ga[y.b].position;P=ga[y.c].position;W[R]=T.x;W[R+1]=T.y;W[R+2]=T.z;W[R+3]=V.x;W[R+4]=V.y;W[R+5]=V.z;W[R+6]=P.x;W[R+7]=P.y;W[R+8]=P.z;R+=9}if(D&&ca.hasTangents){T=ga[y.a].tangent;V=ga[y.b].tangent;P=ga[y.c].tangent;w[H]=T.x;w[H+1]=T.y;w[H+2]=T.z;w[H+3]=T.w;w[H+4]=V.x;w[H+5]=V.y;w[H+6]=V.z;w[H+7]=V.w;w[H+8]=P.x;w[H+9]=P.y;w[H+10]=P.z;w[H+11]=P.w;H+=12}if(v)if(I.length==3&&Z)for(y=0;y<3;y++){F=I[y];ha[Y]=F.x;ha[Y+1]=F.y;ha[Y+2]=F.z;Y+=3}else for(y=0;y<3;y++){ha[Y]=F.x;ha[Y+1]=F.y;
- ha[Y+2]=F.z;Y+=3}if(N&&E)for(y=0;y<3;y++){I=E[y];ia[U]=I.u;ia[U+1]=I.v;U+=2}if(A){M[ba]=X;M[ba+1]=X+1;M[ba+2]=X+2;ba+=3;J[S]=X;J[S+1]=X+1;J[S+2]=X;J[S+3]=X+2;J[S+4]=X+1;J[S+5]=X+2;S+=6;X+=3}}else if(y instanceof THREE.Face4){if(q){T=ga[y.a].position;V=ga[y.b].position;P=ga[y.c].position;da=ga[y.d].position;W[R]=T.x;W[R+1]=T.y;W[R+2]=T.z;W[R+3]=V.x;W[R+4]=V.y;W[R+5]=V.z;W[R+6]=P.x;W[R+7]=P.y;W[R+8]=P.z;W[R+9]=da.x;W[R+10]=da.y;W[R+11]=da.z;R+=12}if(D&&ca.hasTangents){T=ga[y.a].tangent;V=ga[y.b].tangent;
- P=ga[y.c].tangent;y=ga[y.d].tangent;w[H]=T.x;w[H+1]=T.y;w[H+2]=T.z;w[H+3]=T.w;w[H+4]=V.x;w[H+5]=V.y;w[H+6]=V.z;w[H+7]=V.w;w[H+8]=P.x;w[H+9]=P.y;w[H+10]=P.z;w[H+11]=P.w;w[H+12]=y.x;w[H+13]=y.y;w[H+14]=y.z;w[H+15]=y.w;H+=16}if(v)if(I.length==4&&Z)for(y=0;y<4;y++){F=I[y];ha[Y]=F.x;ha[Y+1]=F.y;ha[Y+2]=F.z;Y+=3}else for(y=0;y<4;y++){ha[Y]=F.x;ha[Y+1]=F.y;ha[Y+2]=F.z;Y+=3}if(N&&E)for(y=0;y<4;y++){I=E[y];ia[U]=I.u;ia[U+1]=I.v;U+=2}if(A){M[ba]=X;M[ba+1]=X+1;M[ba+2]=X+2;M[ba+3]=X;M[ba+4]=X+2;M[ba+5]=X+3;ba+=
- 6;J[S]=X;J[S+1]=X+1;J[S+2]=X;J[S+3]=X+3;J[S+4]=X+1;J[S+5]=X+2;J[S+6]=X+2;J[S+7]=X+3;S+=8;X+=4}}}if(q){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,W,B)}if(v){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ha,B)}if(D&&ca.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,w,B)}if(N&&U>0){c.bindBuffer(c.ARRAY_BUFFER,g.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,B)}if(A){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- g.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,M,B);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,J,B)}};this.setLineBuffers=function(g,o,B,q){var A,N,v=g.vertices,D=v.length,G=g.__vertexArray,E=g.__lineArray;if(B)for(B=0;B<D;B++){A=v[B].position;N=B*3;G[N]=A.x;G[N+1]=A.y;G[N+2]=A.z}if(q)for(B=0;B<D;B++)E[B]=B;c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,G,o);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);
- c.bufferData(c.ELEMENT_ARRAY_BUFFER,E,o)};this.setParticleBuffers=function(){};this.renderBuffer=function(g,o,B,q,A,N){var v,D,G,E;if(!q.program){if(q instanceof THREE.MeshDepthMaterial){b(q,THREE.ShaderLib.depth);q.uniforms.mNear.value=g.near;q.uniforms.mFar.value=g.far}else if(q instanceof THREE.MeshNormalMaterial)b(q,THREE.ShaderLib.normal);else if(q instanceof THREE.MeshBasicMaterial){b(q,THREE.ShaderLib.basic);d(q,B)}else if(q instanceof THREE.MeshLambertMaterial){b(q,THREE.ShaderLib.lambert);
- d(q,B)}else if(q instanceof THREE.MeshPhongMaterial){b(q,THREE.ShaderLib.phong);d(q,B)}else if(q instanceof THREE.LineBasicMaterial){b(q,THREE.ShaderLib.basic);e(q,B)}var y,I,F;y=E=D=0;for(I=o.length;y<I;y++){F=o[y];F instanceof THREE.DirectionalLight&&E++;F instanceof THREE.PointLight&&D++}if(D+E<=4){y=E;D=D}else{y=Math.ceil(4*E/(D+E));D=4-y}D={directional:y,point:D};E={fog:B,map:q.map,env_map:q.env_map,maxDirLights:D.directional,maxPointLights:D.point};D=q.fragment_shader;y=q.vertex_shader;I=c.createProgram();
- F=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,
- E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");c.attachShader(I,f("fragment",F+D));c.attachShader(I,f("vertex",E+y));c.linkProgram(I);c.getProgramParameter(I,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
- c.getProgramParameter(I,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");I.uniforms={};I.attributes={};q.program=I;D=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(v in q.uniforms)D.push(v);v=q.program;y=0;for(I=D.length;y<I;y++){F=D[y];v.uniforms[F]=c.getUniformLocation(v,F)}v=q.program;D=["position","normal","uv","tangent"];y=0;for(I=D.length;y<I;y++){F=D[y];v.attributes[F]=c.getAttribLocation(v,F)}}v=q.program;if(v!=k){c.useProgram(v);
- k=v}this.loadCamera(v,g);this.loadMatrices(v);if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial){this.setupLights(v,o);g=this.lights;q.uniforms.enableLighting.value=g.directional.length+g.point.length;q.uniforms.ambientLightColor.value=g.ambient;q.uniforms.directionalLightColor.value=g.directional.colors;q.uniforms.directionalLightDirection.value=g.directional.positions;q.uniforms.pointLightColor.value=g.point.colors;q.uniforms.pointLightPosition.value=g.point.positions}if(q instanceof
- THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial)d(q,B);q instanceof THREE.LineBasicMaterial&&e(q,B);if(q instanceof THREE.MeshPhongMaterial){q.uniforms.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);q.uniforms.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);q.uniforms.shininess.value=q.shininess}B=q.uniforms;for(G in B)if(y=v.uniforms[G]){o=B[G];D=o.type;g=o.value;if(D=="i")c.uniform1i(y,g);else if(D=="f")c.uniform1f(y,
- g);else if(D=="fv1")c.uniform1fv(y,g);else if(D=="fv")c.uniform3fv(y,g);else if(D=="v2")c.uniform2f(y,g.x,g.y);else if(D=="v3")c.uniform3f(y,g.x,g.y,g.z);else if(D=="c")c.uniform3f(y,g.r,g.g,g.b);else if(D=="t"){c.uniform1i(y,g);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){o=o;g=g;if(o.image.length==6){if(!o.image.__webGLTextureCube&&!o.image.__cubeMapInitialized&&o.image.loadCount==6){o.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);
- c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(D=0;D<6;++D)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o.image[D]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);o.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
- g);c.bindTexture(c.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{o=o;g=g;if(!o.__webGLTexture&&o.image.loaded){o.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,o.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,h(o.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,h(o.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,h(o.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,h(o.min_filter));
- c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+g);c.bindTexture(c.TEXTURE_2D,o.__webGLTexture)}}}G=v.attributes;c.bindBuffer(c.ARRAY_BUFFER,A.__webGLVertexBuffer);c.vertexAttribPointer(G.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(G.position);if(G.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,A.__webGLNormalBuffer);c.vertexAttribPointer(G.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(G.normal)}if(G.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,A.__webGLTangentBuffer);
- c.vertexAttribPointer(G.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(G.tangent)}if(G.uv>=0)if(A.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,A.__webGLUVBuffer);c.vertexAttribPointer(G.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(G.uv)}else c.disableVertexAttribArray(G.uv);if(q.wireframe||q instanceof THREE.LineBasicMaterial){G=q.wireframe_linewidth!==undefined?q.wireframe_linewidth:q.linewidth!==undefined?q.linewidth:1;q=q instanceof THREE.LineBasicMaterial&&N.type==THREE.LineStrip?
- c.LINE_STRIP:c.LINES;c.lineWidth(G);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);c.drawElements(q,A.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,A.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(g,o,B,q,A,N,v){var D,G,E,y,I;E=0;for(y=q.materials.length;E<y;E++){D=q.materials[E];if(D instanceof THREE.MeshFaceMaterial){D=0;for(G=A.materials.length;D<G;D++)if((I=A.materials[D])&&I.blending==N&&
- I.opacity<1==v){this.setBlending(I.blending);this.renderBuffer(g,o,B,I,A,q)}}else if((I=D)&&I.blending==N&&I.opacity<1==v){this.setBlending(I.blending);this.renderBuffer(g,o,B,I,A,q)}}};this.render=function(g,o,B,q){var A,N,v,D=g.lights,G=g.fog;this.initWebGLObjects(g);q=q!==undefined?q:true;if(B&&!B.__webGLFramebuffer){B.__webGLFramebuffer=c.createFramebuffer();B.__webGLRenderbuffer=c.createRenderbuffer();B.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,B.__webGLRenderbuffer);
- c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,B.width,B.height);c.bindTexture(c.TEXTURE_2D,B.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,h(B.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,h(B.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,h(B.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,h(B.min_filter));c.texImage2D(c.TEXTURE_2D,0,h(B.format),B.width,B.height,0,h(B.format),h(B.type),null);c.bindFramebuffer(c.FRAMEBUFFER,B.__webGLFramebuffer);
- c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,B.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,B.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}if(B){A=B.__webGLFramebuffer;v=B.width;N=B.height}else{A=null;v=j.width;N=j.height}if(A!=l){c.bindFramebuffer(c.FRAMEBUFFER,A);c.viewport(0,0,v,N);q&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);l=A}this.autoClear&&
- this.clear();o.autoUpdateMatrix&&o.updateMatrix();p.set(o.matrix.flatten());z.set(o.projectionMatrix.flatten());q=0;for(A=g.__webGLObjects.length;q<A;q++){N=g.__webGLObjects[q];v=N.object;N=N.buffer;if(v.visible){this.setupMatrices(v,o);this.renderPass(o,D,G,v,N,THREE.NormalBlending,false)}}q=0;for(A=g.__webGLObjects.length;q<A;q++){N=g.__webGLObjects[q];v=N.object;N=N.buffer;if(v.visible){this.setupMatrices(v,o);if(v.doubleSided)c.disable(c.CULL_FACE);else{c.enable(c.CULL_FACE);v.flipSided?c.frontFace(c.CW):
- c.frontFace(c.CCW)}this.renderPass(o,D,G,v,N,THREE.AdditiveBlending,false);this.renderPass(o,D,G,v,N,THREE.SubtractiveBlending,false);this.renderPass(o,D,G,v,N,THREE.AdditiveBlending,true);this.renderPass(o,D,G,v,N,THREE.SubtractiveBlending,true);this.renderPass(o,D,G,v,N,THREE.NormalBlending,true)}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,B.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
- function(g){function o(E,y,I,F){if(E[y]==undefined){g.__webGLObjects.push({buffer:I,object:F});E[y]=1}}var B,q,A,N,v,D,G;if(!g.__webGLObjects){g.__webGLObjects=[];g.__webGLObjectsMap={}}B=0;for(q=g.objects.length;B<q;B++){A=g.objects[B];v=A.geometry;if(g.__webGLObjectsMap[A.id]==undefined)g.__webGLObjectsMap[A.id]={};G=g.__webGLObjectsMap[A.id];if(A instanceof THREE.Mesh){for(N in v.geometryChunks){D=v.geometryChunks[N];if(!D.__webGLVertexBuffer){this.createMeshBuffers(D);this.initMeshBuffers(D,A);
- v.__dirtyVertices=true;v.__dirtyElements=true;v.__dirtyUvs=true;v.__dirtyNormals=true;v.__dirtyTangents=true}if(v.__dirtyVertices||v.__dirtyElements||v.__dirtyUvs)this.setMeshBuffers(D,A,c.DYNAMIC_DRAW,v.__dirtyVertices,v.__dirtyElements,v.__dirtyUvs,v.__dirtyNormals,v.__dirtyTangents);o(G,N,D,A)}v.__dirtyVertices=false;v.__dirtyElements=false;v.__dirtyUvs=false;v.__dirtyNormals=false;v.__dirtyTangents=false}else if(A instanceof THREE.Line){if(!v.__webGLVertexBuffer){this.createLineBuffers(v);this.initLineBuffers(v);
- v.__dirtyVertices=true;v.__dirtyElements=true}v.__dirtyVertices&&this.setLineBuffers(v,c.DYNAMIC_DRAW,v.__dirtyVertices,v.__dirtyElements);o(G,0,v,A);v.__dirtyVertices=false;v.__dirtyElements=false}else if(A instanceof THREE.ParticleSystem){v.__webGLVertexBuffer||this.createParticleBuffers(v);o(G,0,v,A)}}};this.removeObject=function(g,o){var B,q;for(B=g.__webGLObjects.length-1;B>=0;B--){q=g.__webGLObjects[B].object;o==q&&g.__webGLObjects.splice(B,1)}};this.setupMatrices=function(g,o){g.autoUpdateMatrix&&
- g.updateMatrix();n.multiply(o.matrix,g.matrix);x.set(n.flatten());C=THREE.Matrix4.makeInvert3x3(n).transpose();u.set(C.m);K.set(g.matrix.flatten())};this.loadMatrices=function(g){c.uniformMatrix4fv(g.uniforms.viewMatrix,false,p);c.uniformMatrix4fv(g.uniforms.modelViewMatrix,false,x);c.uniformMatrix4fv(g.uniforms.projectionMatrix,false,z);c.uniformMatrix3fv(g.uniforms.normalMatrix,false,u);c.uniformMatrix4fv(g.uniforms.objectMatrix,false,K)};this.loadCamera=function(g,o){c.uniform3f(g.uniforms.cameraPosition,
- o.position.x,o.position.y,o.position.z)};this.setBlending=function(g){switch(g){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(g,o){if(g){!o||o=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(g=="back")c.cullFace(c.BACK);else g=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);
- c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
- THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
- THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",
- value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
- vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
- THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
- THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
- THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
- shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
- "gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
- THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};
- THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
- var GeometryUtils={merge:function(a,b){var d=b instanceof THREE.Mesh,e=a.vertices.length,f=d?b.geometry:b,h=a.vertices,j=f.vertices,c=a.faces,k=f.faces,l=a.uvs;f=f.uvs;d&&b.autoUpdateMatrix&&b.updateMatrix();for(var n=0,C=j.length;n<C;n++){var p=new THREE.Vertex(j[n].position.clone());d&&b.matrix.multiplyVector3(p.position);h.push(p)}n=0;for(C=k.length;n<C;n++){j=k[n];var x,z=j.vertexNormals;if(j instanceof THREE.Face3)x=new THREE.Face3(j.a+e,j.b+e,j.c+e);else if(j instanceof THREE.Face4)x=new THREE.Face4(j.a+
- e,j.b+e,j.c+e,j.d+e);x.centroid.copy(j.centroid);x.normal.copy(j.normal);d=0;for(h=z.length;d<h;d++){p=z[d];x.vertexNormals.push(p.clone())}x.materials=j.materials.slice();c.push(x)}n=0;for(C=f.length;n<C;n++){e=f[n];c=[];d=0;for(h=e.length;d<h;d++)c.push(new THREE.UV(e[d].u,e[d].v));l.push(c)}}},ImageUtils={loadTexture:function(a,b){var d=new Image;d.onload=function(){this.loaded=true};d.src=a;return new THREE.Texture(d,b)},loadArray:function(a){var b,d,e=[];b=e.loadCount=0;for(d=a.length;b<d;++b){e[b]=
- new Image;e[b].loaded=0;e[b].onload=function(){e.loadCount+=1;this.loaded=true};e[b].src=a[b]}return e}},SceneUtils={loadScene:function(a,b,d){var e,f,h,j,c,k,l,n,C,p,x,z,u,K,t,L,m,g,o,B,q,A,N,v,D;a=new Worker(a);D=new THREE.Loader;a.onmessage=function(G){function E(){for(h in I.objects)if(!F.objects[h]){C=I.objects[h];if(g=F.geometries[C.geometry]){v=[];for(i=0;i<C.materials.length;i++)v[i]=F.materials[C.materials[i]];z=C.position;r=C.rotation;s=C.scale;object=new THREE.Mesh(g,v);object.position.set(z[0],
- z[1],z[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;F.scene.addObject(object);F.objects[h]=object}}}function y(V){return function(P){F.geometries[V]=P;E();T-=1;T==0&&d(F)}}var I=G.data,F={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}},T=0;for(e in I.geometries){n=I.geometries[e];if(n.type=="bin_mesh"||n.type=="ascii_mesh")T+=1}for(e in I.geometries){n=I.geometries[e];if(n.type=="cube"){g=new Cube(n.width,
- n.height,n.depth,n.segments_width,n.segments_height,null,n.flipped,n.sides);F.geometries[e]=g}else if(n.type=="plane"){g=new Plane(n.width,n.height,n.segments_width,n.segments_height);F.geometries[e]=g}else if(n.type=="sphere"){g=new Sphere(n.radius,n.segments_width,n.segments_height);F.geometries[e]=g}else if(n.type=="cylinder"){g=new Cylinder(n.numSegs,n.topRad,n.botRad,n.height,n.topOffset,n.botOffset);F.geometries[e]=g}else if(n.type=="torus"){g=new Torus(n.radius,n.tube,n.segmentsR,n.segmentsT);
- F.geometries[e]=g}else if(n.type=="bin_mesh")D.loadBinary({model:n.url,callback:y(e)});else n.type=="ascii_mesh"&&D.loadAscii({model:n.url,callback:y(e)})}for(l in I.textures){L=I.textures[l];if(L.url instanceof Array){N=ImageUtils.loadArray(L.url);A=new THREE.Texture(N)}else A=ImageUtils.loadTexture(L.url);F.textures[l]=A}for(f in I.materials){p=I.materials[f];for(m in p.parameters)if(m=="env_map"||m=="map")p.parameters[m]=F.textures[p.parameters[m]];o=new THREE[p.type](p.parameters);F.materials[f]=
- o}E();for(j in I.lights){x=I.lights[j];if(x.type=="directional"){z=x.direction;light=new THREE.DirectionalLight;light.position.set(z[0],z[1],z[2]);light.position.normalize()}else if(x.type=="point"){z=x.position;light=new THREE.PointLight;light.position.set(z[0],z[1],z[2])}u=x.color;light.color.setRGB(u[0],u[1],u[2]);F.scene.addLight(light);F.lights[j]=light}for(c in I.cameras){u=I.cameras[c];if(u.type=="perspective")B=new THREE.Camera(u.fov,u.aspect,u.near,u.far);else if(u.type=="ortho"){B=new THREE.Camera;
- B.projectionMatrix=THREE.Matrix4.makeOrtho(u.left,u.right,u.top,u.bottom,u.near,u.far)}z=u.position;K=u.target;B.position.set(z[0],z[1],z[2]);B.target.position.set(K[0],K[1],K[2]);F.cameras[c]=B}for(k in I.fogs){t=I.fogs[k];if(t.type=="linear")q=new THREE.Fog(0,t.near,t.far);else if(t.type=="exp2")q=new THREE.FogExp2(0,t.density);u=t.color;q.color.setRGB(u[0],u[1],u[2]);F.fogs[k]=q}F.currentCamera=F.cameras[I.defaults.camera];if(F.fogs&&I.defaults.fog)F.scene.fog=F.fogs[I.defaults.fog];u=I.defaults.bgcolor;
- F.bgColor=new THREE.Color;F.bgColor.setRGB(u[0],u[1],u[2]);F.bgColorAlpha=I.defaults.bgalpha;b(F)};a.postMessage(0)},addMesh:function(a,b,d,e,f,h,j,c,k,l){b=new THREE.Mesh(b,l);b.scale.x=b.scale.y=b.scale.z=d;b.position.x=e;b.position.y=f;b.position.z=h;b.rotation.x=j;b.rotation.y=c;b.rotation.z=k;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,d){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragment_shader:e.fragment_shader,vertex_shader:e.vertex_shader,
- uniforms:e.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,true),d);a.addObject(b);return b},addPanoramaCube:function(a,b,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));
- b=new THREE.Mesh(new Cube(b,b,b,1,1,e,true),new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,d){var e=b/2;b=new Plane(b,b);var f=Math.PI/2,h=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(a,b,1,-e,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(a,b,1,e,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,
- b,1,0,e,0,f,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(a,b,1,0,-e,0,-f,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[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}},fragment_shader:"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}",
- vertex_shader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main(void) {\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}},fragment_shader:"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}",
- vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
- cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},basic:{uniforms:{},
- vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"void main() {\ngl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n}"}}},Cube=function(a,b,d,e,f,h,j,c){function k(u,K,t,L,m,g,o,B){var q,A,N=e||1,v=f||1,D=N+1,G=v+1,E=m/2,y=g/2;m=m/N;var I=g/v,F=l.vertices.length;if(u=="x"&&K=="y"||u=="y"&&K=="x")q="z";else if(u=="x"&&K=="z"||u=="z"&&K=="x")q="y";else if(u=="z"&&K=="y"||u=="y"&&K=="z")q="x";for(A=0;A<G;A++)for(g=0;g<D;g++){var T=new THREE.Vector3;
- T[u]=(g*m-E)*t;T[K]=(A*I-y)*L;T[q]=o;l.vertices.push(new THREE.Vertex(T))}for(A=0;A<v;A++)for(g=0;g<N;g++){l.faces.push(new THREE.Face4(g+D*A+F,g+D*(A+1)+F,g+1+D*(A+1)+F,g+1+D*A+F,null,B));l.uvs.push([new THREE.UV(g/N,A/v),new THREE.UV(g/N,(A+1)/v),new THREE.UV((g+1)/N,(A+1)/v),new THREE.UV((g+1)/N,A/v)])}}THREE.Geometry.call(this);var l=this,n=a/2,C=b/2,p=d/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([h])}else this.materials=
- [];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(c!=undefined)for(var z in c)if(this.sides[z]!=undefined)this.sides[z]=c[z];this.sides.px&&k("z","y",1*j,-1,d,b,-n,this.materials[0]);this.sides.nx&&k("z","y",-1*j,-1,d,b,n,this.materials[1]);this.sides.py&&k("x","z",1*j,1,a,d,C,this.materials[2]);this.sides.ny&&k("x","z",1*j,-1,a,d,-C,this.materials[3]);this.sides.pz&&k("x","y",1*j,-1,a,b,p,this.materials[4]);this.sides.nz&&k("x","y",-1*j,-1,a,b,-p,this.materials[5]);(function(){for(var u=
- [],K=[],t=0,L=l.vertices.length;t<L;t++){for(var m=l.vertices[t],g=false,o=0,B=u.length;o<B;o++){var q=u[o];if(m.position.x==q.position.x&&m.position.y==q.position.y&&m.position.z==q.position.z){K[t]=o;g=true;break}}if(!g){K[t]=u.length;u.push(new THREE.Vertex(m.position.clone()))}}t=0;for(L=l.faces.length;t<L;t++){m=l.faces[t];m.a=K[m.a];m.b=K[m.b];m.c=K[m.c];m.d=K[m.d]}l.vertices=u})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;
- Cube.prototype.constructor=Cube;
- var Cylinder=function(a,b,d,e,f){function h(l,n,C){j.vertices.push(new THREE.Vertex(new THREE.Vector3(l,n,C)))}THREE.Geometry.call(this);var j=this,c=Math.PI,k;for(k=0;k<a;k++)h(Math.sin(2*c*k/a)*b,Math.cos(2*c*k/a)*b,0);for(k=0;k<a;k++)h(Math.sin(2*c*k/a)*d,Math.cos(2*c*k/a)*d,e);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(d!=0){h(0,0,-f);for(k=a;k<a+a/2;k++)j.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){h(0,0,e+f);for(k=a+a/2;k<
- 2*a;k++)j.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();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,b,d,e){THREE.Geometry.call(this);var f,h=a/2,j=b/2;d=d||1;e=e||1;var c=d+1,k=e+1;a=a/d;var l=b/e;for(f=0;f<k;f++)for(b=0;b<c;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*l-j),0)));for(f=0;f<e;f++)for(b=0;b<d;b++){this.faces.push(new THREE.Face4(b+c*f,b+c*(f+1),b+1+c*(f+1),b+1+c*f));this.uvs.push([new THREE.UV(b/d,f/e),new THREE.UV(b/d,(f+1)/e),new THREE.UV((b+1)/d,(f+1)/e),new THREE.UV((b+1)/d,f/e)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,b,d){THREE.Geometry.call(this);var e,f=Math.PI,h=Math.max(3,b||8),j=Math.max(2,d||6);b=[];for(d=0;d<j+1;d++){e=d/j;var c=a*Math.cos(e*f),k=a*Math.sin(e*f),l=[],n=0;for(e=0;e<h;e++){var C=2*e/h,p=k*Math.sin(C*f);C=k*Math.cos(C*f);(d==0||d==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(C,c,p)))-1);l.push(n)}b.push(l)}var x,z,u;f=b.length;for(d=0;d<f;d++){h=b[d].length;if(d>0)for(e=0;e<h;e++){l=e==h-1;j=b[d][l?0:e+1];c=b[d][l?h-1:e];k=b[d-1][l?h-1:e];l=b[d-1][l?
- 0:e+1];p=d/(f-1);x=(d-1)/(f-1);z=(e+1)/h;C=e/h;n=new THREE.UV(1-z,p);p=new THREE.UV(1-C,p);C=new THREE.UV(1-C,x);var K=new THREE.UV(1-z,x);if(d<b.length-1){x=this.vertices[j].position.clone();z=this.vertices[c].position.clone();u=this.vertices[k].position.clone();x.normalize();z.normalize();u.normalize();this.faces.push(new THREE.Face3(j,c,k,[new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([n,p,C])}if(d>1){x=this.vertices[j].position.clone();
- z=this.vertices[k].position.clone();u=this.vertices[l].position.clone();x.normalize();z.normalize();u.normalize();this.faces.push(new THREE.Face3(j,k,l,[new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)]));this.uvs.push([n,C,K])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,b,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/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(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d=
- 1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;f=(this.segmentsT+1)*b+d-1;var h=(this.segmentsT+1)*(b-1)+d-1,j=(this.segmentsT+1)*(b-1)+d;this.faces.push(new THREE.Face4(e,f,h,j));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[j][0],a[j][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
- function LathedObject(a,b,d){THREE.Geometry.call(this);b=b||12;d=d||2*Math.PI;b=d/b;for(var e=[],f=[],h=[],j=[],c=0;c<a.length;c++){this.vertices.push(new THREE.Vertex(a[c]));f[c]=this.vertices.length-1;e[c]=new THREE.Vector3(a[c].x,a[c].y,a[c].z)}for(var k=THREE.Matrix4.rotationZMatrix(b),l=0;l<=d+0.0010;l+=b){for(c=0;c<e.length;c++)if(l<d){e[c]=k.multiplyVector3(e[c].clone());this.vertices.push(new THREE.Vertex(e[c]));h[c]=this.vertices.length-1}else h=j;if(l==0)j=f;for(c=0;c<f.length-1;c++){this.faces.push(new THREE.Face4(h[c],
- h[c+1],f[c+1],f[c]));this.uvs.push([new THREE.UV(l/d,c/a.length),new THREE.UV(l/d,(c+1)/a.length),new THREE.UV((l-b)/d,(c+1)/a.length),new THREE.UV((l-b)/d,c/a.length)])}f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;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 d=document.createElement("script");d.type="text/javascript";d.onload=b;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a){var b=a.model,d=a.callback,e=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,d,e)};b.postMessage(a)},loadBinary:function(a){var b=a.model,d=a.callback,e=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 h=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(j){THREE.Loader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,d,f,e,h)};b.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,d,e,f,h){var j=new XMLHttpRequest,c=e+"/"+a,k=0;
- j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.Loader.prototype.createBinModel(j.responseText,d,f,b):alert("Couldn't load ["+c+"] ["+j.status+"]");else if(j.readyState==3){if(h){if(k==0)k=j.getResponseHeader("Content-Length");h({total:k,loaded:j.responseText.length})}}else if(j.readyState==2)k=j.getResponseHeader("Content-Length")};j.open("GET",c,true);j.overrideMimeType("text/plain; charset=x-user-defined");j.setRequestHeader("Content-Type","text/plain");j.send(null)},
- createBinModel:function(a,b,d,e){var f=function(h){function j(w,M){var J=n(w,M),Z=n(w,M+1),ca=n(w,M+2),ga=n(w,M+3),ja=(ga<<1&255|ca>>7)-127;J=(ca&127)<<16|Z<<8|J;if(J==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ja)}function c(w,M){var J=n(w,M),Z=n(w,M+1),ca=n(w,M+2);return(n(w,M+3)<<24)+(ca<<16)+(Z<<8)+J}function k(w,M){var J=n(w,M);return(n(w,M+1)<<8)+J}function l(w,M){var J=n(w,M);return J>127?J-256:J}function n(w,M){return w.charCodeAt(M)&255}function C(w){var M,
- J,Z;M=c(a,w);J=c(a,w+B);Z=c(a,w+q);w=k(a,w+A);THREE.Loader.prototype.f3(t,M,J,Z,w)}function p(w){var M,J,Z,ca,ga,ja;M=c(a,w);J=c(a,w+B);Z=c(a,w+q);ca=k(a,w+A);ga=c(a,w+N);ja=c(a,w+v);w=c(a,w+D);THREE.Loader.prototype.f3n(t,g,M,J,Z,ca,ga,ja,w)}function x(w){var M,J,Z,ca;M=c(a,w);J=c(a,w+G);Z=c(a,w+E);ca=c(a,w+y);w=k(a,w+I);THREE.Loader.prototype.f4(t,M,J,Z,ca,w)}function z(w){var M,J,Z,ca,ga,ja,qa,sa;M=c(a,w);J=c(a,w+G);Z=c(a,w+E);ca=c(a,w+y);ga=k(a,w+I);ja=c(a,w+F);qa=c(a,w+T);sa=c(a,w+V);w=c(a,w+
- P);THREE.Loader.prototype.f4n(t,g,M,J,Z,ca,ga,ja,qa,sa,w)}function u(w){var M,J;M=c(a,w);J=c(a,w+da);w=c(a,w+X);THREE.Loader.prototype.uv3(t,o[M*2],o[M*2+1],o[J*2],o[J*2+1],o[w*2],o[w*2+1])}function K(w){var M,J,Z;M=c(a,w);J=c(a,w+R);Z=c(a,w+U);w=c(a,w+ba);THREE.Loader.prototype.uv4(t,o[M*2],o[M*2+1],o[J*2],o[J*2+1],o[Z*2],o[Z*2+1],o[w*2],o[w*2+1])}var t=this,L=0,m,g=[],o=[],B,q,A,N,v,D,G,E,y,I,F,T,V,P,da,X,R,U,ba,Y,H,S,W,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(t,e,h);
- m={signature:a.substr(L,8),header_bytes:n(a,L+8),vertex_coordinate_bytes:n(a,L+9),normal_coordinate_bytes:n(a,L+10),uv_coordinate_bytes:n(a,L+11),vertex_index_bytes:n(a,L+12),normal_index_bytes:n(a,L+13),uv_index_bytes:n(a,L+14),material_index_bytes:n(a,L+15),nvertices:c(a,L+16),nnormals:c(a,L+16+4),nuvs:c(a,L+16+8),ntri_flat:c(a,L+16+12),ntri_smooth:c(a,L+16+16),ntri_flat_uv:c(a,L+16+20),ntri_smooth_uv:c(a,L+16+24),nquad_flat:c(a,L+16+28),nquad_smooth:c(a,L+16+32),nquad_flat_uv:c(a,L+16+36),nquad_smooth_uv:c(a,
- L+16+40)};L+=m.header_bytes;B=m.vertex_index_bytes;q=m.vertex_index_bytes*2;A=m.vertex_index_bytes*3;N=m.vertex_index_bytes*3+m.material_index_bytes;v=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes;D=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*2;G=m.vertex_index_bytes;E=m.vertex_index_bytes*2;y=m.vertex_index_bytes*3;I=m.vertex_index_bytes*4;F=m.vertex_index_bytes*4+m.material_index_bytes;T=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes;
- V=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*2;P=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*3;da=m.uv_index_bytes;X=m.uv_index_bytes*2;R=m.uv_index_bytes;U=m.uv_index_bytes*2;ba=m.uv_index_bytes*3;h=m.vertex_index_bytes*3+m.material_index_bytes;ha=m.vertex_index_bytes*4+m.material_index_bytes;Y=m.ntri_flat*h;H=m.ntri_smooth*(h+m.normal_index_bytes*3);S=m.ntri_flat_uv*(h+m.uv_index_bytes*3);W=m.ntri_smooth_uv*(h+m.normal_index_bytes*3+m.uv_index_bytes*
- 3);ia=m.nquad_flat*ha;h=m.nquad_smooth*(ha+m.normal_index_bytes*4);ha=m.nquad_flat_uv*(ha+m.uv_index_bytes*4);L+=function(w){var M,J,Z,ca=m.vertex_coordinate_bytes*3,ga=w+m.nvertices*ca;for(w=w;w<ga;w+=ca){M=j(a,w);J=j(a,w+m.vertex_coordinate_bytes);Z=j(a,w+m.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(t,M,J,Z)}return m.nvertices*ca}(L);L+=function(w){var M,J,Z,ca=m.normal_coordinate_bytes*3,ga=w+m.nnormals*ca;for(w=w;w<ga;w+=ca){M=l(a,w);J=l(a,w+m.normal_coordinate_bytes);Z=l(a,w+m.normal_coordinate_bytes*
- 2);g.push(M/127,J/127,Z/127)}return m.nnormals*ca}(L);L+=function(w){var M,J,Z=m.uv_coordinate_bytes*2,ca=w+m.nuvs*Z;for(w=w;w<ca;w+=Z){M=j(a,w);J=j(a,w+m.uv_coordinate_bytes);o.push(M,J)}return m.nuvs*Z}(L);L=L;Y=L+Y;H=Y+H;S=H+S;W=S+W;ia=W+ia;h=ia+h;ha=h+ha;(function(w){var M,J=m.vertex_index_bytes*3+m.material_index_bytes,Z=J+m.uv_index_bytes*3,ca=w+m.ntri_flat_uv*Z;for(M=w;M<ca;M+=Z){C(M);u(M+J)}return ca-w})(H);(function(w){var M,J=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*
- 3,Z=J+m.uv_index_bytes*3,ca=w+m.ntri_smooth_uv*Z;for(M=w;M<ca;M+=Z){p(M);u(M+J)}return ca-w})(S);(function(w){var M,J=m.vertex_index_bytes*4+m.material_index_bytes,Z=J+m.uv_index_bytes*4,ca=w+m.nquad_flat_uv*Z;for(M=w;M<ca;M+=Z){x(M);K(M+J)}return ca-w})(h);(function(w){var M,J=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,Z=J+m.uv_index_bytes*4,ca=w+m.nquad_smooth_uv*Z;for(M=w;M<ca;M+=Z){z(M);K(M+J)}return ca-w})(ha);(function(w){var M,J=m.vertex_index_bytes*3+m.material_index_bytes,
- Z=w+m.ntri_flat*J;for(M=w;M<Z;M+=J)C(M);return Z-w})(L);(function(w){var M,J=m.vertex_index_bytes*3+m.material_index_bytes+m.normal_index_bytes*3,Z=w+m.ntri_smooth*J;for(M=w;M<Z;M+=J)p(M);return Z-w})(Y);(function(w){var M,J=m.vertex_index_bytes*4+m.material_index_bytes,Z=w+m.nquad_flat*J;for(M=w;M<Z;M+=J)x(M);return Z-w})(W);(function(w){var M,J=m.vertex_index_bytes*4+m.material_index_bytes+m.normal_index_bytes*4,Z=w+m.nquad_smooth*J;for(M=w;M<Z;M+=J)z(M);return Z-w})(ia);this.computeCentroids();
- this.computeFaceNormals();this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(d))},createModel:function(a,b,d){var e=function(f){var h=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(h,a.materials,f);(function(){var j,c,k,l,n;j=0;for(c=a.vertices.length;j<c;j+=3){k=a.vertices[j];l=a.vertices[j+1];n=a.vertices[j+2];THREE.Loader.prototype.v(h,k,l,n)}})();(function(){function j(z,u){THREE.Loader.prototype.f3(h,z[u],z[u+1],z[u+2],z[u+3])}function c(z,
- u){THREE.Loader.prototype.f3n(h,a.normals,z[u],z[u+1],z[u+2],z[u+3],z[u+4],z[u+5],z[u+6])}function k(z,u){THREE.Loader.prototype.f4(h,z[u],z[u+1],z[u+2],z[u+3],z[u+4])}function l(z,u){THREE.Loader.prototype.f4n(h,a.normals,z[u],z[u+1],z[u+2],z[u+3],z[u+4],z[u+5],z[u+6],z[u+7],z[u+8])}function n(z,u){var K,t,L;K=z[u];t=z[u+1];L=z[u+2];THREE.Loader.prototype.uv3(h,a.uvs[K*2],a.uvs[K*2+1],a.uvs[t*2],a.uvs[t*2+1],a.uvs[L*2],a.uvs[L*2+1])}function C(z,u){var K,t,L,m;K=z[u];t=z[u+1];L=z[u+2];m=z[u+3];THREE.Loader.prototype.uv4(h,
- a.uvs[K*2],a.uvs[K*2+1],a.uvs[t*2],a.uvs[t*2+1],a.uvs[L*2],a.uvs[L*2+1],a.uvs[m*2],a.uvs[m*2+1])}var p,x;p=0;for(x=a.triangles_uv.length;p<x;p+=7){j(a.triangles_uv,p);n(a.triangles_uv,p+4)}p=0;for(x=a.triangles_n_uv.length;p<x;p+=10){c(a.triangles_n_uv,p);n(a.triangles_n_uv,p+7)}p=0;for(x=a.quads_uv.length;p<x;p+=9){k(a.quads_uv,p);C(a.quads_uv,p+5)}p=0;for(x=a.quads_n_uv.length;p<x;p+=13){l(a.quads_n_uv,p);C(a.quads_n_uv,p+9)}p=0;for(x=a.triangles.length;p<x;p+=4)j(a.triangles,p);p=0;for(x=a.triangles_n.length;p<
- x;p+=7)c(a.triangles_n,p);p=0;for(x=a.quads.length;p<x;p+=5)k(a.quads,p);p=0;for(x=a.quads_n.length;p<x;p+=9)l(a.quads_n,p)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(d))},v:function(a,b,d,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,d,e)))},f3:function(a,b,d,e,f){a.faces.push(new THREE.Face3(b,d,e,null,a.materials[f]))},f4:function(a,b,d,e,f,h){a.faces.push(new THREE.Face4(b,d,e,f,null,
- a.materials[h]))},f3n:function(a,b,d,e,f,h,j,c,k){h=a.materials[h];var l=b[c*3],n=b[c*3+1];c=b[c*3+2];var C=b[k*3],p=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(l,n,c),new THREE.Vector3(C,p,k)],h))},f4n:function(a,b,d,e,f,h,j,c,k,l,n){j=a.materials[j];var C=b[k*3],p=b[k*3+1];k=b[k*3+2];var x=b[l*3],z=b[l*3+1];l=b[l*3+2];var u=b[n*3],K=b[n*3+1];n=b[n*3+2];a.faces.push(new THREE.Face4(d,e,f,h,[new THREE.Vector3(b[c*3],b[c*3+1],
- b[c*3+2]),new THREE.Vector3(C,p,k),new THREE.Vector3(x,z,l),new THREE.Vector3(u,K,n)],j))},uv3:function(a,b,d,e,f,h,j){var c=[];c.push(new THREE.UV(b,d));c.push(new THREE.UV(e,f));c.push(new THREE.UV(h,j));a.uvs.push(c)},uv4:function(a,b,d,e,f,h,j,c,k){var l=[];l.push(new THREE.UV(b,d));l.push(new THREE.UV(e,f));l.push(new THREE.UV(h,j));l.push(new THREE.UV(c,k));a.uvs.push(l)},init_materials:function(a,b,d){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],
- d)]},createMaterial:function(a,b){function d(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}var e,f;if(a.map_diffuse&&b){f=document.createElement("canvas");e=new THREE.MeshLambertMaterial({map:new THREE.Texture(f)});f=new Image;f.onload=function(){if(!d(this.width)||!d(this.height)){var h=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),j=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));e.map.image.width=h;e.map.image.height=j;e.map.image.getContext("2d").drawImage(this,0,0,h,j)}else e.map.image=
- this;e.map.image.loaded=1};f.src=b+"/"+a.map_diffuse}else if(a.col_diffuse){f=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;e=new THREE.MeshLambertMaterial({color:f,opacity:a.transparency})}else e=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});return e},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|