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