123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- // ThreeExtras.js r31 - 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,e){this.r=a;this.g=b;this.b=e;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)+")"},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,e){this.x=a||0;this.y=b||0;this.z=e||0};
- THREE.Vector3.prototype={set:function(a,b,e){this.x=a;this.y=b;this.z=e;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,e=this.y,d=this.z;this.x=e*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-e*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},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,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+e*e+a*a)},distanceToSquared:function(a){var b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return b*b+e*e+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,e,d){this.x=a||0;this.y=b||0;this.z=e||0;this.w=d||1};
- THREE.Vector4.prototype={set:function(a,b,e,d){this.x=a;this.y=b;this.z=e;this.w=d;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,e,d=a.objects,g=[];a=0;for(b=d.length;a<b;a++){e=d[a];if(e instanceof THREE.Mesh)g=g.concat(this.intersectObject(e))}g.sort(function(f,j){return f.distance-j.distance});return g},intersectObject:function(a){function b(I,w,C,n){n=n.clone().subSelf(w);C=C.clone().subSelf(w);var O=I.clone().subSelf(w);I=n.dot(n);w=n.dot(C);n=n.dot(O);var L=C.dot(C);C=C.dot(O);O=1/(I*L-w*w);L=(L*n-w*C)*O;I=(I*C-w*n)*O;return L>0&&I>0&&L+I<1}var e,d,g,f,j,h,k,x,c,B,
- r,t=a.geometry,y=t.vertices,A=[];e=0;for(d=t.faces.length;e<d;e++){g=t.faces[e];B=this.origin.clone();r=this.direction.clone();f=a.matrix.multiplyVector3(y[g.a].position.clone());j=a.matrix.multiplyVector3(y[g.b].position.clone());h=a.matrix.multiplyVector3(y[g.c].position.clone());k=g instanceof THREE.Face4?a.matrix.multiplyVector3(y[g.d].position.clone()):null;x=a.rotationMatrix.multiplyVector3(g.normal.clone());c=r.dot(x);if(c<0){x=x.dot((new THREE.Vector3).sub(f,B))/c;B=B.addSelf(r.multiplyScalar(x));
- if(g instanceof THREE.Face3){if(b(B,f,j,h)){g={distance:this.origin.distanceTo(B),point:B,face:g,object:a};A.push(g)}}else if(g instanceof THREE.Face4)if(b(B,f,j,k)||b(B,j,h,k)){g={distance:this.origin.distanceTo(B),point:B,face:g,object:a};A.push(g)}}}return A}};
- THREE.Rectangle=function(){function a(){f=d-b;j=g-e}var b,e,d,g,f,j,h=true;this.getX=function(){return b};this.getY=function(){return e};this.getWidth=function(){return f};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return e};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(k,x,c,B){h=false;b=k;e=x;d=c;g=B;a()};this.addPoint=function(k,x){if(h){h=false;b=k;e=x;d=k;g=x}else{b=b<k?b:k;e=e<x?e:x;d=d>k?d:k;g=g>x?
- g:x}a()};this.add3Points=function(k,x,c,B,r,t){if(h){h=false;b=k<c?k<r?k:r:c<r?c:r;e=x<B?x<t?x:t:B<t?B:t;d=k>c?k>r?k:r:c>r?c:r;g=x>B?x>t?x:t:B>t?B:t}else{b=k<c?k<r?k<b?k:b:r<b?r:b:c<r?c<b?c:b:r<b?r:b;e=x<B?x<t?x<e?x:e:t<e?t:e:B<t?B<e?B:e:t<e?t:e;d=k>c?k>r?k>d?k:d:r>d?r:d:c>r?c>d?c:d:r>d?r:d;g=x>B?x>t?x>g?x:g:t>g?t:g:B>t?B>g?B:g:t>g?t:g}a()};this.addRectangle=function(k){if(h){h=false;b=k.getLeft();e=k.getTop();d=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();e=e<k.getTop()?e:k.getTop();
- d=d>k.getRight()?d:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;e-=k;d+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();e=e>k.getTop()?e:k.getTop();d=d<k.getRight()?d:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(e,k.getTop())>=0};this.empty=function(){h=true;g=d=e=b=0;a()};this.isEmpty=function(){return h};this.toString=
- function(){return"THREE.Rectangle ( left: "+b+", right: "+d+", top: "+e+", bottom: "+g+", width: "+f+", height: "+j+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
- THREE.Matrix4=function(a,b,e,d,g,f,j,h,k,x,c,B,r,t,y,A){this.n11=a||1;this.n12=b||0;this.n13=e||0;this.n14=d||0;this.n21=g||0;this.n22=f||1;this.n23=j||0;this.n24=h||0;this.n31=k||0;this.n32=x||0;this.n33=c||1;this.n34=B||0;this.n41=r||0;this.n42=t||0;this.n43=y||0;this.n44=A||1};
- 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,e,d,g,f,j,h,k,x,c,B,r,t,y,A){this.n11=a;this.n12=b;this.n13=e;this.n14=d;this.n21=g;this.n22=f;this.n23=j;this.n24=h;this.n31=k;this.n32=x;this.n33=c;this.n34=B;this.n41=r;this.n42=t;this.n43=y;this.n44=A;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,e){var d=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3;f.sub(a,b).normalize();d.cross(e,f).normalize();g.cross(f,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);this.n31=f.x;
- this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,e=a.y,d=a.z,g=1/(this.n41*b+this.n42*e+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*e+this.n13*d+this.n14)*g;a.y=(this.n21*b+this.n22*e+this.n23*d+this.n24)*g;a.z=(this.n31*b+this.n32*e+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,e=a.y,d=a.z,g=a.w;a.x=this.n11*b+this.n12*e+this.n13*d+this.n14*g;a.y=this.n21*b+this.n22*e+this.n23*d+this.n24*
- g;a.z=this.n31*b+this.n32*e+this.n33*d+this.n34*g;a.w=this.n41*b+this.n42*e+this.n43*d+this.n44*g;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 e=a.n11,d=a.n12,g=a.n13,f=a.n14,j=a.n21,h=a.n22,k=a.n23,x=a.n24,c=a.n31,B=a.n32,
- r=a.n33,t=a.n34,y=a.n41,A=a.n42,I=a.n43,w=a.n44,C=b.n11,n=b.n12,O=b.n13,L=b.n14,T=b.n21,i=b.n22,o=b.n23,s=b.n24,p=b.n31,u=b.n32,l=b.n33,v=b.n34,z=b.n41,J=b.n42,S=b.n43,Q=b.n44;this.n11=e*C+d*T+g*p+f*z;this.n12=e*n+d*i+g*u+f*J;this.n13=e*O+d*o+g*l+f*S;this.n14=e*L+d*s+g*v+f*Q;this.n21=j*C+h*T+k*p+x*z;this.n22=j*n+h*i+k*u+x*J;this.n23=j*O+h*o+k*l+x*S;this.n24=j*L+h*s+k*v+x*Q;this.n31=c*C+B*T+r*p+t*z;this.n32=c*n+B*i+r*u+t*J;this.n33=c*O+B*o+r*l+t*S;this.n34=c*L+B*s+r*v+t*Q;this.n41=y*C+A*T+I*p+w*z;
- this.n42=y*n+A*i+I*u+w*J;this.n43=y*O+A*o+I*l+w*S;this.n44=y*L+A*s+I*v+w*Q;return this},multiplySelf:function(a){var b=this.n11,e=this.n12,d=this.n13,g=this.n14,f=this.n21,j=this.n22,h=this.n23,k=this.n24,x=this.n31,c=this.n32,B=this.n33,r=this.n34,t=this.n41,y=this.n42,A=this.n43,I=this.n44,w=a.n11,C=a.n21,n=a.n31,O=a.n41,L=a.n12,T=a.n22,i=a.n32,o=a.n42,s=a.n13,p=a.n23,u=a.n33,l=a.n43,v=a.n14,z=a.n24,J=a.n34;a=a.n44;this.n11=b*w+e*C+d*n+g*O;this.n12=b*L+e*T+d*i+g*o;this.n13=b*s+e*p+d*u+g*l;this.n14=
- b*v+e*z+d*J+g*a;this.n21=f*w+j*C+h*n+k*O;this.n22=f*L+j*T+h*i+k*o;this.n23=f*s+j*p+h*u+k*l;this.n24=f*v+j*z+h*J+k*a;this.n31=x*w+c*C+B*n+r*O;this.n32=x*L+c*T+B*i+r*o;this.n33=x*s+c*p+B*u+r*l;this.n34=x*v+c*z+B*J+r*a;this.n41=t*w+y*C+A*n+I*O;this.n42=t*L+y*T+A*i+I*o;this.n43=t*s+y*p+A*u+I*l;this.n44=t*v+y*z+A*J+I*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(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
- this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,e,d){var g=b[e];b[e]=b[d];
- b[d]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
- this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},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,e){var d=new THREE.Matrix4;d.n14=a;d.n24=b;d.n34=e;return d};
- THREE.Matrix4.scaleMatrix=function(a,b,e){var d=new THREE.Matrix4;d.n11=a;d.n22=b;d.n33=e;return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
- THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var e=new THREE.Matrix4,d=Math.cos(b),g=Math.sin(b),f=1-d,j=a.x,h=a.y,k=a.z;e.n11=f*j*j+d;e.n12=f*j*h-g*k;e.n13=f*j*k+g*h;e.n21=f*j*h+g*k;e.n22=f*h*h+d;e.n23=f*h*k-g*j;e.n31=f*j*k-g*h;e.n32=f*h*k+g*j;e.n33=f*k*k+d;return e};
- THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
- a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
- a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
- a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var e=b[10]*b[5]-b[6]*b[9],d=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],j=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],x=-b[9]*b[0]+b[1]*b[8],c=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*f+b[2]*k;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*e;a.m[1]=b*d;a.m[2]=b*g;a.m[3]=b*f;a.m[4]=b*j;a.m[5]=b*h;a.m[6]=b*k;a.m[7]=b*x;a.m[8]=b*c;return a};
- THREE.Matrix4.makeFrustum=function(a,b,e,d,g,f){var j,h,k;j=new THREE.Matrix4;h=2*g/(b-a);k=2*g/(d-e);a=(b+a)/(b-a);e=(d+e)/(d-e);d=-(f+g)/(f-g);g=-2*f*g/(f-g);j.n11=h;j.n12=0;j.n13=a;j.n14=0;j.n21=0;j.n22=k;j.n23=e;j.n24=0;j.n31=0;j.n32=0;j.n33=d;j.n34=g;j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,e,d){var g;a=e*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,e,d)};
- THREE.Matrix4.makeOrtho=function(a,b,e,d,g,f){var j,h,k,x;j=new THREE.Matrix4;h=b-a;k=e-d;x=f-g;a=(b+a)/h;e=(e+d)/k;g=(f+g)/x;j.n11=2/h;j.n12=0;j.n13=0;j.n14=-a;j.n21=0;j.n22=2/k;j.n23=0;j.n24=-e;j.n31=0;j.n32=0;j.n33=-2/x;j.n34=-g;j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};
- 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,e,d,g){this.a=a;this.b=b;this.c=e;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,b,e,d,g,f){this.a=a;this.b=b;this.c=e;this.d=d;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f]};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,e;a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
- e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,e,d,g,f,j,h=new THREE.Vector3,k=new THREE.Vector3;d=0;for(g=this.vertices.length;d<g;d++){f=this.vertices[d];f.normal.set(0,0,0)}d=0;for(g=this.faces.length;d<g;d++){f=this.faces[d];if(a&&f.vertexNormals.length){h.set(0,0,0);b=0;for(e=f.normal.length;b<e;b++)h.addSelf(f.vertexNormals[b]);h.divideScalar(3)}else{b=this.vertices[f.a];e=this.vertices[f.b];j=this.vertices[f.c];h.sub(j.position,
- e.position);k.sub(b.position,e.position);h.crossSelf(k)}h.isZero()||h.normalize();f.normal.copy(h)}},computeVertexNormals:function(){var a,b=[],e,d;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(e=this.faces.length;a<e;a++){d=this.faces[a];if(d instanceof THREE.Face3){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal);b[d.d].addSelf(d.normal)}}a=
- 0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(e=this.faces.length;a<e;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone()}else if(d instanceof THREE.Face4){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone();d.vertexNormals[3]=b[d.d].clone()}}},computeTangents:function(){function a(v,z,J,S){f=v.vertices[z].position;j=v.vertices[J].position;
- h=v.vertices[S].position;k=g[0];x=g[1];c=g[2];B=j.x-f.x;r=h.x-f.x;t=j.y-f.y;y=h.y-f.y;A=j.z-f.z;I=h.z-f.z;w=x.u-k.u;C=c.u-k.u;n=x.v-k.v;O=c.v-k.v;L=1/(w*O-C*n);s.set((O*B-n*r)*L,(O*t-n*y)*L,(O*A-n*I)*L);p.set((w*r-C*B)*L,(w*y-C*t)*L,(w*I-C*A)*L);i[z].addSelf(s);i[J].addSelf(s);i[S].addSelf(s);o[z].addSelf(p);o[J].addSelf(p);o[S].addSelf(p)}var b,e,d,g,f,j,h,k,x,c,B,r,t,y,A,I,w,C,n,O,L,T,i=[],o=[],s=new THREE.Vector3,p=new THREE.Vector3,u=new THREE.Vector3,l=new THREE.Vector3;T=new THREE.Vector3;b=
- 0;for(e=this.vertices.length;b<e;b++){i[b]=new THREE.Vector3;o[b]=new THREE.Vector3}b=0;for(e=this.faces.length;b<e;b++){d=this.faces[b];g=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);
- this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(e=this.vertices.length;b<e;b++){T.copy(this.vertices[b].normal);d=i[b];u.copy(d);u.subSelf(T.multiplyScalar(T.dot(d))).normalize();l.cross(this.vertices[b].normal,d);test=l.dot(o[b]);d=test<0?-1:1;this.vertices[b].tangent.set(u.x,u.y,u.z,d)}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,e=this.vertices.length;b<e;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,e=this.vertices.length;b<e;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(x){var c=[];b=0;for(e=x.length;b<e;b++)x[b]==undefined?c.push("undefined"):c.push(x[b].toString());return c.join("_")}
- var b,e,d,g,f,j,h,k={};d=0;for(g=this.faces.length;d<g;d++){f=this.faces[d];materials=f.materials;j=a(materials);if(k[j]==undefined)k[j]={hash:j,counter:0};h=k[j].hash+"_"+k[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:materials,vertices:0};f=f instanceof THREE.Face3?3:4;if(this.geometryChunks[h].vertices+f>65535){k[j].counter+=1;h=k[j].hash+"_"+k[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:materials,vertices:0}}this.geometryChunks[h].faces.push(d);
- this.geometryChunks[h].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,b,e,d){this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,e,d);this.autoUpdateMatrix=true;this.translateX=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);g.cross(g.clone(),this.up);this.position.addSelf(g);this.target.position.addSelf(g)};this.translateZ=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);
- this.position.subSelf(g);this.target.position.subSelf(g)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.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.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.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.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
- THREE.Object3D.prototype={updateMatrix:function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);
- this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};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.Line=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b]};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.near=1;this.far=1E3;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.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=
- this.far-this.near};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,e,d,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter};
- THREE.Texture.prototype={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.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,e){this.color=new THREE.Color(a);this.near=b||1;this.far=e||1E3};
- THREE.Projector=function(){function a(i,o){return o.z-i.z}function b(i,o){var s=0,p=1,u=i.z+i.w,l=o.z+o.w,v=-i.z+i.w,z=-o.z+o.w;if(u>=0&&l>=0&&v>=0&&z>=0)return true;else if(u<0&&l<0||v<0&&z<0)return false;else{if(u<0)s=Math.max(s,u/(u-l));else if(l<0)p=Math.min(p,u/(u-l));if(v<0)s=Math.max(s,v/(v-z));else if(z<0)p=Math.min(p,v/(v-z));if(p<s)return false;else{i.lerpSelf(o,s);o.lerpSelf(i,1-p);return true}}}var e,d,g=[],f,j,h,k=[],x,c,B=[],r,t,y=[],A=new THREE.Vector4,I=new THREE.Vector4,w=new THREE.Matrix4,
- C=new THREE.Matrix4,n=[],O=new THREE.Vector4,L=new THREE.Vector4,T;this.projectObjects=function(i,o,s){var p=[],u,l;d=0;w.multiply(o.projectionMatrix,o.matrix);n[0]=new THREE.Vector4(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);n[1]=new THREE.Vector4(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);n[2]=new THREE.Vector4(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);n[3]=new THREE.Vector4(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);n[4]=new THREE.Vector4(w.n41-w.n31,w.n42-w.n32,w.n43-
- w.n33,w.n44-w.n34);n[5]=new THREE.Vector4(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);o=0;for(u=n.length;o<u;o++){l=n[o];l.divideScalar(Math.sqrt(l.x*l.x+l.y*l.y+l.z*l.z))}u=i.objects;i=0;for(o=u.length;i<o;i++){l=u[i];var v;if(!(v=!l.visible)){if(v=l instanceof THREE.Mesh){a:{v=void 0;for(var z=l.position,J=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),S=0;S<6;S++){v=n[S].x*z.x+n[S].y*z.y+n[S].z*z.z+n[S].w;if(v<=J){v=false;break a}}v=true}v=!v}v=v}if(!v){e=
- g[d]=g[d]||new THREE.RenderableObject;A.copy(l.position);w.multiplyVector3(A);e.object=l;e.z=A.z;p.push(e);d++}}s&&p.sort(a);return p};this.projectScene=function(i,o,s){var p=[],u,l,v,z,J,S,Q,H,V,M,W,N,F,G,m,q;h=c=t=0;o.autoUpdateMatrix&&o.updateMatrix();w.multiply(o.projectionMatrix,o.matrix);S=this.projectObjects(i,o,true);i=0;for(u=S.length;i<u;i++){Q=S[i].object;if(Q.visible){Q.autoUpdateMatrix&&Q.updateMatrix();H=Q.matrix;V=Q.rotationMatrix;M=Q.materials;W=Q.overdraw;if(Q instanceof THREE.Mesh){N=
- Q.geometry;F=N.vertices;l=0;for(v=F.length;l<v;l++){G=F[l];G.positionWorld.copy(G.position);H.multiplyVector3(G.positionWorld);z=G.positionScreen;z.copy(G.positionWorld);w.multiplyVector4(z);z.multiplyScalar(1/z.w);G.__visible=z.z>0&&z.z<1}N=N.faces;l=0;for(v=N.length;l<v;l++){G=N[l];if(G instanceof THREE.Face3){z=F[G.a];J=F[G.b];m=F[G.c];if(z.__visible&&J.__visible&&m.__visible)if(Q.doubleSided||Q.flipSided!=(m.positionScreen.x-z.positionScreen.x)*(J.positionScreen.y-z.positionScreen.y)-(m.positionScreen.y-
- z.positionScreen.y)*(J.positionScreen.x-z.positionScreen.x)<0){f=k[h]=k[h]||new THREE.RenderableFace3;f.v1.positionWorld.copy(z.positionWorld);f.v2.positionWorld.copy(J.positionWorld);f.v3.positionWorld.copy(m.positionWorld);f.v1.positionScreen.copy(z.positionScreen);f.v2.positionScreen.copy(J.positionScreen);f.v3.positionScreen.copy(m.positionScreen);f.normalWorld.copy(G.normal);V.multiplyVector3(f.normalWorld);f.centroidWorld.copy(G.centroid);H.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);
- w.multiplyVector3(f.centroidScreen);m=G.vertexNormals;T=f.vertexNormalsWorld;z=0;for(J=m.length;z<J;z++){q=T[z]=T[z]||new THREE.Vector3;q.copy(m[z]);V.multiplyVector3(q)}f.z=f.centroidScreen.z;f.meshMaterials=M;f.faceMaterials=G.materials;f.overdraw=W;if(Q.geometry.uvs[l]){f.uvs[0]=Q.geometry.uvs[l][0];f.uvs[1]=Q.geometry.uvs[l][1];f.uvs[2]=Q.geometry.uvs[l][2]}p.push(f);h++}}else if(G instanceof THREE.Face4){z=F[G.a];J=F[G.b];m=F[G.c];q=F[G.d];if(z.__visible&&J.__visible&&m.__visible&&q.__visible)if(Q.doubleSided||
- Q.flipSided!=((q.positionScreen.x-z.positionScreen.x)*(J.positionScreen.y-z.positionScreen.y)-(q.positionScreen.y-z.positionScreen.y)*(J.positionScreen.x-z.positionScreen.x)<0||(J.positionScreen.x-m.positionScreen.x)*(q.positionScreen.y-m.positionScreen.y)-(J.positionScreen.y-m.positionScreen.y)*(q.positionScreen.x-m.positionScreen.x)<0)){f=k[h]=k[h]||new THREE.RenderableFace3;f.v1.positionWorld.copy(z.positionWorld);f.v2.positionWorld.copy(J.positionWorld);f.v3.positionWorld.copy(q.positionWorld);
- f.v1.positionScreen.copy(z.positionScreen);f.v2.positionScreen.copy(J.positionScreen);f.v3.positionScreen.copy(q.positionScreen);f.normalWorld.copy(G.normal);V.multiplyVector3(f.normalWorld);f.centroidWorld.copy(G.centroid);H.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);w.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=M;f.faceMaterials=G.materials;f.overdraw=W;if(Q.geometry.uvs[l]){f.uvs[0]=Q.geometry.uvs[l][0];f.uvs[1]=Q.geometry.uvs[l][1];f.uvs[2]=
- Q.geometry.uvs[l][3]}p.push(f);h++;j=k[h]=k[h]||new THREE.RenderableFace3;j.v1.positionWorld.copy(J.positionWorld);j.v2.positionWorld.copy(m.positionWorld);j.v3.positionWorld.copy(q.positionWorld);j.v1.positionScreen.copy(J.positionScreen);j.v2.positionScreen.copy(m.positionScreen);j.v3.positionScreen.copy(q.positionScreen);j.normalWorld.copy(f.normalWorld);j.centroidWorld.copy(f.centroidWorld);j.centroidScreen.copy(f.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterials=M;j.faceMaterials=G.materials;
- j.overdraw=W;if(Q.geometry.uvs[l]){j.uvs[0]=Q.geometry.uvs[l][1];j.uvs[1]=Q.geometry.uvs[l][2];j.uvs[2]=Q.geometry.uvs[l][3]}p.push(j);h++}}}}else if(Q instanceof THREE.Line){C.multiply(w,H);F=Q.geometry.vertices;G=F[0];G.positionScreen.copy(G.position);C.multiplyVector4(G.positionScreen);l=1;for(v=F.length;l<v;l++){z=F[l];z.positionScreen.copy(z.position);C.multiplyVector4(z.positionScreen);J=F[l-1];O.copy(z.positionScreen);L.copy(J.positionScreen);if(b(O,L)){O.multiplyScalar(1/O.w);L.multiplyScalar(1/
- L.w);x=B[c]=B[c]||new THREE.RenderableLine;x.v1.positionScreen.copy(O);x.v2.positionScreen.copy(L);x.z=Math.max(O.z,L.z);x.materials=Q.materials;p.push(x);c++}}}else if(Q instanceof THREE.Particle){I.set(Q.position.x,Q.position.y,Q.position.z,1);w.multiplyVector4(I);I.z/=I.w;if(I.z>0&&I.z<1){r=y[t]=y[t]||new THREE.RenderableParticle;r.x=I.x/I.w;r.y=I.y/I.w;r.z=I.z;r.rotation=Q.rotation.z;r.scale.x=Q.scale.x*Math.abs(r.x-(I.x+o.projectionMatrix.n11)/(I.w+o.projectionMatrix.n14));r.scale.y=Q.scale.y*
- Math.abs(r.y-(I.y+o.projectionMatrix.n22)/(I.w+o.projectionMatrix.n24));r.materials=Q.materials;p.push(r);t++}}}}s&&p.sort(a);return p};this.unprojectVector=function(i,o){var s=new THREE.Matrix4;s.multiply(THREE.Matrix4.makeInvert(o.matrix),THREE.Matrix4.makeInvert(o.projectionMatrix));s.multiplyVector3(i);return i}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,e,d,g,f;this.domElement=document.createElement("div");this.setSize=function(j,h){e=j;d=h;g=e/2;f=d/2};this.render=function(j,h){var k,x,c,B,r,t,y,A;a=b.projectScene(j,h);k=0;for(x=a.length;k<x;k++){r=a[k];if(r instanceof THREE.RenderableParticle){y=r.x*g+g;A=r.y*f+f;c=0;for(B=r.material.length;c<B;c++){t=r.material[c];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=y+"px";t.style.top=A+"px"}}}}}};
- THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,e=document.createElement("canvas"),d,g,f,j,h=e.getContext("2d"),k=1,x=0,c=null,B=null,r=1,t,y,A,I,w,C,n,O,L,T=new THREE.Color,i=new THREE.Color,o=new THREE.Color,s=new THREE.Color,p=new THREE.Color,u,l,v,z,J,S,Q,H,V,M,W=new THREE.Rectangle,N=new THREE.Rectangle,F=new THREE.Rectangle,G=false,m=new THREE.Color,q=new THREE.Color,D=new THREE.Color,P=new THREE.Color,Y=Math.PI*2,Z=new THREE.Vector3,fa,na,pa,ga,sa,wa,qa=16;fa=document.createElement("canvas");
- fa.width=fa.height=2;na=fa.getContext("2d");na.fillStyle="rgba(0,0,0,1)";na.fillRect(0,0,2,2);pa=na.getImageData(0,0,2,2);ga=pa.data;sa=document.createElement("canvas");sa.width=sa.height=qa;wa=sa.getContext("2d");wa.translate(-qa/2,-qa/2);wa.scale(qa,qa);qa--;this.domElement=e;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ja,xa){d=ja;g=xa;f=d/2;j=g/2;e.width=d;e.height=g;W.set(-f,-j,f,j)};this.clear=function(){if(!N.isEmpty()){N.inflate(1);N.minSelf(W);h.clearRect(N.getX(),
- N.getY(),N.getWidth(),N.getHeight());N.empty()}};this.render=function(ja,xa){function La(E){var X,U,K,R=E.lights;q.setRGB(0,0,0);D.setRGB(0,0,0);P.setRGB(0,0,0);E=0;for(X=R.length;E<X;E++){U=R[E];K=U.color;if(U instanceof THREE.AmbientLight){q.r+=K.r;q.g+=K.g;q.b+=K.b}else if(U instanceof THREE.DirectionalLight){D.r+=K.r;D.g+=K.g;D.b+=K.b}else if(U instanceof THREE.PointLight){P.r+=K.r;P.g+=K.g;P.b+=K.b}}}function ya(E,X,U,K){var R,$,ca,da,ea=E.lights;E=0;for(R=ea.length;E<R;E++){$=ea[E];ca=$.color;
- da=$.intensity;if($ instanceof THREE.DirectionalLight){$=U.dot($.position)*da;if($>0){K.r+=ca.r*$;K.g+=ca.g*$;K.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=U.dot(Z)*da;if($>0){K.r+=ca.r*$;K.g+=ca.g*$;K.b+=ca.b*$}}}}function Ma(E,X,U){if(U.opacity!=0){Da(U.opacity);za(U.blending);var K,R,$,ca,da,ea;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){ca=U.map;da=ca.width>>1;ea=ca.height>>1;R=X.scale.x*f;$=X.scale.y*j;U=R*da;K=$*ea;F.set(E.x-U,E.y-K,E.x+U,
- E.y+K);if(W.instersects(F)){h.save();h.translate(E.x,E.y);h.rotate(-X.rotation);h.scale(R,-$);h.translate(-da,-ea);h.drawImage(ca,0,0);h.restore()}}}else if(U instanceof THREE.ParticleCircleMaterial){if(G){m.r=q.r+D.r+P.r;m.g=q.g+D.g+P.g;m.b=q.b+D.b+P.b;T.r=U.color.r*m.r;T.g=U.color.g*m.g;T.b=U.color.b*m.b;T.updateStyleString()}else T.__styleString=U.color.__styleString;U=X.scale.x*f;K=X.scale.y*j;F.set(E.x-U,E.y-K,E.x+U,E.y+K);if(W.instersects(F)){R=T.__styleString;if(B!=R)h.fillStyle=B=R;h.save();
- h.translate(E.x,E.y);h.rotate(-X.rotation);h.scale(U,K);h.beginPath();h.arc(0,0,1,0,Y,true);h.closePath();h.fill();h.restore()}}}}function Na(E,X,U,K){if(K.opacity!=0){Da(K.opacity);za(K.blending);h.beginPath();h.moveTo(E.positionScreen.x,E.positionScreen.y);h.lineTo(X.positionScreen.x,X.positionScreen.y);h.closePath();if(K instanceof THREE.LineBasicMaterial){T.__styleString=K.color.__styleString;E=K.linewidth;if(r!=E)h.lineWidth=r=E;E=T.__styleString;if(c!=E)h.strokeStyle=c=E;h.stroke();F.inflate(K.linewidth*
- 2)}}}function Ha(E,X,U,K,R,$){if(R.opacity!=0){Da(R.opacity);za(R.blending);I=E.positionScreen.x;w=E.positionScreen.y;C=X.positionScreen.x;n=X.positionScreen.y;O=U.positionScreen.x;L=U.positionScreen.y;h.beginPath();h.moveTo(I,w);h.lineTo(C,n);h.lineTo(O,L);h.lineTo(I,w);h.closePath();if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.image.loaded&&R.map.mapping instanceof THREE.UVMapping&&ta(I,w,C,n,O,L,R.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(R.env_map){if(R.env_map.image.loaded)if(R.env_map.mapping instanceof
- THREE.SphericalReflectionMapping){E=xa.matrix;Z.copy(K.vertexNormalsWorld[0]);J=(Z.x*E.n11+Z.y*E.n12+Z.z*E.n13)*0.5+0.5;S=-(Z.x*E.n21+Z.y*E.n22+Z.z*E.n23)*0.5+0.5;Z.copy(K.vertexNormalsWorld[1]);Q=(Z.x*E.n11+Z.y*E.n12+Z.z*E.n13)*0.5+0.5;H=-(Z.x*E.n21+Z.y*E.n22+Z.z*E.n23)*0.5+0.5;Z.copy(K.vertexNormalsWorld[2]);V=(Z.x*E.n11+Z.y*E.n12+Z.z*E.n13)*0.5+0.5;M=-(Z.x*E.n21+Z.y*E.n22+Z.z*E.n23)*0.5+0.5;ta(I,w,C,n,O,L,R.env_map.image,J,S,Q,H,V,M)}}else R.wireframe?Aa(R.color.__styleString,R.wireframe_linewidth):
- Ba(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){R.map.mapping instanceof THREE.UVMapping&&ta(I,w,C,n,O,L,R.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);za(THREE.SubtractiveBlending)}if(G)if(!R.wireframe&&R.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){i.r=o.r=s.r=q.r;i.g=o.g=s.g=q.g;i.b=o.b=s.b=q.b;ya($,K.v1.positionWorld,K.vertexNormalsWorld[0],i);ya($,K.v2.positionWorld,K.vertexNormalsWorld[1],o);ya($,
- K.v3.positionWorld,K.vertexNormalsWorld[2],s);p.r=(o.r+s.r)*0.5;p.g=(o.g+s.g)*0.5;p.b=(o.b+s.b)*0.5;z=Ia(i,o,s,p);ta(I,w,C,n,O,L,z,0,0,1,0,0,1)}else{m.r=q.r;m.g=q.g;m.b=q.b;ya($,K.centroidWorld,K.normalWorld,m);T.r=R.color.r*m.r;T.g=R.color.g*m.g;T.b=R.color.b*m.b;T.updateStyleString();R.wireframe?Aa(T.__styleString,R.wireframe_linewidth):Ba(T.__styleString)}else R.wireframe?Aa(R.color.__styleString,R.wireframe_linewidth):Ba(R.color.__styleString)}else if(R instanceof THREE.MeshDepthMaterial){u=R.__2near;
- l=R.__farPlusNear;v=R.__farMinusNear;i.r=i.g=i.b=1-u/(l-E.positionScreen.z*v);o.r=o.g=o.b=1-u/(l-X.positionScreen.z*v);s.r=s.g=s.b=1-u/(l-U.positionScreen.z*v);p.r=(o.r+s.r)*0.5;p.g=(o.g+s.g)*0.5;p.b=(o.b+s.b)*0.5;z=Ia(i,o,s,p);ta(I,w,C,n,O,L,z,0,0,1,0,0,1)}else if(R instanceof THREE.MeshNormalMaterial){T.r=Ea(K.normalWorld.x);T.g=Ea(K.normalWorld.y);T.b=Ea(K.normalWorld.z);T.updateStyleString();R.wireframe?Aa(T.__styleString,R.wireframe_linewidth):Ba(T.__styleString)}}}function Aa(E,X){if(c!=E)h.strokeStyle=
- c=E;if(r!=X)h.lineWidth=r=X;h.stroke();F.inflate(X*2)}function Ba(E){if(B!=E)h.fillStyle=B=E;h.fill()}function ta(E,X,U,K,R,$,ca,da,ea,ka,ha,la,ua){var oa,ma;oa=ca.width-1;ma=ca.height-1;da*=oa;ea*=ma;ka*=oa;ha*=ma;la*=oa;ua*=ma;U-=E;K-=X;R-=E;$-=X;ka-=da;ha-=ea;la-=da;ua-=ea;ma=1/(ka*ua-la*ha);oa=(ua*U-ha*R)*ma;ha=(ua*K-ha*$)*ma;U=(ka*R-la*U)*ma;K=(ka*$-la*K)*ma;E=E-oa*da-U*ea;X=X-ha*da-K*ea;h.save();h.transform(oa,ha,U,K,E,X);h.clip();h.drawImage(ca,0,0);h.restore()}function Da(E){if(k!=E)h.globalAlpha=
- k=E}function za(E){if(x!=E){switch(E){case THREE.NormalBlending:h.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:h.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:h.globalCompositeOperation="darker"}x=E}}function Ia(E,X,U,K){var R=~~(E.r*255),$=~~(E.g*255);E=~~(E.b*255);var ca=~~(X.r*255),da=~~(X.g*255);X=~~(X.b*255);var ea=~~(U.r*255),ka=~~(U.g*255);U=~~(U.b*255);var ha=~~(K.r*255),la=~~(K.g*255);K=~~(K.b*255);ga[0]=R<0?0:R>255?255:R;ga[1]=$<0?0:
- $>255?255:$;ga[2]=E<0?0:E>255?255:E;ga[4]=ca<0?0:ca>255?255:ca;ga[5]=da<0?0:da>255?255:da;ga[6]=X<0?0:X>255?255:X;ga[8]=ea<0?0:ea>255?255:ea;ga[9]=ka<0?0:ka>255?255:ka;ga[10]=U<0?0:U>255?255:U;ga[12]=ha<0?0:ha>255?255:ha;ga[13]=la<0?0:la>255?255:la;ga[14]=K<0?0:K>255?255:K;na.putImageData(pa,0,0);wa.drawImage(fa,0,0);return sa}function Ea(E){E=(E+1)*0.5;return E<0?0:E>1?1:E}function Fa(E,X){var U=X.x-E.x,K=X.y-E.y,R=1/Math.sqrt(U*U+K*K);U*=R;K*=R;X.x+=U;X.y+=K;E.x-=U;E.y-=K}var Ca,Ja,ba,ia,ra,Ga,
- Ka,va;h.setTransform(1,0,0,-1,f,j);this.autoClear&&this.clear();a=b.projectScene(ja,xa,this.sortElements);(G=ja.lights.length>0)&&La(ja);Ca=0;for(Ja=a.length;Ca<Ja;Ca++){ba=a[Ca];F.empty();if(ba instanceof THREE.RenderableParticle){t=ba;t.x*=f;t.y*=j;ia=0;for(ra=ba.materials.length;ia<ra;ia++)Ma(t,ba,ba.materials[ia],ja)}else if(ba instanceof THREE.RenderableLine){t=ba.v1;y=ba.v2;t.positionScreen.x*=f;t.positionScreen.y*=j;y.positionScreen.x*=f;y.positionScreen.y*=j;F.addPoint(t.positionScreen.x,
- t.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);if(W.instersects(F)){ia=0;for(ra=ba.materials.length;ia<ra;)Na(t,y,ba,ba.materials[ia++],ja)}}else if(ba instanceof THREE.RenderableFace3){t=ba.v1;y=ba.v2;A=ba.v3;t.positionScreen.x*=f;t.positionScreen.y*=j;y.positionScreen.x*=f;y.positionScreen.y*=j;A.positionScreen.x*=f;A.positionScreen.y*=j;if(ba.overdraw){Fa(t.positionScreen,y.positionScreen);Fa(y.positionScreen,A.positionScreen);Fa(A.positionScreen,t.positionScreen)}F.add3Points(t.positionScreen.x,
- t.positionScreen.y,y.positionScreen.x,y.positionScreen.y,A.positionScreen.x,A.positionScreen.y);if(W.instersects(F)){ia=0;for(ra=ba.meshMaterials.length;ia<ra;){va=ba.meshMaterials[ia++];if(va instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=ba.faceMaterials.length;Ga<Ka;)(va=ba.faceMaterials[Ga++])&&Ha(t,y,A,ba,va,ja)}else Ha(t,y,A,ba,va,ja)}}}N.addRectangle(F)}h.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(H,V,M){var W,N,F,G;W=0;for(N=H.lights.length;W<N;W++){F=H.lights[W];if(F instanceof THREE.DirectionalLight){G=V.normalWorld.dot(F.position)*F.intensity;if(G>0){M.r+=F.color.r*G;M.g+=F.color.g*G;M.b+=F.color.b*G}}else if(F instanceof THREE.PointLight){s.sub(F.position,V.centroidWorld);s.normalize();G=V.normalWorld.dot(s)*F.intensity;if(G>0){M.r+=F.color.r*G;M.g+=F.color.g*G;M.b+=F.color.b*G}}}}function b(H,V,M,W,N,F){v=d(z++);v.setAttribute("d","M "+H.positionScreen.x+
- " "+H.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)n.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(C){O.r=L.r;O.g=L.g;O.b=L.b;a(F,W,O);n.r=N.color.r*O.r;n.g=N.color.g*O.g;n.b=N.color.b*O.b;n.updateStyleString()}else n.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshDepthMaterial){o=1-N.__2near/(N.__farPlusNear-W.z*N.__farMinusNear);
- n.setRGB(o,o,o)}else N instanceof THREE.MeshNormalMaterial&&n.setRGB(g(W.normalWorld.x),g(W.normalWorld.y),g(W.normalWorld.z));N.wireframe?v.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+N.wireframe_linewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframe_linecap+"; stroke-linejoin: "+N.wireframe_linejoin):v.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+N.opacity);h.appendChild(v)}function e(H,V,M,W,N,F,G){v=d(z++);v.setAttribute("d",
- "M "+H.positionScreen.x+" "+H.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+M.positionScreen.x+","+M.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)n.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(C){O.r=L.r;O.g=L.g;O.b=L.b;a(G,N,O);n.r=F.color.r*O.r;n.g=F.color.g*O.g;n.b=F.color.b*O.b;n.updateStyleString()}else n.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){o=
- 1-F.__2near/(F.__farPlusNear-N.z*F.__farMinusNear);n.setRGB(o,o,o)}else F instanceof THREE.MeshNormalMaterial&&n.setRGB(g(N.normalWorld.x),g(N.normalWorld.y),g(N.normalWorld.z));F.wireframe?v.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):v.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+F.opacity);h.appendChild(v)}
- function d(H){if(p[H]==null){p[H]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&p[H].setAttribute("shape-rendering","crispEdges");return p[H]}return p[H]}function g(H){return H<0?Math.min((1+H)*0.5,0.5):0.5+Math.min(H*0.5,0.5)}var f=null,j=new THREE.Projector,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,x,c,B,r,t,y,A,I=new THREE.Rectangle,w=new THREE.Rectangle,C=false,n=new THREE.Color(16777215),O=new THREE.Color(16777215),L=new THREE.Color(0),T=new THREE.Color(0),
- i=new THREE.Color(0),o,s=new THREE.Vector3,p=[],u=[],l=[],v,z,J,S,Q=1;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(H){switch(H){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(H,V){k=H;x=V;c=k/2;B=x/2;h.setAttribute("viewBox",-c+" "+-B+" "+k+" "+x);h.setAttribute("width",k);h.setAttribute("height",x);I.set(-c,-B,c,B)};this.clear=function(){for(;h.childNodes.length>0;)h.removeChild(h.childNodes[0])};this.render=function(H,V){var M,W,
- N,F,G,m,q,D;this.autoClear&&this.clear();f=j.projectScene(H,V,this.sortElements);S=J=z=0;if(C=H.lights.length>0){q=H.lights;L.setRGB(0,0,0);T.setRGB(0,0,0);i.setRGB(0,0,0);M=0;for(W=q.length;M<W;M++){N=q[M];F=N.color;if(N instanceof THREE.AmbientLight){L.r+=F.r;L.g+=F.g;L.b+=F.b}else if(N instanceof THREE.DirectionalLight){T.r+=F.r;T.g+=F.g;T.b+=F.b}else if(N instanceof THREE.PointLight){i.r+=F.r;i.g+=F.g;i.b+=F.b}}}M=0;for(W=f.length;M<W;M++){q=f[M];w.empty();if(q instanceof THREE.RenderableParticle){r=
- q;r.x*=c;r.y*=-B;N=0;for(F=q.materials.length;N<F;N++)if(D=q.materials[N]){G=r;m=q;D=D;var P=J++;if(u[P]==null){u[P]=document.createElementNS("http://www.w3.org/2000/svg","circle");Q==0&&u[P].setAttribute("shape-rendering","crispEdges")}v=u[P];v.setAttribute("cx",G.x);v.setAttribute("cy",G.y);v.setAttribute("r",m.scale.x*c);if(D instanceof THREE.ParticleCircleMaterial){if(C){O.r=L.r+T.r+i.r;O.g=L.g+T.g+i.g;O.b=L.b+T.b+i.b;n.r=D.color.r*O.r;n.g=D.color.g*O.g;n.b=D.color.b*O.b;n.updateStyleString()}else n=
- D.color;v.setAttribute("style","fill: "+n.__styleString)}h.appendChild(v)}}else if(q instanceof THREE.RenderableLine){r=q.v1;t=q.v2;r.positionScreen.x*=c;r.positionScreen.y*=-B;t.positionScreen.x*=c;t.positionScreen.y*=-B;w.addPoint(r.positionScreen.x,r.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);if(I.instersects(w)){N=0;for(F=q.materials.length;N<F;)if(D=q.materials[N++]){G=r;m=t;D=D;P=S++;if(l[P]==null){l[P]=document.createElementNS("http://www.w3.org/2000/svg","line");Q==
- 0&&l[P].setAttribute("shape-rendering","crispEdges")}v=l[P];v.setAttribute("x1",G.positionScreen.x);v.setAttribute("y1",G.positionScreen.y);v.setAttribute("x2",m.positionScreen.x);v.setAttribute("y2",m.positionScreen.y);if(D instanceof THREE.LineBasicMaterial){n.__styleString=D.color.__styleString;v.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+D.linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+D.linecap+"; stroke-linejoin: "+D.linejoin);h.appendChild(v)}}}}else if(q instanceof
- THREE.RenderableFace3){r=q.v1;t=q.v2;y=q.v3;r.positionScreen.x*=c;r.positionScreen.y*=-B;t.positionScreen.x*=c;t.positionScreen.y*=-B;y.positionScreen.x*=c;y.positionScreen.y*=-B;w.addPoint(r.positionScreen.x,r.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);w.addPoint(y.positionScreen.x,y.positionScreen.y);if(I.instersects(w)){N=0;for(F=q.meshMaterials.length;N<F;){D=q.meshMaterials[N++];if(D instanceof THREE.MeshFaceMaterial){G=0;for(m=q.faceMaterials.length;G<m;)(D=q.faceMaterials[G++])&&
- b(r,t,y,q,D,H)}else D&&b(r,t,y,q,D,H)}}}else if(q instanceof THREE.RenderableFace4){r=q.v1;t=q.v2;y=q.v3;A=q.v4;r.positionScreen.x*=c;r.positionScreen.y*=-B;t.positionScreen.x*=c;t.positionScreen.y*=-B;y.positionScreen.x*=c;y.positionScreen.y*=-B;A.positionScreen.x*=c;A.positionScreen.y*=-B;w.addPoint(r.positionScreen.x,r.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);w.addPoint(y.positionScreen.x,y.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);if(I.instersects(w)){N=
- 0;for(F=q.meshMaterials.length;N<F;){D=q.meshMaterials[N++];if(D instanceof THREE.MeshFaceMaterial){G=0;for(m=q.faceMaterials.length;G<m;)(D=q.faceMaterials[G++])&&e(r,t,y,A,q,D,H)}else D&&e(r,t,y,A,q,D,H)}}}}}};
- THREE.WebGLRenderer=function(a,b){function e(i,o,s){var p=c.createProgram();s=["#ifdef GL_ES\nprecision highp float;\n#endif",s?"#define USE_FOG":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");var u=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","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(p,h("fragment",s+i));c.attachShader(p,h("vertex",u+o));c.linkProgram(p);c.getProgramParameter(p,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(p,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");p.uniforms={};p.attributes={};return p}function d(i,o){if(i.image.length==6){if(!i.image.__webGLTextureCube&&!i.image.__cubeMapInitialized&&i.image.loadCount==6){i.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,i.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(var s=0;s<6;++s)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image[s]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);i.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
- o);c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube)}}function g(i,o){if(!i.__webGLTexture&&i.image.loaded){i.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,k(i.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,k(i.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,k(i.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,
- k(i.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+o);c.bindTexture(c.TEXTURE_2D,i.__webGLTexture)}function f(i,o){var s,p,u;s=0;for(p=o.length;s<p;s++){u=o[s];i.uniforms[u]=c.getUniformLocation(i,u)}}function j(i,o){var s,p,u;s=0;for(p=o.length;s<p;s++){u=o[s];i.attributes[u]=c.getAttribLocation(i,u)}}function h(i,o){var s;if(i=="fragment")s=c.createShader(c.FRAGMENT_SHADER);else if(i=="vertex")s=c.createShader(c.VERTEX_SHADER);c.shaderSource(s,
- o);c.compileShader(s);if(!c.getShaderParameter(s,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(s));return null}return s}function k(i){switch(i){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}return 0}var x=document.createElement("canvas"),c,B,r,t=new THREE.Matrix4,y,A=new Float32Array(16),I=new Float32Array(16),w=new Float32Array(16),C=new Float32Array(9),n=new Float32Array(16),O=function(i,o){if(i){var s,p,u,l=pointLights=maxDirLights=maxPointLights=0;s=0;for(p=i.lights.length;s<p;s++){u=i.lights[s];u instanceof THREE.DirectionalLight&&l++;u instanceof
- THREE.PointLight&&pointLights++}if(pointLights+l<=o){maxDirLights=l;maxPointLights=pointLights}else{maxDirLights=Math.ceil(o*l/(pointLights+l));maxPointLights=o-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:o-1}}(a,4);fog=a?a.fog:null;aa=b!=undefined?b:true;this.domElement=x;this.autoClear=true;try{c=x.getContext("experimental-webgl",{antialias:aa})}catch(L){}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(0,0,0,0);B=r=function(i,o,s){var p=[i?"#define MAX_DIR_LIGHTS "+i:"",o?"#define MAX_POINT_LIGHTS "+o:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",i?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":
- "",i?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",o?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":"",o?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",o?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
- i?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",i?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",i?"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );":"",i?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",i?"}":"",o?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",o?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",o?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
- "",o?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",o?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",o?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
- u=[i?"#define MAX_DIR_LIGHTS "+i:"",o?"#define MAX_POINT_LIGHTS "+o:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\n#ifdef USE_FOG\nuniform vec3 fogColor;\nuniform float fogNear;\nuniform float fogFar;\n#endif\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
- i?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",o?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
- o?"vec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",o?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",o?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",o?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",o?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",o?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",o?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",o?"float pointSpecularWeight = 0.0;":"",o?"if ( pointDotNormalHalf >= 0.0 )":
- "",o?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",o?"pointDiffuse += mColor * pointDiffuseWeight;":"",o?"pointSpecular += mSpecular * pointSpecularWeight;":"",o?"}":"",i?"vec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",i?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",i?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",i?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",i?"vec3 dirVector = normalize( lDirection.xyz );":"",i?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
- "",i?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",i?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",i?"float dirSpecularWeight = 0.0;":"",i?"if ( dirDotNormalHalf >= 0.0 )":"",i?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",i?"dirDiffuse += mColor * dirDiffuseWeight;":"",i?"dirSpecular += mSpecular * dirSpecularWeight;":"",i?"}":"","vec4 totalLight = mAmbient;",i?"totalLight += dirDiffuse + dirSpecular;":"",o?"totalLight += pointDiffuse + pointSpecular;":
- "","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif\n}"].join("\n");
- p=e(u,p,s);c.useProgram(p);f(p,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract"]);s&&f(p,["fogColor","fogNear","fogFar"]);i&&f(p,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);o&&f(p,["pointLightNumber","pointLightColor",
- "pointLightPosition"]);c.uniform1i(p.uniforms.enableMap,0);c.uniform1i(p.uniforms.tMap,0);c.uniform1i(p.uniforms.enableCubeMap,0);c.uniform1i(p.uniforms.tCube,1);c.uniform1i(p.uniforms.mixEnvMap,0);c.uniform1i(p.uniforms.useRefract,0);j(p,["position","normal","uv"]);return p}(O.directional,O.point,fog);this.setSize=function(i,o){x.width=i;x.height=o;c.viewport(0,0,x.width,x.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(i,o){var s,p,u,l,v,
- z=[],J=[],S=[];l=[];v=[];c.uniform1i(i.uniforms.enableLighting,o.length);s=0;for(p=o.length;s<p;s++){u=o[s];if(u instanceof THREE.AmbientLight)z.push(u);else if(u instanceof THREE.DirectionalLight)S.push(u);else u instanceof THREE.PointLight&&J.push(u)}s=u=l=v=0;for(p=z.length;s<p;s++){u+=z[s].color.r;l+=z[s].color.g;v+=z[s].color.b}c.uniform3f(i.uniforms.ambientLightColor,u,l,v);l=[];v=[];s=0;for(p=S.length;s<p;s++){u=S[s];l.push(u.color.r*u.intensity);l.push(u.color.g*u.intensity);l.push(u.color.b*
- u.intensity);v.push(u.position.x);v.push(u.position.y);v.push(u.position.z)}if(S.length){c.uniform1i(i.uniforms.directionalLightNumber,S.length);c.uniform3fv(i.uniforms.directionalLightDirection,v);c.uniform3fv(i.uniforms.directionalLightColor,l)}l=[];v=[];s=0;for(p=J.length;s<p;s++){u=J[s];l.push(u.color.r*u.intensity);l.push(u.color.g*u.intensity);l.push(u.color.b*u.intensity);v.push(u.position.x);v.push(u.position.y);v.push(u.position.z)}if(J.length){c.uniform1i(i.uniforms.pointLightNumber,J.length);
- c.uniform3fv(i.uniforms.pointLightPosition,v);c.uniform3fv(i.uniforms.pointLightColor,l)}};this.createBuffers=function(i,o){var s,p,u,l,v,z,J,S,Q,H=[],V=[],M=[],W=[],N=[],F=[],G=0,m=i.geometry.geometryChunks[o],q;u=false;s=0;for(p=i.materials.length;s<p;s++){meshMaterial=i.materials[s];if(meshMaterial instanceof THREE.MeshFaceMaterial){v=0;for(q=m.materials.length;v<q;v++)if(m.materials[v]&&m.materials[v].shading!=undefined&&m.materials[v].shading==THREE.SmoothShading){u=true;break}}else if(meshMaterial&&
- meshMaterial.shading!=undefined&&meshMaterial.shading==THREE.SmoothShading){u=true;break}if(u)break}q=u;s=0;for(p=m.faces.length;s<p;s++){u=m.faces[s];l=i.geometry.faces[u];v=l.vertexNormals;faceNormal=l.normal;u=i.geometry.uvs[u];if(l instanceof THREE.Face3){z=i.geometry.vertices[l.a].position;J=i.geometry.vertices[l.b].position;S=i.geometry.vertices[l.c].position;M.push(z.x,z.y,z.z);M.push(J.x,J.y,J.z);M.push(S.x,S.y,S.z);if(i.geometry.hasTangents){z=i.geometry.vertices[l.a].tangent;J=i.geometry.vertices[l.b].tangent;
- S=i.geometry.vertices[l.c].tangent;N.push(z.x,z.y,z.z,z.w);N.push(J.x,J.y,J.z,J.w);N.push(S.x,S.y,S.z,S.w)}if(v.length==3&&q)for(l=0;l<3;l++)W.push(v[l].x,v[l].y,v[l].z);else for(l=0;l<3;l++)W.push(faceNormal.x,faceNormal.y,faceNormal.z);if(u)for(l=0;l<3;l++)F.push(u[l].u,u[l].v);H.push(G,G+1,G+2);V.push(G,G+1);V.push(G,G+2);V.push(G+1,G+2);G+=3}else if(l instanceof THREE.Face4){z=i.geometry.vertices[l.a].position;J=i.geometry.vertices[l.b].position;S=i.geometry.vertices[l.c].position;Q=i.geometry.vertices[l.d].position;
- M.push(z.x,z.y,z.z);M.push(J.x,J.y,J.z);M.push(S.x,S.y,S.z);M.push(Q.x,Q.y,Q.z);if(i.geometry.hasTangents){z=i.geometry.vertices[l.a].tangent;J=i.geometry.vertices[l.b].tangent;S=i.geometry.vertices[l.c].tangent;l=i.geometry.vertices[l.d].tangent;N.push(z.x,z.y,z.z,z.w);N.push(J.x,J.y,J.z,J.w);N.push(S.x,S.y,S.z,S.w);N.push(l.x,l.y,l.z,l.w)}if(v.length==4&&q)for(l=0;l<4;l++)W.push(v[l].x,v[l].y,v[l].z);else for(l=0;l<4;l++)W.push(faceNormal.x,faceNormal.y,faceNormal.z);if(u)for(l=0;l<4;l++)F.push(u[l].u,
- u[l].v);H.push(G,G+1,G+2);H.push(G,G+2,G+3);V.push(G,G+1);V.push(G,G+2);V.push(G,G+3);V.push(G+1,G+2);V.push(G+2,G+3);G+=4}}if(M.length){m.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,m.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(M),c.STATIC_DRAW);m.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,m.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(W),c.STATIC_DRAW);if(i.geometry.hasTangents){m.__webGLTangentBuffer=c.createBuffer();
- c.bindBuffer(c.ARRAY_BUFFER,m.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(N),c.STATIC_DRAW)}if(F.length>0){m.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,m.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(F),c.STATIC_DRAW)}m.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(H),c.STATIC_DRAW);m.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- m.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(V),c.STATIC_DRAW);m.__webGLFaceCount=H.length;m.__webGLLineCount=V.length}};this.renderBuffer=function(i,o,s,p,u){var l,v,z,J,S,Q,H,V,M;if(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshDepthMaterial||p instanceof THREE.MeshNormalMaterial){if(!p.program){if(p instanceof THREE.MeshDepthMaterial){H=T.depth;p.fragment_shader=H.fragment_shader;p.vertex_shader=H.vertex_shader;p.uniforms=H.uniforms;p.uniforms.mNear.value=
- p.near;p.uniforms.mFar.value=p.far}else if(p instanceof THREE.MeshNormalMaterial){H=T.normal;p.fragment_shader=H.fragment_shader;p.vertex_shader=H.vertex_shader;p.uniforms=H.uniforms}p.program=e(p.fragment_shader,p.vertex_shader,null);H=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(M in p.uniforms)H.push(M);f(p.program,H);j(p.program,["position","normal","uv","tangent"])}M=p.program}else M=r;if(M!=B){c.useProgram(M);B=M}M==r&&this.setupLights(M,
- o);this.loadCamera(M,i);this.loadMatrices(M);if(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshDepthMaterial||p instanceof THREE.MeshNormalMaterial){z=p.wireframe;J=p.wireframe_linewidth;i=M;o=p.uniforms;var W;for(l in o){V=o[l].type;H=o[l].value;W=i.uniforms[l];if(V=="i")c.uniform1i(W,H);else if(V=="f")c.uniform1f(W,H);else if(V=="v3")c.uniform3f(W,H.x,H.y,H.z);else if(V=="c")c.uniform3f(W,H.r,H.g,H.b);else if(V=="t"){c.uniform1i(W,H);if(V=o[l].texture)V.image instanceof Array&&V.image.length==
- 6?d(V,H):g(V,H)}}}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshBasicMaterial){l=p.color;v=p.opacity;z=p.wireframe;J=p.wireframe_linewidth;S=p.map;Q=p.env_map;o=p.combine==THREE.MixOperation;i=p.reflectivity;V=p.env_map&&p.env_map.mapping instanceof THREE.CubeRefractionMapping;H=p.refraction_ratio;c.uniform4f(M.uniforms.mColor,l.r*v,l.g*v,l.b*v,v);c.uniform1i(M.uniforms.mixEnvMap,o);c.uniform1f(M.uniforms.mReflectivity,i);c.uniform1i(M.uniforms.useRefract,
- V);c.uniform1f(M.uniforms.mRefractionRatio,H);if(s){c.uniform1f(M.uniforms.fogNear,s.near);c.uniform1f(M.uniforms.fogFar,s.far);c.uniform3f(M.uniforms.fogColor,s.color.r,s.color.g,s.color.b)}}if(p instanceof THREE.MeshPhongMaterial){s=p.ambient;l=p.specular;p=p.shininess;c.uniform4f(M.uniforms.mAmbient,s.r,s.g,s.b,v);c.uniform4f(M.uniforms.mSpecular,l.r,l.g,l.b,v);c.uniform1f(M.uniforms.mShininess,p);c.uniform1i(M.uniforms.material,2)}else if(p instanceof THREE.MeshLambertMaterial)c.uniform1i(M.uniforms.material,
- 1);else p instanceof THREE.MeshBasicMaterial&&c.uniform1i(M.uniforms.material,0);if(S){g(S,0);c.uniform1i(M.uniforms.tMap,0);c.uniform1i(M.uniforms.enableMap,1)}else c.uniform1i(M.uniforms.enableMap,0);if(Q){d(Q,1);c.uniform1i(M.uniforms.tCube,1);c.uniform1i(M.uniforms.enableCubeMap,1)}else c.uniform1i(M.uniforms.enableCubeMap,0);v=M.attributes;c.bindBuffer(c.ARRAY_BUFFER,u.__webGLVertexBuffer);c.vertexAttribPointer(v.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(v.position);if(v.normal>=
- 0){c.bindBuffer(c.ARRAY_BUFFER,u.__webGLNormalBuffer);c.vertexAttribPointer(v.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(v.normal)}if(v.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,u.__webGLTangentBuffer);c.vertexAttribPointer(v.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(v.tangent)}if(v.uv>=0)if(u.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,u.__webGLUVBuffer);c.vertexAttribPointer(v.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(v.uv)}else c.disableVertexAttribArray(v.uv);if(z){c.lineWidth(J);
- c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);c.drawElements(c.LINES,u.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,u.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(i,o,s,p,u,l,v){var z,J,S,Q,H;S=0;for(Q=p.materials.length;S<Q;S++){z=p.materials[S];if(z instanceof THREE.MeshFaceMaterial){z=0;for(J=u.materials.length;z<J;z++)if((H=u.materials[z])&&H.blending==l&&H.opacity<1==v){this.setBlending(H.blending);
- this.renderBuffer(i,o,s,H,u)}}else if((H=z)&&H.blending==l&&H.opacity<1==v){this.setBlending(H.blending);this.renderBuffer(i,o,s,H,u)}}};this.render=function(i,o){var s,p,u,l,v=i.lights,z=i.fog;this.initWebGLObjects(i);this.autoClear&&this.clear();o.autoUpdateMatrix&&o.updateMatrix();A.set(o.matrix.flatten());w.set(o.projectionMatrix.flatten());s=0;for(p=i.__webGLObjects.length;s<p;s++){u=i.__webGLObjects[s];l=u.object;u=u.buffer;if(l.visible){this.setupMatrices(l,o);this.renderPass(o,v,z,l,u,THREE.NormalBlending,
- false)}}s=0;for(p=i.__webGLObjects.length;s<p;s++){u=i.__webGLObjects[s];l=u.object;u=u.buffer;if(l.visible){this.setupMatrices(l,o);this.renderPass(o,v,z,l,u,THREE.AdditiveBlending,false);this.renderPass(o,v,z,l,u,THREE.SubtractiveBlending,false);this.renderPass(o,v,z,l,u,THREE.AdditiveBlending,true);this.renderPass(o,v,z,l,u,THREE.SubtractiveBlending,true);this.renderPass(o,v,z,l,u,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(i){var o,s,p,u,l,v;if(!i.__webGLObjects){i.__webGLObjects=
- [];i.__webGLObjectsMap={}}o=0;for(s=i.objects.length;o<s;o++){p=i.objects[o];if(i.__webGLObjectsMap[p.id]==undefined)i.__webGLObjectsMap[p.id]={};v=i.__webGLObjectsMap[p.id];if(p instanceof THREE.Mesh)for(l in p.geometry.geometryChunks){u=p.geometry.geometryChunks[l];u.__webGLVertexBuffer||this.createBuffers(p,l);if(v[l]==undefined){u={buffer:u,object:p};i.__webGLObjects.push(u);v[l]=1}}}};this.removeObject=function(i,o){var s,p;for(s=i.__webGLObjects.length-1;s>=0;s--){p=i.__webGLObjects[s].object;
- o==p&&i.__webGLObjects.splice(s,1)}};this.setupMatrices=function(i,o){i.autoUpdateMatrix&&i.updateMatrix();t.multiply(o.matrix,i.matrix);I.set(t.flatten());y=THREE.Matrix4.makeInvert3x3(t).transpose();C.set(y.m);n.set(i.matrix.flatten())};this.loadMatrices=function(i){c.uniformMatrix4fv(i.uniforms.viewMatrix,false,A);c.uniformMatrix4fv(i.uniforms.modelViewMatrix,false,I);c.uniformMatrix4fv(i.uniforms.projectionMatrix,false,w);c.uniformMatrix3fv(i.uniforms.normalMatrix,false,C);c.uniformMatrix4fv(i.uniforms.objectMatrix,
- false,n)};this.loadCamera=function(i,o){c.uniform3f(i.uniforms.cameraPosition,o.position.x,o.position.y,o.position.z)};this.setBlending=function(i){switch(i){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(i,o){if(i){!o||o=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(i=="back")c.cullFace(c.BACK);
- else i=="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};var T={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}"}}};
- 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 e=b instanceof THREE.Mesh,d=a.vertices.length,g=e?b.geometry:b,f=a.vertices,j=g.vertices,h=a.faces,k=g.faces,x=a.uvs;g=g.uvs;e&&b.updateMatrix();for(var c=0,B=j.length;c<B;c++){var r=new THREE.Vertex(j[c].position.clone());e&&b.matrix.multiplyVector3(r.position);f.push(r)}c=0;for(B=k.length;c<B;c++){j=k[c];var t,y=j.vertexNormals;if(j instanceof THREE.Face3)t=new THREE.Face3(j.a+d,j.b+d,j.c+d);else if(j instanceof THREE.Face4)t=new THREE.Face4(j.a+d,j.b+
- d,j.c+d,j.d+d);t.centroid.copy(j.centroid);t.normal.copy(j.normal);e=0;for(f=y.length;e<f;e++){r=y[e];t.vertexNormals.push(r.clone())}t.materials=j.materials.slice();h.push(t)}c=0;for(B=g.length;c<B;c++){d=g[c];h=[];e=0;for(f=d.length;e<f;e++)h.push(new THREE.UV(d[e].u,d[e].v));x.push(h)}}},ImageUtils={loadTexture:function(a,b){var e=new Image;e.onload=function(){this.loaded=true};e.src=a;return new THREE.Texture(e,b)},loadArray:function(a){var b,e,d=[];b=d.loadCount=0;for(e=a.length;b<e;++b){d[b]=
- new Image;d[b].loaded=0;d[b].onload=function(){d.loadCount+=1;this.loaded=true};d[b].src=a[b]}return d}},SceneUtils={addMesh:function(a,b,e,d,g,f,j,h,k,x){b=new THREE.Mesh(b,x);b.scale.x=b.scale.y=b.scale.z=e;b.position.x=d;b.position.y=g;b.position.z=f;b.rotation.x=j;b.rotation.y=h;b.rotation.z=k;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,e){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,
- uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,true),e);a.addObject(b);return b},addPanoramaCube:function(a,b,e){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));
- mesh=new THREE.Mesh(new Cube(b,b,b,1,1,d,true),new THREE.MeshFaceMaterial);a.addObject(mesh);return mesh},addPanoramaCubePlanes:function(a,b,e){var d=b/2;b=new Plane(b,b);var g=Math.PI/2,f=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));SceneUtils.addMesh(a,
- b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[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:{tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},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 uDirLightColor;\nuniform vec3 uPointLightPos;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 normalTex = normalize( texture2D( tNormal, vUv ).xyz * 2.0 - 1.0 );\nvec3 aoTex = 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( uAmbientColor, 1.0 );\ntotalLight += dirDiffuse + dirSpecular;\ntotalLight += pointDiffuse + pointSpecular;\ngl_FragColor = vec4( totalLight.xyz * vLightWeighting * aoTex, 1.0 );\n}",
- vertex_shader:"attribute vec4 tangent;\nuniform vec3 uDirLightPos;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightPos;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientLightColor;\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 vLightWeighting;\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;\nvLightWeighting = uAmbientLightColor;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( vNormal, vPointLightVector ), 0.0 );\nvLightWeighting += uPointLightColor * pointLightWeighting;\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nfloat directionalLightWeighting = max( dot( vNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += uDirLightColor * directionalLightWeighting;\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}"},
- 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:{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}"}}},Cube=function(a,b,e,d,g,f,j,h){function k(A,I,w,C,n,O,L,T){var i,o=d||1,s=g||1,p=o+1,u=s+1,l=n/2,v=O/2;n=n/o;O=O/s;var z=x.vertices.length;if(A=="x"&&I=="y"||A=="y"&&I=="x")i="z";else if(A=="x"&&I=="z"||A=="z"&&I=="x")i="y";else if(A=="z"&&I=="y"||A=="y"&&I=="z")i="x";for(iy=0;iy<u;iy++)for(ix=0;ix<
- p;ix++){var J=new THREE.Vector3;J[A]=(ix*n-l)*w;J[I]=(iy*O-v)*C;J[i]=L;x.vertices.push(new THREE.Vertex(J))}for(iy=0;iy<s;iy++)for(ix=0;ix<o;ix++){x.faces.push(new THREE.Face4(ix+p*iy+z,ix+p*(iy+1)+z,ix+1+p*(iy+1)+z,ix+1+p*iy+z,null,T));x.uvs.push([new THREE.UV(ix/o,iy/s),new THREE.UV(ix/o,(iy+1)/s),new THREE.UV((ix+1)/o,(iy+1)/s),new THREE.UV((ix+1)/o,iy/s)])}}THREE.Geometry.call(this);var x=this,c=a/2,B=b/2,r=e/2;j=j?-1:1;if(f!==undefined)if(f instanceof Array)this.materials=f;else{this.materials=
- [];for(var t=0;t<6;t++)this.materials.push([f])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=undefined)for(var y in h)if(this.sides[y]!=undefined)this.sides[y]=h[y];this.sides.px&&k("z","y",1*j,-1,e,b,-c,this.materials[0]);this.sides.nx&&k("z","y",-1*j,-1,e,b,c,this.materials[1]);this.sides.py&&k("x","z",1*j,1,a,e,B,this.materials[2]);this.sides.ny&&k("x","z",1*j,-1,a,e,-B,this.materials[3]);this.sides.pz&&k("x","y",1*j,-1,a,b,r,this.materials[4]);this.sides.nz&&
- k("x","y",-1*j,-1,a,b,-r,this.materials[5]);(function(){for(var A=[],I=[],w=0,C=x.vertices.length;w<C;w++){for(var n=x.vertices[w],O=false,L=0,T=A.length;L<T;L++){var i=A[L];if(n.position.x==i.position.x&&n.position.y==i.position.y&&n.position.z==i.position.z){I[w]=L;O=true;break}}if(!O){I[w]=A.length;A.push(new THREE.Vertex(n.position.clone()))}}w=0;for(C=x.faces.length;w<C;w++){n=x.faces[w];n.a=I[n.a];n.b=I[n.b];n.c=I[n.c];n.d=I[n.d]}x.vertices=A})();this.computeCentroids();this.computeFaceNormals();
- this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,b,e,d,g){function f(x,c,B){j.vertices.push(new THREE.Vertex(new THREE.Vector3(x,c,B)))}THREE.Geometry.call(this);var j=this,h=Math.PI,k;for(k=0;k<a;k++)f(Math.sin(2*h*k/a)*b,Math.cos(2*h*k/a)*b,0);for(k=0;k<a;k++)f(Math.sin(2*h*k/a)*e,Math.cos(2*h*k/a)*e,d);for(k=0;k<a;k++)j.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(e!=0){f(0,0,-g);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){f(0,0,d+g);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,e,d){THREE.Geometry.call(this);var g,f=a/2,j=b/2;e=e||1;d=d||1;var h=e+1,k=d+1;a=a/e;var x=b/d;for(g=0;g<k;g++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-f,-(g*x-j),0)));for(g=0;g<d;g++)for(b=0;b<e;b++){this.faces.push(new THREE.Face4(b+h*g,b+h*(g+1),b+1+h*(g+1),b+1+h*g));this.uvs.push([new THREE.UV(b/e,g/d),new THREE.UV(b/e,(g+1)/d),new THREE.UV((b+1)/e,(g+1)/d),new THREE.UV((b+1)/e,g/d)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,b,e){THREE.Geometry.call(this);var d,g=Math.PI,f=Math.max(3,b||8),j=Math.max(2,e||6);b=[];for(e=0;e<j+1;e++){d=e/j;var h=a*Math.cos(d*g),k=a*Math.sin(d*g),x=[],c=0;for(d=0;d<f;d++){var B=2*d/f,r=k*Math.sin(B*g);B=k*Math.cos(B*g);(e==0||e==j)&&d>0||(c=this.vertices.push(new THREE.Vertex(new THREE.Vector3(B,h,r)))-1);x.push(c)}b.push(x)}var t,y,A;g=b.length;for(e=0;e<g;e++){f=b[e].length;if(e>0)for(d=0;d<f;d++){x=d==f-1;j=b[e][x?0:d+1];h=b[e][x?f-1:d];k=b[e-1][x?f-1:d];x=b[e-1][x?
- 0:d+1];r=e/(g-1);t=(e-1)/(g-1);y=(d+1)/f;B=d/f;c=new THREE.UV(1-y,r);r=new THREE.UV(1-B,r);B=new THREE.UV(1-B,t);var I=new THREE.UV(1-y,t);if(e<b.length-1){t=this.vertices[j].position.clone();y=this.vertices[h].position.clone();A=this.vertices[k].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(j,h,k,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([c,r,B])}if(e>1){t=this.vertices[j].position.clone();
- y=this.vertices[k].position.clone();A=this.vertices[x].position.clone();t.normalize();y.normalize();A.normalize();this.faces.push(new THREE.Face3(j,k,x,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([c,B,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- 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 e=document.createElement("script");e.type="text/javascript";e.onload=b;e.src=a;document.getElementsByTagName("head")[0].appendChild(e)},loadAscii:function(a,b,e){var d=(new Date).getTime();a=new Worker(a);a.onmessage=function(g){THREE.Loader.prototype.createModel(g.data,b,e)};a.postMessage(d)},loadBinary:function(a,b,e){var d=(new Date).getTime();a=new Worker(a);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(f){THREE.Loader.prototype.loadAjaxBuffers(f.data.buffers,
- f.data.materials,b,e,g)};a.onerror=function(f){alert("worker.onerror: "+f.message+"\n"+f.data);f.preventDefault()};a.postMessage(d)},loadAjaxBuffers:function(a,b,e,d,g){var f=new XMLHttpRequest,j=d+"/"+a,h=0;f.onreadystatechange=function(){if(f.readyState==4)f.status==200||f.status==0?THREE.Loader.prototype.createBinModel(f.responseText,e,d,b):alert("Couldn't load ["+j+"] ["+f.status+"]");else if(f.readyState==3){if(g){if(h==0)h=f.getResponseHeader("Content-Length");g({total:h,loaded:f.responseText.length})}}else if(f.readyState==
- 2)h=f.getResponseHeader("Content-Length")};f.open("GET",j,true);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)},createBinModel:function(a,b,e,d){var g=function(f){function j(m,q){var D=c(m,q),P=c(m,q+1),Y=c(m,q+2),Z=c(m,q+3),fa=(Z<<1&255|Y>>7)-127;D=(Y&127)<<16|P<<8|D;if(D==0&&fa==-127)return 0;return(1-2*(Z>>7))*(1+D*Math.pow(2,-23))*Math.pow(2,fa)}function h(m,q){var D=c(m,q),P=c(m,q+1),Y=c(m,q+2);return(c(m,q+3)<<24)+(Y<<16)+
- (P<<8)+D}function k(m,q){var D=c(m,q);return(c(m,q+1)<<8)+D}function x(m,q){var D=c(m,q);return D>127?D-256:D}function c(m,q){return m.charCodeAt(q)&255}function B(m){var q,D,P;q=h(a,m);D=h(a,m+T);P=h(a,m+i);m=k(a,m+o);THREE.Loader.prototype.f3(w,q,D,P,m)}function r(m){var q,D,P,Y,Z,fa;q=h(a,m);D=h(a,m+T);P=h(a,m+i);Y=k(a,m+o);Z=h(a,m+s);fa=h(a,m+p);m=h(a,m+u);THREE.Loader.prototype.f3n(w,O,q,D,P,Y,Z,fa,m)}function t(m){var q,D,P,Y;q=h(a,m);D=h(a,m+l);P=h(a,m+v);Y=h(a,m+z);m=k(a,m+J);THREE.Loader.prototype.f4(w,
- q,D,P,Y,m)}function y(m){var q,D,P,Y,Z,fa,na,pa;q=h(a,m);D=h(a,m+l);P=h(a,m+v);Y=h(a,m+z);Z=k(a,m+J);fa=h(a,m+S);na=h(a,m+Q);pa=h(a,m+H);m=h(a,m+V);THREE.Loader.prototype.f4n(w,O,q,D,P,Y,Z,fa,na,pa,m)}function A(m){var q,D;q=h(a,m);D=h(a,m+M);m=h(a,m+W);THREE.Loader.prototype.uv3(w,L[q*2],L[q*2+1],L[D*2],L[D*2+1],L[m*2],L[m*2+1])}function I(m){var q,D,P;q=h(a,m);D=h(a,m+N);P=h(a,m+F);m=h(a,m+G);THREE.Loader.prototype.uv4(w,L[q*2],L[q*2+1],L[D*2],L[D*2+1],L[P*2],L[P*2+1],L[m*2],L[m*2+1])}var w=this,
- C=0,n,O=[],L=[],T,i,o,s,p,u,l,v,z,J,S,Q,H,V,M,W,N,F,G;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,f);n={signature:a.substr(C,8),header_bytes:c(a,C+8),vertex_coordinate_bytes:c(a,C+9),normal_coordinate_bytes:c(a,C+10),uv_coordinate_bytes:c(a,C+11),vertex_index_bytes:c(a,C+12),normal_index_bytes:c(a,C+13),uv_index_bytes:c(a,C+14),material_index_bytes:c(a,C+15),nvertices:h(a,C+16),nnormals:h(a,C+16+4),nuvs:h(a,C+16+8),ntri_flat:h(a,C+16+12),ntri_smooth:h(a,C+16+16),ntri_flat_uv:h(a,
- C+16+20),ntri_smooth_uv:h(a,C+16+24),nquad_flat:h(a,C+16+28),nquad_smooth:h(a,C+16+32),nquad_flat_uv:h(a,C+16+36),nquad_smooth_uv:h(a,C+16+40)};C+=n.header_bytes;T=n.vertex_index_bytes;i=n.vertex_index_bytes*2;o=n.vertex_index_bytes*3;s=n.vertex_index_bytes*3+n.material_index_bytes;p=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;u=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;l=n.vertex_index_bytes;v=n.vertex_index_bytes*2;z=n.vertex_index_bytes*3;J=n.vertex_index_bytes*
- 4;S=n.vertex_index_bytes*4+n.material_index_bytes;Q=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;H=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;V=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;M=n.uv_index_bytes;W=n.uv_index_bytes*2;N=n.uv_index_bytes;F=n.uv_index_bytes*2;G=n.uv_index_bytes*3;C+=function(m){var q,D,P,Y=n.vertex_coordinate_bytes*3,Z=m+n.nvertices*Y;for(m=m;m<Z;m+=Y){q=j(a,m);D=j(a,m+n.vertex_coordinate_bytes);P=j(a,
- m+n.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,q,D,P)}return n.nvertices*Y}(C);C+=function(m){var q,D,P,Y=n.normal_coordinate_bytes*3,Z=m+n.nnormals*Y;for(m=m;m<Z;m+=Y){q=x(a,m);D=x(a,m+n.normal_coordinate_bytes);P=x(a,m+n.normal_coordinate_bytes*2);O.push(q/127,D/127,P/127)}return n.nnormals*Y}(C);C+=function(m){var q,D,P=n.uv_coordinate_bytes*2,Y=m+n.nuvs*P;for(m=m;m<Y;m+=P){q=j(a,m);D=j(a,m+n.uv_coordinate_bytes);L.push(q,D)}return n.nuvs*P}(C);C+=function(m){var q,D=n.vertex_index_bytes*
- 3+n.material_index_bytes,P=m+n.ntri_flat*D;for(q=m;q<P;q+=D)B(q);return P-m}(C);C+=function(m){var q,D=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,P=m+n.ntri_smooth*D;for(q=m;q<P;q+=D)r(q);return P-m}(C);C+=function(m){var q,D=n.vertex_index_bytes*3+n.material_index_bytes,P=D+n.uv_index_bytes*3,Y=m+n.ntri_flat_uv*P;for(q=m;q<Y;q+=P){B(q);A(q+D)}return Y-m}(C);C+=function(m){var q,D=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,P=D+n.uv_index_bytes*3,
- Y=m+n.ntri_smooth_uv*P;for(q=m;q<Y;q+=P){r(q);A(q+D)}return Y-m}(C);C+=function(m){var q,D=n.vertex_index_bytes*4+n.material_index_bytes,P=m+n.nquad_flat*D;for(q=m;q<P;q+=D)t(q);return P-m}(C);C+=function(m){var q,D=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,P=m+n.nquad_smooth*D;for(q=m;q<P;q+=D)y(q);return P-m}(C);C+=function(m){var q,D=n.vertex_index_bytes*4+n.material_index_bytes,P=D+n.uv_index_bytes*4,Y=m+n.nquad_flat_uv*P;for(q=m;q<Y;q+=P){t(q);I(q+D)}return Y-m}(C);
- C+=function(m){var q,D=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,P=D+n.uv_index_bytes*4,Y=m+n.nquad_smooth_uv*P;for(q=m;q<Y;q+=P){y(q);I(q+D)}return Y-m}(C);this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(e))},createModel:function(a,b,e){var d=function(g){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,g);(function(){var j,h,k,x,c;j=0;for(h=
- a.vertices.length;j<h;j+=3){k=a.vertices[j];x=a.vertices[j+1];c=a.vertices[j+2];THREE.Loader.prototype.v(f,k,x,c)}})();(function(){function j(y,A){THREE.Loader.prototype.f3(f,y[A],y[A+1],y[A+2],y[A+3])}function h(y,A){THREE.Loader.prototype.f3n(f,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6])}function k(y,A){THREE.Loader.prototype.f4(f,y[A],y[A+1],y[A+2],y[A+3],y[A+4])}function x(y,A){THREE.Loader.prototype.f4n(f,a.normals,y[A],y[A+1],y[A+2],y[A+3],y[A+4],y[A+5],y[A+6],y[A+7],y[A+8])}function c(y,
- A){var I,w,C;I=y[A];w=y[A+1];C=y[A+2];THREE.Loader.prototype.uv3(f,a.uvs[I*2],a.uvs[I*2+1],a.uvs[w*2],a.uvs[w*2+1],a.uvs[C*2],a.uvs[C*2+1])}function B(y,A){var I,w,C,n;I=y[A];w=y[A+1];C=y[A+2];n=y[A+3];THREE.Loader.prototype.uv4(f,a.uvs[I*2],a.uvs[I*2+1],a.uvs[w*2],a.uvs[w*2+1],a.uvs[C*2],a.uvs[C*2+1],a.uvs[n*2],a.uvs[n*2+1])}var r,t;r=0;for(t=a.triangles.length;r<t;r+=4)j(a.triangles,r);r=0;for(t=a.triangles_uv.length;r<t;r+=7){j(a.triangles_uv,r);c(a.triangles_uv,r+4)}r=0;for(t=a.triangles_n.length;r<
- t;r+=7)h(a.triangles_n,r);r=0;for(t=a.triangles_n_uv.length;r<t;r+=10){h(a.triangles_n_uv,r);c(a.triangles_n_uv,r+7)}r=0;for(t=a.quads.length;r<t;r+=5)k(a.quads,r);r=0;for(t=a.quads_uv.length;r<t;r+=9){k(a.quads_uv,r);B(a.quads_uv,r+5)}r=0;for(t=a.quads_n.length;r<t;r+=9)x(a.quads_n,r);r=0;for(t=a.quads_n_uv.length;r<t;r+=13){x(a.quads_n_uv,r);B(a.quads_n_uv,r+9)}})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=
- d;b(new d(e))},v:function(a,b,e,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,d)))},f3:function(a,b,e,d,g){a.faces.push(new THREE.Face3(b,e,d,null,a.materials[g]))},f4:function(a,b,e,d,g,f){a.faces.push(new THREE.Face4(b,e,d,g,null,a.materials[f]))},f3n:function(a,b,e,d,g,f,j,h,k){f=a.materials[f];var x=b[h*3],c=b[h*3+1];h=b[h*3+2];var B=b[k*3],r=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(e,d,g,[new THREE.Vector3(b[j*3],b[j*3+1],b[j*3+2]),new THREE.Vector3(x,c,h),new THREE.Vector3(B,
- r,k)],f))},f4n:function(a,b,e,d,g,f,j,h,k,x,c){j=a.materials[j];var B=b[k*3],r=b[k*3+1];k=b[k*3+2];var t=b[x*3],y=b[x*3+1];x=b[x*3+2];var A=b[c*3],I=b[c*3+1];c=b[c*3+2];a.faces.push(new THREE.Face4(e,d,g,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(B,r,k),new THREE.Vector3(t,y,x),new THREE.Vector3(A,I,c)],j))},uv3:function(a,b,e,d,g,f,j){var h=[];h.push(new THREE.UV(b,e));h.push(new THREE.UV(d,g));h.push(new THREE.UV(f,j));a.uvs.push(h)},uv4:function(a,b,e,d,g,f,j,h,k){var x=[];
- x.push(new THREE.UV(b,e));x.push(new THREE.UV(d,g));x.push(new THREE.UV(f,j));x.push(new THREE.UV(h,k));a.uvs.push(x)},init_materials:function(a,b,e){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],e)]},createMaterial:function(a,b){function e(f){f=Math.log(f)/Math.LN2;return Math.floor(f)==f}var d,g;if(a.map_diffuse&&b){g=document.createElement("canvas");d=new THREE.MeshLambertMaterial({map:new THREE.Texture(g)});g=new Image;g.onload=function(){if(!e(this.width)||
- !e(this.height)){var f=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),j=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));d.map.image.width=f;d.map.image.height=j;d.map.image.getContext("2d").drawImage(this,0,0,f,j)}else d.map.image=this;d.map.image.loaded=1};g.src=b+"/"+a.map_diffuse}else if(a.col_diffuse){g=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;d=new THREE.MeshLambertMaterial({color:g,opacity:a.transparency})}else d=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):
- new THREE.MeshLambertMaterial({color:15658734});return d}};
|