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