123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- // 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,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var f,k,m,r,b,n;if(d==0)f=k=m=0;else{r=Math.floor(a*6);b=a*6-r;a=d*(1-c);n=d*(1-c*b);c=d*(1-c*(1-b));switch(r){case 1:f=n;k=d;m=a;break;case 2:f=a;k=d;m=c;break;case 3:f=a;k=n;m=d;break;case 4:f=c;k=a;m=d;break;case 5:f=d;k=a;m=n;break;case 6:case 0:f=d;k=c;m=a}}this.r=f;this.g=k;this.b=m;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,c){this.x=a||0;this.y=c||0};
- THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.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,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
- THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
- cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.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 c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
- -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
- THREE.Vector4=function(a,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1};
- THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.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,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},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,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(a){var c,d,f=a.objects,k=[];a=0;for(c=f.length;a<c;a++){d=f[a];if(d instanceof THREE.Mesh)k=k.concat(this.intersectObject(d))}k.sort(function(m,r){return m.distance-r.distance});return k},intersectObject:function(a){function c(K,u,R,F){F=F.clone().subSelf(u);R=R.clone().subSelf(u);var P=K.clone().subSelf(u);K=F.dot(F);u=F.dot(R);F=F.dot(P);var e=R.dot(R);R=R.dot(P);P=1/(K*e-u*u);e=(e*F-u*R)*P;K=(K*R-u*F)*P;return e>0&&K>0&&e+K<1}var d,f,k,m,r,b,n,p,B,A,
- x,y=a.geometry,w=y.vertices,I=[];d=0;for(f=y.faces.length;d<f;d++){k=y.faces[d];A=this.origin.clone();x=this.direction.clone();m=a.matrix.multiplyVector3(w[k.a].position.clone());r=a.matrix.multiplyVector3(w[k.b].position.clone());b=a.matrix.multiplyVector3(w[k.c].position.clone());n=k instanceof THREE.Face4?a.matrix.multiplyVector3(w[k.d].position.clone()):null;p=a.rotationMatrix.multiplyVector3(k.normal.clone());B=x.dot(p);if(B<0){p=p.dot((new THREE.Vector3).sub(m,A))/B;A=A.addSelf(x.multiplyScalar(p));
- if(k instanceof THREE.Face3){if(c(A,m,r,b)){k={distance:this.origin.distanceTo(A),point:A,face:k,object:a};I.push(k)}}else if(k instanceof THREE.Face4)if(c(A,m,r,n)||c(A,r,b,n)){k={distance:this.origin.distanceTo(A),point:A,face:k,object:a};I.push(k)}}}return I}};
- THREE.Rectangle=function(){function a(){m=f-c;r=k-d}var c,d,f,k,m,r,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return m};this.getHeight=function(){return r};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return k};this.set=function(n,p,B,A){b=false;c=n;d=p;f=B;k=A;a()};this.addPoint=function(n,p){if(b){b=false;c=n;d=p;f=n;k=p}else{c=c<n?c:n;d=d<p?d:p;f=f>n?f:n;k=k>p?
- k:p}a()};this.add3Points=function(n,p,B,A,x,y){if(b){b=false;c=n<B?n<x?n:x:B<x?B:x;d=p<A?p<y?p:y:A<y?A:y;f=n>B?n>x?n:x:B>x?B:x;k=p>A?p>y?p:y:A>y?A:y}else{c=n<B?n<x?n<c?n:c:x<c?x:c:B<x?B<c?B:c:x<c?x:c;d=p<A?p<y?p<d?p:d:y<d?y:d:A<y?A<d?A:d:y<d?y:d;f=n>B?n>x?n>f?n:f:x>f?x:f:B>x?B>f?B:f:x>f?x:f;k=p>A?p>y?p>k?p:k:y>k?y:k:A>y?A>k?A:k:y>k?y:k}a()};this.addRectangle=function(n){if(b){b=false;c=n.getLeft();d=n.getTop();f=n.getRight();k=n.getBottom()}else{c=c<n.getLeft()?c:n.getLeft();d=d<n.getTop()?d:n.getTop();
- f=f>n.getRight()?f:n.getRight();k=k>n.getBottom()?k:n.getBottom()}a()};this.inflate=function(n){c-=n;d-=n;f+=n;k+=n;a()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();f=f<n.getRight()?f:n.getRight();k=k<n.getBottom()?k:n.getBottom();a()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(c,n.getLeft())>=0&&Math.min(k,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){b=true;k=f=d=c=0;a()};this.isEmpty=function(){return b};this.toString=
- function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+k+", width: "+m+", height: "+r+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
- THREE.Matrix4=function(a,c,d,f,k,m,r,b,n,p,B,A,x,y,w,I){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=k||0;this.n22=m||1;this.n23=r||0;this.n24=b||0;this.n31=n||0;this.n32=p||0;this.n33=B||1;this.n34=A||0;this.n41=x||0;this.n42=y||0;this.n43=w||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,f,k,m,r,b,n,p,B,A,x,y,w,I){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=k;this.n22=m;this.n23=r;this.n24=b;this.n31=n;this.n32=p;this.n33=B;this.n34=A;this.n41=x;this.n42=y;this.n43=w;this.n44=I;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,c,d){var f=THREE.Matrix4.__tmpVec1,k=THREE.Matrix4.__tmpVec2,m=THREE.Matrix4.__tmpVec3;m.sub(a,c).normalize();f.cross(d,m).normalize();k.cross(m,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=k.x;this.n22=k.y;this.n23=k.z;this.n24=-k.dot(a);
- this.n31=m.x;this.n32=m.y;this.n33=m.z;this.n34=-m.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,k=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*k;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*k;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*k;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,k=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*k;a.y=this.n21*c+this.n22*d+this.n23*
- f+this.n24*k;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*k;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*k;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,f=a.n12,k=a.n13,m=a.n14,r=a.n21,b=a.n22,n=a.n23,p=a.n24,B=a.n31,
- A=a.n32,x=a.n33,y=a.n34,w=a.n41,I=a.n42,K=a.n43,u=a.n44,R=c.n11,F=c.n12,P=c.n13,e=c.n14,q=c.n21,h=c.n22,g=c.n23,o=c.n24,i=c.n31,t=c.n32,j=c.n33,l=c.n34,s=c.n41,z=c.n42,v=c.n43,M=c.n44;this.n11=d*R+f*q+k*i+m*s;this.n12=d*F+f*h+k*t+m*z;this.n13=d*P+f*g+k*j+m*v;this.n14=d*e+f*o+k*l+m*M;this.n21=r*R+b*q+n*i+p*s;this.n22=r*F+b*h+n*t+p*z;this.n23=r*P+b*g+n*j+p*v;this.n24=r*e+b*o+n*l+p*M;this.n31=B*R+A*q+x*i+y*s;this.n32=B*F+A*h+x*t+y*z;this.n33=B*P+A*g+x*j+y*v;this.n34=B*e+A*o+x*l+y*M;this.n41=w*R+I*q+
- K*i+u*s;this.n42=w*F+I*h+K*t+u*z;this.n43=w*P+I*g+K*j+u*v;this.n44=w*e+I*o+K*l+u*M;return this},multiplyToArray:function(a,c,d){var f=a.n11,k=a.n12,m=a.n13,r=a.n14,b=a.n21,n=a.n22,p=a.n23,B=a.n24,A=a.n31,x=a.n32,y=a.n33,w=a.n34,I=a.n41,K=a.n42,u=a.n43;a=a.n44;var R=c.n11,F=c.n12,P=c.n13,e=c.n14,q=c.n21,h=c.n22,g=c.n23,o=c.n24,i=c.n31,t=c.n32,j=c.n33,l=c.n34,s=c.n41,z=c.n42,v=c.n43;c=c.n44;this.n11=f*R+k*q+m*i+r*s;this.n12=f*F+k*h+m*t+r*z;this.n13=f*P+k*g+m*j+r*v;this.n14=f*e+k*o+m*l+r*c;this.n21=
- b*R+n*q+p*i+B*s;this.n22=b*F+n*h+p*t+B*z;this.n23=b*P+n*g+p*j+B*v;this.n24=b*e+n*o+p*l+B*c;this.n31=A*R+x*q+y*i+w*s;this.n32=A*F+x*h+y*t+w*z;this.n33=A*P+x*g+y*j+w*v;this.n34=A*e+x*o+y*l+w*c;this.n41=I*R+K*q+u*i+a*s;this.n42=I*F+K*h+u*t+a*z;this.n43=I*P+K*g+u*j+a*v;this.n44=I*e+K*o+u*l+a*c;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;
- d[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,k=this.n14,m=this.n21,r=this.n22,b=this.n23,n=this.n24,p=this.n31,B=this.n32,A=this.n33,x=this.n34,y=this.n41,w=this.n42,I=this.n43,K=this.n44,u=a.n11,R=a.n21,F=a.n31,P=a.n41,e=a.n12,q=a.n22,h=a.n32,g=a.n42,o=a.n13,i=a.n23,t=a.n33,j=a.n43,l=a.n14,s=a.n24,z=a.n34;a=a.n44;this.n11=c*u+d*R+f*F+k*P;this.n12=c*e+d*q+f*h+k*g;this.n13=c*o+d*i+f*t+k*j;this.n14=c*l+d*s+f*z+k*a;this.n21=m*u+r*R+b*F+n*P;this.n22=m*e+r*
- q+b*h+n*g;this.n23=m*o+r*i+b*t+n*j;this.n24=m*l+r*s+b*z+n*a;this.n31=p*u+B*R+A*F+x*P;this.n32=p*e+B*q+A*h+x*g;this.n33=p*o+B*i+A*t+x*j;this.n34=p*l+B*s+A*z+x*a;this.n41=y*u+w*R+I*F+K*P;this.n42=y*e+w*q+I*h+K*g;this.n43=y*o+w*i+I*t+K*j;this.n44=y*l+w*s+I*z+K*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
- determinant:function(){var a=this.n11,c=this.n12,d=this.n13,f=this.n14,k=this.n21,m=this.n22,r=this.n23,b=this.n24,n=this.n31,p=this.n32,B=this.n33,A=this.n34,x=this.n41,y=this.n42,w=this.n43,I=this.n44;return f*r*p*x-d*b*p*x-f*m*B*x+c*b*B*x+d*m*A*x-c*r*A*x-f*r*n*y+d*b*n*y+f*k*B*y-a*b*B*y-d*k*A*y+a*r*A*y+f*m*n*w-c*b*n*w-f*k*p*w+a*b*p*w+c*k*A*w-a*m*A*w-d*m*n*I+c*r*n*I+d*k*p*I-a*r*p*I-c*k*B*I+a*m*B*I},transpose:function(){function a(c,d,f){var k=c[d];c[d]=c[f];c[f]=k}a(this,"n21","n12");a(this,"n31",
- "n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=
- this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,
- 1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),k=1-d,m=a.x,r=a.y,b=a.z,
- n=k*m,p=k*r;this.set(n*m+d,n*r-f*b,n*b+f*r,0,n*r+f*b,p*r+d,p*b-f*m,0,n*b-f*r,p*b+f*m,k*b*b+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};
- THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
- THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,f=a.n13,k=a.n14,m=a.n21,r=a.n22,b=a.n23,n=a.n24,p=a.n31,B=a.n32,A=a.n33,x=a.n34,y=a.n41,w=a.n42,I=a.n43,K=a.n44,u=new THREE.Matrix4;u.n11=b*x*w-n*A*w+n*B*I-r*x*I-b*B*K+r*A*K;u.n12=k*A*w-f*x*w-k*B*I+d*x*I+f*B*K-d*A*K;u.n13=f*n*w-k*b*w+k*r*I-d*n*I-f*r*K+d*b*K;u.n14=k*b*B-f*n*B-k*r*A+d*n*A+f*r*x-d*b*x;u.n21=n*A*y-b*x*y-n*p*I+m*x*I+b*p*K-m*A*K;u.n22=f*x*y-k*A*y+k*p*I-c*x*I-f*p*K+c*A*K;u.n23=k*b*y-f*n*y-k*m*I+c*n*I+f*m*K-c*b*K;u.n24=f*n*p-k*b*p+
- k*m*A-c*n*A-f*m*x+c*b*x;u.n31=r*x*y-n*B*y+n*p*w-m*x*w-r*p*K+m*B*K;u.n32=k*B*y-d*x*y-k*p*w+c*x*w+d*p*K-c*B*K;u.n33=f*n*y-k*r*y+k*m*w-c*n*w-d*m*K+c*r*K;u.n34=k*r*p-d*n*p-k*m*B+c*n*B+d*m*x-c*r*x;u.n41=b*B*y-r*A*y-b*p*w+m*A*w+r*p*I-m*B*I;u.n42=d*A*y-f*B*y+f*p*w-c*A*w-d*p*I+c*B*I;u.n43=f*r*y-d*b*y-f*m*w+c*b*w+d*m*I-c*r*I;u.n44=d*b*p-f*r*p+f*m*B-c*b*B-d*m*A+c*r*A;u.multiplyScalar(1/a.determinant());return u};
- THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,k=-a.n33*a.n21+a.n31*a.n23,m=a.n32*a.n21-a.n31*a.n22,r=-a.n33*a.n12+a.n32*a.n13,b=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,B=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*r+a.n31*p;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*k;d[2]=a*m;d[3]=a*r;d[4]=a*b;d[5]=a*n;d[6]=a*p;d[7]=a*B;d[8]=a*A;return c};
- THREE.Matrix4.makeFrustum=function(a,c,d,f,k,m){var r,b,n;r=new THREE.Matrix4;b=2*k/(c-a);n=2*k/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(m+k)/(m-k);k=-2*m*k/(m-k);r.n11=b;r.n12=0;r.n13=a;r.n14=0;r.n21=0;r.n22=n;r.n23=d;r.n24=0;r.n31=0;r.n32=0;r.n33=f;r.n34=k;r.n41=0;r.n42=0;r.n43=-1;r.n44=0;return r};THREE.Matrix4.makePerspective=function(a,c,d,f){var k;a=d*Math.tan(a*Math.PI/360);k=-a;return THREE.Matrix4.makeFrustum(k*c,a*c,k,a,d,f)};
- THREE.Matrix4.makeOrtho=function(a,c,d,f,k,m){var r,b,n,p;r=new THREE.Matrix4;b=c-a;n=d-f;p=m-k;a=(c+a)/b;d=(d+f)/n;k=(m+k)/p;r.n11=2/b;r.n12=0;r.n13=0;r.n14=-a;r.n21=0;r.n22=2/n;r.n23=0;r.n24=-d;r.n31=0;r.n32=0;r.n33=-2/p;r.n34=-k;r.n41=0;r.n42=0;r.n43=0;r.n44=1;return r};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
- THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||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,c,d,f,k){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=k instanceof Array?k:[k]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,c,d,f,k,m){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=k instanceof THREE.Vector3?k:new THREE.Vector3;this.vertexNormals=k instanceof Array?k:[];this.materials=m instanceof Array?m:[m]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||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.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
- THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
- d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,f,k,m,r,b=new THREE.Vector3,n=new THREE.Vector3;f=0;for(k=this.vertices.length;f<k;f++){m=this.vertices[f];m.normal.set(0,0,0)}f=0;for(k=this.faces.length;f<k;f++){m=this.faces[f];if(a&&m.vertexNormals.length){b.set(0,0,0);c=0;for(d=m.normal.length;c<d;c++)b.addSelf(m.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[m.a];d=this.vertices[m.b];r=this.vertices[m.c];b.sub(r.position,
- d.position);n.sub(c.position,d.position);b.crossSelf(n)}b.isZero()||b.normalize();m.normal.copy(b)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)f[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)f[a].normalize();a=0;for(c=this.faces.length;a<
- c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(l,s,z,v,M,J,E){m=l.vertices[s].position;r=l.vertices[z].position;b=l.vertices[v].position;n=k[M];p=k[J];B=k[E];A=r.x-m.x;x=b.x-m.x;y=r.y-m.y;w=b.y-m.y;
- I=r.z-m.z;K=b.z-m.z;u=p.u-n.u;R=B.u-n.u;F=p.v-n.v;P=B.v-n.v;e=1/(u*P-R*F);g.set((P*A-F*x)*e,(P*y-F*w)*e,(P*I-F*K)*e);o.set((u*x-R*A)*e,(u*w-R*y)*e,(u*K-R*I)*e);q[s].addSelf(g);q[z].addSelf(g);q[v].addSelf(g);h[s].addSelf(o);h[z].addSelf(o);h[v].addSelf(o)}var c,d,f,k,m,r,b,n,p,B,A,x,y,w,I,K,u,R,F,P,e,q=[],h=[],g=new THREE.Vector3,o=new THREE.Vector3,i=new THREE.Vector3,t=new THREE.Vector3,j=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){q[c]=new THREE.Vector3;h[c]=new THREE.Vector3}c=0;
- for(d=this.faces.length;c<d;c++){f=this.faces[c];k=this.uvs[c];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])}}c=0;for(d=this.vertices.length;c<d;c++){j.copy(this.vertices[c].normal);f=q[c];i.copy(f);i.subSelf(j.multiplyScalar(j.dot(f))).normalize();t.cross(this.vertices[c].normal,f);f=t.dot(h[c]);f=f<0?-1:1;this.vertices[c].tangent.set(i.x,i.y,i.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 c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];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,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(B){var A=[];c=0;for(d=B.length;c<d;c++)B[c]==undefined?A.push("undefined"):A.push(B[c].toString());return A.join("_")}var c,d,f,k,m,r,b,n,p={};f=0;for(k=this.faces.length;f<k;f++){m=this.faces[f];
- r=m.materials;b=a(r);if(p[b]==undefined)p[b]={hash:b,counter:0};n=p[b].hash+"_"+p[b].counter;if(this.geometryChunks[n]==undefined)this.geometryChunks[n]={faces:[],materials:r,vertices:0};m=m instanceof THREE.Face3?3:4;if(this.geometryChunks[n].vertices+m>65535){p[b].counter+=1;n=p[b].hash+"_"+p[b].counter;if(this.geometryChunks[n]==undefined)this.geometryChunks[n]={faces:[],materials:r,vertices:0}}this.geometryChunks[n].faces.push(f);this.geometryChunks[n].vertices+=m}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;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.tmpVec=new THREE.Vector3;this.translateX=function(k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
- this.translateZ=function(k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(k);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
- THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
- THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
- THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
- THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){f.setRotY(c.y);this.rotationMatrix.multiplySelf(f)}if(c.z!=0){f.setRotZ(c.z);this.rotationMatrix.multiplySelf(f)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){f.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(f)}}};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,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
- THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];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.BillboardBlending=3;
- THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;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.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
- a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.LineBasicMaterialCounter={value:0};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
- undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_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.shading!==undefined)this.shading=a.shading;if(a.blending!==
- undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
- "<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
- undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_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.shading!==undefined)this.shading=a.shading;if(a.blending!==
- undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
- "<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<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.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=
- 1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;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.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- 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/>opacity: "+this.opacity+"<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/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
- this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshDepthMaterialCounter={value:0};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshNormalMaterialCounter={value:0};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.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;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.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
- THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;
- if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.ParticleBasicMaterialCounter={value:0};
- 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,c,d,f,k,m){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=k!==undefined?k:THREE.LinearFilter;this.min_filter=m!==undefined?m:THREE.LinearMipMapLinearFilter};
- THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
- THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
- THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var c,d,f,k={};for(c in a){k[c]={};for(d in a[c]){f=a[c][d];k[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return k},merge:function(a){var c,d,f,k={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)k[d]=f[d]}return k}};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,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
- THREE.Projector=function(){function a(h,g){return g.z-h.z}function c(h,g){var o=0,i=1,t=h.z+h.w,j=g.z+g.w,l=-h.z+h.w,s=-g.z+g.w;if(t>=0&&j>=0&&l>=0&&s>=0)return true;else if(t<0&&j<0||l<0&&s<0)return false;else{if(t<0)o=Math.max(o,t/(t-j));else if(j<0)i=Math.min(i,t/(t-j));if(l<0)o=Math.max(o,l/(l-s));else if(s<0)i=Math.min(i,l/(l-s));if(i<o)return false;else{h.lerpSelf(g,o);g.lerpSelf(h,1-i);return true}}}var d,f,k=[],m,r,b,n=[],p,B,A=[],x,y,w=[],I=new THREE.Vector4,K=new THREE.Vector4,u=new THREE.Matrix4,
- R=new THREE.Matrix4,F=[],P=new THREE.Vector4,e=new THREE.Vector4,q;this.projectObjects=function(h,g,o){var i=[],t,j;f=0;u.multiply(g.projectionMatrix,g.matrix);F[0]=new THREE.Vector4(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);F[1]=new THREE.Vector4(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);F[2]=new THREE.Vector4(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);F[3]=new THREE.Vector4(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);F[4]=new THREE.Vector4(u.n41-u.n31,u.n42-u.n32,u.n43-
- u.n33,u.n44-u.n34);F[5]=new THREE.Vector4(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);g=0;for(t=F.length;g<t;g++){j=F[g];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}t=h.objects;h=0;for(g=t.length;h<g;h++){j=t[h];var l;if(!(l=!j.visible)){if(l=j instanceof THREE.Mesh){a:{l=void 0;for(var s=j.position,z=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),v=0;v<6;v++){l=F[v].x*s.x+F[v].y*s.y+F[v].z*s.z+F[v].w;if(l<=z){l=false;break a}}l=true}l=!l}l=l}if(!l){d=
- k[f]=k[f]||new THREE.RenderableObject;I.copy(j.position);u.multiplyVector3(I);d.object=j;d.z=I.z;i.push(d);f++}}o&&i.sort(a);return i};this.projectScene=function(h,g,o){var i=[],t=g.near,j=g.far,l,s,z,v,M,J,E,U,X,N,H,O,S,C,L,W;b=B=y=0;g.autoUpdateMatrix&&g.updateMatrix();u.multiply(g.projectionMatrix,g.matrix);J=this.projectObjects(h,g,true);h=0;for(l=J.length;h<l;h++){E=J[h].object;if(E.visible){E.autoUpdateMatrix&&E.updateMatrix();U=E.matrix;X=E.rotationMatrix;N=E.materials;H=E.overdraw;if(E instanceof
- THREE.Mesh){O=E.geometry;S=O.vertices;s=0;for(z=S.length;s<z;s++){C=S[s];C.positionWorld.copy(C.position);U.multiplyVector3(C.positionWorld);v=C.positionScreen;v.copy(C.positionWorld);u.multiplyVector4(v);v.x/=v.w;v.y/=v.w;C.__visible=v.z>t&&v.z<j}O=O.faces;s=0;for(z=O.length;s<z;s++){C=O[s];if(C instanceof THREE.Face3){v=S[C.a];M=S[C.b];L=S[C.c];if(v.__visible&&M.__visible&&L.__visible)if(E.doubleSided||E.flipSided!=(L.positionScreen.x-v.positionScreen.x)*(M.positionScreen.y-v.positionScreen.y)-
- (L.positionScreen.y-v.positionScreen.y)*(M.positionScreen.x-v.positionScreen.x)<0){m=n[b]=n[b]||new THREE.RenderableFace3;m.v1.positionWorld.copy(v.positionWorld);m.v2.positionWorld.copy(M.positionWorld);m.v3.positionWorld.copy(L.positionWorld);m.v1.positionScreen.copy(v.positionScreen);m.v2.positionScreen.copy(M.positionScreen);m.v3.positionScreen.copy(L.positionScreen);m.normalWorld.copy(C.normal);X.multiplyVector3(m.normalWorld);m.centroidWorld.copy(C.centroid);U.multiplyVector3(m.centroidWorld);
- m.centroidScreen.copy(m.centroidWorld);u.multiplyVector3(m.centroidScreen);L=C.vertexNormals;q=m.vertexNormalsWorld;v=0;for(M=L.length;v<M;v++){W=q[v]=q[v]||new THREE.Vector3;W.copy(L[v]);X.multiplyVector3(W)}m.z=m.centroidScreen.z;m.meshMaterials=N;m.faceMaterials=C.materials;m.overdraw=H;if(E.geometry.uvs[s]){m.uvs[0]=E.geometry.uvs[s][0];m.uvs[1]=E.geometry.uvs[s][1];m.uvs[2]=E.geometry.uvs[s][2]}i.push(m);b++}}else if(C instanceof THREE.Face4){v=S[C.a];M=S[C.b];L=S[C.c];W=S[C.d];if(v.__visible&&
- M.__visible&&L.__visible&&W.__visible)if(E.doubleSided||E.flipSided!=((W.positionScreen.x-v.positionScreen.x)*(M.positionScreen.y-v.positionScreen.y)-(W.positionScreen.y-v.positionScreen.y)*(M.positionScreen.x-v.positionScreen.x)<0||(M.positionScreen.x-L.positionScreen.x)*(W.positionScreen.y-L.positionScreen.y)-(M.positionScreen.y-L.positionScreen.y)*(W.positionScreen.x-L.positionScreen.x)<0)){m=n[b]=n[b]||new THREE.RenderableFace3;m.v1.positionWorld.copy(v.positionWorld);m.v2.positionWorld.copy(M.positionWorld);
- m.v3.positionWorld.copy(W.positionWorld);m.v1.positionScreen.copy(v.positionScreen);m.v2.positionScreen.copy(M.positionScreen);m.v3.positionScreen.copy(W.positionScreen);m.normalWorld.copy(C.normal);X.multiplyVector3(m.normalWorld);m.centroidWorld.copy(C.centroid);U.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);u.multiplyVector3(m.centroidScreen);m.z=m.centroidScreen.z;m.meshMaterials=N;m.faceMaterials=C.materials;m.overdraw=H;if(E.geometry.uvs[s]){m.uvs[0]=E.geometry.uvs[s][0];
- m.uvs[1]=E.geometry.uvs[s][1];m.uvs[2]=E.geometry.uvs[s][3]}i.push(m);b++;r=n[b]=n[b]||new THREE.RenderableFace3;r.v1.positionWorld.copy(M.positionWorld);r.v2.positionWorld.copy(L.positionWorld);r.v3.positionWorld.copy(W.positionWorld);r.v1.positionScreen.copy(M.positionScreen);r.v2.positionScreen.copy(L.positionScreen);r.v3.positionScreen.copy(W.positionScreen);r.normalWorld.copy(m.normalWorld);r.centroidWorld.copy(m.centroidWorld);r.centroidScreen.copy(m.centroidScreen);r.z=r.centroidScreen.z;r.meshMaterials=
- N;r.faceMaterials=C.materials;r.overdraw=H;if(E.geometry.uvs[s]){r.uvs[0]=E.geometry.uvs[s][1];r.uvs[1]=E.geometry.uvs[s][2];r.uvs[2]=E.geometry.uvs[s][3]}i.push(r);b++}}}}else if(E instanceof THREE.Line){R.multiply(u,U);S=E.geometry.vertices;C=S[0];C.positionScreen.copy(C.position);R.multiplyVector4(C.positionScreen);s=1;for(z=S.length;s<z;s++){v=S[s];v.positionScreen.copy(v.position);R.multiplyVector4(v.positionScreen);M=S[s-1];P.copy(v.positionScreen);e.copy(M.positionScreen);if(c(P,e)){P.multiplyScalar(1/
- P.w);e.multiplyScalar(1/e.w);p=A[B]=A[B]||new THREE.RenderableLine;p.v1.positionScreen.copy(P);p.v2.positionScreen.copy(e);p.z=Math.max(P.z,e.z);p.materials=E.materials;i.push(p);B++}}}else if(E instanceof THREE.Particle){K.set(E.position.x,E.position.y,E.position.z,1);u.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){x=w[y]=w[y]||new THREE.RenderableParticle;x.x=K.x/K.w;x.y=K.y/K.w;x.z=K.z;x.rotation=E.rotation.z;x.scale.x=E.scale.x*Math.abs(x.x-(K.x+g.projectionMatrix.n11)/(K.w+g.projectionMatrix.n14));
- x.scale.y=E.scale.y*Math.abs(x.y-(K.y+g.projectionMatrix.n22)/(K.w+g.projectionMatrix.n24));x.materials=E.materials;i.push(x);y++}}}}o&&i.sort(a);return i};this.unprojectVector=function(h,g){var o=THREE.Matrix4.makeInvert(g.matrix);o.multiplySelf(THREE.Matrix4.makeInvert(g.projectionMatrix));o.multiplyVector3(h);return h}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,k,m;this.domElement=document.createElement("div");this.setSize=function(r,b){d=r;f=b;k=d/2;m=f/2};this.render=function(r,b){var n,p,B,A,x,y,w,I;a=c.projectScene(r,b);n=0;for(p=a.length;n<p;n++){x=a[n];if(x instanceof THREE.RenderableParticle){w=x.x*k+k;I=x.y*m+m;B=0;for(A=x.material.length;B<A;B++){y=x.material[B];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=w+"px";y.style.top=I+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(aa){if(x!=aa)p.globalAlpha=x=aa}function c(aa){if(y!=aa){switch(aa){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}y=aa}}var d=null,f=new THREE.Projector,k=document.createElement("canvas"),m,r,b,n,p=k.getContext("2d"),B=new THREE.Color(0),A=0,x=1,y=0,w=null,I=null,K=1,u,R,F,P,e,q,h,g,o,i=new THREE.Color,
- t=new THREE.Color,j=new THREE.Color,l=new THREE.Color,s=new THREE.Color,z,v,M,J,E,U,X,N,H,O=new THREE.Rectangle,S=new THREE.Rectangle,C=new THREE.Rectangle,L=false,W=new THREE.Color,ga=new THREE.Color,da=new THREE.Color,Y=new THREE.Color,ba=Math.PI*2,Z=new THREE.Vector3,ea,xa,ha,ia,ta,pa,qa=16;ea=document.createElement("canvas");ea.width=ea.height=2;xa=ea.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);ha=xa.getImageData(0,0,2,2);ia=ha.data;ta=document.createElement("canvas");ta.width=
- ta.height=qa;pa=ta.getContext("2d");pa.translate(-qa/2,-qa/2);pa.scale(qa,qa);qa--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(aa,na){m=aa;r=na;b=m/2;n=r/2;k.width=m;k.height=r;O.set(-b,-n,b,n);x=1;y=0;I=w=null;K=1};this.setClearColor=function(aa,na){B=aa;A=na;S.set(-b,-n,b,n);p.setTransform(1,0,0,-1,b,n);this.clear()};this.setClearColorHex=function(aa,na){B.setHex(aa);A=na;S.set(-b,-n,b,n);p.setTransform(1,0,0,-1,b,n);this.clear()};this.clear=function(){p.setTransform(1,
- 0,0,-1,b,n);if(!S.isEmpty()){S.inflate(1);S.minSelf(O);if(B.hex==0&&A==0)p.clearRect(S.getX(),S.getY(),S.getWidth(),S.getHeight());else{c(THREE.NormalBlending);a(1);p.fillStyle="rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+A+")";p.fillRect(S.getX(),S.getY(),S.getWidth(),S.getHeight())}S.empty()}};this.render=function(aa,na){function ka(D){var V,T,G,Q=D.lights;ga.setRGB(0,0,0);da.setRGB(0,0,0);Y.setRGB(0,0,0);D=0;for(V=Q.length;D<V;D++){T=Q[D];G=T.color;if(T instanceof
- THREE.AmbientLight){ga.r+=G.r;ga.g+=G.g;ga.b+=G.b}else if(T instanceof THREE.DirectionalLight){da.r+=G.r;da.g+=G.g;da.b+=G.b}else if(T instanceof THREE.PointLight){Y.r+=G.r;Y.g+=G.g;Y.b+=G.b}}}function ya(D,V,T,G){var Q,$,fa,ja,la=D.lights;D=0;for(Q=la.length;D<Q;D++){$=la[D];fa=$.color;ja=$.intensity;if($ instanceof THREE.DirectionalLight){$=T.dot($.position)*ja;if($>0){G.r+=fa.r*$;G.g+=fa.g*$;G.b+=fa.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,V);Z.normalize();$=T.dot(Z)*ja;if($>
- 0){G.r+=fa.r*$;G.g+=fa.g*$;G.b+=fa.b*$}}}}function Ga(D,V,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var G,Q,$,fa,ja,la;if(T instanceof THREE.ParticleBasicMaterial){if(T.map&&T.map.image.loaded){fa=T.map.image;ja=fa.width>>1;la=fa.height>>1;Q=V.scale.x*b;$=V.scale.y*n;T=Q*ja;G=$*la;C.set(D.x-T,D.y-G,D.x+T,D.y+G);if(O.instersects(C)){p.save();p.translate(D.x,D.y);p.rotate(-V.rotation);p.scale(Q,-$);p.translate(-ja,-la);p.drawImage(fa,0,0);p.restore()}}}else if(T instanceof THREE.ParticleCircleMaterial){if(L){W.r=
- ga.r+da.r+Y.r;W.g=ga.g+da.g+Y.g;W.b=ga.b+da.b+Y.b;i.r=T.color.r*W.r;i.g=T.color.g*W.g;i.b=T.color.b*W.b;i.updateStyleString()}else i.__styleString=T.color.__styleString;T=V.scale.x*b;G=V.scale.y*n;C.set(D.x-T,D.y-G,D.x+T,D.y+G);if(O.instersects(C)){Q=i.__styleString;if(I!=Q)p.fillStyle=I=Q;p.save();p.translate(D.x,D.y);p.rotate(-V.rotation);p.scale(T,G);p.beginPath();p.arc(0,0,1,0,ba,true);p.closePath();p.fill();p.restore()}}}}function Ha(D,V,T,G){if(G.opacity!=0){a(G.opacity);c(G.blending);p.beginPath();
- p.moveTo(D.positionScreen.x,D.positionScreen.y);p.lineTo(V.positionScreen.x,V.positionScreen.y);p.closePath();if(G instanceof THREE.LineBasicMaterial){i.__styleString=G.color.__styleString;D=G.linewidth;if(K!=D)p.lineWidth=K=D;D=i.__styleString;if(w!=D)p.strokeStyle=w=D;p.stroke();C.inflate(G.linewidth*2)}}}function Da(D,V,T,G,Q,$){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);P=D.positionScreen.x;e=D.positionScreen.y;q=V.positionScreen.x;h=V.positionScreen.y;g=T.positionScreen.x;o=T.positionScreen.y;
- p.beginPath();p.moveTo(P,e);p.lineTo(q,h);p.lineTo(g,o);p.lineTo(P,e);p.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&Aa(P,e,q,h,g,o,Q.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=na.matrix;Z.copy(G.vertexNormalsWorld[0]);J=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;E=-(Z.x*D.n21+Z.y*
- D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(G.vertexNormalsWorld[1]);U=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;X=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(G.vertexNormalsWorld[2]);N=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;H=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Aa(P,e,q,h,g,o,Q.env_map.image,J,E,U,X,N,H)}}else Q.wireframe?ma(Q.color.__styleString,Q.wireframe_linewidth):Ea(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&
- Aa(P,e,q,h,g,o,Q.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);c(THREE.SubtractiveBlending)}if(L)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&G.vertexNormalsWorld.length==3){t.r=j.r=l.r=ga.r;t.g=j.g=l.g=ga.g;t.b=j.b=l.b=ga.b;ya($,G.v1.positionWorld,G.vertexNormalsWorld[0],t);ya($,G.v2.positionWorld,G.vertexNormalsWorld[1],j);ya($,G.v3.positionWorld,G.vertexNormalsWorld[2],l);s.r=(j.r+l.r)*0.5;s.g=(j.g+l.g)*0.5;s.b=(j.b+l.b)*0.5;M=Ma(t,j,l,s);Aa(P,e,q,h,g,o,M,0,0,
- 1,0,0,1)}else{W.r=ga.r;W.g=ga.g;W.b=ga.b;ya($,G.centroidWorld,G.normalWorld,W);i.r=Q.color.r*W.r;i.g=Q.color.g*W.g;i.b=Q.color.b*W.b;i.updateStyleString();Q.wireframe?ma(i.__styleString,Q.wireframe_linewidth):Ea(i.__styleString)}else Q.wireframe?ma(Q.color.__styleString,Q.wireframe_linewidth):Ea(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){z=na.near;v=na.far;t.r=t.g=t.b=1-Ia(D.positionScreen.z,z,v);j.r=j.g=j.b=1-Ia(V.positionScreen.z,z,v);l.r=l.g=l.b=1-Ia(T.positionScreen.z,
- z,v);s.r=(j.r+l.r)*0.5;s.g=(j.g+l.g)*0.5;s.b=(j.b+l.b)*0.5;M=Ma(t,j,l,s);Aa(P,e,q,h,g,o,M,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){i.r=Ja(G.normalWorld.x);i.g=Ja(G.normalWorld.y);i.b=Ja(G.normalWorld.z);i.updateStyleString();Q.wireframe?ma(i.__styleString,Q.wireframe_linewidth):Ea(i.__styleString)}}}function ma(D,V){if(w!=D)p.strokeStyle=w=D;if(K!=V)p.lineWidth=K=V;p.stroke();C.inflate(V*2)}function Ea(D){if(I!=D)p.fillStyle=I=D;p.fill()}function Aa(D,V,T,G,Q,$,fa,ja,la,ua,oa,va,
- Ba){var ra,wa;ra=fa.width-1;wa=fa.height-1;ja*=ra;la*=wa;ua*=ra;oa*=wa;va*=ra;Ba*=wa;T-=D;G-=V;Q-=D;$-=V;ua-=ja;oa-=la;va-=ja;Ba-=la;ra=ua*Ba-va*oa;if(ra!=0){wa=1/ra;ra=(Ba*T-oa*Q)*wa;oa=(Ba*G-oa*$)*wa;T=(ua*Q-va*T)*wa;G=(ua*$-va*G)*wa;D=D-ra*ja-T*la;V=V-oa*ja-G*la;p.save();p.transform(ra,oa,T,G,D,V);p.clip();p.drawImage(fa,0,0);p.restore()}}function Ma(D,V,T,G){var Q=~~(D.r*255),$=~~(D.g*255);D=~~(D.b*255);var fa=~~(V.r*255),ja=~~(V.g*255);V=~~(V.b*255);var la=~~(T.r*255),ua=~~(T.g*255);T=~~(T.b*
- 255);var oa=~~(G.r*255),va=~~(G.g*255);G=~~(G.b*255);ia[0]=Q<0?0:Q>255?255:Q;ia[1]=$<0?0:$>255?255:$;ia[2]=D<0?0:D>255?255:D;ia[4]=fa<0?0:fa>255?255:fa;ia[5]=ja<0?0:ja>255?255:ja;ia[6]=V<0?0:V>255?255:V;ia[8]=la<0?0:la>255?255:la;ia[9]=ua<0?0:ua>255?255:ua;ia[10]=T<0?0:T>255?255:T;ia[12]=oa<0?0:oa>255?255:oa;ia[13]=va<0?0:va>255?255:va;ia[14]=G<0?0:G>255?255:G;xa.putImageData(ha,0,0);pa.drawImage(ea,0,0);return ta}function Ia(D,V,T){D=(D-V)/(T-V);return D*D*(3-2*D)}function Ja(D){D=(D+1)*0.5;return D<
- 0?0:D>1?1:D}function Ka(D,V){var T=V.x-D.x,G=V.y-D.y,Q=1/Math.sqrt(T*T+G*G);T*=Q;G*=Q;V.x+=T;V.y+=G;D.x-=T;D.y-=G}var Fa,Na,ca,sa,za,La,Oa,Ca;this.autoClear?this.clear():p.setTransform(1,0,0,-1,b,n);d=f.projectScene(aa,na,this.sortElements);(L=aa.lights.length>0)&&ka(aa);Fa=0;for(Na=d.length;Fa<Na;Fa++){ca=d[Fa];C.empty();if(ca instanceof THREE.RenderableParticle){u=ca;u.x*=b;u.y*=n;sa=0;for(za=ca.materials.length;sa<za;sa++)Ga(u,ca,ca.materials[sa],aa)}else if(ca instanceof THREE.RenderableLine){u=
- ca.v1;R=ca.v2;u.positionScreen.x*=b;u.positionScreen.y*=n;R.positionScreen.x*=b;R.positionScreen.y*=n;C.addPoint(u.positionScreen.x,u.positionScreen.y);C.addPoint(R.positionScreen.x,R.positionScreen.y);if(O.instersects(C)){sa=0;for(za=ca.materials.length;sa<za;)Ha(u,R,ca,ca.materials[sa++],aa)}}else if(ca instanceof THREE.RenderableFace3){u=ca.v1;R=ca.v2;F=ca.v3;u.positionScreen.x*=b;u.positionScreen.y*=n;R.positionScreen.x*=b;R.positionScreen.y*=n;F.positionScreen.x*=b;F.positionScreen.y*=n;if(ca.overdraw){Ka(u.positionScreen,
- R.positionScreen);Ka(R.positionScreen,F.positionScreen);Ka(F.positionScreen,u.positionScreen)}C.add3Points(u.positionScreen.x,u.positionScreen.y,R.positionScreen.x,R.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if(O.instersects(C)){sa=0;for(za=ca.meshMaterials.length;sa<za;){Ca=ca.meshMaterials[sa++];if(Ca instanceof THREE.MeshFaceMaterial){La=0;for(Oa=ca.faceMaterials.length;La<Oa;)(Ca=ca.faceMaterials[La++])&&Da(u,R,F,ca,Ca,aa)}else Da(u,R,F,ca,Ca,aa)}}}S.addRectangle(C)}p.setTransform(1,
- 0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(J,E,U){var X,N,H,O;X=0;for(N=J.lights.length;X<N;X++){H=J.lights[X];if(H instanceof THREE.DirectionalLight){O=E.normalWorld.dot(H.position)*H.intensity;if(O>0){U.r+=H.color.r*O;U.g+=H.color.g*O;U.b+=H.color.b*O}}else if(H instanceof THREE.PointLight){o.sub(H.position,E.centroidWorld);o.normalize();O=E.normalWorld.dot(o)*H.intensity;if(O>0){U.r+=H.color.r*O;U.g+=H.color.g*O;U.b+=H.color.b*O}}}}function c(J,E,U,X,N,H){l=f(s++);l.setAttribute("d","M "+J.positionScreen.x+
- " "+J.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)F.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(R){P.r=e.r;P.g=e.g;P.b=e.b;a(H,X,P);F.r=N.color.r*P.r;F.g=N.color.g*P.g;F.b=N.color.b*P.b;F.updateStyleString()}else F.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshDepthMaterial){g=1-N.__2near/(N.__farPlusNear-X.z*N.__farMinusNear);
- F.setRGB(g,g,g)}else N instanceof THREE.MeshNormalMaterial&&F.setRGB(k(X.normalWorld.x),k(X.normalWorld.y),k(X.normalWorld.z));N.wireframe?l.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+N.wireframe_linewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframe_linecap+"; stroke-linejoin: "+N.wireframe_linejoin):l.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+N.opacity);b.appendChild(l)}function d(J,E,U,X,N,H,O){l=f(s++);l.setAttribute("d",
- "M "+J.positionScreen.x+" "+J.positionScreen.y+" L "+E.positionScreen.x+" "+E.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)F.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshLambertMaterial)if(R){P.r=e.r;P.g=e.g;P.b=e.b;a(O,N,P);F.r=H.color.r*P.r;F.g=H.color.g*P.g;F.b=H.color.b*P.b;F.updateStyleString()}else F.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshDepthMaterial){g=
- 1-H.__2near/(H.__farPlusNear-N.z*H.__farMinusNear);F.setRGB(g,g,g)}else H instanceof THREE.MeshNormalMaterial&&F.setRGB(k(N.normalWorld.x),k(N.normalWorld.y),k(N.normalWorld.z));H.wireframe?l.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+H.wireframe_linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframe_linecap+"; stroke-linejoin: "+H.wireframe_linejoin):l.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+H.opacity);b.appendChild(l)}
- function f(J){if(i[J]==null){i[J]=document.createElementNS("http://www.w3.org/2000/svg","path");M==0&&i[J].setAttribute("shape-rendering","crispEdges");return i[J]}return i[J]}function k(J){return J<0?Math.min((1+J)*0.5,0.5):0.5+Math.min(J*0.5,0.5)}var m=null,r=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,B,A,x,y,w,I,K=new THREE.Rectangle,u=new THREE.Rectangle,R=false,F=new THREE.Color(16777215),P=new THREE.Color(16777215),e=new THREE.Color(0),q=new THREE.Color(0),
- h=new THREE.Color(0),g,o=new THREE.Vector3,i=[],t=[],j=[],l,s,z,v,M=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(J){switch(J){case "high":M=1;break;case "low":M=0}};this.setSize=function(J,E){n=J;p=E;B=n/2;A=p/2;b.setAttribute("viewBox",-B+" "+-A+" "+n+" "+p);b.setAttribute("width",n);b.setAttribute("height",p);K.set(-B,-A,B,A)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(J,E){var U,X,
- N,H,O,S,C,L;this.autoClear&&this.clear();m=r.projectScene(J,E,this.sortElements);v=z=s=0;if(R=J.lights.length>0){C=J.lights;e.setRGB(0,0,0);q.setRGB(0,0,0);h.setRGB(0,0,0);U=0;for(X=C.length;U<X;U++){N=C[U];H=N.color;if(N instanceof THREE.AmbientLight){e.r+=H.r;e.g+=H.g;e.b+=H.b}else if(N instanceof THREE.DirectionalLight){q.r+=H.r;q.g+=H.g;q.b+=H.b}else if(N instanceof THREE.PointLight){h.r+=H.r;h.g+=H.g;h.b+=H.b}}}U=0;for(X=m.length;U<X;U++){C=m[U];u.empty();if(C instanceof THREE.RenderableParticle){x=
- C;x.x*=B;x.y*=-A;N=0;for(H=C.materials.length;N<H;N++)if(L=C.materials[N]){O=x;S=C;L=L;var W=z++;if(t[W]==null){t[W]=document.createElementNS("http://www.w3.org/2000/svg","circle");M==0&&t[W].setAttribute("shape-rendering","crispEdges")}l=t[W];l.setAttribute("cx",O.x);l.setAttribute("cy",O.y);l.setAttribute("r",S.scale.x*B);if(L instanceof THREE.ParticleCircleMaterial){if(R){P.r=e.r+q.r+h.r;P.g=e.g+q.g+h.g;P.b=e.b+q.b+h.b;F.r=L.color.r*P.r;F.g=L.color.g*P.g;F.b=L.color.b*P.b;F.updateStyleString()}else F=
- L.color;l.setAttribute("style","fill: "+F.__styleString)}b.appendChild(l)}}else if(C instanceof THREE.RenderableLine){x=C.v1;y=C.v2;x.positionScreen.x*=B;x.positionScreen.y*=-A;y.positionScreen.x*=B;y.positionScreen.y*=-A;u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(y.positionScreen.x,y.positionScreen.y);if(K.instersects(u)){N=0;for(H=C.materials.length;N<H;)if(L=C.materials[N++]){O=x;S=y;L=L;W=v++;if(j[W]==null){j[W]=document.createElementNS("http://www.w3.org/2000/svg","line");M==
- 0&&j[W].setAttribute("shape-rendering","crispEdges")}l=j[W];l.setAttribute("x1",O.positionScreen.x);l.setAttribute("y1",O.positionScreen.y);l.setAttribute("x2",S.positionScreen.x);l.setAttribute("y2",S.positionScreen.y);if(L instanceof THREE.LineBasicMaterial){F.__styleString=L.color.__styleString;l.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+L.linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.linecap+"; stroke-linejoin: "+L.linejoin);b.appendChild(l)}}}}else if(C instanceof
- THREE.RenderableFace3){x=C.v1;y=C.v2;w=C.v3;x.positionScreen.x*=B;x.positionScreen.y*=-A;y.positionScreen.x*=B;y.positionScreen.y*=-A;w.positionScreen.x*=B;w.positionScreen.y*=-A;u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(y.positionScreen.x,y.positionScreen.y);u.addPoint(w.positionScreen.x,w.positionScreen.y);if(K.instersects(u)){N=0;for(H=C.meshMaterials.length;N<H;){L=C.meshMaterials[N++];if(L instanceof THREE.MeshFaceMaterial){O=0;for(S=C.faceMaterials.length;O<S;)(L=C.faceMaterials[O++])&&
- c(x,y,w,C,L,J)}else L&&c(x,y,w,C,L,J)}}}else if(C instanceof THREE.RenderableFace4){x=C.v1;y=C.v2;w=C.v3;I=C.v4;x.positionScreen.x*=B;x.positionScreen.y*=-A;y.positionScreen.x*=B;y.positionScreen.y*=-A;w.positionScreen.x*=B;w.positionScreen.y*=-A;I.positionScreen.x*=B;I.positionScreen.y*=-A;u.addPoint(x.positionScreen.x,x.positionScreen.y);u.addPoint(y.positionScreen.x,y.positionScreen.y);u.addPoint(w.positionScreen.x,w.positionScreen.y);u.addPoint(I.positionScreen.x,I.positionScreen.y);if(K.instersects(u)){N=
- 0;for(H=C.meshMaterials.length;N<H;){L=C.meshMaterials[N++];if(L instanceof THREE.MeshFaceMaterial){O=0;for(S=C.faceMaterials.length;O<S;)(L=C.faceMaterials[O++])&&d(x,y,w,I,C,L,J)}else L&&d(x,y,w,I,C,L,J)}}}}}};
- THREE.WebGLRenderer=function(a){function c(e,q){e.fragment_shader=q.fragment_shader;e.vertex_shader=q.vertex_shader;e.uniforms=Uniforms.clone(q.uniforms)}function d(e){if(B!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);B=e.doubleSided}if(A!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);A=e.flipSided}}function f(e){if(e!=x){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,
- b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}x=e}}function k(e,q){var h;if(e=="fragment")h=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")h=b.createShader(b.VERTEX_SHADER);b.shaderSource(h,q);b.compileShader(h);if(!b.getShaderParameter(h,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(h));return null}return h}function m(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;
- case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;
- case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var r=document.createElement("canvas"),
- b,n=null,p=null,B=null,A=null,x=null,y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],w=new THREE.Matrix4,I=new Float32Array(16),K=new Float32Array(16),u=new THREE.Vector4,R=true,F=new THREE.Color(0),P=0;if(a){if(a.antialias!==undefined)R=a.antialias;a.clearColor!==undefined&&F.setHex(a.clearColor);if(a.clearAlpha!==undefined)P=a.clearAlpha}this.domElement=r;this.autoClear=true;(function(e,q,h){try{b=r.getContext("experimental-webgl",
- {antialias:e})}catch(g){console.log(g)}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(q.r,q.g,q.b,h);_cullEnabled=true})(R,F,P);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=
- function(e,q){r.width=e;r.height=q;b.viewport(0,0,r.width,r.height)};this.setClearColorHex=function(e,q){var h=new THREE.Color(e);b.clearColor(h.r,h.g,h.b,q)};this.setClearColor=function(e,q){b.clearColor(e.r,e.g,e.b,q)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(e,q){var h,g,o,i=0,t=0,j=0,l,s,z,v=this.lights,M=v.directional.colors,J=v.directional.positions,E=v.point.colors,U=v.point.positions,X=0,N=0;h=o=o=0;for(g=q.length;h<g;h++){o=q[h];l=o.color;
- s=o.position;z=o.intensity;if(o instanceof THREE.AmbientLight){i+=l.r;t+=l.g;j+=l.b}else if(o instanceof THREE.DirectionalLight){o=X*3;M[o]=l.r*z;M[o+1]=l.g*z;M[o+2]=l.b*z;J[o]=s.x;J[o+1]=s.y;J[o+2]=s.z;X+=1}else if(o instanceof THREE.PointLight){o=N*3;E[o]=l.r*z;E[o+1]=l.g*z;E[o+2]=l.b*z;U[o]=s.x;U[o+1]=s.y;U[o+2]=s.z;N+=1}}for(h=X*3;h<M.length;h++)M[h]=0;for(h=N*3;h<E.length;h++)E[h]=0;v.point.length=N;v.directional.length=X;v.ambient[0]=i;v.ambient[1]=t;v.ambient[2]=j};this.createParticleBuffers=
- function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLColorBuffer=b.createBuffer()};this.createLineBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLColorBuffer=b.createBuffer()};this.createMeshBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLNormalBuffer=b.createBuffer();e.__webGLTangentBuffer=b.createBuffer();e.__webGLColorBuffer=b.createBuffer();e.__webGLUVBuffer=b.createBuffer();e.__webGLUV2Buffer=b.createBuffer();e.__webGLFaceBuffer=b.createBuffer();
- e.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(e){var q=e.vertices.length;e.__vertexArray=new Float32Array(q*3);e.__colorArray=new Float32Array(q*3);e.__webGLLineCount=q};this.initParticleBuffers=function(e){var q=e.vertices.length;e.__vertexArray=new Float32Array(q*3);e.__colorArray=new Float32Array(q*3);e.__sortArray=[];e.__webGLParticleCount=q};this.initMeshBuffers=function(e,q){var h,g,o=0,i=0,t=0,j=q.geometry.faces,l=e.faces;h=0;for(g=l.length;h<g;h++){fi=l[h];face=j[fi];
- if(face instanceof THREE.Face3){o+=3;i+=1;t+=3}else if(face instanceof THREE.Face4){o+=4;i+=2;t+=4}}e.__vertexArray=new Float32Array(o*3);e.__normalArray=new Float32Array(o*3);e.__tangentArray=new Float32Array(o*4);e.__colorArray=new Float32Array(o*3);e.__uvArray=new Float32Array(o*2);e.__uv2Array=new Float32Array(o*2);e.__faceArray=new Uint16Array(i*3);e.__lineArray=new Uint16Array(t*2);o=false;h=0;for(g=q.materials.length;h<g;h++){j=q.materials[h];if(j instanceof THREE.MeshFaceMaterial){j=0;for(l=
- e.materials.length;j<l;j++)if(e.materials[j]&&e.materials[j].shading!=undefined&&e.materials[j].shading==THREE.SmoothShading){o=true;break}}else if(j&&j.shading!=undefined&&j.shading==THREE.SmoothShading){o=true;break}if(o)break}e.__needsSmoothNormals=o;e.__webGLFaceCount=i*3;e.__webGLLineCount=t*2};this.setMeshBuffers=function(e,q,h){var g,o,i,t,j,l,s,z,v,M,J=0,E=0,U=0,X=0,N=0,H=0,O=0,S=0,C=0,L=e.__vertexArray,W=e.__uvArray,ga=e.__uv2Array,da=e.__normalArray,Y=e.__tangentArray,ba=e.__colorArray,
- Z=e.__faceArray,ea=e.__lineArray,xa=e.__needsSmoothNormals,ha=q.geometry,ia=ha.__dirtyVertices,ta=ha.__dirtyElements,pa=ha.__dirtyUvs,qa=ha.__dirtyNormals,aa=ha.__dirtyTangents,na=ha.__dirtyColors,ka=ha.vertices,ya=e.faces,Ga=ha.faces,Ha=ha.uvs,Da=ha.uvs2,ma=ha.colors;q=0;for(g=ya.length;q<g;q++){o=ya[q];i=Ga[o];l=Ha[o];o=Da[o];t=i.vertexNormals;j=i.normal;if(i instanceof THREE.Face3){if(ia){s=ka[i.a].position;z=ka[i.b].position;v=ka[i.c].position;L[E]=s.x;L[E+1]=s.y;L[E+2]=s.z;L[E+3]=z.x;L[E+4]=
- z.y;L[E+5]=z.z;L[E+6]=v.x;L[E+7]=v.y;L[E+8]=v.z;E+=9}if(na&&ma.length){s=ma[i.a];z=ma[i.b];v=ma[i.c];ba[C]=s.r;ba[C+1]=s.g;ba[C+2]=s.b;ba[C+3]=z.r;ba[C+4]=z.g;ba[C+5]=z.b;ba[C+6]=v.r;ba[C+7]=v.g;ba[C+8]=v.b;C+=9}if(aa&&ha.hasTangents){s=ka[i.a].tangent;z=ka[i.b].tangent;v=ka[i.c].tangent;Y[O]=s.x;Y[O+1]=s.y;Y[O+2]=s.z;Y[O+3]=s.w;Y[O+4]=z.x;Y[O+5]=z.y;Y[O+6]=z.z;Y[O+7]=z.w;Y[O+8]=v.x;Y[O+9]=v.y;Y[O+10]=v.z;Y[O+11]=v.w;O+=12}if(qa)if(t.length==3&&xa)for(i=0;i<3;i++){j=t[i];da[H]=j.x;da[H+1]=j.y;da[H+
- 2]=j.z;H+=3}else for(i=0;i<3;i++){da[H]=j.x;da[H+1]=j.y;da[H+2]=j.z;H+=3}if(pa&&l)for(i=0;i<3;i++){t=l[i];W[U]=t.u;W[U+1]=t.v;U+=2}if(pa&&o)for(i=0;i<3;i++){l=o[i];ga[X]=l.u;ga[X+1]=l.v;X+=2}if(ta){Z[N]=J;Z[N+1]=J+1;Z[N+2]=J+2;N+=3;ea[S]=J;ea[S+1]=J+1;ea[S+2]=J;ea[S+3]=J+2;ea[S+4]=J+1;ea[S+5]=J+2;S+=6;J+=3}}else if(i instanceof THREE.Face4){if(ia){s=ka[i.a].position;z=ka[i.b].position;v=ka[i.c].position;M=ka[i.d].position;L[E]=s.x;L[E+1]=s.y;L[E+2]=s.z;L[E+3]=z.x;L[E+4]=z.y;L[E+5]=z.z;L[E+6]=v.x;
- L[E+7]=v.y;L[E+8]=v.z;L[E+9]=M.x;L[E+10]=M.y;L[E+11]=M.z;E+=12}if(na&&ma.length){s=ma[i.a];z=ma[i.b];v=ma[i.c];M=ma[i.d];ba[C]=s.r;ba[C+1]=s.g;ba[C+2]=s.b;ba[C+3]=z.r;ba[C+4]=z.g;ba[C+5]=z.b;ba[C+6]=v.r;ba[C+7]=v.g;ba[C+8]=v.b;ba[C+9]=M.r;ba[C+10]=M.g;ba[C+11]=M.b;C+=12}if(aa&&ha.hasTangents){s=ka[i.a].tangent;z=ka[i.b].tangent;v=ka[i.c].tangent;i=ka[i.d].tangent;Y[O]=s.x;Y[O+1]=s.y;Y[O+2]=s.z;Y[O+3]=s.w;Y[O+4]=z.x;Y[O+5]=z.y;Y[O+6]=z.z;Y[O+7]=z.w;Y[O+8]=v.x;Y[O+9]=v.y;Y[O+10]=v.z;Y[O+11]=v.w;Y[O+
- 12]=i.x;Y[O+13]=i.y;Y[O+14]=i.z;Y[O+15]=i.w;O+=16}if(qa)if(t.length==4&&xa)for(i=0;i<4;i++){j=t[i];da[H]=j.x;da[H+1]=j.y;da[H+2]=j.z;H+=3}else for(i=0;i<4;i++){da[H]=j.x;da[H+1]=j.y;da[H+2]=j.z;H+=3}if(pa&&l)for(i=0;i<4;i++){t=l[i];W[U]=t.u;W[U+1]=t.v;U+=2}if(pa&&o)for(i=0;i<4;i++){l=o[i];ga[X]=l.u;ga[X+1]=l.v;X+=2}if(ta){Z[N]=J;Z[N+1]=J+1;Z[N+2]=J+2;Z[N+3]=J;Z[N+4]=J+2;Z[N+5]=J+3;N+=6;ea[S]=J;ea[S+1]=J+1;ea[S+2]=J;ea[S+3]=J+3;ea[S+4]=J+1;ea[S+5]=J+2;ea[S+6]=J+2;ea[S+7]=J+3;S+=8;J+=4}}}if(ia){b.bindBuffer(b.ARRAY_BUFFER,
- e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,L,h)}if(na&&ma.length){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,ba,h)}if(qa){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,da,h)}if(aa&&ha.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Y,h)}if(pa&&U>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,W,h)}if(pa&&X>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUV2Buffer);
- b.bufferData(b.ARRAY_BUFFER,ga,h)}if(ta){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Z,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ea,h)}};this.setLineBuffers=function(e,q){var h,g,o,i=e.vertices,t=e.colors,j=i.length,l=t.length,s=e.__vertexArray,z=e.__colorArray,v=e.__dirtyColors;if(e.__dirtyVertices){for(h=0;h<j;h++){g=i[h].position;o=h*3;s[o]=g.x;s[o+1]=g.y;s[o+2]=g.z}b.bindBuffer(b.ARRAY_BUFFER,
- e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,s,q)}if(v){for(h=0;h<l;h++){color=t[h];o=h*3;z[o]=color.r;z[o+1]=color.g;z[o+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,z,q)}};this.setParticleBuffers=function(e,q,h){var g,o,i,t=e.vertices,j=t.length,l=e.colors,s=l.length,z=e.__vertexArray,v=e.__colorArray,M=e.__sortArray,J=e.__dirtyVertices,E=e.__dirtyColors;if(h.sortParticles){w.multiplySelf(h.matrix);for(g=0;g<j;g++){o=t[g].position;u.copy(o);w.multiplyVector3(u);
- M[g]=[u.z,g]}M.sort(function(U,X){return X[0]-U[0]});for(g=0;g<j;g++){o=t[M[g][1]].position;i=g*3;z[i]=o.x;z[i+1]=o.y;z[i+2]=o.z}for(g=0;g<s;g++){i=g*3;color=l[M[g][1]];v[i]=color.r;v[i+1]=color.g;v[i+2]=color.b}}else{if(J)for(g=0;g<j;g++){o=t[g].position;i=g*3;z[i]=o.x;z[i+1]=o.y;z[i+2]=o.z}if(E)for(g=0;g<s;g++){color=l[g];i=g*3;v[i]=color.r;v[i+1]=color.g;v[i+2]=color.b}}if(J||h.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,z,q)}if(E||h.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,
- e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,v,q)}};this.initMaterial=function(e,q,h){var g,o;if(e instanceof THREE.MeshDepthMaterial)c(e,THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)c(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)c(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)c(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)c(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)c(e,
- THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&c(e,THREE.ShaderLib.particle_basic);var i,t,j,l;o=j=l=0;for(i=q.length;o<i;o++){t=q[o];t instanceof THREE.DirectionalLight&&j++;t instanceof THREE.PointLight&&l++}if(l+j<=4){q=j;l=l}else{q=Math.ceil(4*j/(l+j));l=4-q}o={directional:q,point:l};l=e.fragment_shader;q=e.vertex_shader;i={fog:h,map:e.map,env_map:e.env_map,light_map:e.light_map,vertex_colors:e.vertex_colors,maxDirLights:o.directional,maxPointLights:o.point};h=b.createProgram();
- o=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,i.fog?"#define USE_FOG":"",i.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.env_map?"#define USE_ENVMAP":"",i.light_map?"#define USE_LIGHTMAP":"",i.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");i=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":
- "","#define MAX_DIR_LIGHTS "+i.maxDirLights,"#define MAX_POINT_LIGHTS "+i.maxPointLights,i.map?"#define USE_MAP":"",i.env_map?"#define USE_ENVMAP":"",i.light_map?"#define USE_LIGHTMAP":"",i.vertex_colors?"#define USE_COLOR":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");
- b.attachShader(h,k("fragment",o+l));b.attachShader(h,k("vertex",i+q));b.linkProgram(h);b.getProgramParameter(h,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(h,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");h.uniforms={};h.attributes={};e.program=h;h=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(g in e.uniforms)h.push(g);g=e.program;l=0;for(q=h.length;l<q;l++){o=h[l];g.uniforms[o]=b.getUniformLocation(g,
- o)}e=e.program;g=["position","normal","uv","uv2","tangent","color"];h=0;for(l=g.length;h<l;h++){q=g[h];e.attributes[q]=b.getAttribLocation(e,q)}};this.setProgram=function(e,q,h,g,o){g.program||this.initMaterial(g,q,h);var i=g.program,t=i.uniforms,j=g.uniforms;if(i!=n){b.useProgram(i);n=i;b.uniformMatrix4fv(t.projectionMatrix,false,I)}if(h&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof
- THREE.ParticleBasicMaterial)){j.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){j.fogNear.value=h.near;j.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)j.fogDensity.value=h.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){this.setupLights(i,q);q=this.lights;j.enableLighting.value=q.directional.length+q.point.length;j.ambientLightColor.value=q.ambient;j.directionalLightColor.value=q.directional.colors;j.directionalLightDirection.value=q.directional.positions;
- j.pointLightColor.value=q.point.colors;j.pointLightPosition.value=q.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){j.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);j.opacity.value=g.opacity;j.map.texture=g.map;j.light_map.texture=g.light_map;j.env_map.texture=g.env_map;j.reflectivity.value=g.reflectivity;j.refraction_ratio.value=g.refraction_ratio;j.combine.value=g.combine;j.useRefract.value=
- g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){j.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);j.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){j.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);j.opacity.value=g.opacity;j.size.value=g.size;j.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){j.ambient.value.setRGB(g.ambient.r,g.ambient.g,
- g.ambient.b);j.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);j.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){j.mNear.value=e.near;j.mFar.value=e.far;j.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)j.opacity.value=g.opacity;var l,s,z;for(l in j)if(z=i.uniforms[l]){h=j[l];s=h.type;q=h.value;if(s=="i")b.uniform1i(z,q);else if(s=="f")b.uniform1f(z,q);else if(s=="fv1")b.uniform1fv(z,q);else if(s=="fv")b.uniform3fv(z,q);else if(s=="v2")b.uniform2f(z,
- q.x,q.y);else if(s=="v3")b.uniform3f(z,q.x,q.y,q.z);else if(s=="c")b.uniform3f(z,q.r,q.g,q.b);else if(s=="t"){b.uniform1i(z,q);if(h=h.texture)if(h.image instanceof Array&&h.image.length==6){h=h;q=q;if(h.image.length==6){if(!h.image.__webGLTextureCube&&!h.image.__cubeMapInitialized&&h.image.loadCount==6){h.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,
- b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(s=0;s<6;++s)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,h.image[s]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);h.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+q);b.bindTexture(b.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube)}}else{h=h;q=q;if(!h.__webGLTexture&&
- h.image.loaded){h.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,h.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,h.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,m(h.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,m(h.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,m(h.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,m(h.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+
- q);b.bindTexture(b.TEXTURE_2D,h.__webGLTexture)}}}b.uniformMatrix4fv(t.modelViewMatrix,false,o._modelViewMatrixArray);b.uniformMatrix3fv(t.normalMatrix,false,o._normalMatrixArray);if(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.env_map)b.uniform3f(t.cameraPosition,e.position.x,e.position.y,e.position.z);if(g instanceof THREE.MeshShaderMaterial||g.env_map)b.uniformMatrix4fv(t.objectMatrix,false,o._objectMatrixArray);if(g instanceof THREE.MeshPhongMaterial||g instanceof
- THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial)b.uniformMatrix4fv(t.viewMatrix,false,K);return i};this.renderBuffer=function(e,q,h,g,o,i){e=this.setProgram(e,q,h,g,i).attributes;b.bindBuffer(b.ARRAY_BUFFER,o.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.position);if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.color)}if(e.normal>=
- 0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.normal)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.tangent)}if(e.uv>=0)if(o.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=
- 0)if(o.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(i instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);b.drawElements(b.LINES,o.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,o.__webGLFaceCount,b.UNSIGNED_SHORT,
- 0)}else if(i instanceof THREE.Line){i=i.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(i,0,o.__webGLLineCount)}else i instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,o.__webGLParticleCount)};this.renderPass=function(e,q,h,g,o,i,t){var j,l,s,z,v;s=0;for(z=g.materials.length;s<z;s++){j=g.materials[s];if(j instanceof THREE.MeshFaceMaterial){j=0;for(l=o.materials.length;j<l;j++)if((v=o.materials[j])&&v.blending==i&&v.opacity<1==t){f(v.blending);this.setDepthTest(v.depth_test);
- this.renderBuffer(e,q,h,v,o,g)}}else if((v=j)&&v.blending==i&&v.opacity<1==t){f(v.blending);this.setDepthTest(v.depth_test);this.renderBuffer(e,q,h,v,o,g)}}};this.renderPassImmediate=function(e,q,h,g,o,i){var t,j,l,s;t=0;for(j=g.materials.length;t<j;t++)if((l=g.materials[t])&&l.blending==o&&l.opacity<1==i){f(l.blending);this.setDepthTest(l.depth_test);s=this.setProgram(e,q,h,l,g);g.render(function(z){var v=s;if(!z.__webGLVertexBuffer)z.__webGLVertexBuffer=b.createBuffer();if(!z.__webGLNormalBuffer)z.__webGLNormalBuffer=
- b.createBuffer();if(z.hasPos){b.bindBuffer(b.ARRAY_BUFFER,z.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,z.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(v.attributes.position);b.vertexAttribPointer(v.attributes.position,3,b.FLOAT,false,0,0)}if(z.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,z.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,z.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(v.attributes.normal);b.vertexAttribPointer(v.attributes.normal,3,b.FLOAT,false,0,0)}b.drawArrays(b.TRIANGLES,
- 0,z.count);z.count=0})}};this.render=function(e,q,h,g){var o,i,t,j,l=e.lights,s=e.fog;q.autoUpdateMatrix&&q.updateMatrix();q.matrix.flattenToArray(K);q.projectionMatrix.flattenToArray(I);w.multiply(q.projectionMatrix,q.matrix);y[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);y[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);y[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);y[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);y[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,
- w.n44-w.n34);y[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(o=0;o<5;o++){j=y[o];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}this.initWebGLObjects(e,q);g=g!==undefined?g:true;if(h&&!h.__webGLFramebuffer){h.__webGLFramebuffer=b.createFramebuffer();h.__webGLRenderbuffer=b.createRenderbuffer();h.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,h.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,h.width,h.height);b.bindTexture(b.TEXTURE_2D,
- h.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,m(h.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,m(h.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,m(h.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,m(h.min_filter));b.texImage2D(b.TEXTURE_2D,0,m(h.format),h.width,h.height,0,m(h.format),m(h.type),null);b.bindFramebuffer(b.FRAMEBUFFER,h.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,h.__webGLTexture,0);
- b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,h.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(h){o=h.__webGLFramebuffer;j=h.width;t=h.height}else{o=null;j=r.width;t=r.height}if(o!=p){b.bindFramebuffer(b.FRAMEBUFFER,o);b.viewport(0,0,j,t);g&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);p=o}this.autoClear&&this.clear();o=e.__webGLObjects.length;for(g=0;g<o;g++){t=e.__webGLObjects[g];
- j=t.object;if(i=j.visible){if(!(i=!(j instanceof THREE.Mesh)))a:{i=void 0;for(var z=j.matrix,v=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),M=0;M<6;M++){i=y[M].x*z.n14+y[M].y*z.n24+y[M].z*z.n34+y[M].w;if(i<=v){i=false;break a}}i=true}i=i}if(i){if(j.autoUpdateMatrix){j.updateMatrix();j.matrix.flattenToArray(j._objectMatrixArray)}this.setupMatrices(j,q);t.render=true}else t.render=false}i=e.__webGLObjectsImmediate.length;for(g=0;g<i;g++){j=e.__webGLObjectsImmediate[g].object;
- if(j.visible){if(j.autoUpdateMatrix){j.updateMatrix();j.matrix.flattenToArray(j._objectMatrixArray)}this.setupMatrices(j,q)}}for(g=0;g<o;g++){t=e.__webGLObjects[g];if(t.render){j=t.object;t=t.buffer;d(j);this.renderPass(q,l,s,j,t,THREE.NormalBlending,false)}}for(g=0;g<i;g++){j=e.__webGLObjectsImmediate[g].object;if(j.visible){d(j);this.renderPassImmediate(q,l,s,j,THREE.NormalBlending,false)}}for(g=0;g<o;g++){t=e.__webGLObjects[g];if(t.render){j=t.object;t=t.buffer;d(j);this.renderPass(q,l,s,j,t,THREE.AdditiveBlending,
- false);this.renderPass(q,l,s,j,t,THREE.SubtractiveBlending,false);this.renderPass(q,l,s,j,t,THREE.AdditiveBlending,true);this.renderPass(q,l,s,j,t,THREE.SubtractiveBlending,true);this.renderPass(q,l,s,j,t,THREE.NormalBlending,true);this.renderPass(q,l,s,j,t,THREE.BillboardBlending,false)}}for(g=0;g<i;g++){j=e.__webGLObjectsImmediate[g].object;if(j.visible){d(j);this.renderPassImmediate(q,l,s,j,THREE.NormalBlending,true)}}if(h&&h.min_filter!==THREE.NearestFilter&&h.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,
- h.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(e,q){function h(v,M,J,E){if(v[M]==undefined){e.__webGLObjects.push({buffer:J,object:E});v[M]=1}}function g(v,M,J){if(v[M]==undefined){e.__webGLObjectsImmediate.push({object:J});v[M]=1}}var o,i,t,j,l,s,z;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={};e.__webGLObjectsImmediate=[]}o=0;for(i=e.objects.length;o<i;o++){t=e.objects[o];l=t.geometry;if(e.__webGLObjectsMap[t.id]==
- undefined){e.__webGLObjectsMap[t.id]={};t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrix.flattenToArray(t._objectMatrixArray)}z=e.__webGLObjectsMap[t.id];if(t instanceof THREE.Mesh){for(j in l.geometryChunks){s=l.geometryChunks[j];if(!s.__webGLVertexBuffer){this.createMeshBuffers(s);this.initMeshBuffers(s,t);l.__dirtyVertices=true;l.__dirtyElements=true;l.__dirtyUvs=true;l.__dirtyNormals=
- true;l.__dirtyTangents=true;l.__dirtyColors=true}if(l.__dirtyVertices||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents)this.setMeshBuffers(s,t,b.DYNAMIC_DRAW);h(z,j,s,t)}l.__dirtyVertices=false;l.__dirtyElements=false;l.__dirtyUvs=false;l.__dirtyNormals=false;l.__dirtyTangents=false;l.__dirtyColors=false}else if(t instanceof THREE.Line){if(!l.__webGLVertexBuffer){this.createLineBuffers(l);this.initLineBuffers(l);l.__dirtyVertices=true;l.__dirtyColors=true}if(l.__dirtyVertices||
- l.__dirtyColors)this.setLineBuffers(l,b.DYNAMIC_DRAW);h(z,0,l,t);l.__dirtyVertices=false;l.__dirtyColors=false}else if(t instanceof THREE.ParticleSystem){if(!l.__webGLVertexBuffer){this.createParticleBuffers(l);this.initParticleBuffers(l);l.__dirtyVertices=true;l.__dirtyColors=true}if(l.__dirtyVertices||l.__dirtyColors||t.sortParticles)this.setParticleBuffers(l,b.DYNAMIC_DRAW,t,q);h(z,0,l,t);l.__dirtyVertices=false;l.__dirtyColors=false}else t instanceof THREE.MarchingCubes&&g(z,0,t)}};this.removeObject=
- function(e,q){var h,g;for(h=e.__webGLObjects.length-1;h>=0;h--){g=e.__webGLObjects[h].object;q==g&&e.__webGLObjects.splice(h,1)}};this.setupMatrices=function(e,q){e._modelViewMatrix.multiplyToArray(q.matrix,e.matrix,e._modelViewMatrixArray);e._normalMatrix=THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)};this.setDepthTest=function(e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setFaceCulling=function(e,q){if(e){!q||q=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);
- if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
- THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float 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_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
- lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,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:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
- value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\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 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
- THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
- "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
- THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
- THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"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 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
- THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
- THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.Snippets.lights_vertex,
- "gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,
- "void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.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};
|