123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- // Three.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,e){this.r=a;this.g=b;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
- ","+~~(this.g*255)+","+~~(this.b*255)+")"},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,e){this.x=a||0;this.y=b||0;this.z=e||0};
- THREE.Vector3.prototype={set:function(a,b,e){this.x=a;this.y=b;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
- cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z=b*a.y-e*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},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,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+e*e+a*a)},distanceToSquared:function(a){var b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return b*b+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
- -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
- THREE.Vector4=function(a,b,e,f){this.x=a||0;this.y=b||0;this.z=e||0;this.w=f||1};
- THREE.Vector4.prototype={set:function(a,b,e,f){this.x=a;this.y=b;this.z=e;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
- return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
- THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(a){var b,e,f=a.objects,g=[];a=0;for(b=f.length;a<b;a++){e=f[a];if(e instanceof THREE.Mesh)g=g.concat(this.intersectObject(e))}g.sort(function(i,p){return i.distance-p.distance});return g},intersectObject:function(a){function b(U,s,Q,d){d=d.clone().subSelf(s);Q=Q.clone().subSelf(s);var h=U.clone().subSelf(s);U=d.dot(d);s=d.dot(Q);d=d.dot(h);var o=Q.dot(Q);Q=Q.dot(h);h=1/(U*o-s*s);o=(o*d-s*Q)*h;U=(U*Q-s*d)*h;return o>0&&U>0&&o+U<1}var e,f,g,i,p,c,k,m,D,F,
- y,C=a.geometry,R=C.vertices,W=[];e=0;for(f=C.faces.length;e<f;e++){g=C.faces[e];F=this.origin.clone();y=this.direction.clone();i=a.matrix.multiplyVector3(R[g.a].position.clone());p=a.matrix.multiplyVector3(R[g.b].position.clone());c=a.matrix.multiplyVector3(R[g.c].position.clone());k=g instanceof THREE.Face4?a.matrix.multiplyVector3(R[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());D=y.dot(m);if(D<0){m=m.dot((new THREE.Vector3).sub(i,F))/D;F=F.addSelf(y.multiplyScalar(m));
- if(g instanceof THREE.Face3){if(b(F,i,p,c)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:a};W.push(g)}}else if(g instanceof THREE.Face4)if(b(F,i,p,k)||b(F,p,c,k)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:a};W.push(g)}}}return W}};
- THREE.Rectangle=function(){function a(){i=f-b;p=g-e}var b,e,f,g,i,p,c=true;this.getX=function(){return b};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return p};this.getLeft=function(){return b};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(k,m,D,F){c=false;b=k;e=m;f=D;g=F;a()};this.addPoint=function(k,m){if(c){c=false;b=k;e=m;f=k;g=m}else{b=b<k?b:k;e=e<m?e:m;f=f>k?f:k;g=g>m?
- g:m}a()};this.add3Points=function(k,m,D,F,y,C){if(c){c=false;b=k<D?k<y?k:y:D<y?D:y;e=m<F?m<C?m:C:F<C?F:C;f=k>D?k>y?k:y:D>y?D:y;g=m>F?m>C?m:C:F>C?F:C}else{b=k<D?k<y?k<b?k:b:y<b?y:b:D<y?D<b?D:b:y<b?y:b;e=m<F?m<C?m<e?m:e:C<e?C:e:F<C?F<e?F:e:C<e?C:e;f=k>D?k>y?k>f?k:f:y>f?y:f:D>y?D>f?D:f:y>f?y:f;g=m>F?m>C?m>g?m:g:C>g?C:g:F>C?F>g?F:g:C>g?C:g}a()};this.addRectangle=function(k){if(c){c=false;b=k.getLeft();e=k.getTop();f=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();e=e<k.getTop()?e:k.getTop();
- f=f>k.getRight()?f:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;e-=k;f+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(f,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(e,k.getTop())>=0};this.empty=function(){c=true;g=f=e=b=0;a()};this.isEmpty=function(){return c};this.toString=
- function(){return"THREE.Rectangle ( left: "+b+", right: "+f+", top: "+e+", bottom: "+g+", width: "+i+", height: "+p+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
- THREE.Matrix4=function(a,b,e,f,g,i,p,c,k,m,D,F,y,C,R,W){this.n11=a||1;this.n12=b||0;this.n13=e||0;this.n14=f||0;this.n21=g||0;this.n22=i||1;this.n23=p||0;this.n24=c||0;this.n31=k||0;this.n32=m||0;this.n33=D||1;this.n34=F||0;this.n41=y||0;this.n42=C||0;this.n43=R||0;this.n44=W||1};
- THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,e,f,g,i,p,c,k,m,D,F,y,C,R,W){this.n11=a;this.n12=b;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=p;this.n24=c;this.n31=k;this.n32=m;this.n33=D;this.n34=F;this.n41=y;this.n42=C;this.n43=R;this.n44=W;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
- a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,e){var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3;i.sub(a,b).normalize();f.cross(e,i).normalize();g.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);this.n31=i.x;
- this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,e=a.y,f=a.z,g=1/(this.n41*b+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*e+this.n13*f+this.n14)*g;a.y=(this.n21*b+this.n22*e+this.n23*f+this.n24)*g;a.z=(this.n31*b+this.n32*e+this.n33*f+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,e=a.y,f=a.z,g=a.w;a.x=this.n11*b+this.n12*e+this.n13*f+this.n14*g;a.y=this.n21*b+this.n22*e+this.n23*f+this.n24*
- g;a.z=this.n31*b+this.n32*e+this.n33*f+this.n34*g;a.w=this.n41*b+this.n42*e+this.n43*f+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var e=a.n11,f=a.n12,g=a.n13,i=a.n14,p=a.n21,c=a.n22,k=a.n23,m=a.n24,D=a.n31,F=a.n32,
- y=a.n33,C=a.n34,R=a.n41,W=a.n42,U=a.n43,s=a.n44,Q=b.n11,d=b.n12,h=b.n13,o=b.n14,n=b.n21,l=b.n22,t=b.n23,r=b.n24,q=b.n31,z=b.n32,u=b.n33,j=b.n34,w=b.n41,S=b.n42,A=b.n43,J=b.n44;this.n11=e*Q+f*n+g*q+i*w;this.n12=e*d+f*l+g*z+i*S;this.n13=e*h+f*t+g*u+i*A;this.n14=e*o+f*r+g*j+i*J;this.n21=p*Q+c*n+k*q+m*w;this.n22=p*d+c*l+k*z+m*S;this.n23=p*h+c*t+k*u+m*A;this.n24=p*o+c*r+k*j+m*J;this.n31=D*Q+F*n+y*q+C*w;this.n32=D*d+F*l+y*z+C*S;this.n33=D*h+F*t+y*u+C*A;this.n34=D*o+F*r+y*j+C*J;this.n41=R*Q+W*n+U*q+s*w;
- this.n42=R*d+W*l+U*z+s*S;this.n43=R*h+W*t+U*u+s*A;this.n44=R*o+W*r+U*j+s*J;return this},multiplySelf:function(a){var b=this.n11,e=this.n12,f=this.n13,g=this.n14,i=this.n21,p=this.n22,c=this.n23,k=this.n24,m=this.n31,D=this.n32,F=this.n33,y=this.n34,C=this.n41,R=this.n42,W=this.n43,U=this.n44,s=a.n11,Q=a.n21,d=a.n31,h=a.n41,o=a.n12,n=a.n22,l=a.n32,t=a.n42,r=a.n13,q=a.n23,z=a.n33,u=a.n43,j=a.n14,w=a.n24,S=a.n34;a=a.n44;this.n11=b*s+e*Q+f*d+g*h;this.n12=b*o+e*n+f*l+g*t;this.n13=b*r+e*q+f*z+g*u;this.n14=
- b*j+e*w+f*S+g*a;this.n21=i*s+p*Q+c*d+k*h;this.n22=i*o+p*n+c*l+k*t;this.n23=i*r+p*q+c*z+k*u;this.n24=i*j+p*w+c*S+k*a;this.n31=m*s+D*Q+F*d+y*h;this.n32=m*o+D*n+F*l+y*t;this.n33=m*r+D*q+F*z+y*u;this.n34=m*j+D*w+F*S+y*a;this.n41=C*s+R*Q+W*d+U*h;this.n42=C*o+R*n+W*l+U*t;this.n43=C*r+R*q+W*z+U*u;this.n44=C*j+R*w+W*S+U*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=
- a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
- this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,e,f){var g=b[e];b[e]=b[f];
- b[f]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
- this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,e){var f=new THREE.Matrix4;f.n14=a;f.n24=b;f.n34=e;return f};
- THREE.Matrix4.scaleMatrix=function(a,b,e){var f=new THREE.Matrix4;f.n11=a;f.n22=b;f.n33=e;return f};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
- THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var e=new THREE.Matrix4,f=Math.cos(b),g=Math.sin(b),i=1-f,p=a.x,c=a.y,k=a.z;e.n11=i*p*p+f;e.n12=i*p*c-g*k;e.n13=i*p*k+g*c;e.n21=i*p*c+g*k;e.n22=i*c*c+f;e.n23=i*c*k-g*p;e.n31=i*p*k-g*c;e.n32=i*c*k+g*p;e.n33=i*k*k+f;return e};
- THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
- a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
- a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
- a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var e=b[10]*b[5]-b[6]*b[9],f=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],i=-b[10]*b[4]+b[6]*b[8],p=b[10]*b[0]-b[2]*b[8],c=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],D=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*i+b[2]*k;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*e;a.m[1]=b*f;a.m[2]=b*g;a.m[3]=b*i;a.m[4]=b*p;a.m[5]=b*c;a.m[6]=b*k;a.m[7]=b*m;a.m[8]=b*D;return a};
- THREE.Matrix4.makeFrustum=function(a,b,e,f,g,i){var p,c,k;p=new THREE.Matrix4;c=2*g/(b-a);k=2*g/(f-e);a=(b+a)/(b-a);e=(f+e)/(f-e);f=-(i+g)/(i-g);g=-2*i*g/(i-g);p.n11=c;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=k;p.n23=e;p.n24=0;p.n31=0;p.n32=0;p.n33=f;p.n34=g;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,b,e,f){var g;a=e*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,e,f)};
- THREE.Matrix4.makeOrtho=function(a,b,e,f,g,i){var p,c,k,m;p=new THREE.Matrix4;c=b-a;k=e-f;m=i-g;a=(b+a)/c;e=(e+f)/k;g=(i+g)/m;p.n11=2/c;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/k;p.n23=0;p.n24=-e;p.n31=0;p.n32=0;p.n33=-2/m;p.n34=-g;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};
- THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
- THREE.Face3=function(a,b,e,f,g){this.a=a;this.b=b;this.c=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,b,e,f,g,i){this.a=a;this.b=b;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
- THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
- THREE.Geometry.prototype={computeCentroids:function(){var a,b,e;a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
- e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,e,f,g,i,p,c=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.vertices.length;f<g;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(a&&i.vertexNormals.length){c.set(0,0,0);b=0;for(e=i.normal.length;b<e;b++)c.addSelf(i.vertexNormals[b]);c.divideScalar(3)}else{b=this.vertices[i.a];e=this.vertices[i.b];p=this.vertices[i.c];c.sub(p.position,
- e.position);k.sub(b.position,e.position);c.crossSelf(k)}c.isZero()||c.normalize();i.normal.copy(c)}},computeVertexNormals:function(){var a,b,e,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];if(e instanceof THREE.Face3){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal);f[e.d].addSelf(e.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<
- b;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c]);e.vertexNormals[3].copy(f[e.d])}}},computeTangents:function(){function a(j,w,S,A,J,M,I){i=j.vertices[w].position;p=j.vertices[S].position;c=j.vertices[A].position;k=g[J];m=g[M];D=g[I];F=p.x-i.x;y=c.x-i.x;C=p.y-i.y;R=c.y-i.y;
- W=p.z-i.z;U=c.z-i.z;s=m.u-k.u;Q=D.u-k.u;d=m.v-k.v;h=D.v-k.v;o=1/(s*h-Q*d);t.set((h*F-d*y)*o,(h*C-d*R)*o,(h*W-d*U)*o);r.set((s*y-Q*F)*o,(s*R-Q*C)*o,(s*U-Q*W)*o);n[w].addSelf(t);n[S].addSelf(t);n[A].addSelf(t);l[w].addSelf(r);l[S].addSelf(r);l[A].addSelf(r)}var b,e,f,g,i,p,c,k,m,D,F,y,C,R,W,U,s,Q,d,h,o,n=[],l=[],t=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,z=new THREE.Vector3,u=new THREE.Vector3;b=0;for(e=this.vertices.length;b<e;b++){n[b]=new THREE.Vector3;l[b]=new THREE.Vector3}b=0;
- for(e=this.faces.length;b<e;b++){f=this.faces[b];g=this.uvs[b];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
- this.vertices[f.d].normal.copy(f.vertexNormals[3])}}b=0;for(e=this.vertices.length;b<e;b++){u.copy(this.vertices[b].normal);f=n[b];q.copy(f);q.subSelf(u.multiplyScalar(u.dot(f))).normalize();z.cross(this.vertices[b].normal,f);f=z.dot(l[b]);f=f<0?-1:1;this.vertices[b].tangent.set(q.x,q.y,q.z,f)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
- z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,e=this.vertices.length;b<e;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
- this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,e=this.vertices.length;b<e;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(D){var F=[];b=0;for(e=D.length;b<e;b++)D[b]==undefined?F.push("undefined"):F.push(D[b].toString());return F.join("_")}var b,e,f,g,i,p,c,k,m={};f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];
- p=i.materials;c=a(p);if(m[c]==undefined)m[c]={hash:c,counter:0};k=m[c].hash+"_"+m[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){m[c].counter+=1;k=m[c].hash+"_"+m[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0}}this.geometryChunks[k].faces.push(f);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,b,e,f){this.fov=a;this.aspect=b;this.near=e;this.far=f;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.translateX=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);g.cross(g.clone(),this.up);this.position.addSelf(g);this.target.position.addSelf(g)};this.translateZ=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);
- this.position.subSelf(g);this.target.position.subSelf(g)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.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,e){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=e!==undefined?e:THREE.LineContinuous};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,e,f,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=i!==undefined?i: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;var Uniforms={clone:function(a){var b,e,f,g={};for(b in a){g[b]={};for(e in a[b]){f=a[b][e];g[b][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return g},merge:function(a){var b,e,f,g={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(e in f)g[e]=f[e]}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,e){this.color=new THREE.Color(a);this.near=b||1;this.far=e||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
- THREE.Projector=function(){function a(l,t){return t.z-l.z}function b(l,t){var r=0,q=1,z=l.z+l.w,u=t.z+t.w,j=-l.z+l.w,w=-t.z+t.w;if(z>=0&&u>=0&&j>=0&&w>=0)return true;else if(z<0&&u<0||j<0&&w<0)return false;else{if(z<0)r=Math.max(r,z/(z-u));else if(u<0)q=Math.min(q,z/(z-u));if(j<0)r=Math.max(r,j/(j-w));else if(w<0)q=Math.min(q,j/(j-w));if(q<r)return false;else{l.lerpSelf(t,r);t.lerpSelf(l,1-q);return true}}}var e,f,g=[],i,p,c,k=[],m,D,F=[],y,C,R=[],W=new THREE.Vector4,U=new THREE.Vector4,s=new THREE.Matrix4,
- Q=new THREE.Matrix4,d=[],h=new THREE.Vector4,o=new THREE.Vector4,n;this.projectObjects=function(l,t,r){var q=[],z,u;f=0;s.multiply(t.projectionMatrix,t.matrix);d[0]=new THREE.Vector4(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);d[1]=new THREE.Vector4(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);d[2]=new THREE.Vector4(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);d[3]=new THREE.Vector4(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);d[4]=new THREE.Vector4(s.n41-s.n31,s.n42-s.n32,s.n43-
- s.n33,s.n44-s.n34);d[5]=new THREE.Vector4(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+s.n34);t=0;for(z=d.length;t<z;t++){u=d[t];u.divideScalar(Math.sqrt(u.x*u.x+u.y*u.y+u.z*u.z))}z=l.objects;l=0;for(t=z.length;l<t;l++){u=z[l];var j;if(!(j=!u.visible)){if(j=u instanceof THREE.Mesh){a:{j=void 0;for(var w=u.position,S=-u.geometry.boundingSphere.radius*Math.max(u.scale.x,Math.max(u.scale.y,u.scale.z)),A=0;A<6;A++){j=d[A].x*w.x+d[A].y*w.y+d[A].z*w.z+d[A].w;if(j<=S){j=false;break a}}j=true}j=!j}j=j}if(!j){e=
- g[f]=g[f]||new THREE.RenderableObject;W.copy(u.position);s.multiplyVector3(W);e.object=u;e.z=W.z;q.push(e);f++}}r&&q.sort(a);return q};this.projectScene=function(l,t,r){var q=[],z=t.near,u=t.far,j,w,S,A,J,M,I,V,P,E,H,T,N,v,G,K;c=D=C=0;t.autoUpdateMatrix&&t.updateMatrix();s.multiply(t.projectionMatrix,t.matrix);M=this.projectObjects(l,t,true);l=0;for(j=M.length;l<j;l++){I=M[l].object;if(I.visible){I.autoUpdateMatrix&&I.updateMatrix();V=I.matrix;P=I.rotationMatrix;E=I.materials;H=I.overdraw;if(I instanceof
- THREE.Mesh){T=I.geometry;N=T.vertices;w=0;for(S=N.length;w<S;w++){v=N[w];v.positionWorld.copy(v.position);V.multiplyVector3(v.positionWorld);A=v.positionScreen;A.copy(v.positionWorld);s.multiplyVector4(A);A.x/=A.w;A.y/=A.w;v.__visible=A.z>z&&A.z<u}T=T.faces;w=0;for(S=T.length;w<S;w++){v=T[w];if(v instanceof THREE.Face3){A=N[v.a];J=N[v.b];G=N[v.c];if(A.__visible&&J.__visible&&G.__visible)if(I.doubleSided||I.flipSided!=(G.positionScreen.x-A.positionScreen.x)*(J.positionScreen.y-A.positionScreen.y)-
- (G.positionScreen.y-A.positionScreen.y)*(J.positionScreen.x-A.positionScreen.x)<0){i=k[c]=k[c]||new THREE.RenderableFace3;i.v1.positionWorld.copy(A.positionWorld);i.v2.positionWorld.copy(J.positionWorld);i.v3.positionWorld.copy(G.positionWorld);i.v1.positionScreen.copy(A.positionScreen);i.v2.positionScreen.copy(J.positionScreen);i.v3.positionScreen.copy(G.positionScreen);i.normalWorld.copy(v.normal);P.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);V.multiplyVector3(i.centroidWorld);
- i.centroidScreen.copy(i.centroidWorld);s.multiplyVector3(i.centroidScreen);G=v.vertexNormals;n=i.vertexNormalsWorld;A=0;for(J=G.length;A<J;A++){K=n[A]=n[A]||new THREE.Vector3;K.copy(G[A]);P.multiplyVector3(K)}i.z=i.centroidScreen.z;i.meshMaterials=E;i.faceMaterials=v.materials;i.overdraw=H;if(I.geometry.uvs[w]){i.uvs[0]=I.geometry.uvs[w][0];i.uvs[1]=I.geometry.uvs[w][1];i.uvs[2]=I.geometry.uvs[w][2]}q.push(i);c++}}else if(v instanceof THREE.Face4){A=N[v.a];J=N[v.b];G=N[v.c];K=N[v.d];if(A.__visible&&
- J.__visible&&G.__visible&&K.__visible)if(I.doubleSided||I.flipSided!=((K.positionScreen.x-A.positionScreen.x)*(J.positionScreen.y-A.positionScreen.y)-(K.positionScreen.y-A.positionScreen.y)*(J.positionScreen.x-A.positionScreen.x)<0||(J.positionScreen.x-G.positionScreen.x)*(K.positionScreen.y-G.positionScreen.y)-(J.positionScreen.y-G.positionScreen.y)*(K.positionScreen.x-G.positionScreen.x)<0)){i=k[c]=k[c]||new THREE.RenderableFace3;i.v1.positionWorld.copy(A.positionWorld);i.v2.positionWorld.copy(J.positionWorld);
- i.v3.positionWorld.copy(K.positionWorld);i.v1.positionScreen.copy(A.positionScreen);i.v2.positionScreen.copy(J.positionScreen);i.v3.positionScreen.copy(K.positionScreen);i.normalWorld.copy(v.normal);P.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);V.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);s.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=E;i.faceMaterials=v.materials;i.overdraw=H;if(I.geometry.uvs[w]){i.uvs[0]=I.geometry.uvs[w][0];
- i.uvs[1]=I.geometry.uvs[w][1];i.uvs[2]=I.geometry.uvs[w][3]}q.push(i);c++;p=k[c]=k[c]||new THREE.RenderableFace3;p.v1.positionWorld.copy(J.positionWorld);p.v2.positionWorld.copy(G.positionWorld);p.v3.positionWorld.copy(K.positionWorld);p.v1.positionScreen.copy(J.positionScreen);p.v2.positionScreen.copy(G.positionScreen);p.v3.positionScreen.copy(K.positionScreen);p.normalWorld.copy(i.normalWorld);p.centroidWorld.copy(i.centroidWorld);p.centroidScreen.copy(i.centroidScreen);p.z=p.centroidScreen.z;p.meshMaterials=
- E;p.faceMaterials=v.materials;p.overdraw=H;if(I.geometry.uvs[w]){p.uvs[0]=I.geometry.uvs[w][1];p.uvs[1]=I.geometry.uvs[w][2];p.uvs[2]=I.geometry.uvs[w][3]}q.push(p);c++}}}}else if(I instanceof THREE.Line){Q.multiply(s,V);N=I.geometry.vertices;v=N[0];v.positionScreen.copy(v.position);Q.multiplyVector4(v.positionScreen);w=1;for(S=N.length;w<S;w++){A=N[w];A.positionScreen.copy(A.position);Q.multiplyVector4(A.positionScreen);J=N[w-1];h.copy(A.positionScreen);o.copy(J.positionScreen);if(b(h,o)){h.multiplyScalar(1/
- h.w);o.multiplyScalar(1/o.w);m=F[D]=F[D]||new THREE.RenderableLine;m.v1.positionScreen.copy(h);m.v2.positionScreen.copy(o);m.z=Math.max(h.z,o.z);m.materials=I.materials;q.push(m);D++}}}else if(I instanceof THREE.Particle){U.set(I.position.x,I.position.y,I.position.z,1);s.multiplyVector4(U);U.z/=U.w;if(U.z>0&&U.z<1){y=R[C]=R[C]||new THREE.RenderableParticle;y.x=U.x/U.w;y.y=U.y/U.w;y.z=U.z;y.rotation=I.rotation.z;y.scale.x=I.scale.x*Math.abs(y.x-(U.x+t.projectionMatrix.n11)/(U.w+t.projectionMatrix.n14));
- y.scale.y=I.scale.y*Math.abs(y.y-(U.y+t.projectionMatrix.n22)/(U.w+t.projectionMatrix.n24));y.materials=I.materials;q.push(y);C++}}}}r&&q.sort(a);return q};this.unprojectVector=function(l,t){var r=new THREE.Matrix4;r.multiply(THREE.Matrix4.makeInvert(t.matrix),THREE.Matrix4.makeInvert(t.projectionMatrix));r.multiplyVector3(l);return l}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,e,f,g,i;this.domElement=document.createElement("div");this.setSize=function(p,c){e=p;f=c;g=e/2;i=f/2};this.render=function(p,c){var k,m,D,F,y,C,R,W;a=b.projectScene(p,c);k=0;for(m=a.length;k<m;k++){y=a[k];if(y instanceof THREE.RenderableParticle){R=y.x*g+g;W=y.y*i+i;D=0;for(F=y.material.length;D<F;D++){C=y.material[D];if(C instanceof THREE.ParticleDOMMaterial){C=C.domElement;C.style.left=R+"px";C.style.top=W+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(da){if(y!=da)m.globalAlpha=y=da}function b(da){if(C!=da){switch(da){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}C=da}}var e=null,f=new THREE.Projector,g=document.createElement("canvas"),i,p,c,k,m=g.getContext("2d"),D=null,F=null,y=1,C=0,R=null,W=null,U=1,s,Q,d,h,o,n,l,t,r,q=new THREE.Color,
- z=new THREE.Color,u=new THREE.Color,j=new THREE.Color,w=new THREE.Color,S,A,J,M,I,V,P,E,H,T=new THREE.Rectangle,N=new THREE.Rectangle,v=new THREE.Rectangle,G=false,K=new THREE.Color,ea=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ia=Math.PI*2,Y=new THREE.Vector3,pa,ja,Da,ha,ua,ya,sa=16;pa=document.createElement("canvas");pa.width=pa.height=2;ja=pa.getContext("2d");ja.fillStyle="rgba(0,0,0,1)";ja.fillRect(0,0,2,2);Da=ja.getImageData(0,0,2,2);ha=Da.data;ua=document.createElement("canvas");ua.width=
- ua.height=sa;ya=ua.getContext("2d");ya.translate(-sa/2,-sa/2);ya.scale(sa,sa);sa--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,qa){i=da;p=qa;c=i/2;k=p/2;g.width=i;g.height=p;T.set(-c,-k,c,k)};this.setClearColor=function(da,qa){D=da!==null?new THREE.Color(da):null;F=qa;N.set(-c,-k,c,k);m.setTransform(1,0,0,-1,c,k);this.clear()};this.clear=function(){if(!N.isEmpty()){N.inflate(1);N.minSelf(T);if(D!==null){b(THREE.NormalBlending);a(1);m.fillStyle=
- "rgba("+Math.floor(D.r*255)+","+Math.floor(D.g*255)+","+Math.floor(D.b*255)+","+F+")";m.fillRect(N.getX(),N.getY(),N.getWidth(),N.getHeight())}else m.clearRect(N.getX(),N.getY(),N.getWidth(),N.getHeight());N.empty()}};this.render=function(da,qa){function Ma(x){var X,O,B,L=x.lights;ea.setRGB(0,0,0);ba.setRGB(0,0,0);Z.setRGB(0,0,0);x=0;for(X=L.length;x<X;x++){O=L[x];B=O.color;if(O instanceof THREE.AmbientLight){ea.r+=B.r;ea.g+=B.g;ea.b+=B.b}else if(O instanceof THREE.DirectionalLight){ba.r+=B.r;ba.g+=
- B.g;ba.b+=B.b}else if(O instanceof THREE.PointLight){Z.r+=B.r;Z.g+=B.g;Z.b+=B.b}}}function za(x,X,O,B){var L,$,ca,fa,ga=x.lights;x=0;for(L=ga.length;x<L;x++){$=ga[x];ca=$.color;fa=$.intensity;if($ instanceof THREE.DirectionalLight){$=O.dot($.position)*fa;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=O.dot(Y)*fa;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}}}function Na(x,X,O){if(O.opacity!=0){a(O.opacity);b(O.blending);var B,
- L,$,ca,fa,ga;if(O instanceof THREE.ParticleBasicMaterial){if(O.map){ca=O.map;fa=ca.width>>1;ga=ca.height>>1;L=X.scale.x*c;$=X.scale.y*k;O=L*fa;B=$*ga;v.set(x.x-O,x.y-B,x.x+O,x.y+B);if(T.instersects(v)){m.save();m.translate(x.x,x.y);m.rotate(-X.rotation);m.scale(L,-$);m.translate(-fa,-ga);m.drawImage(ca,0,0);m.restore()}}}else if(O instanceof THREE.ParticleCircleMaterial){if(G){K.r=ea.r+ba.r+Z.r;K.g=ea.g+ba.g+Z.g;K.b=ea.b+ba.b+Z.b;q.r=O.color.r*K.r;q.g=O.color.g*K.g;q.b=O.color.b*K.b;q.updateStyleString()}else q.__styleString=
- O.color.__styleString;O=X.scale.x*c;B=X.scale.y*k;v.set(x.x-O,x.y-B,x.x+O,x.y+B);if(T.instersects(v)){L=q.__styleString;if(W!=L)m.fillStyle=W=L;m.save();m.translate(x.x,x.y);m.rotate(-X.rotation);m.scale(O,B);m.beginPath();m.arc(0,0,1,0,ia,true);m.closePath();m.fill();m.restore()}}}}function Oa(x,X,O,B){if(B.opacity!=0){a(B.opacity);b(B.blending);m.beginPath();m.moveTo(x.positionScreen.x,x.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(B instanceof THREE.LineBasicMaterial){q.__styleString=
- B.color.__styleString;x=B.linewidth;if(U!=x)m.lineWidth=U=x;x=q.__styleString;if(R!=x)m.strokeStyle=R=x;m.stroke();v.inflate(B.linewidth*2)}}}function Ia(x,X,O,B,L,$){if(L.opacity!=0){a(L.opacity);b(L.blending);h=x.positionScreen.x;o=x.positionScreen.y;n=X.positionScreen.x;l=X.positionScreen.y;t=O.positionScreen.x;r=O.positionScreen.y;m.beginPath();m.moveTo(h,o);m.lineTo(n,l);m.lineTo(t,r);m.lineTo(h,o);m.closePath();if(L instanceof THREE.MeshBasicMaterial)if(L.map)L.map.image.loaded&&L.map.mapping instanceof
- THREE.UVMapping&&va(h,o,n,l,t,r,L.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(L.env_map){if(L.env_map.image.loaded)if(L.env_map.mapping instanceof THREE.SphericalReflectionMapping){x=qa.matrix;Y.copy(B.vertexNormalsWorld[0]);M=(Y.x*x.n11+Y.y*x.n12+Y.z*x.n13)*0.5+0.5;I=-(Y.x*x.n21+Y.y*x.n22+Y.z*x.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[1]);V=(Y.x*x.n11+Y.y*x.n12+Y.z*x.n13)*0.5+0.5;P=-(Y.x*x.n21+Y.y*x.n22+Y.z*x.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[2]);E=
- (Y.x*x.n11+Y.y*x.n12+Y.z*x.n13)*0.5+0.5;H=-(Y.x*x.n21+Y.y*x.n22+Y.z*x.n23)*0.5+0.5;va(h,o,n,l,t,r,L.env_map.image,M,I,V,P,E,H)}}else L.wireframe?Aa(L.color.__styleString,L.wireframe_linewidth):Ba(L.color.__styleString);else if(L instanceof THREE.MeshLambertMaterial){if(L.map&&!L.wireframe){L.map.mapping instanceof THREE.UVMapping&&va(h,o,n,l,t,r,L.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(G)if(!L.wireframe&&L.shading==THREE.SmoothShading&&
- B.vertexNormalsWorld.length==3){z.r=u.r=j.r=ea.r;z.g=u.g=j.g=ea.g;z.b=u.b=j.b=ea.b;za($,B.v1.positionWorld,B.vertexNormalsWorld[0],z);za($,B.v2.positionWorld,B.vertexNormalsWorld[1],u);za($,B.v3.positionWorld,B.vertexNormalsWorld[2],j);w.r=(u.r+j.r)*0.5;w.g=(u.g+j.g)*0.5;w.b=(u.b+j.b)*0.5;J=Ja(z,u,j,w);va(h,o,n,l,t,r,J,0,0,1,0,0,1)}else{K.r=ea.r;K.g=ea.g;K.b=ea.b;za($,B.centroidWorld,B.normalWorld,K);q.r=L.color.r*K.r;q.g=L.color.g*K.g;q.b=L.color.b*K.b;q.updateStyleString();L.wireframe?Aa(q.__styleString,
- L.wireframe_linewidth):Ba(q.__styleString)}else L.wireframe?Aa(L.color.__styleString,L.wireframe_linewidth):Ba(L.color.__styleString)}else if(L instanceof THREE.MeshDepthMaterial){S=qa.near;A=qa.far;z.r=z.g=z.b=1-Ea(x.positionScreen.z,S,A);u.r=u.g=u.b=1-Ea(X.positionScreen.z,S,A);j.r=j.g=j.b=1-Ea(O.positionScreen.z,S,A);w.r=(u.r+j.r)*0.5;w.g=(u.g+j.g)*0.5;w.b=(u.b+j.b)*0.5;J=Ja(z,u,j,w);va(h,o,n,l,t,r,J,0,0,1,0,0,1)}else if(L instanceof THREE.MeshNormalMaterial){q.r=Fa(B.normalWorld.x);q.g=Fa(B.normalWorld.y);
- q.b=Fa(B.normalWorld.z);q.updateStyleString();L.wireframe?Aa(q.__styleString,L.wireframe_linewidth):Ba(q.__styleString)}}}function Aa(x,X){if(R!=x)m.strokeStyle=R=x;if(U!=X)m.lineWidth=U=X;m.stroke();v.inflate(X*2)}function Ba(x){if(W!=x)m.fillStyle=W=x;m.fill()}function va(x,X,O,B,L,$,ca,fa,ga,ma,ka,na,wa){var ra,oa;ra=ca.width-1;oa=ca.height-1;fa*=ra;ga*=oa;ma*=ra;ka*=oa;na*=ra;wa*=oa;O-=x;B-=X;L-=x;$-=X;ma-=fa;ka-=ga;na-=fa;wa-=ga;oa=1/(ma*wa-na*ka);ra=(wa*O-ka*L)*oa;ka=(wa*B-ka*$)*oa;O=(ma*L-
- na*O)*oa;B=(ma*$-na*B)*oa;x=x-ra*fa-O*ga;X=X-ka*fa-B*ga;m.save();m.transform(ra,ka,O,B,x,X);m.clip();m.drawImage(ca,0,0);m.restore()}function Ja(x,X,O,B){var L=~~(x.r*255),$=~~(x.g*255);x=~~(x.b*255);var ca=~~(X.r*255),fa=~~(X.g*255);X=~~(X.b*255);var ga=~~(O.r*255),ma=~~(O.g*255);O=~~(O.b*255);var ka=~~(B.r*255),na=~~(B.g*255);B=~~(B.b*255);ha[0]=L<0?0:L>255?255:L;ha[1]=$<0?0:$>255?255:$;ha[2]=x<0?0:x>255?255:x;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=fa<0?0:fa>255?255:fa;ha[6]=X<0?0:X>255?255:X;ha[8]=ga<
- 0?0:ga>255?255:ga;ha[9]=ma<0?0:ma>255?255:ma;ha[10]=O<0?0:O>255?255:O;ha[12]=ka<0?0:ka>255?255:ka;ha[13]=na<0?0:na>255?255:na;ha[14]=B<0?0:B>255?255:B;ja.putImageData(Da,0,0);ya.drawImage(pa,0,0);return ua}function Ea(x,X,O){x=(x-X)/(O-X);return x*x*(3-2*x)}function Fa(x){x=(x+1)*0.5;return x<0?0:x>1?1:x}function Ga(x,X){var O=X.x-x.x,B=X.y-x.y,L=1/Math.sqrt(O*O+B*B);O*=L;B*=L;X.x+=O;X.y+=B;x.x-=O;x.y-=B}var Ca,Ka,aa,la,ta,Ha,La,xa;m.setTransform(1,0,0,-1,c,k);this.autoClear&&this.clear();e=f.projectScene(da,
- qa,this.sortElements);(G=da.lights.length>0)&&Ma(da);Ca=0;for(Ka=e.length;Ca<Ka;Ca++){aa=e[Ca];v.empty();if(aa instanceof THREE.RenderableParticle){s=aa;s.x*=c;s.y*=k;la=0;for(ta=aa.materials.length;la<ta;la++)Na(s,aa,aa.materials[la],da)}else if(aa instanceof THREE.RenderableLine){s=aa.v1;Q=aa.v2;s.positionScreen.x*=c;s.positionScreen.y*=k;Q.positionScreen.x*=c;Q.positionScreen.y*=k;v.addPoint(s.positionScreen.x,s.positionScreen.y);v.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(T.instersects(v)){la=
- 0;for(ta=aa.materials.length;la<ta;)Oa(s,Q,aa,aa.materials[la++],da)}}else if(aa instanceof THREE.RenderableFace3){s=aa.v1;Q=aa.v2;d=aa.v3;s.positionScreen.x*=c;s.positionScreen.y*=k;Q.positionScreen.x*=c;Q.positionScreen.y*=k;d.positionScreen.x*=c;d.positionScreen.y*=k;if(aa.overdraw){Ga(s.positionScreen,Q.positionScreen);Ga(Q.positionScreen,d.positionScreen);Ga(d.positionScreen,s.positionScreen)}v.add3Points(s.positionScreen.x,s.positionScreen.y,Q.positionScreen.x,Q.positionScreen.y,d.positionScreen.x,
- d.positionScreen.y);if(T.instersects(v)){la=0;for(ta=aa.meshMaterials.length;la<ta;){xa=aa.meshMaterials[la++];if(xa instanceof THREE.MeshFaceMaterial){Ha=0;for(La=aa.faceMaterials.length;Ha<La;)(xa=aa.faceMaterials[Ha++])&&Ia(s,Q,d,aa,xa,da)}else Ia(s,Q,d,aa,xa,da)}}}N.addRectangle(v)}m.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(M,I,V){var P,E,H,T;P=0;for(E=M.lights.length;P<E;P++){H=M.lights[P];if(H instanceof THREE.DirectionalLight){T=I.normalWorld.dot(H.position)*H.intensity;if(T>0){V.r+=H.color.r*T;V.g+=H.color.g*T;V.b+=H.color.b*T}}else if(H instanceof THREE.PointLight){r.sub(H.position,I.centroidWorld);r.normalize();T=I.normalWorld.dot(r)*H.intensity;if(T>0){V.r+=H.color.r*T;V.g+=H.color.g*T;V.b+=H.color.b*T}}}}function b(M,I,V,P,E,H){j=f(w++);j.setAttribute("d","M "+M.positionScreen.x+
- " "+M.positionScreen.y+" L "+I.positionScreen.x+" "+I.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)d.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(Q){h.r=o.r;h.g=o.g;h.b=o.b;a(H,P,h);d.r=E.color.r*h.r;d.g=E.color.g*h.g;d.b=E.color.b*h.b;d.updateStyleString()}else d.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){t=1-E.__2near/(E.__farPlusNear-P.z*E.__farMinusNear);
- d.setRGB(t,t,t)}else E instanceof THREE.MeshNormalMaterial&&d.setRGB(g(P.normalWorld.x),g(P.normalWorld.y),g(P.normalWorld.z));E.wireframe?j.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):j.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+E.opacity);c.appendChild(j)}function e(M,I,V,P,E,H,T){j=f(w++);j.setAttribute("d",
- "M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+I.positionScreen.x+" "+I.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)d.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshLambertMaterial)if(Q){h.r=o.r;h.g=o.g;h.b=o.b;a(T,E,h);d.r=H.color.r*h.r;d.g=H.color.g*h.g;d.b=H.color.b*h.b;d.updateStyleString()}else d.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshDepthMaterial){t=
- 1-H.__2near/(H.__farPlusNear-E.z*H.__farMinusNear);d.setRGB(t,t,t)}else H instanceof THREE.MeshNormalMaterial&&d.setRGB(g(E.normalWorld.x),g(E.normalWorld.y),g(E.normalWorld.z));H.wireframe?j.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+H.wireframe_linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframe_linecap+"; stroke-linejoin: "+H.wireframe_linejoin):j.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+H.opacity);c.appendChild(j)}
- function f(M){if(q[M]==null){q[M]=document.createElementNS("http://www.w3.org/2000/svg","path");J==0&&q[M].setAttribute("shape-rendering","crispEdges");return q[M]}return q[M]}function g(M){return M<0?Math.min((1+M)*0.5,0.5):0.5+Math.min(M*0.5,0.5)}var i=null,p=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,D,F,y,C,R,W,U=new THREE.Rectangle,s=new THREE.Rectangle,Q=false,d=new THREE.Color(16777215),h=new THREE.Color(16777215),o=new THREE.Color(0),n=new THREE.Color(0),
- l=new THREE.Color(0),t,r=new THREE.Vector3,q=[],z=[],u=[],j,w,S,A,J=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(M){switch(M){case "high":J=1;break;case "low":J=0}};this.setSize=function(M,I){k=M;m=I;D=k/2;F=m/2;c.setAttribute("viewBox",-D+" "+-F+" "+k+" "+m);c.setAttribute("width",k);c.setAttribute("height",m);U.set(-D,-F,D,F)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])};this.render=function(M,I){var V,P,
- E,H,T,N,v,G;this.autoClear&&this.clear();i=p.projectScene(M,I,this.sortElements);A=S=w=0;if(Q=M.lights.length>0){v=M.lights;o.setRGB(0,0,0);n.setRGB(0,0,0);l.setRGB(0,0,0);V=0;for(P=v.length;V<P;V++){E=v[V];H=E.color;if(E instanceof THREE.AmbientLight){o.r+=H.r;o.g+=H.g;o.b+=H.b}else if(E instanceof THREE.DirectionalLight){n.r+=H.r;n.g+=H.g;n.b+=H.b}else if(E instanceof THREE.PointLight){l.r+=H.r;l.g+=H.g;l.b+=H.b}}}V=0;for(P=i.length;V<P;V++){v=i[V];s.empty();if(v instanceof THREE.RenderableParticle){y=
- v;y.x*=D;y.y*=-F;E=0;for(H=v.materials.length;E<H;E++)if(G=v.materials[E]){T=y;N=v;G=G;var K=S++;if(z[K]==null){z[K]=document.createElementNS("http://www.w3.org/2000/svg","circle");J==0&&z[K].setAttribute("shape-rendering","crispEdges")}j=z[K];j.setAttribute("cx",T.x);j.setAttribute("cy",T.y);j.setAttribute("r",N.scale.x*D);if(G instanceof THREE.ParticleCircleMaterial){if(Q){h.r=o.r+n.r+l.r;h.g=o.g+n.g+l.g;h.b=o.b+n.b+l.b;d.r=G.color.r*h.r;d.g=G.color.g*h.g;d.b=G.color.b*h.b;d.updateStyleString()}else d=
- G.color;j.setAttribute("style","fill: "+d.__styleString)}c.appendChild(j)}}else if(v instanceof THREE.RenderableLine){y=v.v1;C=v.v2;y.positionScreen.x*=D;y.positionScreen.y*=-F;C.positionScreen.x*=D;C.positionScreen.y*=-F;s.addPoint(y.positionScreen.x,y.positionScreen.y);s.addPoint(C.positionScreen.x,C.positionScreen.y);if(U.instersects(s)){E=0;for(H=v.materials.length;E<H;)if(G=v.materials[E++]){T=y;N=C;G=G;K=A++;if(u[K]==null){u[K]=document.createElementNS("http://www.w3.org/2000/svg","line");J==
- 0&&u[K].setAttribute("shape-rendering","crispEdges")}j=u[K];j.setAttribute("x1",T.positionScreen.x);j.setAttribute("y1",T.positionScreen.y);j.setAttribute("x2",N.positionScreen.x);j.setAttribute("y2",N.positionScreen.y);if(G instanceof THREE.LineBasicMaterial){d.__styleString=G.color.__styleString;j.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+G.linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.linecap+"; stroke-linejoin: "+G.linejoin);c.appendChild(j)}}}}else if(v instanceof
- THREE.RenderableFace3){y=v.v1;C=v.v2;R=v.v3;y.positionScreen.x*=D;y.positionScreen.y*=-F;C.positionScreen.x*=D;C.positionScreen.y*=-F;R.positionScreen.x*=D;R.positionScreen.y*=-F;s.addPoint(y.positionScreen.x,y.positionScreen.y);s.addPoint(C.positionScreen.x,C.positionScreen.y);s.addPoint(R.positionScreen.x,R.positionScreen.y);if(U.instersects(s)){E=0;for(H=v.meshMaterials.length;E<H;){G=v.meshMaterials[E++];if(G instanceof THREE.MeshFaceMaterial){T=0;for(N=v.faceMaterials.length;T<N;)(G=v.faceMaterials[T++])&&
- b(y,C,R,v,G,M)}else G&&b(y,C,R,v,G,M)}}}else if(v instanceof THREE.RenderableFace4){y=v.v1;C=v.v2;R=v.v3;W=v.v4;y.positionScreen.x*=D;y.positionScreen.y*=-F;C.positionScreen.x*=D;C.positionScreen.y*=-F;R.positionScreen.x*=D;R.positionScreen.y*=-F;W.positionScreen.x*=D;W.positionScreen.y*=-F;s.addPoint(y.positionScreen.x,y.positionScreen.y);s.addPoint(C.positionScreen.x,C.positionScreen.y);s.addPoint(R.positionScreen.x,R.positionScreen.y);s.addPoint(W.positionScreen.x,W.positionScreen.y);if(U.instersects(s)){E=
- 0;for(H=v.meshMaterials.length;E<H;){G=v.meshMaterials[E++];if(G instanceof THREE.MeshFaceMaterial){T=0;for(N=v.faceMaterials.length;T<N;)(G=v.faceMaterials[T++])&&e(y,C,R,W,v,G,M)}else G&&e(y,C,R,W,v,G,M)}}}}}};
- THREE.WebGLRenderer=function(a){function b(d,h){d.fragment_shader=h.fragment_shader;d.vertex_shader=h.vertex_shader;d.uniforms=Uniforms.clone(h.uniforms)}function e(d,h){d.uniforms.color.value.setRGB(d.color.r*d.opacity,d.color.g*d.opacity,d.color.b*d.opacity);d.uniforms.opacity.value=d.opacity;d.uniforms.map.texture=d.map;d.uniforms.env_map.texture=d.env_map;d.uniforms.reflectivity.value=d.reflectivity;d.uniforms.refraction_ratio.value=d.refraction_ratio;d.uniforms.combine.value=d.combine;d.uniforms.useRefract.value=
- d.env_map&&d.env_map.mapping instanceof THREE.CubeRefractionMapping;if(h){d.uniforms.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){d.uniforms.fogNear.value=h.near;d.uniforms.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)d.uniforms.fogDensity.value=h.density}}function f(d,h){d.uniforms.color.value.setRGB(d.color.r*d.opacity,d.color.g*d.opacity,d.color.b*d.opacity);d.uniforms.opacity.value=d.opacity;if(h){d.uniforms.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){d.uniforms.fogNear.value=
- h.near;d.uniforms.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)d.uniforms.fogDensity.value=h.density}}function g(d,h){var o;if(d=="fragment")o=c.createShader(c.FRAGMENT_SHADER);else if(d=="vertex")o=c.createShader(c.VERTEX_SHADER);c.shaderSource(o,h);c.compileShader(o);if(!c.getShaderParameter(o,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(o));return null}return o}function i(d){switch(d){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
- case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var p=document.createElement("canvas"),c,k=null,m=new THREE.Matrix4,D,F=new Float32Array(16),y=new Float32Array(16),C=new Float32Array(16),
- R=new Float32Array(9),W=new Float32Array(16),U=true,s=new THREE.Color(0),Q=0;if(a){if(a.antialias!==undefined)U=a.antialias;a.clearColor!==undefined&&s.setHex(a.clearColor);if(a.clearAlpha!==undefined)Q=a.clearAlpha}this.domElement=p;this.autoClear=true;(function(d,h,o){try{c=p.getContext("experimental-webgl",{antialias:d})}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(h.r,h.g,h.b,o)})(U,s,Q);this.setSize=function(d,h){p.width=d;p.height=h;c.viewport(0,0,p.width,p.height)};this.setClearColor=function(d,h){var o=new THREE.Color(d);c.clearColor(o.r,o.g,o.b,h)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(d,h){var o,n,l,t=0,r=0,q=0,z,u,j,w=[],S=[],A=[],J=[];o=0;for(n=h.length;o<n;o++){l=h[o];z=l.color;u=
- l.position;j=l.intensity;if(l instanceof THREE.AmbientLight){t+=z.r;r+=z.g;q+=z.b}else if(l instanceof THREE.DirectionalLight){w.push(z.r*j,z.g*j,z.b*j);S.push(u.x,u.y,u.z)}else if(l instanceof THREE.PointLight){A.push(z.r*j,z.g*j,z.b*j);J.push(u.x,u.y,u.z)}}return{ambient:[t,r,q],directional:{colors:w,positions:S},point:{colors:A,positions:J}}};this.createParticleBuffers=function(){};this.createLineBuffers=function(d){var h,o,n,l=[],t=[],r=d.geometry.vertices;h=0;for(o=r.length;h<o;h++){n=r[h].position;
- l.push(n.x,n.y,n.z);t.push(h)}if(l.length){d.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(l),c.STATIC_DRAW);d.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(t),c.STATIC_DRAW);d.__webGLLineCount=t.length}};this.createBuffers=function(d){d.__webGLVertexBuffer=c.createBuffer();d.__webGLNormalBuffer=c.createBuffer();d.__webGLTangentBuffer=
- c.createBuffer();d.__webGLUVBuffer=c.createBuffer();d.__webGLFaceBuffer=c.createBuffer();d.__webGLLineBuffer=c.createBuffer()};this.initBuffers=function(d,h){var o,n,l=0,t=0,r=0,q=h.geometry.faces,z=d.faces;o=0;for(n=z.length;o<n;o++){fi=z[o];face=q[fi];if(face instanceof THREE.Face3){l+=3;t+=1;r+=3}else if(face instanceof THREE.Face4){l+=4;t+=2;r+=5}}d.__vertexArray=new Float32Array(l*3);d.__normalArray=new Float32Array(l*3);d.__tangentArray=new Float32Array(l*4);d.__uvArray=new Float32Array(l*2);
- d.__faceArray=new Uint16Array(t*3);d.__lineArray=new Uint16Array(r*2);l=false;o=0;for(n=h.materials.length;o<n;o++){q=h.materials[o];if(q instanceof THREE.MeshFaceMaterial){q=0;for(z=d.materials.length;q<z;q++)if(d.materials[q]&&d.materials[q].shading!=undefined&&d.materials[q].shading==THREE.SmoothShading){l=true;break}}else if(q&&q.shading!=undefined&&q.shading==THREE.SmoothShading){l=true;break}if(l)break}d.__needsSmoothNormals=l;d.__webGLFaceCount=t*3;d.__webGLLineCount=r*2};this.setBuffers=function(d,
- h,o,n,l,t,r,q){var z,u,j,w,S,A,J,M,I,V,P=0,E=0,H=0,T=0,N=0,v=0,G=0,K=d.__vertexArray,ea=d.__uvArray,ba=d.__normalArray,Z=d.__tangentArray,ia=d.__faceArray,Y=d.__lineArray,pa=d.__needsSmoothNormals,ja=h.geometry;h=0;for(z=d.faces.length;h<z;h++){u=d.faces[h];j=ja.faces[u];w=j.vertexNormals;S=j.normal;u=ja.uvs[u];V=ja.vertices;if(j instanceof THREE.Face3){if(n){A=V[j.a].position;J=V[j.b].position;M=V[j.c].position;K[E]=A.x;K[E+1]=A.y;K[E+2]=A.z;K[E+3]=J.x;K[E+4]=J.y;K[E+5]=J.z;K[E+6]=M.x;K[E+7]=M.y;
- K[E+8]=M.z;E+=9}if(q&&ja.hasTangents){A=V[j.a].tangent;J=V[j.b].tangent;M=V[j.c].tangent;Z[v]=A.x;Z[v+1]=A.y;Z[v+2]=A.z;Z[v+3]=A.w;Z[v+4]=J.x;Z[v+5]=J.y;Z[v+6]=J.z;Z[v+7]=J.w;Z[v+8]=M.x;Z[v+9]=M.y;Z[v+10]=M.z;Z[v+11]=M.w;v+=12}if(r)if(w.length==3&&pa)for(j=0;j<3;j++){S=w[j];ba[N]=S.x;ba[N+1]=S.y;ba[N+2]=S.z;N+=3}else for(j=0;j<3;j++){ba[N]=S.x;ba[N+1]=S.y;ba[N+2]=S.z;N+=3}if(t&&u)for(j=0;j<3;j++){w=u[j];ea[H]=w.u;ea[H+1]=w.v;H+=2}if(l){ia[T]=P;ia[T+1]=P+1;ia[T+2]=P+2;T+=3;Y[G]=P;Y[G+1]=P+1;Y[G+2]=
- P;Y[G+3]=P+2;Y[G+4]=P+1;Y[G+5]=P+2;G+=6;P+=3}}else if(j instanceof THREE.Face4){if(n){A=V[j.a].position;J=V[j.b].position;M=V[j.c].position;I=V[j.d].position;K[E]=A.x;K[E+1]=A.y;K[E+2]=A.z;K[E+3]=J.x;K[E+4]=J.y;K[E+5]=J.z;K[E+6]=M.x;K[E+7]=M.y;K[E+8]=M.z;K[E+9]=I.x;K[E+10]=I.y;K[E+11]=I.z;E+=12}if(q&&ja.hasTangents){A=V[j.a].tangent;J=V[j.b].tangent;M=V[j.c].tangent;j=V[j.d].tangent;Z[v]=A.x;Z[v+1]=A.y;Z[v+2]=A.z;Z[v+3]=A.w;Z[v+4]=J.x;Z[v+5]=J.y;Z[v+6]=J.z;Z[v+7]=J.w;Z[v+8]=M.x;Z[v+9]=M.y;Z[v+10]=
- M.z;Z[v+11]=M.w;Z[v+12]=j.x;Z[v+13]=j.y;Z[v+14]=j.z;Z[v+15]=j.w;v+=16}if(r)if(w.length==4&&pa)for(j=0;j<4;j++){S=w[j];ba[N]=S.x;ba[N+1]=S.y;ba[N+2]=S.z;N+=3}else for(j=0;j<4;j++){ba[N]=S.x;ba[N+1]=S.y;ba[N+2]=S.z;N+=3}if(t&&u)for(j=0;j<4;j++){w=u[j];ea[H]=w.u;ea[H+1]=w.v;H+=2}if(l){ia[T]=P;ia[T+1]=P+1;ia[T+2]=P+2;ia[T+3]=P;ia[T+4]=P+2;ia[T+5]=P+3;T+=6;Y[G]=P;Y[G+1]=P+1;Y[G+2]=P;Y[G+3]=P+2;Y[G+4]=P;Y[G+5]=P+3;Y[G+6]=P+1;Y[G+7]=P+2;Y[G+8]=P+2;Y[G+9]=P+3;G+=10;P+=4}}}if(n){c.bindBuffer(c.ARRAY_BUFFER,
- d.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,K,o)}if(r){c.bindBuffer(c.ARRAY_BUFFER,d.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ba,o)}if(q&&ja.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,d.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,Z,o)}if(t&&H>0){c.bindBuffer(c.ARRAY_BUFFER,d.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ea,o)}if(l){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ia,o);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);
- c.bufferData(c.ELEMENT_ARRAY_BUFFER,Y,o)}};this.renderBuffer=function(d,h,o,n,l){var t,r,q,z;if(!n.program){if(n instanceof THREE.MeshDepthMaterial){b(n,THREE.ShaderLib.depth);n.uniforms.mNear.value=d.near;n.uniforms.mFar.value=d.far}else if(n instanceof THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial){b(n,THREE.ShaderLib.basic);e(n,o)}else if(n instanceof THREE.MeshLambertMaterial){b(n,THREE.ShaderLib.lambert);e(n,o)}else if(n instanceof THREE.MeshPhongMaterial){b(n,
- THREE.ShaderLib.phong);e(n,o)}else if(n instanceof THREE.LineBasicMaterial){b(n,THREE.ShaderLib.basic);f(n,o)}var u,j,w;u=z=r=0;for(j=h.length;u<j;u++){w=h[u];w instanceof THREE.DirectionalLight&&z++;w instanceof THREE.PointLight&&r++}if(r+z<=4){u=z;r=r}else{u=Math.ceil(4*z/(r+z));r=4-u}r={directional:u,point:r};z={fog:o,map:n.map,env_map:n.env_map,maxDirLights:r.directional,maxPointLights:r.point};r=n.fragment_shader;u=n.vertex_shader;j=c.createProgram();w=["#ifdef GL_ES\nprecision highp float;\n#endif",
- "#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,z.fog?"#define USE_FOG":"",z.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",z.map?"#define USE_MAP":"",z.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");z=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,z.map?"#define USE_MAP":"",z.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(j,g("fragment",w+r));c.attachShader(j,g("vertex",z+u));c.linkProgram(j);c.getProgramParameter(j,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(j,c.VALIDATE_STATUS)+
- ", gl error ["+c.getError()+"]");j.uniforms={};j.attributes={};n.program=j;r=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(t in n.uniforms)r.push(t);t=n.program;u=0;for(j=r.length;u<j;u++){w=r[u];t.uniforms[w]=c.getUniformLocation(t,w)}t=n.program;r=["position","normal","uv","tangent"];u=0;for(j=r.length;u<j;u++){w=r[u];t.attributes[w]=c.getAttribLocation(t,w)}}t=n.program;if(t!=k){c.useProgram(t);k=t}this.loadCamera(t,d);this.loadMatrices(t);
- if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){d=this.setupLights(t,h);n.uniforms.enableLighting.value=d.directional.positions.length+d.point.positions.length;n.uniforms.ambientLightColor.value=d.ambient;n.uniforms.directionalLightColor.value=d.directional.colors;n.uniforms.directionalLightDirection.value=d.directional.positions;n.uniforms.pointLightColor.value=d.point.colors;n.uniforms.pointLightPosition.value=d.point.positions}if(n instanceof THREE.MeshBasicMaterial||
- n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial)e(n,o);n instanceof THREE.LineBasicMaterial&&f(n,o);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}o=n.uniforms;for(q in o)if(u=t.uniforms[q]){h=o[q];r=h.type;d=h.value;if(r=="i")c.uniform1i(u,d);else if(r=="f")c.uniform1f(u,d);else if(r=="fv")c.uniform3fv(u,
- d);else if(r=="v2")c.uniform2f(u,d.x,d.y);else if(r=="v3")c.uniform3f(u,d.x,d.y,d.z);else if(r=="c")c.uniform3f(u,d.r,d.g,d.b);else if(r=="t"){c.uniform1i(u,d);if(h=h.texture)if(h.image instanceof Array&&h.image.length==6){h=h;d=d;if(h.image.length==6){if(!h.image.__webGLTextureCube&&!h.image.__cubeMapInitialized&&h.image.loadCount==6){h.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,h.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(r=0;r<6;++r)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,h.image[r]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);h.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube)}}else{h=
- h;d=d;if(!h.__webGLTexture&&h.image.loaded){h.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,h.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,h.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,i(h.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,i(h.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,i(h.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,i(h.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,
- null)}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,h.__webGLTexture)}}}q=t.attributes;c.bindBuffer(c.ARRAY_BUFFER,l.__webGLVertexBuffer);c.vertexAttribPointer(q.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(q.position);if(q.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLNormalBuffer);c.vertexAttribPointer(q.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(q.normal)}if(q.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLTangentBuffer);c.vertexAttribPointer(q.tangent,4,c.FLOAT,
- false,0,0);c.enableVertexAttribArray(q.tangent)}if(q.uv>=0)if(l.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLUVBuffer);c.vertexAttribPointer(q.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(q.uv)}else c.disableVertexAttribArray(q.uv);if(n.wireframe||n instanceof THREE.LineBasicMaterial){q=n.wireframe_linewidth!==undefined?n.wireframe_linewidth:n.linewidth!==undefined?n.linewidth:1;n=n instanceof THREE.LineBasicMaterial&&l.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(q);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- l.__webGLLineBuffer);c.drawElements(n,l.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,l.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(d,h,o,n,l,t,r){var q,z,u,j,w;u=0;for(j=n.materials.length;u<j;u++){q=n.materials[u];if(q instanceof THREE.MeshFaceMaterial){q=0;for(z=l.materials.length;q<z;q++)if((w=l.materials[q])&&w.blending==t&&w.opacity<1==r){this.setBlending(w.blending);this.renderBuffer(d,h,o,w,
- l)}}else if((w=q)&&w.blending==t&&w.opacity<1==r){this.setBlending(w.blending);this.renderBuffer(d,h,o,w,l)}}};this.render=function(d,h){var o,n,l,t,r=d.lights,q=d.fog;this.initWebGLObjects(d);this.autoClear&&this.clear();h.autoUpdateMatrix&&h.updateMatrix();F.set(h.matrix.flatten());C.set(h.projectionMatrix.flatten());o=0;for(n=d.__webGLObjects.length;o<n;o++){l=d.__webGLObjects[o];t=l.object;l=l.buffer;if(t.visible){this.setupMatrices(t,h);this.renderPass(h,r,q,t,l,THREE.NormalBlending,false)}}o=
- 0;for(n=d.__webGLObjects.length;o<n;o++){l=d.__webGLObjects[o];t=l.object;l=l.buffer;if(t.visible){this.setupMatrices(t,h);this.renderPass(h,r,q,t,l,THREE.AdditiveBlending,false);this.renderPass(h,r,q,t,l,THREE.SubtractiveBlending,false);this.renderPass(h,r,q,t,l,THREE.AdditiveBlending,true);this.renderPass(h,r,q,t,l,THREE.SubtractiveBlending,true);this.renderPass(h,r,q,t,l,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(d){function h(u,j,w,S){if(u[j]==undefined){d.__webGLObjects.push({buffer:w,
- object:S});u[j]=1}}var o,n,l,t,r,q,z;if(!d.__webGLObjects){d.__webGLObjects=[];d.__webGLObjectsMap={}}o=0;for(n=d.objects.length;o<n;o++){l=d.objects[o];r=l.geometry;if(d.__webGLObjectsMap[l.id]==undefined)d.__webGLObjectsMap[l.id]={};z=d.__webGLObjectsMap[l.id];if(l instanceof THREE.Mesh){for(t in r.geometryChunks){q=r.geometryChunks[t];if(!q.__webGLVertexBuffer){this.createBuffers(q);this.initBuffers(q,l);r.__dirtyVertices=true;r.__dirtyElements=true;r.__dirtyUvs=true;r.__dirtyNormals=true;r.__dirtyTangents=
- true}if(r.__dirtyVertices||r.__dirtyElements||r.__dirtyUvs)this.setBuffers(q,l,c.DYNAMIC_DRAW,r.__dirtyVertices,r.__dirtyElements,r.__dirtyUvs,r.__dirtyNormals,r.__dirtyTangents);h(z,t,q,l)}r.__dirtyVertices=false;r.__dirtyElements=false;r.__dirtyUvs=false;r.__dirtyNormals=false;r.__dirtyTangents=false}else if(l instanceof THREE.Line){l.__webGLVertexBuffer||this.createLineBuffers(l);h(z,0,l,l)}else if(l instanceof THREE.ParticleSystem){l.__webGLVertexBuffer||this.createParticleBuffers(l);h(z,0,l,
- l)}}};this.removeObject=function(d,h){var o,n;for(o=d.__webGLObjects.length-1;o>=0;o--){n=d.__webGLObjects[o].object;h==n&&d.__webGLObjects.splice(o,1)}};this.setupMatrices=function(d,h){d.autoUpdateMatrix&&d.updateMatrix();m.multiply(h.matrix,d.matrix);y.set(m.flatten());D=THREE.Matrix4.makeInvert3x3(m).transpose();R.set(D.m);W.set(d.matrix.flatten())};this.loadMatrices=function(d){c.uniformMatrix4fv(d.uniforms.viewMatrix,false,F);c.uniformMatrix4fv(d.uniforms.modelViewMatrix,false,y);c.uniformMatrix4fv(d.uniforms.projectionMatrix,
- false,C);c.uniformMatrix3fv(d.uniforms.normalMatrix,false,R);c.uniformMatrix4fv(d.uniforms.objectMatrix,false,W)};this.loadCamera=function(d,h){c.uniform3f(d.uniforms.cameraPosition,h.position.x,h.position.y,h.position.z)};this.setBlending=function(d){switch(d){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(d,h){if(d){!h||h=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(d=="back")c.cullFace(c.BACK);else d=="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};
|