diff --git a/build/Three.js b/build/Three.js index 66c75e41..29d1f21e 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,6 +1,6 @@ // Three.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,i,b,q,r,k;if(d==0)e=i=b=0;else{q=Math.floor(a*6);r=a*6-q;a=d*(1-c);k=d*(1-c*r);c=d*(1-c*(1-r));switch(q){case 1:e=k;i=d;b=a;break;case 2:e=a;i=d;b=c;break;case 3:e=a;i=k;b=d;break;case 4:e=c;i=a;b=d;break;case 5:e=d;i=a;b=k;break;case 6:case 0:e=d;i=c;b=a}}this.r=e;this.g=i;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,h,b,q,r,l;if(d==0)e=h=b=0;else{q=Math.floor(a*6);r=a*6-q;a=d*(1-c);l=d*(1-c*r);c=d*(1-c*(1-r));switch(q){case 1:e=l;h=d;b=a;break;case 2:e=a;h=d;b=c;break;case 3:e=a;h=l;b=d;break;case 4:e=c;h=a;b=d;break;case 5:e=d;h=a;b=l;break;case 6:case 0:e=d;h=c;b=a}}this.r=e;this.g=h;this.b=b;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* @@ -13,55 +13,55 @@ THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,i=[];a=0;for(c=e.length;a0&&J>0&&j+J<1}var d,e,i,b,q,r,k,m,y,x, -v,w=a.geometry,F=w.vertices,I=[];d=0;for(e=w.faces.length;dk?e:k;i=i>m? -i:m}a()};this.add3Points=function(k,m,y,x,v,w){if(r){r=false;c=ky?k>v?k:v:y>v?y:v;i=m>x?m>w?m:w:x>w?x:w}else{c=ky?k>v?k>e?k:e:v>e?v:e:y>v?y>e?y:e:v>e?v:e;i=m>x?m>w?m>i?m:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(k){if(r){r=false;c=k.getLeft();d=k.getTop();e=k.getRight();i=k.getBottom()}else{c=ck.getRight()?e:k.getRight();i=i>k.getBottom()?i:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;i+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e=0&&Math.min(i,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){r=true;i=e=d=c=0;a()};this.isEmpty=function(){return r};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+q+" )"}};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}}; -THREE.Matrix4=function(a,c,d,e,i,b,q,r,k,m,y,x,v,w,F,I){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=q||0;this.n24=r||0;this.n31=k||0;this.n32=m||0;this.n33=y||1;this.n34=x||0;this.n41=v||0;this.n42=w||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,i,b,q,r,k,m,y,x,v,w,F,I){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=q;this.n24=r;this.n31=k;this.n32=m;this.n33=y;this.n34=x;this.n41=v;this.n42=w;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); -this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23* -e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+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 d=a.n11,e=a.n12,i=a.n13,b=a.n14,q=a.n21,r=a.n22,k=a.n23,m=a.n24,y=a.n31, -x=a.n32,v=a.n33,w=a.n34,F=a.n41,I=a.n42,J=a.n43,t=a.n44,T=c.n11,E=c.n12,f=c.n13,j=c.n14,h=c.n21,g=c.n22,n=c.n23,l=c.n24,p=c.n31,o=c.n32,s=c.n33,u=c.n34,z=c.n41,G=c.n42,H=c.n43,L=c.n44;this.n11=d*T+e*h+i*p+b*z;this.n12=d*E+e*g+i*o+b*G;this.n13=d*f+e*n+i*s+b*H;this.n14=d*j+e*l+i*u+b*L;this.n21=q*T+r*h+k*p+m*z;this.n22=q*E+r*g+k*o+m*G;this.n23=q*f+r*n+k*s+m*H;this.n24=q*j+r*l+k*u+m*L;this.n31=y*T+x*h+v*p+w*z;this.n32=y*E+x*g+v*o+w*G;this.n33=y*f+x*n+v*s+w*H;this.n34=y*j+x*l+v*u+w*L;this.n41=F*T+I*h+ -J*p+t*z;this.n42=F*E+I*g+J*o+t*G;this.n43=F*f+I*n+J*s+t*H;this.n44=F*j+I*l+J*u+t*L;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,q=this.n22,r=this.n23,k=this.n24,m=this.n31,y=this.n32,x=this.n33,v=this.n34,w=this.n41,F=this.n42,I=this.n43,J=this.n44,t=a.n11,T=a.n21,E=a.n31,f=a.n41,j=a.n12,h=a.n22,g=a.n32,n=a.n42,l=a.n13,p=a.n23,o=a.n33,s=a.n43,u=a.n14,z=a.n24,G=a.n34;a=a.n44;this.n11=c*t+d*T+e*E+i*f;this.n12=c*j+d*h+e*g+i*n;this.n13=c*l+d*p+e*o+i* -s;this.n14=c*u+d*z+e*G+i*a;this.n21=b*t+q*T+r*E+k*f;this.n22=b*j+q*h+r*g+k*n;this.n23=b*l+q*p+r*o+k*s;this.n24=b*u+q*z+r*G+k*a;this.n31=m*t+y*T+x*E+v*f;this.n32=m*j+y*h+x*g+v*n;this.n33=m*l+y*p+x*o+v*s;this.n34=m*u+y*z+x*G+v*a;this.n41=w*t+F*T+I*E+J*f;this.n42=w*j+F*h+I*g+J*n;this.n43=w*l+F*p+I*o+J*s;this.n44=w*u+F*z+I*G+J*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= -a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,q=this.n23,r=this.n24,k=this.n31,m=this.n32,y=this.n33,x=this.n34,v=this.n41,w=this.n42,F=this.n43,I=this.n44;return e*q*m*v-d*r*m*v-e*b*y*v+c*r*y*v+d*b*x*v-c*q*x*v-e*q*k*w+d*r*k*w+e*i*y*w-a*r*y*w-d*i*x*w+a*q*x*w+e*b*k*F-c*r*k*F-e*i*m*F+a*r*m*F+c*i*x*F-a*b*x*F-d*b*k*I+c*q*k*I+d*i*m*I-a*q*m*I-c*i*y*I+a*b*y*I},transpose:function(){function a(c,d, -e){var i=c[d];c[d]=c[e];c[e]=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; +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a0&&L>0&&k+L<1}var d,e,h,b,q,r,l,n,y,x, +v,w=a.geometry,G=w.vertices,K=[];d=0;for(e=w.faces.length;dl?e:l;h=h>n? +h:n}a()};this.add3Points=function(l,n,y,x,v,w){if(r){r=false;c=ly?l>v?l:v:y>v?y:v;h=n>x?n>w?n:w:x>w?x:w}else{c=ly?l>v?l>e?l:e:v>e?v:e:y>v?y>e?y:e:v>e?v:e;h=n>x?n>w?n>h?n:h:w>h?w:h:x>w?x>h?x:h:w>h?w:h}a()};this.addRectangle=function(l){if(r){r=false;c=l.getLeft();d=l.getTop();e=l.getRight();h=l.getBottom()}else{c=cl.getRight()?e:l.getRight();h=h>l.getBottom()?h:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;e+=l;h+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();e=e=0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){r=true;h=e=d=c=0;a()};this.isEmpty=function(){return r};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+h+", width: "+b+", height: "+q+" )"}};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}}; +THREE.Matrix4=function(a,c,d,e,h,b,q,r,l,n,y,x,v,w,G,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=h||0;this.n22=b||1;this.n23=q||0;this.n24=r||0;this.n31=l||0;this.n32=n||0;this.n33=y||1;this.n34=x||0;this.n41=v||0;this.n42=w||0;this.n43=G||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,d,e,h,b,q,r,l,n,y,x,v,w,G,K){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=b;this.n23=q;this.n24=r;this.n31=l;this.n32=n;this.n33=y;this.n34=x;this.n41=v;this.n42=w;this.n43=G;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,d){var e=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();h.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23* +e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,b=a.n14,q=a.n21,r=a.n22,l=a.n23,n=a.n24,y=a.n31, +x=a.n32,v=a.n33,w=a.n34,G=a.n41,K=a.n42,L=a.n43,t=a.n44,T=c.n11,E=c.n12,f=c.n13,k=c.n14,i=c.n21,g=c.n22,m=c.n23,j=c.n24,o=c.n31,p=c.n32,s=c.n33,u=c.n34,z=c.n41,H=c.n42,F=c.n43,I=c.n44;this.n11=d*T+e*i+h*o+b*z;this.n12=d*E+e*g+h*p+b*H;this.n13=d*f+e*m+h*s+b*F;this.n14=d*k+e*j+h*u+b*I;this.n21=q*T+r*i+l*o+n*z;this.n22=q*E+r*g+l*p+n*H;this.n23=q*f+r*m+l*s+n*F;this.n24=q*k+r*j+l*u+n*I;this.n31=y*T+x*i+v*o+w*z;this.n32=y*E+x*g+v*p+w*H;this.n33=y*f+x*m+v*s+w*F;this.n34=y*k+x*j+v*u+w*I;this.n41=G*T+K*i+ +L*o+t*z;this.n42=G*E+K*g+L*p+t*H;this.n43=G*f+K*m+L*s+t*F;this.n44=G*k+K*j+L*u+t*I;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,h=this.n14,b=this.n21,q=this.n22,r=this.n23,l=this.n24,n=this.n31,y=this.n32,x=this.n33,v=this.n34,w=this.n41,G=this.n42,K=this.n43,L=this.n44,t=a.n11,T=a.n21,E=a.n31,f=a.n41,k=a.n12,i=a.n22,g=a.n32,m=a.n42,j=a.n13,o=a.n23,p=a.n33,s=a.n43,u=a.n14,z=a.n24,H=a.n34;a=a.n44;this.n11=c*t+d*T+e*E+h*f;this.n12=c*k+d*i+e*g+h*m;this.n13=c*j+d*o+e*p+h* +s;this.n14=c*u+d*z+e*H+h*a;this.n21=b*t+q*T+r*E+l*f;this.n22=b*k+q*i+r*g+l*m;this.n23=b*j+q*o+r*p+l*s;this.n24=b*u+q*z+r*H+l*a;this.n31=n*t+y*T+x*E+v*f;this.n32=n*k+y*i+x*g+v*m;this.n33=n*j+y*o+x*p+v*s;this.n34=n*u+y*z+x*H+v*a;this.n41=w*t+G*T+K*E+L*f;this.n42=w*k+G*i+K*g+L*m;this.n43=w*j+G*o+K*p+L*s;this.n44=w*u+G*z+K*H+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,d=this.n13,e=this.n14,h=this.n21,b=this.n22,q=this.n23,r=this.n24,l=this.n31,n=this.n32,y=this.n33,x=this.n34,v=this.n41,w=this.n42,G=this.n43,K=this.n44;return e*q*n*v-d*r*n*v-e*b*y*v+c*r*y*v+d*b*x*v-c*q*x*v-e*q*l*w+d*r*l*w+e*h*y*w-a*r*y*w-d*h*x*w+a*q*x*w+e*b*l*G-c*r*l*G-e*h*n*G+a*r*n*G+c*h*x*G-a*b*x*G-d*b*l*K+c*q*l*K+d*h*n*K-a*q*n*K-c*h*y*K+a*b*y*K},transpose:function(){function a(c,d, +e){var h=c[d];c[d]=c[e];c[e]=h}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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,q=a.y,r=a.z,k=i*b,m=i*q;this.set(k*b+d,k*q-e*r,k*r+e*q,0,k*q+e*r,m*q+d,m*r-e*b,0,k*r-e*q,m*r+e*b,i*r*r+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,b=a.x,q=a.y,r=a.z,l=h*b,n=h*q;this.set(l*b+d,l*q-e*r,l*r+e*q,0,l*q+e*r,n*q+d,n*r-e*b,0,l*r-e*q,n*r+e*b,h*r*r+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,q=a.n22,r=a.n23,k=a.n24,m=a.n31,y=a.n32,x=a.n33,v=a.n34,w=a.n41,F=a.n42,I=a.n43,J=a.n44,t=new THREE.Matrix4;t.n11=r*v*F-k*x*F+k*y*I-q*v*I-r*y*J+q*x*J;t.n12=i*x*F-e*v*F-i*y*I+d*v*I+e*y*J-d*x*J;t.n13=e*k*F-i*r*F+i*q*I-d*k*I-e*q*J+d*r*J;t.n14=i*r*y-e*k*y-i*q*x+d*k*x+e*q*v-d*r*v;t.n21=k*x*w-r*v*w-k*m*I+b*v*I+r*m*J-b*x*J;t.n22=e*v*w-i*x*w+i*m*I-c*v*I-e*m*J+c*x*J;t.n23=i*r*w-e*k*w-i*b*I+c*k*I+e*b*J-c*r*J;t.n24=e*k*m-i*r*m+ -i*b*x-c*k*x-e*b*v+c*r*v;t.n31=q*v*w-k*y*w+k*m*F-b*v*F-q*m*J+b*y*J;t.n32=i*y*w-d*v*w-i*m*F+c*v*F+d*m*J-c*y*J;t.n33=e*k*w-i*q*w+i*b*F-c*k*F-d*b*J+c*q*J;t.n34=i*q*m-d*k*m-i*b*y+c*k*y+d*b*v-c*q*v;t.n41=r*y*w-q*x*w-r*m*F+b*x*F+q*m*I-b*y*I;t.n42=d*x*w-e*y*w+e*m*F-c*x*F-d*m*I+c*y*I;t.n43=e*q*w-d*r*w-e*b*F+c*r*F+d*b*I-c*q*I;t.n44=d*r*m-e*q*m+e*b*y-c*r*y-d*b*x+c*q*x;t.multiplyScalar(1/a.determinant());return t}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*q+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*q;d[4]=c*r;d[5]=c*k;d[6]=c*m;d[7]=c*y;d[8]=c*x;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var q,r,k;q=new THREE.Matrix4;r=2*i/(c-a);k=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);q.n11=r;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=k;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=e;q.n34=i;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var q,r,k,m;q=new THREE.Matrix4;r=c-a;k=d-e;m=b-i;a=(c+a)/r;d=(d+e)/k;i=(b+i)/m;q.n11=2/r;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/k;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/m;q.n34=-i;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,b=a.n21,q=a.n22,r=a.n23,l=a.n24,n=a.n31,y=a.n32,x=a.n33,v=a.n34,w=a.n41,G=a.n42,K=a.n43,L=a.n44,t=new THREE.Matrix4;t.n11=r*v*G-l*x*G+l*y*K-q*v*K-r*y*L+q*x*L;t.n12=h*x*G-e*v*G-h*y*K+d*v*K+e*y*L-d*x*L;t.n13=e*l*G-h*r*G+h*q*K-d*l*K-e*q*L+d*r*L;t.n14=h*r*y-e*l*y-h*q*x+d*l*x+e*q*v-d*r*v;t.n21=l*x*w-r*v*w-l*n*K+b*v*K+r*n*L-b*x*L;t.n22=e*v*w-h*x*w+h*n*K-c*v*K-e*n*L+c*x*L;t.n23=h*r*w-e*l*w-h*b*K+c*l*K+e*b*L-c*r*L;t.n24=e*l*n-h*r*n+ +h*b*x-c*l*x-e*b*v+c*r*v;t.n31=q*v*w-l*y*w+l*n*G-b*v*G-q*n*L+b*y*L;t.n32=h*y*w-d*v*w-h*n*G+c*v*G+d*n*L-c*y*L;t.n33=e*l*w-h*q*w+h*b*G-c*l*G-d*b*L+c*q*L;t.n34=h*q*n-d*l*n-h*b*y+c*l*y+d*b*v-c*q*v;t.n41=r*y*w-q*x*w-r*n*G+b*x*G+q*n*K-b*y*K;t.n42=d*x*w-e*y*w+e*n*G-c*x*G-d*n*K+c*y*K;t.n43=e*q*w-d*r*w-e*b*G+c*r*G+d*b*K-c*q*K;t.n44=d*r*n-e*q*n+e*b*y-c*r*y-d*b*x+c*q*x;t.multiplyScalar(1/a.determinant());return t}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],h=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],n=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*q+c[2]*n;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*h;d[2]=c*b;d[3]=c*q;d[4]=c*r;d[5]=c*l;d[6]=c*n;d[7]=c*y;d[8]=c*x;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,h,b){var q,r,l;q=new THREE.Matrix4;r=2*h/(c-a);l=2*h/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+h)/(b-h);h=-2*b*h/(b-h);q.n11=r;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=e;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,h,b){var q,r,l,n;q=new THREE.Matrix4;r=c-a;l=d-e;n=b-h;a=(c+a)/r;d=(d+e)/l;h=(b+h)/n;q.n11=2/r;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/n;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};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.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; +THREE.Face3=function(a,c,d,e,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,e,h,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(u,z,H,F,I,M,N){b=u.vertices[z].position;q=u.vertices[H].position;r=u.vertices[F].position;l=h[I];n=h[M];y=h[N];x=q.x-b.x;v=r.x-b.x;w=q.y-b.y;G=r.y-b.y; +K=q.z-b.z;L=r.z-b.z;t=n.u-l.u;T=y.u-l.u;E=n.v-l.v;f=y.v-l.v;k=1/(t*f-T*E);m.set((f*x-E*v)*k,(f*w-E*G)*k,(f*K-E*L)*k);j.set((t*v-T*x)*k,(t*G-T*w)*k,(t*L-T*K)*k);i[z].addSelf(m);i[H].addSelf(m);i[F].addSelf(m);g[z].addSelf(j);g[H].addSelf(j);g[F].addSelf(j)}var c,d,e,h,b,q,r,l,n,y,x,v,w,G,K,L,t,T,E,f,k,i=[],g=[],m=new THREE.Vector3,j=new THREE.Vector3,o=new THREE.Vector3,p=new THREE.Vector3,s=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[r].counter+=1;k=m[r].hash+"_"+m[r].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:q,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){n[r].counter+=1;l=n[r].hash+"_"+n[r].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(e);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(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=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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.colors=[];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}}; @@ -87,126 +87,129 @@ THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShadi THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!== undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; -THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending}}; -THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
)"}}; +THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.vertex_colors=false;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; +THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
vertex_colors: "+this.vertex_colors+"
)"}}; 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 (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,h,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=b!==undefined?b: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 (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,d,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c=0&&s>=0&&u>=0&&z>=0)return true;else if(o<0&&s<0||u<0&&z<0)return false;else{if(o<0)l=Math.max(l,o/(o-s));else if(s<0)p=Math.min(p,o/(o-s));if(u<0)l=Math.max(l,u/(u-z));else if(z<0)p=Math.min(p,u/(u-z));if(po&&H.z0&&J.z<1){v=F[w]=F[w]||new THREE.RenderableParticle;v.x=J.x/J.w;v.y=J.y/J.w;v.z=J.z;v.rotation=M.rotation.z;v.scale.x=M.scale.x*Math.abs(v.x-(J.x+n.projectionMatrix.n11)/(J.w+n.projectionMatrix.n14)); -v.scale.y=M.scale.y*Math.abs(v.y-(J.y+n.projectionMatrix.n22)/(J.w+n.projectionMatrix.n24));v.materials=M.materials;p.push(v);w++}}}}l&&p.sort(a);return p};this.unprojectVector=function(g,n){var l=THREE.Matrix4.makeInvert(n.matrix);l.multiplySelf(THREE.Matrix4.makeInvert(n.projectionMatrix));l.multiplyVector3(g);return g}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(q,r){d=q;e=r;i=d/2;b=e/2};this.render=function(q,r){var k,m,y,x,v,w,F,I;a=c.projectScene(q,r);k=0;for(m=a.length;k=0&&s>=0&&u>=0&&z>=0)return true;else if(p<0&&s<0||u<0&&z<0)return false;else{if(p<0)j=Math.max(j,p/(p-s));else if(s<0)o=Math.min(o,p/(p-s));if(u<0)j=Math.max(j,u/(u-z));else if(z<0)o=Math.min(o,u/(u-z));if(op&&F.z0&&L.z<1){v=G[w]=G[w]||new THREE.RenderableParticle;v.x=L.x/L.w;v.y=L.y/L.w;v.z=L.z;v.rotation=N.rotation.z;v.scale.x=N.scale.x*Math.abs(v.x-(L.x+m.projectionMatrix.n11)/(L.w+m.projectionMatrix.n14)); +v.scale.y=N.scale.y*Math.abs(v.y-(L.y+m.projectionMatrix.n22)/(L.w+m.projectionMatrix.n24));v.materials=N.materials;o.push(v);w++}}}}j&&o.sort(a);return o};this.unprojectVector=function(g,m){var j=THREE.Matrix4.makeInvert(m.matrix);j.multiplySelf(THREE.Matrix4.makeInvert(m.projectionMatrix));j.multiplyVector3(g);return g}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,h,b;this.domElement=document.createElement("div");this.setSize=function(q,r){d=q;e=r;h=d/2;b=e/2};this.render=function(q,r){var l,n,y,x,v,w,G,K;a=c.projectScene(q,r);l=0;for(n=a.length;l0){D.r+=da.r*$;D.g+=da.g*$;D.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($>0){D.r+=da.r*$;D.g+=da.g*$;D.b+=da.b*$}}}}function Na(A,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending); -var D,P,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;P=X.scale.x*r;$=X.scale.y*k;S=P*ha;D=$*ia;C.set(A.x-S,A.y-D,A.x+S,A.y+D);if(R.instersects(C)){m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(P,-$);m.translate(-ha,-ia);m.drawImage(da,0,0);m.restore()}}}else if(S instanceof THREE.ParticleCircleMaterial){if(Q){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;p.r=S.color.r*U.r;p.g=S.color.g*U.g; -p.b=S.color.b*U.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;S=X.scale.x*r;D=X.scale.y*k;C.set(A.x-S,A.y-D,A.x+S,A.y+D);if(R.instersects(C)){P=p.__styleString;if(I!=P)m.fillStyle=I=P;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(S,D);m.beginPath();m.arc(0,0,1,0,za,true);m.closePath();m.fill();m.restore()}}}}function Oa(A,X,S,D){if(D.opacity!=0){a(D.opacity);c(D.blending);m.beginPath();m.moveTo(A.positionScreen.x,A.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y); -m.closePath();if(D instanceof THREE.LineBasicMaterial){p.__styleString=D.color.__styleString;A=D.linewidth;if(J!=A)m.lineWidth=J=A;A=p.__styleString;if(F!=A)m.strokeStyle=F=A;m.stroke();C.inflate(D.linewidth*2)}}}function Ja(A,X,S,D,P,$){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;j=A.positionScreen.y;h=X.positionScreen.x;g=X.positionScreen.y;n=S.positionScreen.x;l=S.positionScreen.y;m.beginPath();m.moveTo(f,j);m.lineTo(h,g);m.lineTo(n,l);m.lineTo(f,j);m.closePath();if(P instanceof -THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&wa(f,j,h,g,n,l,P.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=la.matrix;Z.copy(D.vertexNormalsWorld[0]);N=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;M=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5; -W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[2]);K=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(f,j,h,g,n,l,P.env_map.image,N,M,V,W,K,B)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof THREE.UVMapping&&wa(f,j,h,g,n,l,P.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v); -c(THREE.SubtractiveBlending)}if(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==3){o.r=s.r=u.r=Y.r;o.g=s.g=u.g=Y.g;o.b=s.b=u.b=Y.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],o);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],s);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],u);z.r=(s.r+u.r)*0.5;z.g=(s.g+u.g)*0.5;z.b=(s.b+u.b)*0.5;L=Ka(o,s,u,z);wa(f,j,h,g,n,l,L,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,D.centroidWorld,D.normalWorld,U);p.r=P.color.r*U.r;p.g= -P.color.g*U.g;p.b=P.color.b*U.b;p.updateStyleString();P.wireframe?Ba(p.__styleString,P.wireframe_linewidth):Ca(p.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){G=la.near;H=la.far;o.r=o.g=o.b=1-Fa(A.positionScreen.z,G,H);s.r=s.g=s.b=1-Fa(X.positionScreen.z,G,H);u.r=u.g=u.b=1-Fa(S.positionScreen.z,G,H);z.r=(s.r+u.r)*0.5;z.g=(s.g+u.g)*0.5;z.b=(s.b+u.b)*0.5;L=Ka(o,s,u,z);wa(f,j,h,g,n,l,L,0,0,1,0,0, -1)}else if(P instanceof THREE.MeshNormalMaterial){p.r=Ga(D.normalWorld.x);p.g=Ga(D.normalWorld.y);p.b=Ga(D.normalWorld.z);p.updateStyleString();P.wireframe?Ba(p.__styleString,P.wireframe_linewidth):Ca(p.__styleString)}}}function Ba(A,X){if(F!=A)m.strokeStyle=F=A;if(J!=X)m.lineWidth=J=X;m.stroke();C.inflate(X*2)}function Ca(A){if(I!=A)m.fillStyle=I=A;m.fill()}function wa(A,X,S,D,P,$,da,ha,ia,ra,ja,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ja*=ta;sa*=ua;xa*=ta;S-=A;D-=X;P-= -A;$-=X;ra-=ha;ja-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ja);ua=(xa*S-ja*P)*ta;ja=(xa*D-ja*$)*ta;S=(ra*P-sa*S)*ta;D=(ra*$-sa*D)*ta;A=A-ua*ha-S*ia;X=X-ja*ha-D*ia;m.save();m.transform(ua,ja,S,D,A,X);m.clip();m.drawImage(da,0,0);m.restore()}function Ka(A,X,S,D){var P=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255),ra=~~(S.g*255);S=~~(S.b*255);var ja=~~(D.r*255),sa=~~(D.g*255);D=~~(D.b*255);ga[0]=P<0?0:P>255?255:P;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0: +var D,P,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;P=X.scale.x*r;$=X.scale.y*l;S=P*ha;D=$*ia;C.set(A.x-S,A.y-D,A.x+S,A.y+D);if(R.instersects(C)){n.save();n.translate(A.x,A.y);n.rotate(-X.rotation);n.scale(P,-$);n.translate(-ha,-ia);n.drawImage(da,0,0);n.restore()}}}else if(S instanceof THREE.ParticleCircleMaterial){if(Q){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;o.r=S.color.r*U.r;o.g=S.color.g*U.g; +o.b=S.color.b*U.b;o.updateStyleString()}else o.__styleString=S.color.__styleString;S=X.scale.x*r;D=X.scale.y*l;C.set(A.x-S,A.y-D,A.x+S,A.y+D);if(R.instersects(C)){P=o.__styleString;if(K!=P)n.fillStyle=K=P;n.save();n.translate(A.x,A.y);n.rotate(-X.rotation);n.scale(S,D);n.beginPath();n.arc(0,0,1,0,za,true);n.closePath();n.fill();n.restore()}}}}function Oa(A,X,S,D){if(D.opacity!=0){a(D.opacity);c(D.blending);n.beginPath();n.moveTo(A.positionScreen.x,A.positionScreen.y);n.lineTo(X.positionScreen.x,X.positionScreen.y); +n.closePath();if(D instanceof THREE.LineBasicMaterial){o.__styleString=D.color.__styleString;A=D.linewidth;if(L!=A)n.lineWidth=L=A;A=o.__styleString;if(G!=A)n.strokeStyle=G=A;n.stroke();C.inflate(D.linewidth*2)}}}function Ja(A,X,S,D,P,$){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;k=A.positionScreen.y;i=X.positionScreen.x;g=X.positionScreen.y;m=S.positionScreen.x;j=S.positionScreen.y;n.beginPath();n.moveTo(f,k);n.lineTo(i,g);n.lineTo(m,j);n.lineTo(f,k);n.closePath();if(P instanceof +THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&wa(f,k,i,g,m,j,P.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=la.matrix;Z.copy(D.vertexNormalsWorld[0]);M=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;N=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5; +W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[2]);J=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(f,k,i,g,m,j,P.env_map.image,M,N,V,W,J,B)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof THREE.UVMapping&&wa(f,k,i,g,m,j,P.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v); +c(THREE.SubtractiveBlending)}if(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==3){p.r=s.r=u.r=Y.r;p.g=s.g=u.g=Y.g;p.b=s.b=u.b=Y.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],p);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],s);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],u);z.r=(s.r+u.r)*0.5;z.g=(s.g+u.g)*0.5;z.b=(s.b+u.b)*0.5;I=Ka(p,s,u,z);wa(f,k,i,g,m,j,I,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,D.centroidWorld,D.normalWorld,U);o.r=P.color.r*U.r;o.g= +P.color.g*U.g;o.b=P.color.b*U.b;o.updateStyleString();P.wireframe?Ba(o.__styleString,P.wireframe_linewidth):Ca(o.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){H=la.near;F=la.far;p.r=p.g=p.b=1-Fa(A.positionScreen.z,H,F);s.r=s.g=s.b=1-Fa(X.positionScreen.z,H,F);u.r=u.g=u.b=1-Fa(S.positionScreen.z,H,F);z.r=(s.r+u.r)*0.5;z.g=(s.g+u.g)*0.5;z.b=(s.b+u.b)*0.5;I=Ka(p,s,u,z);wa(f,k,i,g,m,j,I,0,0,1,0,0, +1)}else if(P instanceof THREE.MeshNormalMaterial){o.r=Ga(D.normalWorld.x);o.g=Ga(D.normalWorld.y);o.b=Ga(D.normalWorld.z);o.updateStyleString();P.wireframe?Ba(o.__styleString,P.wireframe_linewidth):Ca(o.__styleString)}}}function Ba(A,X){if(G!=A)n.strokeStyle=G=A;if(L!=X)n.lineWidth=L=X;n.stroke();C.inflate(X*2)}function Ca(A){if(K!=A)n.fillStyle=K=A;n.fill()}function wa(A,X,S,D,P,$,da,ha,ia,ra,ja,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ja*=ta;sa*=ua;xa*=ta;S-=A;D-=X;P-= +A;$-=X;ra-=ha;ja-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ja);ua=(xa*S-ja*P)*ta;ja=(xa*D-ja*$)*ta;S=(ra*P-sa*S)*ta;D=(ra*$-sa*D)*ta;A=A-ua*ha-S*ia;X=X-ja*ha-D*ia;n.save();n.transform(ua,ja,S,D,A,X);n.clip();n.drawImage(da,0,0);n.restore()}function Ka(A,X,S,D){var P=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255),ra=~~(S.g*255);S=~~(S.b*255);var ja=~~(D.r*255),sa=~~(D.g*255);D=~~(D.b*255);ga[0]=P<0?0:P>255?255:P;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0: A>255?255:A;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ja<0?0:ja>255?255:ja;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=D<0?0:D>255?255:D;oa.putImageData(ka,0,0);ea.drawImage(na,0,0);return pa}function Fa(A,X,S){A=(A-X)/(S-X);return A*A*(3-2*A)}function Ga(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A,X){var S=X.x-A.x,D=X.y-A.y,P=1/Math.sqrt(S*S+D*D);S*=P;D*=P;X.x+=S;X.y+=D;A.x-=S;A.y-= -D}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():m.setTransform(1,0,0,-1,r,k);d=e.projectScene(ca,la,this.sortElements);(Q=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}else if(B instanceof THREE.PointLight){l.sub(B.position,M.centroidWorld);l.normalize();R=M.normalWorld.dot(l)*B.intensity;if(R>0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}}}function c(N,M,V,W,K,B){u=e(z++);u.setAttribute("d","M "+N.positionScreen.x+ -" "+N.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)E.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(T){f.r=j.r;f.g=j.g;f.b=j.b;a(B,W,f);E.r=K.color.r*f.r;E.g=K.color.g*f.g;E.b=K.color.b*f.b;E.updateStyleString()}else E.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshDepthMaterial){n=1-K.__2near/(K.__farPlusNear-W.z*K.__farMinusNear); -E.setRGB(n,n,n)}else K instanceof THREE.MeshNormalMaterial&&E.setRGB(i(W.normalWorld.x),i(W.normalWorld.y),i(W.normalWorld.z));K.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+K.opacity);r.appendChild(u)}function d(N,M,V,W,K,B,R){u=e(z++);u.setAttribute("d", -"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){f.r=j.r;f.g=j.g;f.b=j.b;a(R,K,f);E.r=B.color.r*f.r;E.g=B.color.g*f.g;E.b=B.color.b*f.b;E.updateStyleString()}else E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){n= -1-B.__2near/(B.__farPlusNear-K.z*B.__farMinusNear);E.setRGB(n,n,n)}else B instanceof THREE.MeshNormalMaterial&&E.setRGB(i(K.normalWorld.x),i(K.normalWorld.y),i(K.normalWorld.z));B.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(u)} -function e(N){if(p[N]==null){p[N]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&p[N].setAttribute("shape-rendering","crispEdges");return p[N]}return p[N]}function i(N){return N<0?Math.min((1+N)*0.5,0.5):0.5+Math.min(N*0.5,0.5)}var b=null,q=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,y,x,v,w,F,I,J=new THREE.Rectangle,t=new THREE.Rectangle,T=false,E=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),h=new THREE.Color(0), -g=new THREE.Color(0),n,l=new THREE.Vector3,p=[],o=[],s=[],u,z,G,H,L=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":L=1;break;case "low":L=0}};this.setSize=function(N,M){k=N;m=M;y=k/2;x=m/2;r.setAttribute("viewBox",-y+" "+-x+" "+k+" "+m);r.setAttribute("width",k);r.setAttribute("height",m);J.set(-y,-x,y,x)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(N,M){var V,W, -K,B,R,O,C,Q;this.autoClear&&this.clear();b=q.projectScene(N,M,this.sortElements);H=G=z=0;if(T=N.lights.length>0){C=N.lights;j.setRGB(0,0,0);h.setRGB(0,0,0);g.setRGB(0,0,0);V=0;for(W=C.length;V0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}else if(B instanceof THREE.PointLight){j.sub(B.position,N.centroidWorld);j.normalize();R=N.normalWorld.dot(j)*B.intensity;if(R>0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}}}function c(M,N,V,W,J,B){u=e(z++);u.setAttribute("d","M "+M.positionScreen.x+ +" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)E.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(T){f.r=k.r;f.g=k.g;f.b=k.b;a(B,W,f);E.r=J.color.r*f.r;E.g=J.color.g*f.g;E.b=J.color.b*f.b;E.updateStyleString()}else E.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){m=1-J.__2near/(J.__farPlusNear-W.z*J.__farMinusNear); +E.setRGB(m,m,m)}else J instanceof THREE.MeshNormalMaterial&&E.setRGB(h(W.normalWorld.x),h(W.normalWorld.y),h(W.normalWorld.z));J.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+J.opacity);r.appendChild(u)}function d(M,N,V,W,J,B,R){u=e(z++);u.setAttribute("d", +"M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){f.r=k.r;f.g=k.g;f.b=k.b;a(R,J,f);E.r=B.color.r*f.r;E.g=B.color.g*f.g;E.b=B.color.b*f.b;E.updateStyleString()}else E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){m= +1-B.__2near/(B.__farPlusNear-J.z*B.__farMinusNear);E.setRGB(m,m,m)}else B instanceof THREE.MeshNormalMaterial&&E.setRGB(h(J.normalWorld.x),h(J.normalWorld.y),h(J.normalWorld.z));B.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(u)} +function e(M){if(o[M]==null){o[M]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&o[M].setAttribute("shape-rendering","crispEdges");return o[M]}return o[M]}function h(M){return M<0?Math.min((1+M)*0.5,0.5):0.5+Math.min(M*0.5,0.5)}var b=null,q=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,n,y,x,v,w,G,K,L=new THREE.Rectangle,t=new THREE.Rectangle,T=false,E=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),i=new THREE.Color(0), +g=new THREE.Color(0),m,j=new THREE.Vector3,o=[],p=[],s=[],u,z,H,F,I=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(M){switch(M){case "high":I=1;break;case "low":I=0}};this.setSize=function(M,N){l=M;n=N;y=l/2;x=n/2;r.setAttribute("viewBox",-y+" "+-x+" "+l+" "+n);r.setAttribute("width",l);r.setAttribute("height",n);L.set(-y,-x,y,x)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(M,N){var V,W, +J,B,R,O,C,Q;this.autoClear&&this.clear();b=q.projectScene(M,N,this.sortElements);F=H=z=0;if(T=M.lights.length>0){C=M.lights;k.setRGB(0,0,0);i.setRGB(0,0,0);g.setRGB(0,0,0);V=0;for(W=C.length;V0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer); -b.bufferData(b.ARRAY_BUFFER,C,h)}if(ka&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Q,h)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,h)}};this.setLineBuffers=function(f,j){var h,g,n,l=f.vertices,p=l.length,o=f.__vertexArray,s=f.__lineArray,u=f.__dirtyElements;if(f.__dirtyVertices)for(h=0;h0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+l.maxDirLights,"#define MAX_POINT_LIGHTS "+l.maxPointLights,l.map?"#define USE_MAP":"",l.env_map? -"#define USE_ENVMAP":"",l.light_map?"#define USE_LIGHTMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(h,d("fragment",n+s));b.attachShader(h,d("vertex",l+j));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={};f.program=h;h=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(g in f.uniforms)h.push(g);g=f.program;s=0;for(j=h.length;s=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLNormalBuffer); -b.vertexAttribPointer(p.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.normal)}if(p.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLTangentBuffer);b.vertexAttribPointer(p.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(n.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLUVBuffer);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv)}else b.disableVertexAttribArray(p.uv);if(p.uv2>=0)if(n.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER, -n.__webGLUV2Buffer);b.vertexAttribPointer(p.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv2)}else b.disableVertexAttribArray(p.uv2);if(g.wireframe||g instanceof THREE.LineBasicMaterial){p=g.wireframe_linewidth!==undefined?g.wireframe_linewidth:g.linewidth!==undefined?g.linewidth:1;g=g instanceof THREE.LineBasicMaterial&&l.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(p);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);b.drawElements(g,n.__webGLLineCount,b.UNSIGNED_SHORT, -0)}else if(g instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLParticleBuffer);b.drawElements(b.POINTS,n.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,n.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,j,h,g,n,l,p){var o,s,u,z,G;u=0;for(z=g.materials.length;u=0;h--){g=f.__webGLObjects[h].object;j==g&&f.__webGLObjects.splice(h,1)}};this.setupMatrices=function(f,j){k.multiply(j.matrix,f.matrix);x.set(k.flatten());m=THREE.Matrix4.makeInvert3x3(k).transpose();w.set(m.m);F.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(f.uniforms.modelViewMatrix, -false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,v);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,F)};this.loadCamera=function(f,j){b.uniform3f(f.uniforms.cameraPosition,j.position.x,j.position.y,j.position.z)};this.setBlending=function(f){switch(f){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(f,j){if(f){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="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\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", -envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", -map_particle_fragment:"#ifdef USE_MAP\nmapColor = 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\nmapColor = 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\nlightmapColor = 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", +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 h=document.createElement("canvas"),b,q=null,r=null,l=new THREE.Matrix4,n,y=new Float32Array(16),x=new Float32Array(16), +v=new Float32Array(16),w=new Float32Array(9),G=new Float32Array(16),K=new THREE.Matrix4,L=new THREE.Vector4,t=true,T=new THREE.Color(0),E=0;if(a){if(a.antialias!==undefined)t=a.antialias;a.clearColor!==undefined&&T.setHex(a.clearColor);if(a.clearAlpha!==undefined)E=a.clearAlpha}this.domElement=h;this.autoClear=true;(function(f,k,i){try{b=h.getContext("experimental-webgl",{antialias:f})}catch(g){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1); +b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(k.r,k.g,k.b,i)})(t,T,E);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,k){h.width=f;h.height=k;b.viewport(0,0,h.width,h.height)};this.setClearColor=function(f,k){var i=new THREE.Color(f);b.clearColor(i.r,i.g,i.b,k)}; +this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(f,k){var i,g,m,j=0,o=0,p=0,s,u,z,H=this.lights,F=H.directional.colors,I=H.directional.positions,M=H.point.colors,N=H.point.positions,V=0,W=0;i=0;for(g=k.length;i0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,C,i)}if(ka&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Q,i)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,i)}};this.setLineBuffers=function(f,k){var i,g,m,j=f.vertices,o=j.length,p=f.__vertexArray,s=f.__lineArray,u= +f.__dirtyElements;if(f.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+j.maxDirLights,"#define MAX_POINT_LIGHTS "+j.maxPointLights,j.map?"#define USE_MAP":"",j.env_map?"#define USE_ENVMAP": +"",j.light_map?"#define USE_LIGHTMAP":"",j.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(i,d("fragment",m+s));b.attachShader(i,d("vertex",j+k));b.linkProgram(i);b.getProgramParameter(i,b.LINK_STATUS)|| +alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(g in f.uniforms)i.push(g);g=f.program;s=0;for(k=i.length;s= +0){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLColorBuffer);b.vertexAttribPointer(o.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.color)}if(o.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLNormalBuffer);b.vertexAttribPointer(o.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.normal)}if(o.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLTangentBuffer);b.vertexAttribPointer(o.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.tangent)}if(o.uv>=0)if(m.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER, +m.__webGLUVBuffer);b.vertexAttribPointer(o.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.uv)}else b.disableVertexAttribArray(o.uv);if(o.uv2>=0)if(m.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,m.__webGLUV2Buffer);b.vertexAttribPointer(o.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.uv2)}else b.disableVertexAttribArray(o.uv2);if(g.wireframe||g instanceof THREE.LineBasicMaterial){o=g.wireframe_linewidth!==undefined?g.wireframe_linewidth:g.linewidth!==undefined?g.linewidth:1;g=g instanceof +THREE.LineBasicMaterial&&j.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(o);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webGLLineBuffer);b.drawElements(g,m.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(g instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webGLParticleBuffer);b.drawElements(b.POINTS,m.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,m.__webGLFaceCount,b.UNSIGNED_SHORT, +0)}};this.renderPass=function(f,k,i,g,m,j,o){var p,s,u,z,H;u=0;for(z=g.materials.length;u=0;i--){g=f.__webGLObjects[i].object;k==g&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f,k){l.multiply(k.matrix,f.matrix);x.set(l.flatten()); +n=THREE.Matrix4.makeInvert3x3(l).transpose();w.set(n.m);G.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,v);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,G)};this.loadCamera=function(f,k){b.uniform3f(f.uniforms.cameraPosition,k.position.x,k.position.y,k.position.z)};this.setBlending= +function(f){switch(f){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(f,k){if(f){!k||k=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="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\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", +map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\nmapColor = 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\nmapColor = 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\nlightmapColor = 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 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"}; -THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},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:{color:{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)}}}; +lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif", +color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\nvertexColor = 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}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}", -vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", +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.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",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,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}, -lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment, -"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex, -"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", -THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", +lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment, +THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex, +THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", +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() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", -THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:"uniform float size;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\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}; +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() {\nvec4 mColor = vec4( psColor, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 vertexColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment, +"gl_FragColor = mColor * mapColor * vertexColor;",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}; diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index dc17a893..5fb91f6a 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -1,6 +1,6 @@ // 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,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,i,b,q,r,k;if(d==0)e=i=b=0;else{q=Math.floor(a*6);r=a*6-q;a=d*(1-c);k=d*(1-c*r);c=d*(1-c*(1-r));switch(q){case 1:e=k;i=d;b=a;break;case 2:e=a;i=d;b=c;break;case 3:e=a;i=k;b=d;break;case 4:e=c;i=a;b=d;break;case 5:e=d;i=a;b=k;break;case 6:case 0:e=d;i=c;b=a}}this.r=e;this.g=i;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,h,b,q,r,l;if(d==0)e=h=b=0;else{q=Math.floor(a*6);r=a*6-q;a=d*(1-c);l=d*(1-c*r);c=d*(1-c*(1-r));switch(q){case 1:e=l;h=d;b=a;break;case 2:e=a;h=d;b=c;break;case 3:e=a;h=l;b=d;break;case 4:e=c;h=a;b=d;break;case 5:e=d;h=a;b=l;break;case 6:case 0:e=d;h=c;b=a}}this.r=e;this.g=h;this.b=b;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* @@ -13,55 +13,55 @@ THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,i=[];a=0;for(c=e.length;a0&&J>0&&j+J<1}var d,e,i,b,q,r,k,l,y,x, -v,w=a.geometry,F=w.vertices,I=[];d=0;for(e=w.faces.length;dk?e:k;i=i>l? -i:l}a()};this.add3Points=function(k,l,y,x,v,w){if(r){r=false;c=ky?k>v?k:v:y>v?y:v;i=l>x?l>w?l:w:x>w?x:w}else{c=ky?k>v?k>e?k:e:v>e?v:e:y>v?y>e?y:e:v>e?v:e;i=l>x?l>w?l>i?l:i:w>i?w:i:x>w?x>i?x:i:w>i?w:i}a()};this.addRectangle=function(k){if(r){r=false;c=k.getLeft();d=k.getTop();e=k.getRight();i=k.getBottom()}else{c=ck.getRight()?e:k.getRight();i=i>k.getBottom()?i:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;i+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e=0&&Math.min(i,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){r=true;i=e=d=c=0;a()};this.isEmpty=function(){return r};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+i+", width: "+b+", height: "+q+" )"}};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}}; -THREE.Matrix4=function(a,c,d,e,i,b,q,r,k,l,y,x,v,w,F,I){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=i||0;this.n22=b||1;this.n23=q||0;this.n24=r||0;this.n31=k||0;this.n32=l||0;this.n33=y||1;this.n34=x||0;this.n41=v||0;this.n42=w||0;this.n43=F||0;this.n44=I||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,i,b,q,r,k,l,y,x,v,w,F,I){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=i;this.n22=b;this.n23=q;this.n24=r;this.n31=k;this.n32=l;this.n33=y;this.n34=x;this.n41=v;this.n42=w;this.n43=F;this.n44=I;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();i.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); -this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,i=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23* -e+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*e+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 d=a.n11,e=a.n12,i=a.n13,b=a.n14,q=a.n21,r=a.n22,k=a.n23,l=a.n24,y=a.n31, -x=a.n32,v=a.n33,w=a.n34,F=a.n41,I=a.n42,J=a.n43,t=a.n44,T=c.n11,E=c.n12,f=c.n13,j=c.n14,h=c.n21,g=c.n22,n=c.n23,m=c.n24,p=c.n31,o=c.n32,s=c.n33,u=c.n34,A=c.n41,G=c.n42,H=c.n43,L=c.n44;this.n11=d*T+e*h+i*p+b*A;this.n12=d*E+e*g+i*o+b*G;this.n13=d*f+e*n+i*s+b*H;this.n14=d*j+e*m+i*u+b*L;this.n21=q*T+r*h+k*p+l*A;this.n22=q*E+r*g+k*o+l*G;this.n23=q*f+r*n+k*s+l*H;this.n24=q*j+r*m+k*u+l*L;this.n31=y*T+x*h+v*p+w*A;this.n32=y*E+x*g+v*o+w*G;this.n33=y*f+x*n+v*s+w*H;this.n34=y*j+x*m+v*u+w*L;this.n41=F*T+I*h+ -J*p+t*A;this.n42=F*E+I*g+J*o+t*G;this.n43=F*f+I*n+J*s+t*H;this.n44=F*j+I*m+J*u+t*L;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,i=this.n14,b=this.n21,q=this.n22,r=this.n23,k=this.n24,l=this.n31,y=this.n32,x=this.n33,v=this.n34,w=this.n41,F=this.n42,I=this.n43,J=this.n44,t=a.n11,T=a.n21,E=a.n31,f=a.n41,j=a.n12,h=a.n22,g=a.n32,n=a.n42,m=a.n13,p=a.n23,o=a.n33,s=a.n43,u=a.n14,A=a.n24,G=a.n34;a=a.n44;this.n11=c*t+d*T+e*E+i*f;this.n12=c*j+d*h+e*g+i*n;this.n13=c*m+d*p+e*o+i* -s;this.n14=c*u+d*A+e*G+i*a;this.n21=b*t+q*T+r*E+k*f;this.n22=b*j+q*h+r*g+k*n;this.n23=b*m+q*p+r*o+k*s;this.n24=b*u+q*A+r*G+k*a;this.n31=l*t+y*T+x*E+v*f;this.n32=l*j+y*h+x*g+v*n;this.n33=l*m+y*p+x*o+v*s;this.n34=l*u+y*A+x*G+v*a;this.n41=w*t+F*T+I*E+J*f;this.n42=w*j+F*h+I*g+J*n;this.n43=w*m+F*p+I*o+J*s;this.n44=w*u+F*A+I*G+J*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= -a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,i=this.n21,b=this.n22,q=this.n23,r=this.n24,k=this.n31,l=this.n32,y=this.n33,x=this.n34,v=this.n41,w=this.n42,F=this.n43,I=this.n44;return e*q*l*v-d*r*l*v-e*b*y*v+c*r*y*v+d*b*x*v-c*q*x*v-e*q*k*w+d*r*k*w+e*i*y*w-a*r*y*w-d*i*x*w+a*q*x*w+e*b*k*F-c*r*k*F-e*i*l*F+a*r*l*F+c*i*x*F-a*b*x*F-d*b*k*I+c*q*k*I+d*i*l*I-a*q*l*I-c*i*y*I+a*b*y*I},transpose:function(){function a(c,d, -e){var i=c[d];c[d]=c[e];c[e]=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; +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a0&&L>0&&k+L<1}var d,e,h,b,q,r,l,m,y,x, +v,w=a.geometry,G=w.vertices,K=[];d=0;for(e=w.faces.length;dl?e:l;h=h>m? +h:m}a()};this.add3Points=function(l,m,y,x,v,w){if(r){r=false;c=ly?l>v?l:v:y>v?y:v;h=m>x?m>w?m:w:x>w?x:w}else{c=ly?l>v?l>e?l:e:v>e?v:e:y>v?y>e?y:e:v>e?v:e;h=m>x?m>w?m>h?m:h:w>h?w:h:x>w?x>h?x:h:w>h?w:h}a()};this.addRectangle=function(l){if(r){r=false;c=l.getLeft();d=l.getTop();e=l.getRight();h=l.getBottom()}else{c=cl.getRight()?e:l.getRight();h=h>l.getBottom()?h:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;e+=l;h+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();e=e=0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){r=true;h=e=d=c=0;a()};this.isEmpty=function(){return r};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+h+", width: "+b+", height: "+q+" )"}};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}}; +THREE.Matrix4=function(a,c,d,e,h,b,q,r,l,m,y,x,v,w,G,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=h||0;this.n22=b||1;this.n23=q||0;this.n24=r||0;this.n31=l||0;this.n32=m||0;this.n33=y||1;this.n34=x||0;this.n41=v||0;this.n42=w||0;this.n43=G||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,d,e,h,b,q,r,l,m,y,x,v,w,G,K){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=b;this.n23=q;this.n24=r;this.n31=l;this.n32=m;this.n33=y;this.n34=x;this.n41=v;this.n42=w;this.n43=G;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,d){var e=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();h.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23* +e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,b=a.n14,q=a.n21,r=a.n22,l=a.n23,m=a.n24,y=a.n31, +x=a.n32,v=a.n33,w=a.n34,G=a.n41,K=a.n42,L=a.n43,t=a.n44,T=c.n11,E=c.n12,f=c.n13,k=c.n14,i=c.n21,g=c.n22,n=c.n23,j=c.n24,o=c.n31,p=c.n32,s=c.n33,u=c.n34,z=c.n41,H=c.n42,F=c.n43,I=c.n44;this.n11=d*T+e*i+h*o+b*z;this.n12=d*E+e*g+h*p+b*H;this.n13=d*f+e*n+h*s+b*F;this.n14=d*k+e*j+h*u+b*I;this.n21=q*T+r*i+l*o+m*z;this.n22=q*E+r*g+l*p+m*H;this.n23=q*f+r*n+l*s+m*F;this.n24=q*k+r*j+l*u+m*I;this.n31=y*T+x*i+v*o+w*z;this.n32=y*E+x*g+v*p+w*H;this.n33=y*f+x*n+v*s+w*F;this.n34=y*k+x*j+v*u+w*I;this.n41=G*T+K*i+ +L*o+t*z;this.n42=G*E+K*g+L*p+t*H;this.n43=G*f+K*n+L*s+t*F;this.n44=G*k+K*j+L*u+t*I;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,h=this.n14,b=this.n21,q=this.n22,r=this.n23,l=this.n24,m=this.n31,y=this.n32,x=this.n33,v=this.n34,w=this.n41,G=this.n42,K=this.n43,L=this.n44,t=a.n11,T=a.n21,E=a.n31,f=a.n41,k=a.n12,i=a.n22,g=a.n32,n=a.n42,j=a.n13,o=a.n23,p=a.n33,s=a.n43,u=a.n14,z=a.n24,H=a.n34;a=a.n44;this.n11=c*t+d*T+e*E+h*f;this.n12=c*k+d*i+e*g+h*n;this.n13=c*j+d*o+e*p+h* +s;this.n14=c*u+d*z+e*H+h*a;this.n21=b*t+q*T+r*E+l*f;this.n22=b*k+q*i+r*g+l*n;this.n23=b*j+q*o+r*p+l*s;this.n24=b*u+q*z+r*H+l*a;this.n31=m*t+y*T+x*E+v*f;this.n32=m*k+y*i+x*g+v*n;this.n33=m*j+y*o+x*p+v*s;this.n34=m*u+y*z+x*H+v*a;this.n41=w*t+G*T+K*E+L*f;this.n42=w*k+G*i+K*g+L*n;this.n43=w*j+G*o+K*p+L*s;this.n44=w*u+G*z+K*H+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,d=this.n13,e=this.n14,h=this.n21,b=this.n22,q=this.n23,r=this.n24,l=this.n31,m=this.n32,y=this.n33,x=this.n34,v=this.n41,w=this.n42,G=this.n43,K=this.n44;return e*q*m*v-d*r*m*v-e*b*y*v+c*r*y*v+d*b*x*v-c*q*x*v-e*q*l*w+d*r*l*w+e*h*y*w-a*r*y*w-d*h*x*w+a*q*x*w+e*b*l*G-c*r*l*G-e*h*m*G+a*r*m*G+c*h*x*G-a*b*x*G-d*b*l*K+c*q*l*K+d*h*m*K-a*q*m*K-c*h*y*K+a*b*y*K},transpose:function(){function a(c,d, +e){var h=c[d];c[d]=c[e];c[e]=h}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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),i=1-d,b=a.x,q=a.y,r=a.z,k=i*b,l=i*q;this.set(k*b+d,k*q-e*r,k*r+e*q,0,k*q+e*r,l*q+d,l*r-e*b,0,k*r-e*q,l*r+e*b,i*r*r+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,b=a.x,q=a.y,r=a.z,l=h*b,m=h*q;this.set(l*b+d,l*q-e*r,l*r+e*q,0,l*q+e*r,m*q+d,m*r-e*b,0,l*r-e*q,m*r+e*b,h*r*r+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,i=a.n14,b=a.n21,q=a.n22,r=a.n23,k=a.n24,l=a.n31,y=a.n32,x=a.n33,v=a.n34,w=a.n41,F=a.n42,I=a.n43,J=a.n44,t=new THREE.Matrix4;t.n11=r*v*F-k*x*F+k*y*I-q*v*I-r*y*J+q*x*J;t.n12=i*x*F-e*v*F-i*y*I+d*v*I+e*y*J-d*x*J;t.n13=e*k*F-i*r*F+i*q*I-d*k*I-e*q*J+d*r*J;t.n14=i*r*y-e*k*y-i*q*x+d*k*x+e*q*v-d*r*v;t.n21=k*x*w-r*v*w-k*l*I+b*v*I+r*l*J-b*x*J;t.n22=e*v*w-i*x*w+i*l*I-c*v*I-e*l*J+c*x*J;t.n23=i*r*w-e*k*w-i*b*I+c*k*I+e*b*J-c*r*J;t.n24=e*k*l-i*r*l+ -i*b*x-c*k*x-e*b*v+c*r*v;t.n31=q*v*w-k*y*w+k*l*F-b*v*F-q*l*J+b*y*J;t.n32=i*y*w-d*v*w-i*l*F+c*v*F+d*l*J-c*y*J;t.n33=e*k*w-i*q*w+i*b*F-c*k*F-d*b*J+c*q*J;t.n34=i*q*l-d*k*l-i*b*y+c*k*y+d*b*v-c*q*v;t.n41=r*y*w-q*x*w-r*l*F+b*x*F+q*l*I-b*y*I;t.n42=d*x*w-e*y*w+e*l*F-c*x*F-d*l*I+c*y*I;t.n43=e*q*w-d*r*w-e*b*F+c*r*F+d*b*I-c*q*I;t.n44=d*r*l-e*q*l+e*b*y-c*r*y-d*b*x+c*q*x;t.multiplyScalar(1/a.determinant());return t}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],l=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*q+c[2]*l;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*i;d[2]=c*b;d[3]=c*q;d[4]=c*r;d[5]=c*k;d[6]=c*l;d[7]=c*y;d[8]=c*x;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,i,b){var q,r,k;q=new THREE.Matrix4;r=2*i/(c-a);k=2*i/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+i)/(b-i);i=-2*b*i/(b-i);q.n11=r;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=k;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=e;q.n34=i;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,e){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,c,d,e,i,b){var q,r,k,l;q=new THREE.Matrix4;r=c-a;k=d-e;l=b-i;a=(c+a)/r;d=(d+e)/k;i=(b+i)/l;q.n11=2/r;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/k;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/l;q.n34=-i;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,h=a.n14,b=a.n21,q=a.n22,r=a.n23,l=a.n24,m=a.n31,y=a.n32,x=a.n33,v=a.n34,w=a.n41,G=a.n42,K=a.n43,L=a.n44,t=new THREE.Matrix4;t.n11=r*v*G-l*x*G+l*y*K-q*v*K-r*y*L+q*x*L;t.n12=h*x*G-e*v*G-h*y*K+d*v*K+e*y*L-d*x*L;t.n13=e*l*G-h*r*G+h*q*K-d*l*K-e*q*L+d*r*L;t.n14=h*r*y-e*l*y-h*q*x+d*l*x+e*q*v-d*r*v;t.n21=l*x*w-r*v*w-l*m*K+b*v*K+r*m*L-b*x*L;t.n22=e*v*w-h*x*w+h*m*K-c*v*K-e*m*L+c*x*L;t.n23=h*r*w-e*l*w-h*b*K+c*l*K+e*b*L-c*r*L;t.n24=e*l*m-h*r*m+ +h*b*x-c*l*x-e*b*v+c*r*v;t.n31=q*v*w-l*y*w+l*m*G-b*v*G-q*m*L+b*y*L;t.n32=h*y*w-d*v*w-h*m*G+c*v*G+d*m*L-c*y*L;t.n33=e*l*w-h*q*w+h*b*G-c*l*G-d*b*L+c*q*L;t.n34=h*q*m-d*l*m-h*b*y+c*l*y+d*b*v-c*q*v;t.n41=r*y*w-q*x*w-r*m*G+b*x*G+q*m*K-b*y*K;t.n42=d*x*w-e*y*w+e*m*G-c*x*G-d*m*K+c*y*K;t.n43=e*q*w-d*r*w-e*b*G+c*r*G+d*b*K-c*q*K;t.n44=d*r*m-e*q*m+e*b*y-c*r*y-d*b*x+c*q*x;t.multiplyScalar(1/a.determinant());return t}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],h=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],x=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*q+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*h;d[2]=c*b;d[3]=c*q;d[4]=c*r;d[5]=c*l;d[6]=c*m;d[7]=c*y;d[8]=c*x;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,h,b){var q,r,l;q=new THREE.Matrix4;r=2*h/(c-a);l=2*h/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+h)/(b-h);h=-2*b*h/(b-h);q.n11=r;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=e;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,h,b){var q,r,l,m;q=new THREE.Matrix4;r=c-a;l=d-e;m=b-h;a=(c+a)/r;d=(d+e)/l;h=(b+h)/m;q.n11=2/r;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/m;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,e,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,d,e,i,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=b instanceof Array?b:[b]};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.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; +THREE.Face3=function(a,c,d,e,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,e,h,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(u,z,H,F,I,M,N){b=u.vertices[z].position;q=u.vertices[H].position;r=u.vertices[F].position;l=h[I];m=h[M];y=h[N];x=q.x-b.x;v=r.x-b.x;w=q.y-b.y;G=r.y-b.y; +K=q.z-b.z;L=r.z-b.z;t=m.u-l.u;T=y.u-l.u;E=m.v-l.v;f=y.v-l.v;k=1/(t*f-T*E);n.set((f*x-E*v)*k,(f*w-E*G)*k,(f*K-E*L)*k);j.set((t*v-T*x)*k,(t*G-T*w)*k,(t*L-T*K)*k);i[z].addSelf(n);i[H].addSelf(n);i[F].addSelf(n);g[z].addSelf(j);g[H].addSelf(j);g[F].addSelf(j)}var c,d,e,h,b,q,r,l,m,y,x,v,w,G,K,L,t,T,E,f,k,i=[],g=[],n=new THREE.Vector3,j=new THREE.Vector3,o=new THREE.Vector3,p=new THREE.Vector3,s=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){l[r].counter+=1;k=l[r].hash+"_"+l[r].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:q,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[r].counter+=1;l=m[r].hash+"_"+m[r].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(e);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(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=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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.colors=[];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}}; @@ -87,127 +87,130 @@ THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShadi THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!== undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; -THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending}}; -THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
)"}}; +THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.vertex_colors=false;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; +THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
vertex_colors: "+this.vertex_colors+"
)"}}; 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 (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,i,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,h,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=b!==undefined?b: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 (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,d,e,i={};for(c in a){i[c]={};for(d in a[c]){e=a[c][d];i[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return i},merge:function(a){var c,d,e,i={};for(c=0;c=0&&s>=0&&u>=0&&A>=0)return true;else if(o<0&&s<0||u<0&&A<0)return false;else{if(o<0)m=Math.max(m,o/(o-s));else if(s<0)p=Math.min(p,o/(o-s));if(u<0)m=Math.max(m,u/(u-A));else if(A<0)p=Math.min(p,u/(u-A));if(po&&H.z0&&J.z<1){v=F[w]=F[w]||new THREE.RenderableParticle;v.x=J.x/J.w;v.y=J.y/J.w;v.z=J.z;v.rotation=M.rotation.z;v.scale.x=M.scale.x*Math.abs(v.x-(J.x+n.projectionMatrix.n11)/(J.w+n.projectionMatrix.n14)); -v.scale.y=M.scale.y*Math.abs(v.y-(J.y+n.projectionMatrix.n22)/(J.w+n.projectionMatrix.n24));v.materials=M.materials;p.push(v);w++}}}}m&&p.sort(a);return p};this.unprojectVector=function(g,n){var m=THREE.Matrix4.makeInvert(n.matrix);m.multiplySelf(THREE.Matrix4.makeInvert(n.projectionMatrix));m.multiplyVector3(g);return g}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,i,b;this.domElement=document.createElement("div");this.setSize=function(q,r){d=q;e=r;i=d/2;b=e/2};this.render=function(q,r){var k,l,y,x,v,w,F,I;a=c.projectScene(q,r);k=0;for(l=a.length;k0){D.r+=da.r*$;D.g+=da.g*$;D.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($>0){D.r+=da.r*$;D.g+=da.g*$;D.b+=da.b*$}}}}function Na(z,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending); -var D,Q,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;Q=X.scale.x*r;$=X.scale.y*k;S=Q*ha;D=$*ia;C.set(z.x-S,z.y-D,z.x+S,z.y+D);if(!P.instersects(C))return;l.save();l.translate(z.x,z.y);l.rotate(-X.rotation);l.scale(Q,-$);l.translate(-ha,-ia);l.drawImage(da,0,0);l.restore()}l.beginPath();l.moveTo(z.x-10,z.y);l.lineTo(z.x+10,z.y);l.moveTo(z.x,z.y-10);l.lineTo(z.x,z.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)"; -l.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(R){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;p.r=S.color.r*U.r;p.g=S.color.g*U.g;p.b=S.color.b*U.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;S=X.scale.x*r;D=X.scale.y*k;C.set(z.x-S,z.y-D,z.x+S,z.y+D);if(P.instersects(C)){Q=p.__styleString;if(I!=Q)l.fillStyle=I=Q;l.save();l.translate(z.x,z.y);l.rotate(-X.rotation);l.scale(S,D);l.beginPath();l.arc(0,0,1,0,za,true);l.closePath();l.fill();l.restore()}}}} -function Oa(z,X,S,D){if(D.opacity!=0){a(D.opacity);c(D.blending);l.beginPath();l.moveTo(z.positionScreen.x,z.positionScreen.y);l.lineTo(X.positionScreen.x,X.positionScreen.y);l.closePath();if(D instanceof THREE.LineBasicMaterial){p.__styleString=D.color.__styleString;z=D.linewidth;if(J!=z)l.lineWidth=J=z;z=p.__styleString;if(F!=z)l.strokeStyle=F=z;l.stroke();C.inflate(D.linewidth*2)}}}function Ja(z,X,S,D,Q,$){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);f=z.positionScreen.x;j=z.positionScreen.y;h= -X.positionScreen.x;g=X.positionScreen.y;n=S.positionScreen.x;m=S.positionScreen.y;l.beginPath();l.moveTo(f,j);l.lineTo(h,g);l.lineTo(n,m);l.lineTo(f,j);l.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&wa(f,j,h,g,n,m,Q.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof THREE.SphericalReflectionMapping){z=la.matrix;Z.copy(D.vertexNormalsWorld[0]); -N=(Z.x*z.n11+Z.y*z.n12+Z.z*z.n13)*0.5+0.5;M=-(Z.x*z.n21+Z.y*z.n22+Z.z*z.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[1]);V=(Z.x*z.n11+Z.y*z.n12+Z.z*z.n13)*0.5+0.5;W=-(Z.x*z.n21+Z.y*z.n22+Z.z*z.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[2]);K=(Z.x*z.n11+Z.y*z.n12+Z.z*z.n13)*0.5+0.5;B=-(Z.x*z.n21+Z.y*z.n22+Z.z*z.n23)*0.5+0.5;wa(f,j,h,g,n,m,Q.env_map.image,N,M,V,W,K,B)}}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&&wa(f,j,h,g,n,m,Q.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);c(THREE.SubtractiveBlending)}if(R)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==3){o.r=s.r=u.r=Y.r;o.g=s.g=u.g=Y.g;o.b=s.b=u.b=Y.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],o);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],s);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],u);A.r=(s.r+u.r)*0.5;A.g=(s.g+u.g)*0.5; -A.b=(s.b+u.b)*0.5;L=Ka(o,s,u,A);wa(f,j,h,g,n,m,L,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,D.centroidWorld,D.normalWorld,U);p.r=Q.color.r*U.r;p.g=Q.color.g*U.g;p.b=Q.color.b*U.b;p.updateStyleString();Q.wireframe?Ba(p.__styleString,Q.wireframe_linewidth):Ca(p.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){G=la.near;H=la.far;o.r=o.g=o.b=1-Fa(z.positionScreen.z,G,H);s.r=s.g=s.b=1-Fa(X.positionScreen.z, -G,H);u.r=u.g=u.b=1-Fa(S.positionScreen.z,G,H);A.r=(s.r+u.r)*0.5;A.g=(s.g+u.g)*0.5;A.b=(s.b+u.b)*0.5;L=Ka(o,s,u,A);wa(f,j,h,g,n,m,L,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){p.r=Ga(D.normalWorld.x);p.g=Ga(D.normalWorld.y);p.b=Ga(D.normalWorld.z);p.updateStyleString();Q.wireframe?Ba(p.__styleString,Q.wireframe_linewidth):Ca(p.__styleString)}}}function Ba(z,X){if(F!=z)l.strokeStyle=F=z;if(J!=X)l.lineWidth=J=X;l.stroke();C.inflate(X*2)}function Ca(z){if(I!=z)l.fillStyle=I=z;l.fill()} -function wa(z,X,S,D,Q,$,da,ha,ia,ra,ja,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ja*=ta;sa*=ua;xa*=ta;S-=z;D-=X;Q-=z;$-=X;ra-=ha;ja-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ja);ua=(xa*S-ja*Q)*ta;ja=(xa*D-ja*$)*ta;S=(ra*Q-sa*S)*ta;D=(ra*$-sa*D)*ta;z=z-ua*ha-S*ia;X=X-ja*ha-D*ia;l.save();l.transform(ua,ja,S,D,z,X);l.clip();l.drawImage(da,0,0);l.restore()}function Ka(z,X,S,D){var Q=~~(z.r*255),$=~~(z.g*255);z=~~(z.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255), -ra=~~(S.g*255);S=~~(S.b*255);var ja=~~(D.r*255),sa=~~(D.g*255);D=~~(D.b*255);ga[0]=Q<0?0:Q>255?255:Q;ga[1]=$<0?0:$>255?255:$;ga[2]=z<0?0:z>255?255:z;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ja<0?0:ja>255?255:ja;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=D<0?0:D>255?255:D;oa.putImageData(ka,0,0);ea.drawImage(na,0,0);return pa}function Fa(z,X,S){z=(z-X)/(S-X);return z*z*(3-2*z)}function Ga(z){z= -(z+1)*0.5;return z<0?0:z>1?1:z}function Ha(z,X){var S=X.x-z.x,D=X.y-z.y,Q=1/Math.sqrt(S*S+D*D);S*=Q;D*=Q;X.x+=S;X.y+=D;z.x-=S;z.y-=D}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():l.setTransform(1,0,0,-1,r,k);d=e.projectScene(ca,la,this.sortElements);l.fillStyle="rgba( 0, 255, 255, 0.5 )";l.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight());(R=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}else if(B instanceof THREE.PointLight){m.sub(B.position,M.centroidWorld);m.normalize();P=M.normalWorld.dot(m)*B.intensity;if(P>0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}}}function c(N,M,V,W,K,B){u=e(A++);u.setAttribute("d","M "+N.positionScreen.x+ -" "+N.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)E.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(T){f.r=j.r;f.g=j.g;f.b=j.b;a(B,W,f);E.r=K.color.r*f.r;E.g=K.color.g*f.g;E.b=K.color.b*f.b;E.updateStyleString()}else E.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshDepthMaterial){n=1-K.__2near/(K.__farPlusNear-W.z*K.__farMinusNear); -E.setRGB(n,n,n)}else K instanceof THREE.MeshNormalMaterial&&E.setRGB(i(W.normalWorld.x),i(W.normalWorld.y),i(W.normalWorld.z));K.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+K.opacity);r.appendChild(u)}function d(N,M,V,W,K,B,P){u=e(A++);u.setAttribute("d", -"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){f.r=j.r;f.g=j.g;f.b=j.b;a(P,K,f);E.r=B.color.r*f.r;E.g=B.color.g*f.g;E.b=B.color.b*f.b;E.updateStyleString()}else E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){n= -1-B.__2near/(B.__farPlusNear-K.z*B.__farMinusNear);E.setRGB(n,n,n)}else B instanceof THREE.MeshNormalMaterial&&E.setRGB(i(K.normalWorld.x),i(K.normalWorld.y),i(K.normalWorld.z));B.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(u)} -function e(N){if(p[N]==null){p[N]=document.createElementNS("http://www.w3.org/2000/svg","path");L==0&&p[N].setAttribute("shape-rendering","crispEdges");return p[N]}return p[N]}function i(N){return N<0?Math.min((1+N)*0.5,0.5):0.5+Math.min(N*0.5,0.5)}var b=null,q=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,y,x,v,w,F,I,J=new THREE.Rectangle,t=new THREE.Rectangle,T=false,E=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),h=new THREE.Color(0), -g=new THREE.Color(0),n,m=new THREE.Vector3,p=[],o=[],s=[],u,A,G,H,L=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":L=1;break;case "low":L=0}};this.setSize=function(N,M){k=N;l=M;y=k/2;x=l/2;r.setAttribute("viewBox",-y+" "+-x+" "+k+" "+l);r.setAttribute("width",k);r.setAttribute("height",l);J.set(-y,-x,y,x)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(N,M){var V,W, -K,B,P,O,C,R;this.autoClear&&this.clear();b=q.projectScene(N,M,this.sortElements);H=G=A=0;if(T=N.lights.length>0){C=N.lights;j.setRGB(0,0,0);h.setRGB(0,0,0);g.setRGB(0,0,0);V=0;for(W=C.length;V=0&&s>=0&&u>=0&&z>=0)return true;else if(p<0&&s<0||u<0&&z<0)return false;else{if(p<0)j=Math.max(j,p/(p-s));else if(s<0)o=Math.min(o,p/(p-s));if(u<0)j=Math.max(j,u/(u-z));else if(z<0)o=Math.min(o,u/(u-z));if(op&&F.z0&&L.z<1){v=G[w]=G[w]||new THREE.RenderableParticle;v.x=L.x/L.w;v.y=L.y/L.w;v.z=L.z;v.rotation=N.rotation.z;v.scale.x=N.scale.x*Math.abs(v.x-(L.x+n.projectionMatrix.n11)/(L.w+n.projectionMatrix.n14)); +v.scale.y=N.scale.y*Math.abs(v.y-(L.y+n.projectionMatrix.n22)/(L.w+n.projectionMatrix.n24));v.materials=N.materials;o.push(v);w++}}}}j&&o.sort(a);return o};this.unprojectVector=function(g,n){var j=THREE.Matrix4.makeInvert(n.matrix);j.multiplySelf(THREE.Matrix4.makeInvert(n.projectionMatrix));j.multiplyVector3(g);return g}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,h,b;this.domElement=document.createElement("div");this.setSize=function(q,r){d=q;e=r;h=d/2;b=e/2};this.render=function(q,r){var l,m,y,x,v,w,G,K;a=c.projectScene(q,r);l=0;for(m=a.length;l0){D.r+=da.r*$;D.g+=da.g*$;D.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($>0){D.r+=da.r*$;D.g+=da.g*$;D.b+=da.b*$}}}}function Na(A,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending); +var D,Q,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;Q=X.scale.x*r;$=X.scale.y*l;S=Q*ha;D=$*ia;C.set(A.x-S,A.y-D,A.x+S,A.y+D);if(!P.instersects(C))return;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(Q,-$);m.translate(-ha,-ia);m.drawImage(da,0,0);m.restore()}m.beginPath();m.moveTo(A.x-10,A.y);m.lineTo(A.x+10,A.y);m.moveTo(A.x,A.y-10);m.lineTo(A.x,A.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)"; +m.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(R){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;o.r=S.color.r*U.r;o.g=S.color.g*U.g;o.b=S.color.b*U.b;o.updateStyleString()}else o.__styleString=S.color.__styleString;S=X.scale.x*r;D=X.scale.y*l;C.set(A.x-S,A.y-D,A.x+S,A.y+D);if(P.instersects(C)){Q=o.__styleString;if(K!=Q)m.fillStyle=K=Q;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(S,D);m.beginPath();m.arc(0,0,1,0,za,true);m.closePath();m.fill();m.restore()}}}} +function Oa(A,X,S,D){if(D.opacity!=0){a(D.opacity);c(D.blending);m.beginPath();m.moveTo(A.positionScreen.x,A.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(D instanceof THREE.LineBasicMaterial){o.__styleString=D.color.__styleString;A=D.linewidth;if(L!=A)m.lineWidth=L=A;A=o.__styleString;if(G!=A)m.strokeStyle=G=A;m.stroke();C.inflate(D.linewidth*2)}}}function Ja(A,X,S,D,Q,$){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);f=A.positionScreen.x;k=A.positionScreen.y;i= +X.positionScreen.x;g=X.positionScreen.y;n=S.positionScreen.x;j=S.positionScreen.y;m.beginPath();m.moveTo(f,k);m.lineTo(i,g);m.lineTo(n,j);m.lineTo(f,k);m.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&wa(f,k,i,g,n,j,Q.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=la.matrix;Z.copy(D.vertexNormalsWorld[0]); +M=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;N=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(D.vertexNormalsWorld[2]);J=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(f,k,i,g,n,j,Q.env_map.image,M,N,V,W,J,B)}}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&&wa(f,k,i,g,n,j,Q.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);c(THREE.SubtractiveBlending)}if(R)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==3){p.r=s.r=u.r=Y.r;p.g=s.g=u.g=Y.g;p.b=s.b=u.b=Y.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],p);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],s);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],u);z.r=(s.r+u.r)*0.5;z.g=(s.g+u.g)*0.5; +z.b=(s.b+u.b)*0.5;I=Ka(p,s,u,z);wa(f,k,i,g,n,j,I,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,D.centroidWorld,D.normalWorld,U);o.r=Q.color.r*U.r;o.g=Q.color.g*U.g;o.b=Q.color.b*U.b;o.updateStyleString();Q.wireframe?Ba(o.__styleString,Q.wireframe_linewidth):Ca(o.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){H=la.near;F=la.far;p.r=p.g=p.b=1-Fa(A.positionScreen.z,H,F);s.r=s.g=s.b=1-Fa(X.positionScreen.z, +H,F);u.r=u.g=u.b=1-Fa(S.positionScreen.z,H,F);z.r=(s.r+u.r)*0.5;z.g=(s.g+u.g)*0.5;z.b=(s.b+u.b)*0.5;I=Ka(p,s,u,z);wa(f,k,i,g,n,j,I,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){o.r=Ga(D.normalWorld.x);o.g=Ga(D.normalWorld.y);o.b=Ga(D.normalWorld.z);o.updateStyleString();Q.wireframe?Ba(o.__styleString,Q.wireframe_linewidth):Ca(o.__styleString)}}}function Ba(A,X){if(G!=A)m.strokeStyle=G=A;if(L!=X)m.lineWidth=L=X;m.stroke();C.inflate(X*2)}function Ca(A){if(K!=A)m.fillStyle=K=A;m.fill()} +function wa(A,X,S,D,Q,$,da,ha,ia,ra,ja,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ja*=ta;sa*=ua;xa*=ta;S-=A;D-=X;Q-=A;$-=X;ra-=ha;ja-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ja);ua=(xa*S-ja*Q)*ta;ja=(xa*D-ja*$)*ta;S=(ra*Q-sa*S)*ta;D=(ra*$-sa*D)*ta;A=A-ua*ha-S*ia;X=X-ja*ha-D*ia;m.save();m.transform(ua,ja,S,D,A,X);m.clip();m.drawImage(da,0,0);m.restore()}function Ka(A,X,S,D){var Q=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255), +ra=~~(S.g*255);S=~~(S.b*255);var ja=~~(D.r*255),sa=~~(D.g*255);D=~~(D.b*255);ga[0]=Q<0?0:Q>255?255:Q;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0:A>255?255:A;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ja<0?0:ja>255?255:ja;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=D<0?0:D>255?255:D;oa.putImageData(ka,0,0);ea.drawImage(na,0,0);return pa}function Fa(A,X,S){A=(A-X)/(S-X);return A*A*(3-2*A)}function Ga(A){A= +(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A,X){var S=X.x-A.x,D=X.y-A.y,Q=1/Math.sqrt(S*S+D*D);S*=Q;D*=Q;X.x+=S;X.y+=D;A.x-=S;A.y-=D}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():m.setTransform(1,0,0,-1,r,l);d=e.projectScene(ca,la,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight());(R=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}else if(B instanceof THREE.PointLight){j.sub(B.position,N.centroidWorld);j.normalize();P=N.normalWorld.dot(j)*B.intensity;if(P>0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}}}function c(M,N,V,W,J,B){u=e(z++);u.setAttribute("d","M "+M.positionScreen.x+ +" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)E.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(T){f.r=k.r;f.g=k.g;f.b=k.b;a(B,W,f);E.r=J.color.r*f.r;E.g=J.color.g*f.g;E.b=J.color.b*f.b;E.updateStyleString()}else E.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){n=1-J.__2near/(J.__farPlusNear-W.z*J.__farMinusNear); +E.setRGB(n,n,n)}else J instanceof THREE.MeshNormalMaterial&&E.setRGB(h(W.normalWorld.x),h(W.normalWorld.y),h(W.normalWorld.z));J.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+J.opacity);r.appendChild(u)}function d(M,N,V,W,J,B,P){u=e(z++);u.setAttribute("d", +"M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){f.r=k.r;f.g=k.g;f.b=k.b;a(P,J,f);E.r=B.color.r*f.r;E.g=B.color.g*f.g;E.b=B.color.b*f.b;E.updateStyleString()}else E.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){n= +1-B.__2near/(B.__farPlusNear-J.z*B.__farMinusNear);E.setRGB(n,n,n)}else B instanceof THREE.MeshNormalMaterial&&E.setRGB(h(J.normalWorld.x),h(J.normalWorld.y),h(J.normalWorld.z));B.wireframe?u.setAttribute("style","fill: none; stroke: "+E.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):u.setAttribute("style","fill: "+E.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(u)} +function e(M){if(o[M]==null){o[M]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&o[M].setAttribute("shape-rendering","crispEdges");return o[M]}return o[M]}function h(M){return M<0?Math.min((1+M)*0.5,0.5):0.5+Math.min(M*0.5,0.5)}var b=null,q=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,m,y,x,v,w,G,K,L=new THREE.Rectangle,t=new THREE.Rectangle,T=false,E=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),i=new THREE.Color(0), +g=new THREE.Color(0),n,j=new THREE.Vector3,o=[],p=[],s=[],u,z,H,F,I=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(M){switch(M){case "high":I=1;break;case "low":I=0}};this.setSize=function(M,N){l=M;m=N;y=l/2;x=m/2;r.setAttribute("viewBox",-y+" "+-x+" "+l+" "+m);r.setAttribute("width",l);r.setAttribute("height",m);L.set(-y,-x,y,x)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(M,N){var V,W, +J,B,P,O,C,R;this.autoClear&&this.clear();b=q.projectScene(M,N,this.sortElements);F=H=z=0;if(T=M.lights.length>0){C=M.lights;k.setRGB(0,0,0);i.setRGB(0,0,0);g.setRGB(0,0,0);V=0;for(W=C.length;V0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer); -b.bufferData(b.ARRAY_BUFFER,C,h)}if(ka&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,R,h)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,h)}};this.setLineBuffers=function(f,j){var h,g,n,m=f.vertices,p=m.length,o=f.__vertexArray,s=f.__lineArray,u=f.__dirtyElements;if(f.__dirtyVertices)for(h=0;h0?"#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":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(h,d("fragment",n+s));b.attachShader(h,d("vertex",m+j));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={};f.program=h;h=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(g in f.uniforms)h.push(g);g=f.program;s=0;for(j=h.length;s=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLNormalBuffer); -b.vertexAttribPointer(p.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.normal)}if(p.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLTangentBuffer);b.vertexAttribPointer(p.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(n.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLUVBuffer);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv)}else b.disableVertexAttribArray(p.uv);if(p.uv2>=0)if(n.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER, -n.__webGLUV2Buffer);b.vertexAttribPointer(p.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv2)}else b.disableVertexAttribArray(p.uv2);if(g.wireframe||g instanceof THREE.LineBasicMaterial){p=g.wireframe_linewidth!==undefined?g.wireframe_linewidth:g.linewidth!==undefined?g.linewidth:1;g=g instanceof THREE.LineBasicMaterial&&m.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(p);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);b.drawElements(g,n.__webGLLineCount,b.UNSIGNED_SHORT, -0)}else if(g instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLParticleBuffer);b.drawElements(b.POINTS,n.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,n.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,j,h,g,n,m,p){var o,s,u,A,G;u=0;for(A=g.materials.length;u=0;h--){g=f.__webGLObjects[h].object;j==g&&f.__webGLObjects.splice(h,1)}};this.setupMatrices=function(f,j){k.multiply(j.matrix,f.matrix);x.set(k.flatten());l=THREE.Matrix4.makeInvert3x3(k).transpose();w.set(l.m);F.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(f.uniforms.modelViewMatrix, -false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,v);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,F)};this.loadCamera=function(f,j){b.uniform3f(f.uniforms.cameraPosition,j.position.x,j.position.y,j.position.z)};this.setBlending=function(f){switch(f){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(f,j){if(f){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="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\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", -envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", -map_particle_fragment:"#ifdef USE_MAP\nmapColor = 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\nmapColor = 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\nlightmapColor = 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", +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 h=document.createElement("canvas"),b,q=null,r=null,l=new THREE.Matrix4,m,y=new Float32Array(16),x=new Float32Array(16), +v=new Float32Array(16),w=new Float32Array(9),G=new Float32Array(16),K=new THREE.Matrix4,L=new THREE.Vector4,t=true,T=new THREE.Color(0),E=0;if(a){if(a.antialias!==undefined)t=a.antialias;a.clearColor!==undefined&&T.setHex(a.clearColor);if(a.clearAlpha!==undefined)E=a.clearAlpha}this.domElement=h;this.autoClear=true;(function(f,k,i){try{b=h.getContext("experimental-webgl",{antialias:f})}catch(g){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1); +b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(k.r,k.g,k.b,i)})(t,T,E);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,k){h.width=f;h.height=k;b.viewport(0,0,h.width,h.height)};this.setClearColor=function(f,k){var i=new THREE.Color(f);b.clearColor(i.r,i.g,i.b,k)}; +this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(f,k){var i,g,n,j=0,o=0,p=0,s,u,z,H=this.lights,F=H.directional.colors,I=H.directional.positions,M=H.point.colors,N=H.point.positions,V=0,W=0;i=0;for(g=k.length;i0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,C,i)}if(ka&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,R,i)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,i)}};this.setLineBuffers=function(f,k){var i,g,n,j=f.vertices,o=j.length,p=f.__vertexArray,s=f.__lineArray,u= +f.__dirtyElements;if(f.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+j.maxDirLights,"#define MAX_POINT_LIGHTS "+j.maxPointLights,j.map?"#define USE_MAP":"",j.env_map?"#define USE_ENVMAP": +"",j.light_map?"#define USE_LIGHTMAP":"",j.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(i,d("fragment",n+s));b.attachShader(i,d("vertex",j+k));b.linkProgram(i);b.getProgramParameter(i,b.LINK_STATUS)|| +alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(g in f.uniforms)i.push(g);g=f.program;s=0;for(k=i.length;s= +0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLColorBuffer);b.vertexAttribPointer(o.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.color)}if(o.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLNormalBuffer);b.vertexAttribPointer(o.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.normal)}if(o.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLTangentBuffer);b.vertexAttribPointer(o.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.tangent)}if(o.uv>=0)if(n.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER, +n.__webGLUVBuffer);b.vertexAttribPointer(o.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.uv)}else b.disableVertexAttribArray(o.uv);if(o.uv2>=0)if(n.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,n.__webGLUV2Buffer);b.vertexAttribPointer(o.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(o.uv2)}else b.disableVertexAttribArray(o.uv2);if(g.wireframe||g instanceof THREE.LineBasicMaterial){o=g.wireframe_linewidth!==undefined?g.wireframe_linewidth:g.linewidth!==undefined?g.linewidth:1;g=g instanceof +THREE.LineBasicMaterial&&j.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(o);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);b.drawElements(g,n.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(g instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLParticleBuffer);b.drawElements(b.POINTS,n.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,n.__webGLFaceCount,b.UNSIGNED_SHORT, +0)}};this.renderPass=function(f,k,i,g,n,j,o){var p,s,u,z,H;u=0;for(z=g.materials.length;u=0;i--){g=f.__webGLObjects[i].object;k==g&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f,k){l.multiply(k.matrix,f.matrix);x.set(l.flatten()); +m=THREE.Matrix4.makeInvert3x3(l).transpose();w.set(m.m);G.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,v);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,w);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,G)};this.loadCamera=function(f,k){b.uniform3f(f.uniforms.cameraPosition,k.position.x,k.position.y,k.position.z)};this.setBlending= +function(f){switch(f){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(f,k){if(f){!k||k=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="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\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", +map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\nmapColor = 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\nmapColor = 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\nlightmapColor = 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 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"}; -THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},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:{color:{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)}}}; +lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif", +color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\nvertexColor = 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}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}", -vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", +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.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",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,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}, -lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment, -"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex, -"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", -THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", +lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment, +THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex, +THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", +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() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", -THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:"uniform float size;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\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}; +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() {\nvec4 mColor = vec4( psColor, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 vertexColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment, +"gl_FragColor = mColor * mapColor * vertexColor;",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}; diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 1cc5a177..3b5ebb71 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -1,6 +1,6 @@ // ThreeExtras.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,f,b,j,h,g;if(d==0)e=f=b=0;else{j=Math.floor(a*6);h=a*6-j;a=d*(1-c);g=d*(1-c*h);c=d*(1-c*(1-h));switch(j){case 1:e=g;f=d;b=a;break;case 2:e=a;f=d;b=c;break;case 3:e=a;f=g;b=d;break;case 4:e=c;f=a;b=d;break;case 5:e=d;f=a;b=g;break;case 6:case 0:e=d;f=c;b=a}}this.r=e;this.g=f;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,f,b,l,h,g;if(d==0)e=f=b=0;else{l=Math.floor(a*6);h=a*6-l;a=d*(1-c);g=d*(1-c*h);c=d*(1-c*(1-h));switch(l){case 1:e=g;f=d;b=a;break;case 2:e=a;f=d;b=c;break;case 3:e=a;f=g;b=d;break;case 4:e=c;f=a;b=d;break;case 5:e=d;f=a;b=g;break;case 6:case 0:e=d;f=c;b=a}}this.r=e;this.g=f;this.b=b;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* @@ -13,47 +13,47 @@ THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,f=[];a=0;for(c=e.length;a0&&G>0&&p+G<1}var d,e,f,b,j,h,g,m,y,C, -u,q=a.geometry,A=q.vertices,F=[];d=0;for(e=q.faces.length;dg?e:g;f=f>m? -f:m}a()};this.add3Points=function(g,m,y,C,u,q){if(h){h=false;c=gy?g>u?g:u:y>u?y:u;f=m>C?m>q?m:q:C>q?C:q}else{c=gy?g>u?g>e?g:e:u>e?u:e:y>u?y>e?y:e:u>e?u:e;f=m>C?m>q?m>f?m:f:q>f?q:f:C>q?C>f?C:f:q>f?q:f}a()};this.addRectangle=function(g){if(h){h=false;c=g.getLeft();d=g.getTop();e=g.getRight();f=g.getBottom()}else{c=c0&&G>0&&o+G<1}var d,e,f,b,l,h,g,m,y,C, +w,p=a.geometry,z=p.vertices,F=[];d=0;for(e=p.faces.length;dg?e:g;f=f>m? +f:m}a()};this.add3Points=function(g,m,y,C,w,p){if(h){h=false;c=gy?g>w?g:w:y>w?y:w;f=m>C?m>p?m:p:C>p?C:p}else{c=gy?g>w?g>e?g:e:w>e?w:e:y>w?y>e?y:e:w>e?w:e;f=m>C?m>p?m>f?m:f:p>f?p:f:C>p?C>f?C:f:p>f?p:f}a()};this.addRectangle=function(g){if(h){h=false;c=g.getLeft();d=g.getTop();e=g.getRight();f=g.getBottom()}else{c=cg.getRight()?e:g.getRight();f=f>g.getBottom()?f:g.getBottom()}a()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;a()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e=0&&Math.min(f,g.getBottom())-Math.max(d,g.getTop())>=0};this.empty=function(){h=true;f=e=d=c=0;a()};this.isEmpty=function(){return h};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+f+", width: "+b+", height: "+j+" )"}};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}}; -THREE.Matrix4=function(a,c,d,e,f,b,j,h,g,m,y,C,u,q,A,F){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=b||1;this.n23=j||0;this.n24=h||0;this.n31=g||0;this.n32=m||0;this.n33=y||1;this.n34=C||0;this.n41=u||0;this.n42=q||0;this.n43=A||0;this.n44=F||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,f,b,j,h,g,m,y,C,u,q,A,F){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=b;this.n23=j;this.n24=h;this.n31=g;this.n32=m;this.n33=y;this.n34=C;this.n41=u;this.n42=q;this.n43=A;this.n44=F;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+f+", width: "+b+", height: "+l+" )"}};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}}; +THREE.Matrix4=function(a,c,d,e,f,b,l,h,g,m,y,C,w,p,z,F){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=b||1;this.n23=l||0;this.n24=h||0;this.n31=g||0;this.n32=m||0;this.n33=y||1;this.n34=C||0;this.n41=w||0;this.n42=p||0;this.n43=z||0;this.n44=F||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,f,b,l,h,g,m,y,C,w,p,z,F){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=b;this.n23=l;this.n24=h;this.n31=g;this.n32=m;this.n33=y;this.n34=C;this.n41=w;this.n42=p;this.n43=z;this.n44=F;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();f.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a); this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23* -e+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,f=a.n13,b=a.n14,j=a.n21,h=a.n22,g=a.n23,m=a.n24,y=a.n31, -C=a.n32,u=a.n33,q=a.n34,A=a.n41,F=a.n42,G=a.n43,t=a.n44,H=c.n11,o=c.n12,l=c.n13,p=c.n14,n=c.n21,k=c.n22,w=c.n23,v=c.n24,x=c.n31,z=c.n32,D=c.n33,B=c.n34,I=c.n41,O=c.n42,Q=c.n43,R=c.n44;this.n11=d*H+e*n+f*x+b*I;this.n12=d*o+e*k+f*z+b*O;this.n13=d*l+e*w+f*D+b*Q;this.n14=d*p+e*v+f*B+b*R;this.n21=j*H+h*n+g*x+m*I;this.n22=j*o+h*k+g*z+m*O;this.n23=j*l+h*w+g*D+m*Q;this.n24=j*p+h*v+g*B+m*R;this.n31=y*H+C*n+u*x+q*I;this.n32=y*o+C*k+u*z+q*O;this.n33=y*l+C*w+u*D+q*Q;this.n34=y*p+C*v+u*B+q*R;this.n41=A*H+F*n+ -G*x+t*I;this.n42=A*o+F*k+G*z+t*O;this.n43=A*l+F*w+G*D+t*Q;this.n44=A*p+F*v+G*B+t*R;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,f=this.n14,b=this.n21,j=this.n22,h=this.n23,g=this.n24,m=this.n31,y=this.n32,C=this.n33,u=this.n34,q=this.n41,A=this.n42,F=this.n43,G=this.n44,t=a.n11,H=a.n21,o=a.n31,l=a.n41,p=a.n12,n=a.n22,k=a.n32,w=a.n42,v=a.n13,x=a.n23,z=a.n33,D=a.n43,B=a.n14,I=a.n24,O=a.n34;a=a.n44;this.n11=c*t+d*H+e*o+f*l;this.n12=c*p+d*n+e*k+f*w;this.n13=c*v+d*x+e*z+f* -D;this.n14=c*B+d*I+e*O+f*a;this.n21=b*t+j*H+h*o+g*l;this.n22=b*p+j*n+h*k+g*w;this.n23=b*v+j*x+h*z+g*D;this.n24=b*B+j*I+h*O+g*a;this.n31=m*t+y*H+C*o+u*l;this.n32=m*p+y*n+C*k+u*w;this.n33=m*v+y*x+C*z+u*D;this.n34=m*B+y*I+C*O+u*a;this.n41=q*t+A*H+F*o+G*l;this.n42=q*p+A*n+F*k+G*w;this.n43=q*v+A*x+F*z+G*D;this.n44=q*B+A*I+F*O+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= -a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,b=this.n22,j=this.n23,h=this.n24,g=this.n31,m=this.n32,y=this.n33,C=this.n34,u=this.n41,q=this.n42,A=this.n43,F=this.n44;return e*j*m*u-d*h*m*u-e*b*y*u+c*h*y*u+d*b*C*u-c*j*C*u-e*j*g*q+d*h*g*q+e*f*y*q-a*h*y*q-d*f*C*q+a*j*C*q+e*b*g*A-c*h*g*A-e*f*m*A+a*h*m*A+c*f*C*A-a*b*C*A-d*b*g*F+c*j*g*F+d*f*m*F-a*j*m*F-c*f*y*F+a*b*y*F},transpose:function(){function a(c,d, +e+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,f=a.n13,b=a.n14,l=a.n21,h=a.n22,g=a.n23,m=a.n24,y=a.n31, +C=a.n32,w=a.n33,p=a.n34,z=a.n41,F=a.n42,G=a.n43,u=a.n44,H=c.n11,n=c.n12,k=c.n13,o=c.n14,q=c.n21,j=c.n22,v=c.n23,t=c.n24,x=c.n31,A=c.n32,D=c.n33,B=c.n34,I=c.n41,P=c.n42,O=c.n43,Q=c.n44;this.n11=d*H+e*q+f*x+b*I;this.n12=d*n+e*j+f*A+b*P;this.n13=d*k+e*v+f*D+b*O;this.n14=d*o+e*t+f*B+b*Q;this.n21=l*H+h*q+g*x+m*I;this.n22=l*n+h*j+g*A+m*P;this.n23=l*k+h*v+g*D+m*O;this.n24=l*o+h*t+g*B+m*Q;this.n31=y*H+C*q+w*x+p*I;this.n32=y*n+C*j+w*A+p*P;this.n33=y*k+C*v+w*D+p*O;this.n34=y*o+C*t+w*B+p*Q;this.n41=z*H+F*q+ +G*x+u*I;this.n42=z*n+F*j+G*A+u*P;this.n43=z*k+F*v+G*D+u*O;this.n44=z*o+F*t+G*B+u*Q;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,f=this.n14,b=this.n21,l=this.n22,h=this.n23,g=this.n24,m=this.n31,y=this.n32,C=this.n33,w=this.n34,p=this.n41,z=this.n42,F=this.n43,G=this.n44,u=a.n11,H=a.n21,n=a.n31,k=a.n41,o=a.n12,q=a.n22,j=a.n32,v=a.n42,t=a.n13,x=a.n23,A=a.n33,D=a.n43,B=a.n14,I=a.n24,P=a.n34;a=a.n44;this.n11=c*u+d*H+e*n+f*k;this.n12=c*o+d*q+e*j+f*v;this.n13=c*t+d*x+e*A+f* +D;this.n14=c*B+d*I+e*P+f*a;this.n21=b*u+l*H+h*n+g*k;this.n22=b*o+l*q+h*j+g*v;this.n23=b*t+l*x+h*A+g*D;this.n24=b*B+l*I+h*P+g*a;this.n31=m*u+y*H+C*n+w*k;this.n32=m*o+y*q+C*j+w*v;this.n33=m*t+y*x+C*A+w*D;this.n34=m*B+y*I+C*P+w*a;this.n41=p*u+z*H+F*n+G*k;this.n42=p*o+z*q+F*j+G*v;this.n43=p*t+z*x+F*A+G*D;this.n44=p*B+z*I+F*P+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= +a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,b=this.n22,l=this.n23,h=this.n24,g=this.n31,m=this.n32,y=this.n33,C=this.n34,w=this.n41,p=this.n42,z=this.n43,F=this.n44;return e*l*m*w-d*h*m*w-e*b*y*w+c*h*y*w+d*b*C*w-c*l*C*w-e*l*g*p+d*h*g*p+e*f*y*p-a*h*y*p-d*f*C*p+a*l*C*p+e*b*g*z-c*h*g*z-e*f*m*z+a*h*m*z+c*f*C*z-a*b*C*z-d*b*g*F+c*l*g*F+d*f*m*F-a*l*m*F-c*f*y*F+a*b*y*F},transpose:function(){function a(c,d, e){var f=c[d];c[d]=c[e];c[e]=f}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},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,b=a.x,j=a.y,h=a.z,g=f*b,m=f*j;this.set(g*b+d,g*j-e*h,g*h+e*j,0,g*j+e*h,m*j+d,m*h-e*b,0,g*h-e*j,m*h+e*b,f*h*h+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,b=a.x,l=a.y,h=a.z,g=f*b,m=f*l;this.set(g*b+d,g*l-e*h,g*h+e*l,0,g*l+e*h,m*l+d,m*h-e*b,0,g*h-e*l,m*h+e*b,f*h*h+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,b=a.n21,j=a.n22,h=a.n23,g=a.n24,m=a.n31,y=a.n32,C=a.n33,u=a.n34,q=a.n41,A=a.n42,F=a.n43,G=a.n44,t=new THREE.Matrix4;t.n11=h*u*A-g*C*A+g*y*F-j*u*F-h*y*G+j*C*G;t.n12=f*C*A-e*u*A-f*y*F+d*u*F+e*y*G-d*C*G;t.n13=e*g*A-f*h*A+f*j*F-d*g*F-e*j*G+d*h*G;t.n14=f*h*y-e*g*y-f*j*C+d*g*C+e*j*u-d*h*u;t.n21=g*C*q-h*u*q-g*m*F+b*u*F+h*m*G-b*C*G;t.n22=e*u*q-f*C*q+f*m*F-c*u*F-e*m*G+c*C*G;t.n23=f*h*q-e*g*q-f*b*F+c*g*F+e*b*G-c*h*G;t.n24=e*g*m-f*h*m+ -f*b*C-c*g*C-e*b*u+c*h*u;t.n31=j*u*q-g*y*q+g*m*A-b*u*A-j*m*G+b*y*G;t.n32=f*y*q-d*u*q-f*m*A+c*u*A+d*m*G-c*y*G;t.n33=e*g*q-f*j*q+f*b*A-c*g*A-d*b*G+c*j*G;t.n34=f*j*m-d*g*m-f*b*y+c*g*y+d*b*u-c*j*u;t.n41=h*y*q-j*C*q-h*m*A+b*C*A+j*m*F-b*y*F;t.n42=d*C*q-e*y*q+e*m*A-c*C*A-d*m*F+c*y*F;t.n43=e*j*q-d*h*q-e*b*A+c*h*A+d*b*F-c*j*F;t.n44=d*h*m-e*j*m+e*b*y-c*h*y-d*b*C+c*j*C;t.multiplyScalar(1/a.determinant());return t}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],j=-c[10]*c[4]+c[6]*c[8],h=c[10]*c[0]-c[2]*c[8],g=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],C=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*j+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*f;d[2]=c*b;d[3]=c*j;d[4]=c*h;d[5]=c*g;d[6]=c*m;d[7]=c*y;d[8]=c*C;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,f,b){var j,h,g;j=new THREE.Matrix4;h=2*f/(c-a);g=2*f/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+f)/(b-f);f=-2*b*f/(b-f);j.n11=h;j.n12=0;j.n13=a;j.n14=0;j.n21=0;j.n22=g;j.n23=d;j.n24=0;j.n31=0;j.n32=0;j.n33=e;j.n34=f;j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,c,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,c,d,e,f,b){var j,h,g,m;j=new THREE.Matrix4;h=c-a;g=d-e;m=b-f;a=(c+a)/h;d=(d+e)/g;f=(b+f)/m;j.n11=2/h;j.n12=0;j.n13=0;j.n14=-a;j.n21=0;j.n22=2/g;j.n23=0;j.n24=-d;j.n31=0;j.n32=0;j.n33=-2/m;j.n34=-f;j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,b=a.n21,l=a.n22,h=a.n23,g=a.n24,m=a.n31,y=a.n32,C=a.n33,w=a.n34,p=a.n41,z=a.n42,F=a.n43,G=a.n44,u=new THREE.Matrix4;u.n11=h*w*z-g*C*z+g*y*F-l*w*F-h*y*G+l*C*G;u.n12=f*C*z-e*w*z-f*y*F+d*w*F+e*y*G-d*C*G;u.n13=e*g*z-f*h*z+f*l*F-d*g*F-e*l*G+d*h*G;u.n14=f*h*y-e*g*y-f*l*C+d*g*C+e*l*w-d*h*w;u.n21=g*C*p-h*w*p-g*m*F+b*w*F+h*m*G-b*C*G;u.n22=e*w*p-f*C*p+f*m*F-c*w*F-e*m*G+c*C*G;u.n23=f*h*p-e*g*p-f*b*F+c*g*F+e*b*G-c*h*G;u.n24=e*g*m-f*h*m+ +f*b*C-c*g*C-e*b*w+c*h*w;u.n31=l*w*p-g*y*p+g*m*z-b*w*z-l*m*G+b*y*G;u.n32=f*y*p-d*w*p-f*m*z+c*w*z+d*m*G-c*y*G;u.n33=e*g*p-f*l*p+f*b*z-c*g*z-d*b*G+c*l*G;u.n34=f*l*m-d*g*m-f*b*y+c*g*y+d*b*w-c*l*w;u.n41=h*y*p-l*C*p-h*m*z+b*C*z+l*m*F-b*y*F;u.n42=d*C*p-e*y*p+e*m*z-c*C*z-d*m*F+c*y*F;u.n43=e*l*p-d*h*p-e*b*z+c*h*z+d*b*F-c*l*F;u.n44=d*h*m-e*l*m+e*b*y-c*h*y-d*b*C+c*l*C;u.multiplyScalar(1/a.determinant());return u}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],l=-c[10]*c[4]+c[6]*c[8],h=c[10]*c[0]-c[2]*c[8],g=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],C=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*l+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*f;d[2]=c*b;d[3]=c*l;d[4]=c*h;d[5]=c*g;d[6]=c*m;d[7]=c*y;d[8]=c*C;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,f,b){var l,h,g;l=new THREE.Matrix4;h=2*f/(c-a);g=2*f/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+f)/(b-f);f=-2*b*f/(b-f);l.n11=h;l.n12=0;l.n13=a;l.n14=0;l.n21=0;l.n22=g;l.n23=d;l.n24=0;l.n31=0;l.n32=0;l.n33=e;l.n34=f;l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,c,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,f,b){var l,h,g,m;l=new THREE.Matrix4;h=c-a;g=d-e;m=b-f;a=(c+a)/h;d=(d+e)/g;f=(b+f)/m;l.n11=2/h;l.n12=0;l.n13=0;l.n14=-a;l.n21=0;l.n22=2/g;l.n23=0;l.n24=-d;l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-f;l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,c,d,e,f){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; THREE.Face4=function(a,c,d,e,f,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=b instanceof Array?b:[b]};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.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; +THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[h].counter+=1;g=m[h].hash+"_"+m[h].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:j,vertices:0}}this.geometryChunks[g].faces.push(e);this.geometryChunks[g].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[h].counter+=1;g=m[h].hash+"_"+m[h].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:l,vertices:0}}this.geometryChunks[g].faces.push(e);this.geometryChunks[g].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);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()}; @@ -61,7 +61,7 @@ THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.positio THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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.colors=[];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; +THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}}; @@ -87,8 +87,8 @@ THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShadi THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!== undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}}; THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; -THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending}}; -THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
)"}}; +THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.vertex_colors=false;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; +THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
vertex_colors: "+this.vertex_colors+"
)"}}; 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 (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,f,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=b!==undefined?b: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 (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; @@ -98,130 +98,133 @@ var Uniforms={clone:function(a){var c,d,e,f={};for(c in a){f[c]={};for(d in a[c] THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){}; THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}}; THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4}; -THREE.Projector=function(){function a(k,w){return w.z-k.z}function c(k,w){var v=0,x=1,z=k.z+k.w,D=w.z+w.w,B=-k.z+k.w,I=-w.z+w.w;if(z>=0&&D>=0&&B>=0&&I>=0)return true;else if(z<0&&D<0||B<0&&I<0)return false;else{if(z<0)v=Math.max(v,z/(z-D));else if(D<0)x=Math.min(x,z/(z-D));if(B<0)v=Math.max(v,B/(B-I));else if(I<0)x=Math.min(x,B/(B-I));if(xz&&Q.z0&&G.z<1){u=A[q]=A[q]||new THREE.RenderableParticle;u.x=G.x/G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=T.rotation.z;u.scale.x=T.scale.x*Math.abs(u.x-(G.x+w.projectionMatrix.n11)/(G.w+w.projectionMatrix.n14)); -u.scale.y=T.scale.y*Math.abs(u.y-(G.y+w.projectionMatrix.n22)/(G.w+w.projectionMatrix.n24));u.materials=T.materials;x.push(u);q++}}}}v&&x.sort(a);return x};this.unprojectVector=function(k,w){var v=THREE.Matrix4.makeInvert(w.matrix);v.multiplySelf(THREE.Matrix4.makeInvert(w.projectionMatrix));v.multiplyVector3(k);return k}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,f,b;this.domElement=document.createElement("div");this.setSize=function(j,h){d=j;e=h;f=d/2;b=e/2};this.render=function(j,h){var g,m,y,C,u,q,A,F;a=c.projectScene(j,h);g=0;for(m=a.length;g0){P.r+=na.r*ga;P.g+=na.g*ga;P.b+=na.b*ga}}else if(ga instanceof THREE.PointLight){J.sub(ga.position,fa);J.normalize();ga=aa.dot(J)*oa;if(ga>0){P.r+=na.r*ga;P.g+=na.g*ga;P.b+=na.b*ga}}}}function Qa(M,fa,aa){if(aa.opacity!= -0){a(aa.opacity);c(aa.blending);var P,Y,ga,na,oa,pa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map&&aa.map.image.loaded){na=aa.map.image;oa=na.width>>1;pa=na.height>>1;Y=fa.scale.x*h;ga=fa.scale.y*g;aa=Y*oa;P=ga*pa;N.set(M.x-aa,M.y-P,M.x+aa,M.y+P);if(Z.instersects(N)){m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(Y,-ga);m.translate(-oa,-pa);m.drawImage(na,0,0);m.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(W){$.r=da.r+ha.r+E.r;$.g=da.g+ha.g+E.g;$.b=da.b+ -ha.b+E.b;x.r=aa.color.r*$.r;x.g=aa.color.g*$.g;x.b=aa.color.b*$.b;x.updateStyleString()}else x.__styleString=aa.color.__styleString;aa=fa.scale.x*h;P=fa.scale.y*g;N.set(M.x-aa,M.y-P,M.x+aa,M.y+P);if(Z.instersects(N)){Y=x.__styleString;if(F!=Y)m.fillStyle=F=Y;m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(aa,P);m.beginPath();m.arc(0,0,1,0,L,true);m.closePath();m.fill();m.restore()}}}}function Ra(M,fa,aa,P){if(P.opacity!=0){a(P.opacity);c(P.blending);m.beginPath();m.moveTo(M.positionScreen.x, -M.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(P instanceof THREE.LineBasicMaterial){x.__styleString=P.color.__styleString;M=P.linewidth;if(G!=M)m.lineWidth=G=M;M=x.__styleString;if(A!=M)m.strokeStyle=A=M;m.stroke();N.inflate(P.linewidth*2)}}}function Ma(M,fa,aa,P,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);l=M.positionScreen.x;p=M.positionScreen.y;n=fa.positionScreen.x;k=fa.positionScreen.y;w=aa.positionScreen.x;v=aa.positionScreen.y;m.beginPath();m.moveTo(l, -p);m.lineTo(n,k);m.lineTo(w,v);m.lineTo(l,p);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(l,p,n,k,w,v,Y.map.image,P.uvs[0].u,P.uvs[0].v,P.uvs[1].u,P.uvs[1].v,P.uvs[2].u,P.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=sa.matrix;J.copy(P.vertexNormalsWorld[0]);U=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;T=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5; -J.copy(P.vertexNormalsWorld[1]);ba=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;ca=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(P.vertexNormalsWorld[2]);S=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;K=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;Aa(l,p,n,k,w,v,Y.env_map.image,U,T,ba,ca,S,K)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(l,p,n,k,w, -v,Y.map.image,P.uvs[0].u,P.uvs[0].v,P.uvs[1].u,P.uvs[1].v,P.uvs[2].u,P.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&P.vertexNormalsWorld.length==3){z.r=D.r=B.r=da.r;z.g=D.g=B.g=da.g;z.b=D.b=B.b=da.b;Da(ga,P.v1.positionWorld,P.vertexNormalsWorld[0],z);Da(ga,P.v2.positionWorld,P.vertexNormalsWorld[1],D);Da(ga,P.v3.positionWorld,P.vertexNormalsWorld[2],B);I.r=(D.r+B.r)*0.5;I.g=(D.g+B.g)*0.5;I.b=(D.b+B.b)*0.5;R=Na(z,D,B,I);Aa(l,p,n,k,w,v,R,0,0,1,0,0,1)}else{$.r= -da.r;$.g=da.g;$.b=da.b;Da(ga,P.centroidWorld,P.normalWorld,$);x.r=Y.color.r*$.r;x.g=Y.color.g*$.g;x.b=Y.color.b*$.b;x.updateStyleString();Y.wireframe?Ea(x.__styleString,Y.wireframe_linewidth):Fa(x.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){O=sa.near;Q=sa.far;z.r=z.g=z.b=1-Ia(M.positionScreen.z,O,Q);D.r=D.g=D.b=1-Ia(fa.positionScreen.z,O,Q);B.r=B.g=B.b=1-Ia(aa.positionScreen.z,O,Q);I.r=(D.r+ -B.r)*0.5;I.g=(D.g+B.g)*0.5;I.b=(D.b+B.b)*0.5;R=Na(z,D,B,I);Aa(l,p,n,k,w,v,R,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){x.r=Ja(P.normalWorld.x);x.g=Ja(P.normalWorld.y);x.b=Ja(P.normalWorld.z);x.updateStyleString();Y.wireframe?Ea(x.__styleString,Y.wireframe_linewidth):Fa(x.__styleString)}}}function Ea(M,fa){if(A!=M)m.strokeStyle=A=M;if(G!=fa)m.lineWidth=G=fa;m.stroke();N.inflate(fa*2)}function Fa(M){if(F!=M)m.fillStyle=F=M;m.fill()}function Aa(M,fa,aa,P,Y,ga,na,oa,pa,va,ra,wa,Ba){var ya, -xa;ya=na.width-1;xa=na.height-1;oa*=ya;pa*=xa;va*=ya;ra*=xa;wa*=ya;Ba*=xa;aa-=M;P-=fa;Y-=M;ga-=fa;va-=oa;ra-=pa;wa-=oa;Ba-=pa;xa=1/(va*Ba-wa*ra);ya=(Ba*aa-ra*Y)*xa;ra=(Ba*P-ra*ga)*xa;aa=(va*Y-wa*aa)*xa;P=(va*ga-wa*P)*xa;M=M-ya*oa-aa*pa;fa=fa-ra*oa-P*pa;m.save();m.transform(ya,ra,aa,P,M,fa);m.clip();m.drawImage(na,0,0);m.restore()}function Na(M,fa,aa,P){var Y=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var na=~~(fa.r*255),oa=~~(fa.g*255);fa=~~(fa.b*255);var pa=~~(aa.r*255),va=~~(aa.g*255);aa=~~(aa.b* -255);var ra=~~(P.r*255),wa=~~(P.g*255);P=~~(P.b*255);ia[0]=Y<0?0:Y>255?255:Y;ia[1]=ga<0?0:ga>255?255:ga;ia[2]=M<0?0:M>255?255:M;ia[4]=na<0?0:na>255?255:na;ia[5]=oa<0?0:oa>255?255:oa;ia[6]=fa<0?0:fa>255?255:fa;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=va<0?0:va>255?255:va;ia[10]=aa<0?0:aa>255?255:aa;ia[12]=ra<0?0:ra>255?255:ra;ia[13]=wa<0?0:wa>255?255:wa;ia[14]=P<0?0:P>255?255:P;ea.putImageData(ja,0,0);la.drawImage(X,0,0);return qa}function Ia(M,fa,aa){M=(M-fa)/(aa-fa);return M*M*(3-2*M)}function Ja(M){M=(M+ -1)*0.5;return M<0?0:M>1?1:M}function Ka(M,fa){var aa=fa.x-M.x,P=fa.y-M.y,Y=1/Math.sqrt(aa*aa+P*P);aa*=Y;P*=Y;fa.x+=aa;fa.y+=P;M.x-=aa;M.y-=P}var Ga,Oa,ka,ta,za,La,Pa,Ca;this.autoClear?this.clear():m.setTransform(1,0,0,-1,h,g);d=e.projectScene(ma,sa,this.sortElements);(W=ma.lights.length>0)&&Ha(ma);Ga=0;for(Oa=d.length;Ga=0&&D>=0&&B>=0&&I>=0)return true;else if(A<0&&D<0||B<0&&I<0)return false;else{if(A<0)t=Math.max(t,A/(A-D));else if(D<0)x=Math.min(x,A/(A-D));if(B<0)t=Math.max(t,B/(B-I));else if(I<0)x=Math.min(x,B/(B-I));if(xA&&O.z0&&G.z<1){w=z[p]=z[p]||new THREE.RenderableParticle;w.x=G.x/G.w;w.y=G.y/G.w;w.z=G.z;w.rotation=U.rotation.z;w.scale.x=U.scale.x*Math.abs(w.x-(G.x+v.projectionMatrix.n11)/(G.w+v.projectionMatrix.n14)); +w.scale.y=U.scale.y*Math.abs(w.y-(G.y+v.projectionMatrix.n22)/(G.w+v.projectionMatrix.n24));w.materials=U.materials;x.push(w);p++}}}}t&&x.sort(a);return x};this.unprojectVector=function(j,v){var t=THREE.Matrix4.makeInvert(v.matrix);t.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));t.multiplyVector3(j);return j}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,f,b;this.domElement=document.createElement("div");this.setSize=function(l,h){d=l;e=h;f=d/2;b=e/2};this.render=function(l,h){var g,m,y,C,w,p,z,F;a=c.projectScene(l,h);g=0;for(m=a.length;g0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}else if(ga instanceof THREE.PointLight){J.sub(ga.position,fa);J.normalize();ga=aa.dot(J)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}}}function Qa(M,fa,aa){if(aa.opacity!= +0){a(aa.opacity);c(aa.blending);var R,Y,ga,na,oa,pa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map&&aa.map.image.loaded){na=aa.map.image;oa=na.width>>1;pa=na.height>>1;Y=fa.scale.x*h;ga=fa.scale.y*g;aa=Y*oa;R=ga*pa;N.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(N)){m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(Y,-ga);m.translate(-oa,-pa);m.drawImage(na,0,0);m.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(W){$.r=da.r+ha.r+E.r;$.g=da.g+ha.g+E.g;$.b=da.b+ +ha.b+E.b;x.r=aa.color.r*$.r;x.g=aa.color.g*$.g;x.b=aa.color.b*$.b;x.updateStyleString()}else x.__styleString=aa.color.__styleString;aa=fa.scale.x*h;R=fa.scale.y*g;N.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(N)){Y=x.__styleString;if(F!=Y)m.fillStyle=F=Y;m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(aa,R);m.beginPath();m.arc(0,0,1,0,L,true);m.closePath();m.fill();m.restore()}}}}function Ra(M,fa,aa,R){if(R.opacity!=0){a(R.opacity);c(R.blending);m.beginPath();m.moveTo(M.positionScreen.x, +M.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){x.__styleString=R.color.__styleString;M=R.linewidth;if(G!=M)m.lineWidth=G=M;M=x.__styleString;if(z!=M)m.strokeStyle=z=M;m.stroke();N.inflate(R.linewidth*2)}}}function Ma(M,fa,aa,R,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);k=M.positionScreen.x;o=M.positionScreen.y;q=fa.positionScreen.x;j=fa.positionScreen.y;v=aa.positionScreen.x;t=aa.positionScreen.y;m.beginPath();m.moveTo(k, +o);m.lineTo(q,j);m.lineTo(v,t);m.lineTo(k,o);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(k,o,q,j,v,t,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=sa.matrix;J.copy(R.vertexNormalsWorld[0]);T=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;U=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5; +J.copy(R.vertexNormalsWorld[1]);ba=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;ca=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(R.vertexNormalsWorld[2]);S=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;K=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;Aa(k,o,q,j,v,t,Y.env_map.image,T,U,ba,ca,S,K)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(k,o,q,j,v, +t,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){A.r=D.r=B.r=da.r;A.g=D.g=B.g=da.g;A.b=D.b=B.b=da.b;Da(ga,R.v1.positionWorld,R.vertexNormalsWorld[0],A);Da(ga,R.v2.positionWorld,R.vertexNormalsWorld[1],D);Da(ga,R.v3.positionWorld,R.vertexNormalsWorld[2],B);I.r=(D.r+B.r)*0.5;I.g=(D.g+B.g)*0.5;I.b=(D.b+B.b)*0.5;Q=Na(A,D,B,I);Aa(k,o,q,j,v,t,Q,0,0,1,0,0,1)}else{$.r= +da.r;$.g=da.g;$.b=da.b;Da(ga,R.centroidWorld,R.normalWorld,$);x.r=Y.color.r*$.r;x.g=Y.color.g*$.g;x.b=Y.color.b*$.b;x.updateStyleString();Y.wireframe?Ea(x.__styleString,Y.wireframe_linewidth):Fa(x.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){P=sa.near;O=sa.far;A.r=A.g=A.b=1-Ia(M.positionScreen.z,P,O);D.r=D.g=D.b=1-Ia(fa.positionScreen.z,P,O);B.r=B.g=B.b=1-Ia(aa.positionScreen.z,P,O);I.r=(D.r+ +B.r)*0.5;I.g=(D.g+B.g)*0.5;I.b=(D.b+B.b)*0.5;Q=Na(A,D,B,I);Aa(k,o,q,j,v,t,Q,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){x.r=Ja(R.normalWorld.x);x.g=Ja(R.normalWorld.y);x.b=Ja(R.normalWorld.z);x.updateStyleString();Y.wireframe?Ea(x.__styleString,Y.wireframe_linewidth):Fa(x.__styleString)}}}function Ea(M,fa){if(z!=M)m.strokeStyle=z=M;if(G!=fa)m.lineWidth=G=fa;m.stroke();N.inflate(fa*2)}function Fa(M){if(F!=M)m.fillStyle=F=M;m.fill()}function Aa(M,fa,aa,R,Y,ga,na,oa,pa,va,ra,wa,Ba){var ya, +xa;ya=na.width-1;xa=na.height-1;oa*=ya;pa*=xa;va*=ya;ra*=xa;wa*=ya;Ba*=xa;aa-=M;R-=fa;Y-=M;ga-=fa;va-=oa;ra-=pa;wa-=oa;Ba-=pa;xa=1/(va*Ba-wa*ra);ya=(Ba*aa-ra*Y)*xa;ra=(Ba*R-ra*ga)*xa;aa=(va*Y-wa*aa)*xa;R=(va*ga-wa*R)*xa;M=M-ya*oa-aa*pa;fa=fa-ra*oa-R*pa;m.save();m.transform(ya,ra,aa,R,M,fa);m.clip();m.drawImage(na,0,0);m.restore()}function Na(M,fa,aa,R){var Y=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var na=~~(fa.r*255),oa=~~(fa.g*255);fa=~~(fa.b*255);var pa=~~(aa.r*255),va=~~(aa.g*255);aa=~~(aa.b* +255);var ra=~~(R.r*255),wa=~~(R.g*255);R=~~(R.b*255);ia[0]=Y<0?0:Y>255?255:Y;ia[1]=ga<0?0:ga>255?255:ga;ia[2]=M<0?0:M>255?255:M;ia[4]=na<0?0:na>255?255:na;ia[5]=oa<0?0:oa>255?255:oa;ia[6]=fa<0?0:fa>255?255:fa;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=va<0?0:va>255?255:va;ia[10]=aa<0?0:aa>255?255:aa;ia[12]=ra<0?0:ra>255?255:ra;ia[13]=wa<0?0:wa>255?255:wa;ia[14]=R<0?0:R>255?255:R;ea.putImageData(ja,0,0);la.drawImage(X,0,0);return qa}function Ia(M,fa,aa){M=(M-fa)/(aa-fa);return M*M*(3-2*M)}function Ja(M){M=(M+ +1)*0.5;return M<0?0:M>1?1:M}function Ka(M,fa){var aa=fa.x-M.x,R=fa.y-M.y,Y=1/Math.sqrt(aa*aa+R*R);aa*=Y;R*=Y;fa.x+=aa;fa.y+=R;M.x-=aa;M.y-=R}var Ga,Oa,ka,ta,za,La,Pa,Ca;this.autoClear?this.clear():m.setTransform(1,0,0,-1,h,g);d=e.projectScene(ma,sa,this.sortElements);(W=ma.lights.length>0)&&Ha(ma);Ga=0;for(Oa=d.length;Ga0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}else if(K instanceof THREE.PointLight){v.sub(K.position,T.centroidWorld);v.normalize();Z=T.normalWorld.dot(v)*K.intensity;if(Z>0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}}}function c(U,T,ba,ca,S,K){B=e(I++);B.setAttribute("d", -"M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)o.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(H){l.r=p.r;l.g=p.g;l.b=p.b;a(K,ca,l);o.r=S.color.r*l.r;o.g=S.color.g*l.g;o.b=S.color.b*l.b;o.updateStyleString()}else o.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){w=1-S.__2near/(S.__farPlusNear- -ca.z*S.__farMinusNear);o.setRGB(w,w,w)}else S instanceof THREE.MeshNormalMaterial&&o.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?B.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):B.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+S.opacity);h.appendChild(B)}function d(U,T,ba,ca,S, -K,Z){B=e(I++);B.setAttribute("d","M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)o.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(H){l.r=p.r;l.g=p.g;l.b=p.b;a(Z,S,l);o.r=K.color.r*l.r;o.g=K.color.g*l.g;o.b=K.color.b*l.b;o.updateStyleString()}else o.__styleString=K.color.__styleString; -else if(K instanceof THREE.MeshDepthMaterial){w=1-K.__2near/(K.__farPlusNear-S.z*K.__farMinusNear);o.setRGB(w,w,w)}else K instanceof THREE.MeshNormalMaterial&&o.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));K.wireframe?B.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):B.setAttribute("style","fill: "+o.__styleString+ -"; fill-opacity: "+K.opacity);h.appendChild(B)}function e(U){if(x[U]==null){x[U]=document.createElementNS("http://www.w3.org/2000/svg","path");R==0&&x[U].setAttribute("shape-rendering","crispEdges");return x[U]}return x[U]}function f(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var b=null,j=new THREE.Projector,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,m,y,C,u,q,A,F,G=new THREE.Rectangle,t=new THREE.Rectangle,H=false,o=new THREE.Color(16777215),l=new THREE.Color(16777215), -p=new THREE.Color(0),n=new THREE.Color(0),k=new THREE.Color(0),w,v=new THREE.Vector3,x=[],z=[],D=[],B,I,O,Q,R=1;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":R=1;break;case "low":R=0}};this.setSize=function(U,T){g=U;m=T;y=g/2;C=m/2;h.setAttribute("viewBox",-y+" "+-C+" "+g+" "+m);h.setAttribute("width",g);h.setAttribute("height",m);G.set(-y,-C,y,C)};this.clear=function(){for(;h.childNodes.length>0;)h.removeChild(h.childNodes[0])}; -this.render=function(U,T){var ba,ca,S,K,Z,V,N,W;this.autoClear&&this.clear();b=j.projectScene(U,T,this.sortElements);Q=O=I=0;if(H=U.lights.length>0){N=U.lights;p.setRGB(0,0,0);n.setRGB(0,0,0);k.setRGB(0,0,0);ba=0;for(ca=N.length;ba0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}else if(K instanceof THREE.PointLight){t.sub(K.position,U.centroidWorld);t.normalize();Z=U.normalWorld.dot(t)*K.intensity;if(Z>0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}}}function c(T,U,ba,ca,S,K){B=e(I++);B.setAttribute("d", +"M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)n.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(H){k.r=o.r;k.g=o.g;k.b=o.b;a(K,ca,k);n.r=S.color.r*k.r;n.g=S.color.g*k.g;n.b=S.color.b*k.b;n.updateStyleString()}else n.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){v=1-S.__2near/(S.__farPlusNear- +ca.z*S.__farMinusNear);n.setRGB(v,v,v)}else S instanceof THREE.MeshNormalMaterial&&n.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?B.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):B.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+S.opacity);h.appendChild(B)}function d(T,U,ba,ca,S, +K,Z){B=e(I++);B.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)n.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(H){k.r=o.r;k.g=o.g;k.b=o.b;a(Z,S,k);n.r=K.color.r*k.r;n.g=K.color.g*k.g;n.b=K.color.b*k.b;n.updateStyleString()}else n.__styleString=K.color.__styleString; +else if(K instanceof THREE.MeshDepthMaterial){v=1-K.__2near/(K.__farPlusNear-S.z*K.__farMinusNear);n.setRGB(v,v,v)}else K instanceof THREE.MeshNormalMaterial&&n.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));K.wireframe?B.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):B.setAttribute("style","fill: "+n.__styleString+ +"; fill-opacity: "+K.opacity);h.appendChild(B)}function e(T){if(x[T]==null){x[T]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&x[T].setAttribute("shape-rendering","crispEdges");return x[T]}return x[T]}function f(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var b=null,l=new THREE.Projector,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),g,m,y,C,w,p,z,F,G=new THREE.Rectangle,u=new THREE.Rectangle,H=false,n=new THREE.Color(16777215),k=new THREE.Color(16777215), +o=new THREE.Color(0),q=new THREE.Color(0),j=new THREE.Color(0),v,t=new THREE.Vector3,x=[],A=[],D=[],B,I,P,O,Q=1;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(T,U){g=T;m=U;y=g/2;C=m/2;h.setAttribute("viewBox",-y+" "+-C+" "+g+" "+m);h.setAttribute("width",g);h.setAttribute("height",m);G.set(-y,-C,y,C)};this.clear=function(){for(;h.childNodes.length>0;)h.removeChild(h.childNodes[0])}; +this.render=function(T,U){var ba,ca,S,K,Z,V,N,W;this.autoClear&&this.clear();b=l.projectScene(T,U,this.sortElements);O=P=I=0;if(H=T.lights.length>0){N=T.lights;o.setRGB(0,0,0);q.setRGB(0,0,0);j.setRGB(0,0,0);ba=0;for(ca=N.length;ba0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,N,n)}if(ja&&ba>0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,W,n)}if(ea){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,E,n)}};this.setLineBuffers=function(l,p){var n,k,w,v=l.vertices,x=v.length,z=l.__vertexArray, -D=l.__lineArray,B=l.__dirtyElements;if(l.__dirtyVertices)for(n=0;n0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights, -"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(n,d("fragment",w+D));b.attachShader(n,d("vertex",v+p));b.linkProgram(n); -b.getProgramParameter(n,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(n,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");n.uniforms={};n.attributes={};l.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(k in l.uniforms)n.push(k);k=l.program;D=0;for(p=n.length;D= -0){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLNormalBuffer);b.vertexAttribPointer(x.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.normal)}if(x.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLTangentBuffer);b.vertexAttribPointer(x.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.tangent)}if(x.uv>=0)if(w.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLUVBuffer);b.vertexAttribPointer(x.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.uv)}else b.disableVertexAttribArray(x.uv);if(x.uv2>= -0)if(w.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,w.__webGLUV2Buffer);b.vertexAttribPointer(x.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.uv2)}else b.disableVertexAttribArray(x.uv2);if(k.wireframe||k instanceof THREE.LineBasicMaterial){x=k.wireframe_linewidth!==undefined?k.wireframe_linewidth:k.linewidth!==undefined?k.linewidth:1;k=k instanceof THREE.LineBasicMaterial&&v.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(x);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer); -b.drawElements(k,w.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(k instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLParticleBuffer);b.drawElements(b.POINTS,w.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,w.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(l,p,n,k,w,v,x){var z,D,B,I,O;B=0;for(I=k.materials.length;B=0;n--){k=l.__webGLObjects[n].object;p==k&&l.__webGLObjects.splice(n,1)}};this.setupMatrices=function(l,p){g.multiply(p.matrix,l.matrix);C.set(g.flatten());m=THREE.Matrix4.makeInvert3x3(g).transpose();q.set(m.m);A.set(l.matrix.flatten())};this.loadMatrices=function(l){b.uniformMatrix4fv(l.uniforms.viewMatrix, -false,y);b.uniformMatrix4fv(l.uniforms.modelViewMatrix,false,C);b.uniformMatrix4fv(l.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(l.uniforms.normalMatrix,false,q);b.uniformMatrix4fv(l.uniforms.objectMatrix,false,A)};this.loadCamera=function(l,p){b.uniform3f(l.uniforms.cameraPosition,p.position.x,p.position.y,p.position.z)};this.setBlending=function(l){switch(l){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(l,p){if(l){!p||p=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(l=="back")b.cullFace(b.BACK);else l=="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}}; +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 f=document.createElement("canvas"),b,l=null,h=null,g=new THREE.Matrix4,m,y=new Float32Array(16),C=new Float32Array(16), +w=new Float32Array(16),p=new Float32Array(9),z=new Float32Array(16),F=new THREE.Matrix4,G=new THREE.Vector4,u=true,H=new THREE.Color(0),n=0;if(a){if(a.antialias!==undefined)u=a.antialias;a.clearColor!==undefined&&H.setHex(a.clearColor);if(a.clearAlpha!==undefined)n=a.clearAlpha}this.domElement=f;this.autoClear=true;(function(k,o,q){try{b=f.getContext("experimental-webgl",{antialias:k})}catch(j){}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,q)})(u,H,n);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(k,o){f.width=k;f.height=o;b.viewport(0,0,f.width,f.height)};this.setClearColor=function(k,o){var q=new THREE.Color(k);b.clearColor(q.r,q.g,q.b,o)}; +this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(k,o){var q,j,v,t=0,x=0,A=0,D,B,I,P=this.lights,O=P.directional.colors,Q=P.directional.positions,T=P.point.colors,U=P.point.positions,ba=0,ca=0;q=0;for(j=o.length;q0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,N,q)}if(ja&&ba>0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,W,q)}if(ea){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,E,q)}};this.setLineBuffers=function(k,o){var q,j,v,t=k.vertices,x=t.length,A=k.__vertexArray, +D=k.__lineArray,B=k.__dirtyElements;if(k.__dirtyVertices){for(q=0;q0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+t.maxDirLights,"#define MAX_POINT_LIGHTS "+t.maxPointLights,t.map?"#define USE_MAP":"",t.env_map?"#define USE_ENVMAP": +"",t.light_map?"#define USE_LIGHTMAP":"",t.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(q,d("fragment",v+D));b.attachShader(q,d("vertex",t+o));b.linkProgram(q);b.getProgramParameter(q,b.LINK_STATUS)|| +alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(q,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");q.uniforms={};q.attributes={};k.program=q;q=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(j in k.uniforms)q.push(j);j=k.program;D=0;for(o=q.length;D= +0){b.bindBuffer(b.ARRAY_BUFFER,v.__webGLColorBuffer);b.vertexAttribPointer(x.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.color)}if(x.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,v.__webGLNormalBuffer);b.vertexAttribPointer(x.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.normal)}if(x.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,v.__webGLTangentBuffer);b.vertexAttribPointer(x.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.tangent)}if(x.uv>=0)if(v.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER, +v.__webGLUVBuffer);b.vertexAttribPointer(x.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.uv)}else b.disableVertexAttribArray(x.uv);if(x.uv2>=0)if(v.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,v.__webGLUV2Buffer);b.vertexAttribPointer(x.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(x.uv2)}else b.disableVertexAttribArray(x.uv2);if(j.wireframe||j instanceof THREE.LineBasicMaterial){x=j.wireframe_linewidth!==undefined?j.wireframe_linewidth:j.linewidth!==undefined?j.linewidth:1;j=j instanceof +THREE.LineBasicMaterial&&t.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(x);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,v.__webGLLineBuffer);b.drawElements(j,v.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(j instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,v.__webGLParticleBuffer);b.drawElements(b.POINTS,v.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,v.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,v.__webGLFaceCount,b.UNSIGNED_SHORT, +0)}};this.renderPass=function(k,o,q,j,v,t,x){var A,D,B,I,P;B=0;for(I=j.materials.length;B=0;q--){j=k.__webGLObjects[q].object;o==j&&k.__webGLObjects.splice(q,1)}};this.setupMatrices=function(k,o){g.multiply(o.matrix,k.matrix);C.set(g.flatten()); +m=THREE.Matrix4.makeInvert3x3(g).transpose();p.set(m.m);z.set(k.matrix.flatten())};this.loadMatrices=function(k){b.uniformMatrix4fv(k.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(k.uniforms.modelViewMatrix,false,C);b.uniformMatrix4fv(k.uniforms.projectionMatrix,false,w);b.uniformMatrix3fv(k.uniforms.normalMatrix,false,p);b.uniformMatrix4fv(k.uniforms.objectMatrix,false,z)};this.loadCamera=function(k,o){b.uniform3f(k.uniforms.cameraPosition,o.position.x,o.position.y,o.position.z)};this.setBlending= +function(k){switch(k){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(k,o){if(k){!o||o=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(k=="back")b.cullFace(b.BACK);else k=="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\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\nmapColor = 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\nmapColor = 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\nlightmapColor = 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 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"}; -THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},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:{color:{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)}}}; +lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif", +color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\nvertexColor = 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}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}", -vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", +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.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );", THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",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,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}, -lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment, -"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex, -"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", -THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", +lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment, +THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex, +THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;", +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() {\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );", THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;", -THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:"uniform float size;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"}}; -THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]}; -THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; -var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,f=d?c.geometry:c,b=a.vertices,j=f.vertices,h=a.faces,g=f.faces,m=a.uvs;f=f.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var y=0,C=j.length;y25)b=25;f=(b-1)*0.5;d=Array(b);for(c=e=0;c25)b=25;f=(b-1)*0.5;d=Array(b);for(c=e=0;c0||(y=this.vertices.push(new THREE.Vertex(new THREE.Vector3(C,h,u)))-1);m.push(y)}c.push(m)}var q,A,F;f=c.length;for(d=0;d0)for(e=0;e1){q=this.vertices[j].position.clone(); -A=this.vertices[g].position.clone();F=this.vertices[m].position.clone();q.normalize();A.normalize();F.normalize();this.faces.push(new THREE.Face3(j,g,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(F.x,F.y,F.z)]));this.uvs.push([y,C,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(a,c,d){THREE.Geometry.call(this);var e,f=Math.PI,b=Math.max(3,c||8),l=Math.max(2,d||6);c=[];for(d=0;d0||(y=this.vertices.push(new THREE.Vertex(new THREE.Vector3(C,h,w)))-1);m.push(y)}c.push(m)}var p,z,F;f=c.length;for(d=0;d0)for(e=0;e1){p=this.vertices[l].position.clone(); +z=this.vertices[g].position.clone();F=this.vertices[m].position.clone();p.normalize();z.normalize();F.normalize();this.faces.push(new THREE.Face3(l,g,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(F.x,F.y,F.z)]));this.uvs.push([y,C,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,c,d,e){this.radius=a||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= -1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;f=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,b,j));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[b][0],a[b][1]),new THREE.UV(a[j][0],a[j][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus; -var Icosahedron=function(a){function c(C,u,q){var A=Math.sqrt(C*C+u*u+q*q);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(C/A,u/A,q/A)))-1}function d(C,u,q,A){A.faces.push(new THREE.Face3(C,u,q))}function e(C,u){var q=f.vertices[C].position,A=f.vertices[u].position;return c((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var f=this,b=new THREE.Geometry,j;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, -1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);d(0,11,5,b);d(0,5,1,b);d(0,1,7,b);d(0,7,10,b);d(0,10,11,b);d(1,5,9,b);d(5,11,4,b);d(11,10,2,b);d(10,7,6,b);d(7,1,8,b);d(3,9,4,b);d(3,4,2,b);d(3,2,6,b);d(3,6,8,b);d(3,8,9,b);d(4,9,5,b);d(2,4,11,b);d(6,2,10,b);d(8,6,7,b);d(9,8,1,b);for(a=0;a>7)-127;J=(ea&127)<<16|X<<8|J;if(J==0&&ia==-127)return 0;return(1-2*(ja>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ia)}function h(E,L){var J=y(E,L),X=y(E,L+1),ea=y(E,L+2);return(y(E,L+3)<<24)+(ea<<16)+(X<<8)+J}function g(E,L){var J=y(E,L);return(y(E,L+1)<<8)+J}function m(E,L){var J=y(E,L);return J>127?J-256:J}function y(E,L){return E.charCodeAt(L)&255}function C(E){var L, -J,X;L=h(a,E);J=h(a,E+n);X=h(a,E+k);E=g(a,E+w);THREE.Loader.prototype.f3(t,L,J,X,E)}function u(E){var L,J,X,ea,ja,ia;L=h(a,E);J=h(a,E+n);X=h(a,E+k);ea=g(a,E+w);ja=h(a,E+v);ia=h(a,E+x);E=h(a,E+z);THREE.Loader.prototype.f3n(t,l,L,J,X,ea,ja,ia,E)}function q(E){var L,J,X,ea;L=h(a,E);J=h(a,E+D);X=h(a,E+B);ea=h(a,E+I);E=g(a,E+O);THREE.Loader.prototype.f4(t,L,J,X,ea,E)}function A(E){var L,J,X,ea,ja,ia,qa,la;L=h(a,E);J=h(a,E+D);X=h(a,E+B);ea=h(a,E+I);ja=g(a,E+O);ia=h(a,E+Q);qa=h(a,E+R);la=h(a,E+U);E=h(a,E+ -T);THREE.Loader.prototype.f4n(t,l,L,J,X,ea,ja,ia,qa,la,E)}function F(E){var L,J;L=h(a,E);J=h(a,E+ba);E=h(a,E+ca);THREE.Loader.prototype.uv3(t.uvs,p[L*2],p[L*2+1],p[J*2],p[J*2+1],p[E*2],p[E*2+1])}function G(E){var L,J,X;L=h(a,E);J=h(a,E+S);X=h(a,E+K);E=h(a,E+Z);THREE.Loader.prototype.uv4(t.uvs,p[L*2],p[L*2+1],p[J*2],p[J*2+1],p[X*2],p[X*2+1],p[E*2],p[E*2+1])}var t=this,H=0,o,l=[],p=[],n,k,w,v,x,z,D,B,I,O,Q,R,U,T,ba,ca,S,K,Z,V,N,W,$,da,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(t, -e,b);o={signature:a.substr(H,8),header_bytes:y(a,H+8),vertex_coordinate_bytes:y(a,H+9),normal_coordinate_bytes:y(a,H+10),uv_coordinate_bytes:y(a,H+11),vertex_index_bytes:y(a,H+12),normal_index_bytes:y(a,H+13),uv_index_bytes:y(a,H+14),material_index_bytes:y(a,H+15),nvertices:h(a,H+16),nnormals:h(a,H+16+4),nuvs:h(a,H+16+8),ntri_flat:h(a,H+16+12),ntri_smooth:h(a,H+16+16),ntri_flat_uv:h(a,H+16+20),ntri_smooth_uv:h(a,H+16+24),nquad_flat:h(a,H+16+28),nquad_smooth:h(a,H+16+32),nquad_flat_uv:h(a,H+16+36), -nquad_smooth_uv:h(a,H+16+40)};H+=o.header_bytes;n=o.vertex_index_bytes;k=o.vertex_index_bytes*2;w=o.vertex_index_bytes*3;v=o.vertex_index_bytes*3+o.material_index_bytes;x=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;z=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;D=o.vertex_index_bytes;B=o.vertex_index_bytes*2;I=o.vertex_index_bytes*3;O=o.vertex_index_bytes*4;Q=o.vertex_index_bytes*4+o.material_index_bytes;R=o.vertex_index_bytes*4+o.material_index_bytes+ -o.normal_index_bytes;U=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;T=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;ba=o.uv_index_bytes;ca=o.uv_index_bytes*2;S=o.uv_index_bytes;K=o.uv_index_bytes*2;Z=o.uv_index_bytes*3;b=o.vertex_index_bytes*3+o.material_index_bytes;ha=o.vertex_index_bytes*4+o.material_index_bytes;V=o.ntri_flat*b;N=o.ntri_smooth*(b+o.normal_index_bytes*3);W=o.ntri_flat_uv*(b+o.uv_index_bytes*3);$=o.ntri_smooth_uv*(b+o.normal_index_bytes* -3+o.uv_index_bytes*3);da=o.nquad_flat*ha;b=o.nquad_smooth*(ha+o.normal_index_bytes*4);ha=o.nquad_flat_uv*(ha+o.uv_index_bytes*4);H+=function(E){var L,J,X,ea=o.vertex_coordinate_bytes*3,ja=E+o.nvertices*ea;for(E=E;E>7)-127;J=(ea&127)<<16|X<<8|J;if(J==0&&ia==-127)return 0;return(1-2*(ja>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ia)}function h(E,L){var J=y(E,L),X=y(E,L+1),ea=y(E,L+2);return(y(E,L+3)<<24)+(ea<<16)+(X<<8)+J}function g(E,L){var J=y(E,L);return(y(E,L+1)<<8)+J}function m(E,L){var J=y(E,L);return J>127?J-256:J}function y(E,L){return E.charCodeAt(L)&255}function C(E){var L, +J,X;L=h(a,E);J=h(a,E+q);X=h(a,E+j);E=g(a,E+v);THREE.Loader.prototype.f3(u,L,J,X,E)}function w(E){var L,J,X,ea,ja,ia;L=h(a,E);J=h(a,E+q);X=h(a,E+j);ea=g(a,E+v);ja=h(a,E+t);ia=h(a,E+x);E=h(a,E+A);THREE.Loader.prototype.f3n(u,k,L,J,X,ea,ja,ia,E)}function p(E){var L,J,X,ea;L=h(a,E);J=h(a,E+D);X=h(a,E+B);ea=h(a,E+I);E=g(a,E+P);THREE.Loader.prototype.f4(u,L,J,X,ea,E)}function z(E){var L,J,X,ea,ja,ia,qa,la;L=h(a,E);J=h(a,E+D);X=h(a,E+B);ea=h(a,E+I);ja=g(a,E+P);ia=h(a,E+O);qa=h(a,E+Q);la=h(a,E+T);E=h(a,E+ +U);THREE.Loader.prototype.f4n(u,k,L,J,X,ea,ja,ia,qa,la,E)}function F(E){var L,J;L=h(a,E);J=h(a,E+ba);E=h(a,E+ca);THREE.Loader.prototype.uv3(u.uvs,o[L*2],o[L*2+1],o[J*2],o[J*2+1],o[E*2],o[E*2+1])}function G(E){var L,J,X;L=h(a,E);J=h(a,E+S);X=h(a,E+K);E=h(a,E+Z);THREE.Loader.prototype.uv4(u.uvs,o[L*2],o[L*2+1],o[J*2],o[J*2+1],o[X*2],o[X*2+1],o[E*2],o[E*2+1])}var u=this,H=0,n,k=[],o=[],q,j,v,t,x,A,D,B,I,P,O,Q,T,U,ba,ca,S,K,Z,V,N,W,$,da,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u, +e,b);n={signature:a.substr(H,8),header_bytes:y(a,H+8),vertex_coordinate_bytes:y(a,H+9),normal_coordinate_bytes:y(a,H+10),uv_coordinate_bytes:y(a,H+11),vertex_index_bytes:y(a,H+12),normal_index_bytes:y(a,H+13),uv_index_bytes:y(a,H+14),material_index_bytes:y(a,H+15),nvertices:h(a,H+16),nnormals:h(a,H+16+4),nuvs:h(a,H+16+8),ntri_flat:h(a,H+16+12),ntri_smooth:h(a,H+16+16),ntri_flat_uv:h(a,H+16+20),ntri_smooth_uv:h(a,H+16+24),nquad_flat:h(a,H+16+28),nquad_smooth:h(a,H+16+32),nquad_flat_uv:h(a,H+16+36), +nquad_smooth_uv:h(a,H+16+40)};H+=n.header_bytes;q=n.vertex_index_bytes;j=n.vertex_index_bytes*2;v=n.vertex_index_bytes*3;t=n.vertex_index_bytes*3+n.material_index_bytes;x=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;A=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;D=n.vertex_index_bytes;B=n.vertex_index_bytes*2;I=n.vertex_index_bytes*3;P=n.vertex_index_bytes*4;O=n.vertex_index_bytes*4+n.material_index_bytes;Q=n.vertex_index_bytes*4+n.material_index_bytes+ +n.normal_index_bytes;T=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;ba=n.uv_index_bytes;ca=n.uv_index_bytes*2;S=n.uv_index_bytes;K=n.uv_index_bytes*2;Z=n.uv_index_bytes*3;b=n.vertex_index_bytes*3+n.material_index_bytes;ha=n.vertex_index_bytes*4+n.material_index_bytes;V=n.ntri_flat*b;N=n.ntri_smooth*(b+n.normal_index_bytes*3);W=n.ntri_flat_uv*(b+n.uv_index_bytes*3);$=n.ntri_smooth_uv*(b+n.normal_index_bytes* +3+n.uv_index_bytes*3);da=n.nquad_flat*ha;b=n.nquad_smooth*(ha+n.normal_index_bytes*4);ha=n.nquad_flat_uv*(ha+n.uv_index_bytes*4);H+=function(E){var L,J,X,ea=n.vertex_coordinate_bytes*3,ja=E+n.nvertices*ea;for(E=E;E + + + three.js - particles - billboards - colors - webgl + + + + + +
+ three.js - webgl particle billboards colors example +
+ +
+
+ Sorry, your browser doesn't support WebGL + and Web Workers.
+
+ Please try in + Chrome 9+ / + Firefox 4+ / + Safari OSX 10.6+ +
+
+ + + + + + + diff --git a/src/core/Geometry.js b/src/core/Geometry.js index 8ea4b030..39a8b96a 100644 --- a/src/core/Geometry.js +++ b/src/core/Geometry.js @@ -10,6 +10,7 @@ THREE.Geometry = function () { this.faces = []; this.uvs = []; this.uvs2 = []; + this.colors = []; this.boundingBox = null; this.boundingSphere = null; diff --git a/src/materials/ParticleBasicMaterial.js b/src/materials/ParticleBasicMaterial.js index 84758a09..64bfde41 100644 --- a/src/materials/ParticleBasicMaterial.js +++ b/src/materials/ParticleBasicMaterial.js @@ -16,6 +16,8 @@ THREE.ParticleBasicMaterial = function ( parameters ) { this.opacity = 1; this.size = 1; + this.vertex_colors = false; + this.blending = THREE.NormalBlending; this.offset = new THREE.Vector2(); // TODO: expose to parameters @@ -27,6 +29,7 @@ THREE.ParticleBasicMaterial = function ( parameters ) { if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity; if ( parameters.size !== undefined ) this.size = parameters.size; if ( parameters.blending !== undefined ) this.blending = parameters.blending; + if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors; } @@ -42,6 +45,7 @@ THREE.ParticleBasicMaterial.prototype = { 'opacity: ' + this.opacity + '
' + 'size: ' + this.size + '
' + 'blending: ' + this.blending + '
' + + 'vertex_colors: ' + this.vertex_colors + '
' + ')'; } diff --git a/src/objects/ParticleSystem.js b/src/objects/ParticleSystem.js index a760808c..e1f9e557 100644 --- a/src/objects/ParticleSystem.js +++ b/src/objects/ParticleSystem.js @@ -8,7 +8,6 @@ THREE.ParticleSystem = function ( geometry, materials ) { this.geometry = geometry; this.materials = materials instanceof Array ? materials : [ materials ]; - this.colors = []; this.sortParticles = false; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 5d24dfe0..4fc679de 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -197,6 +197,7 @@ THREE.WebGLRenderer = function ( parameters ) { var nvertices = geometry.vertices.length; geometry.__vertexArray = new Float32Array( nvertices * 3 ); + geometry.__colorArray = new Float32Array( nvertices * 3 ); geometry.__particleArray = new Uint16Array( nvertices ); geometry.__sortArray = []; @@ -665,6 +666,9 @@ THREE.WebGLRenderer = function ( parameters ) { } + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLVertexBuffer ); + _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); + } // yeah, this is silly as order of element indices is currently fixed @@ -678,24 +682,25 @@ THREE.WebGLRenderer = function ( parameters ) { } + _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometry.__webGLLineBuffer ); + _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, lineArray, hint ); + } - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometry.__webGLLineBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, lineArray, hint ); - }; this.setParticleBuffers = function( geometry, hint, object, camera ) { - var v, vertex, offset, + var v, c, vertex, offset, vertices = geometry.vertices, vl = vertices.length, + colors = geometry.colors, + cl = colors.length, + vertexArray = geometry.__vertexArray, particleArray = geometry.__particleArray, + colorArray = geometry.__colorArray, sortArray = geometry.__sortArray, @@ -730,9 +735,21 @@ THREE.WebGLRenderer = function ( parameters ) { vertexArray[ offset ] = vertex.x; vertexArray[ offset + 1 ] = vertex.y; vertexArray[ offset + 2 ] = vertex.z; - } + for ( c = 0; c < cl; c++ ) { + + offset = c * 3; + + color = colors[ sortArray[c][1] ]; + + colorArray[ offset ] = color.r; + colorArray[ offset + 1 ] = color.g; + colorArray[ offset + 2 ] = color.b; + + } + + } else { if ( dirtyVertices ) { @@ -750,9 +767,26 @@ THREE.WebGLRenderer = function ( parameters ) { } } + + if ( dirtyColors ) { + + for ( c = 0; c < cl; c++ ) { + + color = colors[ c ]; + + offset = c * 3; + + colorArray[ offset ] = color.r; + colorArray[ offset + 1 ] = color.g; + colorArray[ offset + 2 ] = color.b; + + } + + } } + // yeah, this is silly as order of element indices is currently fixed // though this could change if some use case arises // (like depth-sorting of semi-opaque particles) @@ -764,15 +798,25 @@ THREE.WebGLRenderer = function ( parameters ) { particleArray[ v ] = v; } + + _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometry.__webGLParticleBuffer ); + _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, particleArray, hint ); } - - _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLVertexBuffer ); - _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); - - _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometry.__webGLParticleBuffer ); - _gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, particleArray, hint ); + if ( dirtyVertices || object.sortParticles ) { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLVertexBuffer ); + _gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint ); + + } + + if ( dirtyColors || object.sortParticles ) { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webGLColorBuffer ); + _gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint ); + + } }; @@ -787,7 +831,7 @@ THREE.WebGLRenderer = function ( parameters ) { function refreshUniformsCommon( material, fog ) { // premultiply alpha - material.uniforms.color.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity ); + material.uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity ); // pure color //material.uniforms.color.value.setHex( material.color.hex ); @@ -824,7 +868,7 @@ THREE.WebGLRenderer = function ( parameters ) { function refreshUniformsLine( material, fog ) { - material.uniforms.color.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity ); + material.uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity ); material.uniforms.opacity.value = material.opacity; if ( fog ) { @@ -848,7 +892,7 @@ THREE.WebGLRenderer = function ( parameters ) { function refreshUniformsParticle( material, fog ) { - material.uniforms.color.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity ); + material.uniforms.psColor.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity ); material.uniforms.opacity.value = material.opacity; material.uniforms.size.value = material.size; material.uniforms.map.texture = material.map; @@ -935,7 +979,8 @@ THREE.WebGLRenderer = function ( parameters ) { maxLightCount = allocateLights( lights, 4 ); - parameters = { fog: fog, map: material.map, env_map: material.env_map, light_map: material.light_map, maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point }; + parameters = { fog: fog, map: material.map, env_map: material.env_map, light_map: material.light_map, vertex_colors: material.vertex_colors, + maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point }; material.program = buildProgram( material.fragment_shader, material.vertex_shader, parameters ); identifiers = [ 'viewMatrix', 'modelViewMatrix', 'projectionMatrix', 'normalMatrix', 'objectMatrix', 'cameraPosition' ]; @@ -946,7 +991,7 @@ THREE.WebGLRenderer = function ( parameters ) { } cacheUniformLocations( material.program, identifiers ); - cacheAttributeLocations( material.program, [ "position", "normal", "uv", "uv2", "tangent" ] ); + cacheAttributeLocations( material.program, [ "position", "normal", "uv", "uv2", "tangent", "color" ] ); } @@ -1021,6 +1066,16 @@ THREE.WebGLRenderer = function ( parameters ) { _gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 ); _gl.enableVertexAttribArray( attributes.position ); + // colors + + if ( attributes.color >= 0 ) { + + _gl.bindBuffer( _gl.ARRAY_BUFFER, geometryChunk.__webGLColorBuffer ); + _gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 ); + _gl.enableVertexAttribArray( attributes.color ); + + } + // normals if ( attributes.normal >= 0 ) { @@ -1588,6 +1643,7 @@ THREE.WebGLRenderer = function ( parameters ) { parameters.map ? "#define USE_MAP" : "", parameters.env_map ? "#define USE_ENVMAP" : "", parameters.light_map ? "#define USE_LIGHTMAP" : "", + parameters.vertex_colors ? "#define USE_COLOR" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", @@ -1603,6 +1659,7 @@ THREE.WebGLRenderer = function ( parameters ) { parameters.map ? "#define USE_MAP" : "", parameters.env_map ? "#define USE_ENVMAP" : "", parameters.light_map ? "#define USE_LIGHTMAP" : "", + parameters.vertex_colors ? "#define USE_COLOR" : "", "uniform mat4 objectMatrix;", "uniform mat4 modelViewMatrix;", @@ -1612,6 +1669,7 @@ THREE.WebGLRenderer = function ( parameters ) { "uniform vec3 cameraPosition;", "attribute vec3 position;", "attribute vec3 normal;", + "attribute vec3 color;", "attribute vec2 uv;", "attribute vec2 uv2;", "" @@ -2417,7 +2475,52 @@ THREE.Snippets = { "totalLight += pointDiffuse + pointSpecular;", "#endif" + ].join("\n"), + + // VERTEX COLORS + + color_pars_fragment: [ + + "#ifdef USE_COLOR", + + "varying vec3 vColor;", + + "#endif" + + ].join("\n"), + + + color_fragment: [ + + "#ifdef USE_COLOR", + + "vertexColor = vec4( vColor, opacity );", + + "#endif" + + ].join("\n"), + + color_pars_vertex: [ + + "#ifdef USE_COLOR", + + "varying vec3 vColor;", + + "#endif" + + ].join("\n"), + + + color_vertex: [ + + "#ifdef USE_COLOR", + + "vColor = color;", + + "#endif" + ].join("\n") + }; @@ -2425,7 +2528,7 @@ THREE.UniformsLib = { common: { - "color" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, + "diffuse" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, "opacity" : { type: "f", value: 1 }, "map" : { type: "t", value: 0, texture: null }, @@ -2457,7 +2560,7 @@ THREE.UniformsLib = { particle: { - "color" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, + "psColor" : { type: "c", value: new THREE.Color( 0xeeeeee ) }, "opacity" : { type: "f", value: 1 }, "size" : { type: "f", value: 1 }, "map" : { type: "t", value: 0, texture: null }, @@ -2544,7 +2647,7 @@ THREE.ShaderLib = { fragment_shader: [ - "uniform vec3 color;", + "uniform vec3 diffuse;", "uniform float opacity;", THREE.Snippets[ "map_pars_fragment" ], @@ -2554,7 +2657,7 @@ THREE.ShaderLib = { "void main() {", - "vec4 mColor = vec4( color, opacity );", + "vec4 mColor = vec4( diffuse, opacity );", "vec4 mapColor = vec4( 1.0 );", "vec4 lightmapColor = vec4( 1.0 );", "vec4 cubeColor = vec4( 1.0 );", @@ -2600,7 +2703,7 @@ THREE.ShaderLib = { fragment_shader: [ - "uniform vec3 color;", + "uniform vec3 diffuse;", "uniform float opacity;", "varying vec3 vLightWeighting;", @@ -2612,7 +2715,7 @@ THREE.ShaderLib = { "void main() {", - "vec4 mColor = vec4( color, opacity );", + "vec4 mColor = vec4( diffuse, opacity );", "vec4 mapColor = vec4( 1.0 );", "vec4 lightmapColor = vec4( 1.0 );", "vec4 cubeColor = vec4( 1.0 );", @@ -2672,7 +2775,7 @@ THREE.ShaderLib = { fragment_shader: [ - "uniform vec3 color;", + "uniform vec3 diffuse;", "uniform float opacity;", "uniform vec3 ambient;", @@ -2689,7 +2792,7 @@ THREE.ShaderLib = { "void main() {", - "vec4 mColor = vec4( color, opacity );", + "vec4 mColor = vec4( diffuse, opacity );", "vec4 mapColor = vec4( 1.0 );", "vec4 lightmapColor = vec4( 1.0 );", "vec4 cubeColor = vec4( 1.0 );", @@ -2753,20 +2856,23 @@ THREE.ShaderLib = { fragment_shader: [ - "uniform vec3 color;", + "uniform vec3 psColor;", "uniform float opacity;", + THREE.Snippets[ "color_pars_fragment" ], THREE.Snippets[ "map_particle_pars_fragment" ], THREE.Snippets[ "fog_pars_fragment" ], "void main() {", - "vec4 mColor = vec4( color, opacity );", + "vec4 mColor = vec4( psColor, opacity );", "vec4 mapColor = vec4( 1.0 );", + "vec4 vertexColor = vec4( 1.0 );", THREE.Snippets[ "map_particle_fragment" ], + THREE.Snippets[ "color_fragment" ], - "gl_FragColor = mColor * mapColor;", + "gl_FragColor = mColor * mapColor * vertexColor;", THREE.Snippets[ "fog_fragment" ], @@ -2778,8 +2884,12 @@ THREE.ShaderLib = { "uniform float size;", + THREE.Snippets[ "color_pars_vertex" ], + "void main() {", + THREE.Snippets[ "color_vertex" ], + "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", "gl_Position = projectionMatrix * mvPosition;",