diff --git a/build/Three.js b/build/Three.js index 9cf84597..fb46fb43 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,68 +1,68 @@ // 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 h,j,m,b,r,o;if(d==0)h=j=m=0;else{b=Math.floor(a*6);r=a*6-b;a=d*(1-c);o=d*(1-c*r);c=d*(1-c*(1-r));switch(b){case 1:h=o;j=d;m=a;break;case 2:h=a;j=d;m=c;break;case 3:h=a;j=o;m=d;break;case 4:h=c;j=a;m=d;break;case 5:h=d;j=a;m=o;break;case 6:case 0:h=d;j=c;m=a}}this.r=h;this.g=j;this.b=m;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,e){var g,i,j,b,s,n;if(e==0)g=i=j=0;else{b=Math.floor(a*6);s=a*6-b;a=e*(1-c);n=e*(1-c*s);c=e*(1-c*(1-s));switch(b){case 1:g=n;i=e;j=a;break;case 2:g=a;i=e;j=c;break;case 3:g=a;i=n;j=e;break;case 4:g=c;i=a;j=e;break;case 5:g=e;i=a;j=n;break;case 6:case 0:g=e;i=c;j=a}}this.r=g;this.g=i;this.b=j;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; -THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,h=this.z;this.x=d*a.z-h*a.y;this.y=h*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0}; +THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,g=this.z;this.x=e*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,c,d,h){this.x=a||0;this.y=c||0;this.z=d||0;this.w=h||1}; -THREE.Vector4.prototype={set:function(a,c,d,h){this.x=a;this.y=c;this.z=d;this.w=h;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; +THREE.Vector4=function(a,c,e,g){this.x=a||0;this.y=c||0;this.z=e||0;this.w=g||1}; +THREE.Vector4.prototype={set:function(a,c,e,g){this.x=a;this.y=c;this.z=e;this.w=g;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,h=a.objects,j=[];a=0;for(c=h.length;a0&&e>0&&l+e<1}var d,h,j,m,b,r,o,p,B,A, -u,y=a.geometry,H=y.vertices,L=[];d=0;for(h=y.faces.length;do?h:o;j=j>p? -j:p}a()};this.add3Points=function(o,p,B,A,u,y){if(r){r=false;c=oB?o>u?o:u:B>u?B:u;j=p>A?p>y?p:y:A>y?A:y}else{c=oB?o>u?o>h?o:h:u>h?u:h:B>u?B>h?B:h:u>h?u:h;j=p>A?p>y?p>j?p:j:y>j?y:j:A>y?A>j?A:j:y>j?y:j}a()};this.addRectangle=function(o){if(r){r=false;c=o.getLeft();d=o.getTop();h=o.getRight();j=o.getBottom()}else{c=co.getRight()?h:o.getRight();j=j>o.getBottom()?j:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;h+=o;j+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();h=h=0&&Math.min(j,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){r=true;j=h=d=c=0;a()};this.isEmpty=function(){return r};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+h+", top: "+d+", bottom: "+j+", width: "+m+", height: "+b+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,h,j,m,b,r,o,p,B,A,u,y,H,L){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=h||0;this.n21=j||0;this.n22=m||1;this.n23=b||0;this.n24=r||0;this.n31=o||0;this.n32=p||0;this.n33=B||1;this.n34=A||0;this.n41=u||0;this.n42=y||0;this.n43=H||0;this.n44=L||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,h,j,m,b,r,o,p,B,A,u,y,H,L){this.n11=a;this.n12=c;this.n13=d;this.n14=h;this.n21=j;this.n22=m;this.n23=b;this.n24=r;this.n31=o;this.n32=p;this.n33=B;this.n34=A;this.n41=u;this.n42=y;this.n43=H;this.n44=L;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 h=THREE.Matrix4.__tmpVec1,j=THREE.Matrix4.__tmpVec2,m=THREE.Matrix4.__tmpVec3;m.sub(a,c).normalize();h.cross(d,m).normalize();j.cross(m,h).normalize();this.n11=h.x;this.n12=h.y;this.n13=h.z;this.n14=-h.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a); -this.n31=m.x;this.n32=m.y;this.n33=m.z;this.n34=-m.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,h=a.z,j=1/(this.n41*c+this.n42*d+this.n43*h+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*h+this.n14)*j;a.y=(this.n21*c+this.n22*d+this.n23*h+this.n24)*j;a.z=(this.n31*c+this.n32*d+this.n33*h+this.n34)*j;return a},multiplyVector4:function(a){var c=a.x,d=a.y,h=a.z,j=a.w;a.x=this.n11*c+this.n12*d+this.n13*h+this.n14*j;a.y=this.n21*c+this.n22*d+this.n23* -h+this.n24*j;a.z=this.n31*c+this.n32*d+this.n33*h+this.n34*j;a.w=this.n41*c+this.n42*d+this.n43*h+this.n44*j;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,h=a.n12,j=a.n13,m=a.n14,b=a.n21,r=a.n22,o=a.n23,p=a.n24,B=a.n31, -A=a.n32,u=a.n33,y=a.n34,H=a.n41,L=a.n42,e=a.n43,g=a.n44,i=c.n11,f=c.n12,k=c.n13,l=c.n14,t=c.n21,q=c.n22,n=c.n23,z=c.n24,s=c.n31,w=c.n32,E=c.n33,v=c.n34,C=c.n41,W=c.n42,J=c.n43,P=c.n44;this.n11=d*i+h*t+j*s+m*C;this.n12=d*f+h*q+j*w+m*W;this.n13=d*k+h*n+j*E+m*J;this.n14=d*l+h*z+j*v+m*P;this.n21=b*i+r*t+o*s+p*C;this.n22=b*f+r*q+o*w+p*W;this.n23=b*k+r*n+o*E+p*J;this.n24=b*l+r*z+o*v+p*P;this.n31=B*i+A*t+u*s+y*C;this.n32=B*f+A*q+u*w+y*W;this.n33=B*k+A*n+u*E+y*J;this.n34=B*l+A*z+u*v+y*P;this.n41=H*i+L*t+ -e*s+g*C;this.n42=H*f+L*q+e*w+g*W;this.n43=H*k+L*n+e*E+g*J;this.n44=H*l+L*z+e*v+g*P;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,h=this.n13,j=this.n14,m=this.n21,b=this.n22,r=this.n23,o=this.n24,p=this.n31,B=this.n32,A=this.n33,u=this.n34,y=this.n41,H=this.n42,L=this.n43,e=this.n44,g=a.n11,i=a.n21,f=a.n31,k=a.n41,l=a.n12,t=a.n22,q=a.n32,n=a.n42,z=a.n13,s=a.n23,w=a.n33,E=a.n43,v=a.n14,C=a.n24,W=a.n34;a=a.n44;this.n11=c*g+d*i+h*f+j*k;this.n12=c*l+d*t+h*q+j*n;this.n13=c*z+d*s+h*w+j* -E;this.n14=c*v+d*C+h*W+j*a;this.n21=m*g+b*i+r*f+o*k;this.n22=m*l+b*t+r*q+o*n;this.n23=m*z+b*s+r*w+o*E;this.n24=m*v+b*C+r*W+o*a;this.n31=p*g+B*i+A*f+u*k;this.n32=p*l+B*t+A*q+u*n;this.n33=p*z+B*s+A*w+u*E;this.n34=p*v+B*C+A*W+u*a;this.n41=y*g+H*i+L*f+e*k;this.n42=y*l+H*t+L*q+e*n;this.n43=y*z+H*s+L*w+e*E;this.n44=y*v+H*C+L*W+e*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,h=this.n14,j=this.n21,m=this.n22,b=this.n23,r=this.n24,o=this.n31,p=this.n32,B=this.n33,A=this.n34,u=this.n41,y=this.n42,H=this.n43,L=this.n44;return h*b*p*u-d*r*p*u-h*m*B*u+c*r*B*u+d*m*A*u-c*b*A*u-h*b*o*y+d*r*o*y+h*j*B*y-a*r*B*y-d*j*A*y+a*b*A*y+h*m*o*H-c*r*o*H-h*j*p*H+a*r*p*H+c*j*A*H-a*m*A*H-d*m*o*L+c*b*o*L+d*j*p*L-a*b*p*L-c*j*B*L+a*m*B*L},transpose:function(){function a(c,d, -h){var j=c[d];c[d]=c[h];c[h]=j}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),h=Math.sin(c),j=1-d,m=a.x,b=a.y,r=a.z,o=j*m,p=j*b;this.set(o*m+d,o*b-h*r,o*r+h*b,0,o*b+h*r,p*b+d,p*r-h*m,0,o*r-h*b,p*r+h*m,j*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 h=new THREE.Matrix4;h.setTranslation(a,c,d);return h};THREE.Matrix4.scaleMatrix=function(a,c,d){var h=new THREE.Matrix4;h.setScale(a,c,d);return h};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,h=a.n13,j=a.n14,m=a.n21,b=a.n22,r=a.n23,o=a.n24,p=a.n31,B=a.n32,A=a.n33,u=a.n34,y=a.n41,H=a.n42,L=a.n43,e=a.n44,g=new THREE.Matrix4;g.n11=r*u*H-o*A*H+o*B*L-b*u*L-r*B*e+b*A*e;g.n12=j*A*H-h*u*H-j*B*L+d*u*L+h*B*e-d*A*e;g.n13=h*o*H-j*r*H+j*b*L-d*o*L-h*b*e+d*r*e;g.n14=j*r*B-h*o*B-j*b*A+d*o*A+h*b*u-d*r*u;g.n21=o*A*y-r*u*y-o*p*L+m*u*L+r*p*e-m*A*e;g.n22=h*u*y-j*A*y+j*p*L-c*u*L-h*p*e+c*A*e;g.n23=j*r*y-h*o*y-j*m*L+c*o*L+h*m*e-c*r*e;g.n24=h*o*p-j*r*p+ -j*m*A-c*o*A-h*m*u+c*r*u;g.n31=b*u*y-o*B*y+o*p*H-m*u*H-b*p*e+m*B*e;g.n32=j*B*y-d*u*y-j*p*H+c*u*H+d*p*e-c*B*e;g.n33=h*o*y-j*b*y+j*m*H-c*o*H-d*m*e+c*b*e;g.n34=j*b*p-d*o*p-j*m*B+c*o*B+d*m*u-c*b*u;g.n41=r*B*y-b*A*y-r*p*H+m*A*H+b*p*L-m*B*L;g.n42=d*A*y-h*B*y+h*p*H-c*A*H-d*p*L+c*B*L;g.n43=h*b*y-d*r*y-h*m*H+c*r*H+d*m*L-c*b*L;g.n44=d*r*p-h*b*p+h*m*B-c*r*B-d*m*A+c*b*A;g.multiplyScalar(1/a.determinant());return g}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,h=c[10]*c[5]-c[6]*c[9],j=-c[10]*c[1]+c[2]*c[9],m=c[6]*c[1]-c[2]*c[5],b=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],o=-c[6]*c[0]+c[2]*c[4],p=c[9]*c[4]-c[5]*c[8],B=-c[9]*c[0]+c[1]*c[8],A=c[5]*c[0]-c[1]*c[4];c=c[0]*h+c[1]*b+c[2]*p;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*h;d[1]=c*j;d[2]=c*m;d[3]=c*b;d[4]=c*r;d[5]=c*o;d[6]=c*p;d[7]=c*B;d[8]=c*A;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,h,j,m){var b,r,o;b=new THREE.Matrix4;r=2*j/(c-a);o=2*j/(h-d);a=(c+a)/(c-a);d=(h+d)/(h-d);h=-(m+j)/(m-j);j=-2*m*j/(m-j);b.n11=r;b.n12=0;b.n13=a;b.n14=0;b.n21=0;b.n22=o;b.n23=d;b.n24=0;b.n31=0;b.n32=0;b.n33=h;b.n34=j;b.n41=0;b.n42=0;b.n43=-1;b.n44=0;return b};THREE.Matrix4.makePerspective=function(a,c,d,h){var j;a=d*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*c,a*c,j,a,d,h)}; -THREE.Matrix4.makeOrtho=function(a,c,d,h,j,m){var b,r,o,p;b=new THREE.Matrix4;r=c-a;o=d-h;p=m-j;a=(c+a)/r;d=(d+h)/o;j=(m+j)/p;b.n11=2/r;b.n12=0;b.n13=0;b.n14=-a;b.n21=0;b.n22=2/o;b.n23=0;b.n24=-d;b.n31=0;b.n32=0;b.n33=-2/p;b.n34=-j;b.n41=0;b.n42=0;b.n43=0;b.n44=1;return b};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Ray.prototype={intersectScene:function(a){var c,e,g=a.objects,i=[];a=0;for(c=g.length;a0&&M>0&&k+M<1}var e,g,i,j,b,s,n,p,r,A, +w,z=a.geometry,H=z.vertices,L=[];e=0;for(g=z.faces.length;en?g:n;i=i>p? +i:p}a()};this.add3Points=function(n,p,r,A,w,z){if(s){s=false;c=nr?n>w?n:w:r>w?r:w;i=p>A?p>z?p:z:A>z?A:z}else{c=nr?n>w?n>g?n:g:w>g?w:g:r>w?r>g?r:g:w>g?w:g;i=p>A?p>z?p>i?p:i:z>i?z:i:A>z?A>i?A:i:z>i?z:i}a()};this.addRectangle=function(n){if(s){s=false;c=n.getLeft();e=n.getTop();g=n.getRight();i=n.getBottom()}else{c=cn.getRight()?g:n.getRight();i=i>n.getBottom()?i:n.getBottom()}a()};this.inflate=function(n){c-=n;e-=n;g+=n;i+=n;a()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();e=e>n.getTop()?e:n.getTop();g=g=0&&Math.min(i,n.getBottom())-Math.max(e,n.getTop())>=0};this.empty=function(){s=true;i=g=e=c=0;a()};this.isEmpty=function(){return s};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", bottom: "+i+", width: "+j+", height: "+b+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,e,g,i,j,b,s,n,p,r,A,w,z,H,L){this.n11=a||1;this.n12=c||0;this.n13=e||0;this.n14=g||0;this.n21=i||0;this.n22=j||1;this.n23=b||0;this.n24=s||0;this.n31=n||0;this.n32=p||0;this.n33=r||1;this.n34=A||0;this.n41=w||0;this.n42=z||0;this.n43=H||0;this.n44=L||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,e,g,i,j,b,s,n,p,r,A,w,z,H,L){this.n11=a;this.n12=c;this.n13=e;this.n14=g;this.n21=i;this.n22=j;this.n23=b;this.n24=s;this.n31=n;this.n32=p;this.n33=r;this.n34=A;this.n41=w;this.n42=z;this.n43=H;this.n44=L;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,e){var g=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,j=THREE.Matrix4.__tmpVec3;j.sub(a,c).normalize();g.cross(e,j).normalize();i.cross(j,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); +this.n31=j.x;this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,e=a.y,g=a.z,i=1/(this.n41*c+this.n42*e+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*e+this.n13*g+this.n14)*i;a.y=(this.n21*c+this.n22*e+this.n23*g+this.n24)*i;a.z=(this.n31*c+this.n32*e+this.n33*g+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,e=a.y,g=a.z,i=a.w;a.x=this.n11*c+this.n12*e+this.n13*g+this.n14*i;a.y=this.n21*c+this.n22*e+this.n23* +g+this.n24*i;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*i;a.w=this.n41*c+this.n42*e+this.n43*g+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var e=a.n11,g=a.n12,i=a.n13,j=a.n14,b=a.n21,s=a.n22,n=a.n23,p=a.n24,r=a.n31, +A=a.n32,w=a.n33,z=a.n34,H=a.n41,L=a.n42,M=a.n43,d=a.n44,l=c.n11,h=c.n12,f=c.n13,k=c.n14,m=c.n21,t=c.n22,o=c.n23,q=c.n24,v=c.n31,x=c.n32,u=c.n33,y=c.n34,B=c.n41,N=c.n42,K=c.n43,T=c.n44;this.n11=e*l+g*m+i*v+j*B;this.n12=e*h+g*t+i*x+j*N;this.n13=e*f+g*o+i*u+j*K;this.n14=e*k+g*q+i*y+j*T;this.n21=b*l+s*m+n*v+p*B;this.n22=b*h+s*t+n*x+p*N;this.n23=b*f+s*o+n*u+p*K;this.n24=b*k+s*q+n*y+p*T;this.n31=r*l+A*m+w*v+z*B;this.n32=r*h+A*t+w*x+z*N;this.n33=r*f+A*o+w*u+z*K;this.n34=r*k+A*q+w*y+z*T;this.n41=H*l+L*m+ +M*v+d*B;this.n42=H*h+L*t+M*x+d*N;this.n43=H*f+L*o+M*u+d*K;this.n44=H*k+L*q+M*y+d*T;return this},multiplySelf:function(a){var c=this.n11,e=this.n12,g=this.n13,i=this.n14,j=this.n21,b=this.n22,s=this.n23,n=this.n24,p=this.n31,r=this.n32,A=this.n33,w=this.n34,z=this.n41,H=this.n42,L=this.n43,M=this.n44,d=a.n11,l=a.n21,h=a.n31,f=a.n41,k=a.n12,m=a.n22,t=a.n32,o=a.n42,q=a.n13,v=a.n23,x=a.n33,u=a.n43,y=a.n14,B=a.n24,N=a.n34;a=a.n44;this.n11=c*d+e*l+g*h+i*f;this.n12=c*k+e*m+g*t+i*o;this.n13=c*q+e*v+g*x+i* +u;this.n14=c*y+e*B+g*N+i*a;this.n21=j*d+b*l+s*h+n*f;this.n22=j*k+b*m+s*t+n*o;this.n23=j*q+b*v+s*x+n*u;this.n24=j*y+b*B+s*N+n*a;this.n31=p*d+r*l+A*h+w*f;this.n32=p*k+r*m+A*t+w*o;this.n33=p*q+r*v+A*x+w*u;this.n34=p*y+r*B+A*N+w*a;this.n41=z*d+H*l+L*h+M*f;this.n42=z*k+H*m+L*t+M*o;this.n43=z*q+H*v+L*x+M*u;this.n44=z*y+H*B+L*N+M*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= +a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,j=this.n22,b=this.n23,s=this.n24,n=this.n31,p=this.n32,r=this.n33,A=this.n34,w=this.n41,z=this.n42,H=this.n43,L=this.n44;return g*b*p*w-e*s*p*w-g*j*r*w+c*s*r*w+e*j*A*w-c*b*A*w-g*b*n*z+e*s*n*z+g*i*r*z-a*s*r*z-e*i*A*z+a*b*A*z+g*j*n*H-c*s*n*H-g*i*p*H+a*s*p*H+c*i*A*H-a*j*A*H-e*j*n*L+c*b*n*L+e*i*p*L-a*b*p*L-c*i*r*L+a*j*r*L},transpose:function(){function a(c,e, +g){var i=c[e];c[e]=c[g];c[g]=i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; +a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,e){this.set(1,0,0,a,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(a,c,e){this.set(a,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var e=Math.cos(c),g=Math.sin(c),i=1-e,j=a.x,b=a.y,s=a.z,n=i*j,p=i*b;this.set(n*j+e,n*b-g*s,n*s+g*b,0,n*b+g*s,p*b+e,p*s-g*j,0,n*s-g*b,p*s+g*j,i*s*s+e,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setTranslation(a,c,e);return g};THREE.Matrix4.scaleMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setScale(a,c,e);return g};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; +THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4;e.setRotAxis(a,c);return e}; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,j=a.n21,b=a.n22,s=a.n23,n=a.n24,p=a.n31,r=a.n32,A=a.n33,w=a.n34,z=a.n41,H=a.n42,L=a.n43,M=a.n44,d=new THREE.Matrix4;d.n11=s*w*H-n*A*H+n*r*L-b*w*L-s*r*M+b*A*M;d.n12=i*A*H-g*w*H-i*r*L+e*w*L+g*r*M-e*A*M;d.n13=g*n*H-i*s*H+i*b*L-e*n*L-g*b*M+e*s*M;d.n14=i*s*r-g*n*r-i*b*A+e*n*A+g*b*w-e*s*w;d.n21=n*A*z-s*w*z-n*p*L+j*w*L+s*p*M-j*A*M;d.n22=g*w*z-i*A*z+i*p*L-c*w*L-g*p*M+c*A*M;d.n23=i*s*z-g*n*z-i*j*L+c*n*L+g*j*M-c*s*M;d.n24=g*n*p-i*s*p+ +i*j*A-c*n*A-g*j*w+c*s*w;d.n31=b*w*z-n*r*z+n*p*H-j*w*H-b*p*M+j*r*M;d.n32=i*r*z-e*w*z-i*p*H+c*w*H+e*p*M-c*r*M;d.n33=g*n*z-i*b*z+i*j*H-c*n*H-e*j*M+c*b*M;d.n34=i*b*p-e*n*p-i*j*r+c*n*r+e*j*w-c*b*w;d.n41=s*r*z-b*A*z-s*p*H+j*A*H+b*p*L-j*r*L;d.n42=e*A*z-g*r*z+g*p*H-c*A*H-e*p*L+c*r*L;d.n43=g*b*z-e*s*z-g*j*H+c*s*H+e*j*L-c*b*L;d.n44=e*s*p-g*b*p+g*j*r-c*s*r-e*j*A+c*b*A;d.multiplyScalar(1/a.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var e=a.m,g=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],j=c[6]*c[1]-c[2]*c[5],b=-c[10]*c[4]+c[6]*c[8],s=c[10]*c[0]-c[2]*c[8],n=-c[6]*c[0]+c[2]*c[4],p=c[9]*c[4]-c[5]*c[8],r=-c[9]*c[0]+c[1]*c[8],A=c[5]*c[0]-c[1]*c[4];c=c[0]*g+c[1]*b+c[2]*p;if(c==0)throw"matrix not invertible";c=1/c;e[0]=c*g;e[1]=c*i;e[2]=c*j;e[3]=c*b;e[4]=c*s;e[5]=c*n;e[6]=c*p;e[7]=c*r;e[8]=c*A;return a}; +THREE.Matrix4.makeFrustum=function(a,c,e,g,i,j){var b,s,n;b=new THREE.Matrix4;s=2*i/(c-a);n=2*i/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);g=-(j+i)/(j-i);i=-2*j*i/(j-i);b.n11=s;b.n12=0;b.n13=a;b.n14=0;b.n21=0;b.n22=n;b.n23=e;b.n24=0;b.n31=0;b.n32=0;b.n33=g;b.n34=i;b.n41=0;b.n42=0;b.n43=-1;b.n44=0;return b};THREE.Matrix4.makePerspective=function(a,c,e,g){var i;a=e*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,e,g)}; +THREE.Matrix4.makeOrtho=function(a,c,e,g,i,j){var b,s,n,p;b=new THREE.Matrix4;s=c-a;n=e-g;p=j-i;a=(c+a)/s;e=(e+g)/n;i=(j+i)/p;b.n11=2/s;b.n12=0;b.n13=0;b.n14=-a;b.n21=0;b.n22=2/n;b.n23=0;b.n24=-e;b.n31=0;b.n32=0;b.n33=-2/p;b.n34=-i;b.n41=0;b.n42=0;b.n43=0;b.n44=1;return b};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,h,j){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,d,h,j,m){this.a=a;this.b=c;this.c=d;this.d=h;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.materials=m instanceof Array?m:[m]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,e,g,i){this.a=a;this.b=c;this.c=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,e,g,i,j){this.a=a;this.b=c;this.c=e;this.d=g;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; -THREE.Geometry.prototype={computeCentroids:function(){var a,c,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], -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){p[r].counter+=1;o=p[r].hash+"_"+p[r].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],materials:b,vertices:0}}this.geometryChunks[o].faces.push(h);this.geometryChunks[o].vertices+=m}},toString:function(){return"THREE.Geometry ( vertices: "+ +THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;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], +z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=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,e=this.vertices.length;c65535){p[s].counter+=1;n=p[s].hash+"_"+p[s].counter;if(this.geometryChunks[n]==undefined)this.geometryChunks[n]={faces:[],materials:b,vertices:0}}this.geometryChunks[n].faces.push(g);this.geometryChunks[n].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,h){this.fov=a;this.aspect=c;this.near=d;this.far=h;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(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);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,e,g){this.fov=a;this.aspect=c;this.near=e;this.far=g;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,h=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){h.setRotY(c.y);this.rotationMatrix.multiplySelf(h)}if(c.z!=0){h.setRotZ(c.z);this.rotationMatrix.multiplySelf(h)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){h.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(h)}}};THREE.Object3DCounter={value:0}; +THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,e=this.scale,g=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){g.setRotY(c.y);this.rotationMatrix.multiplySelf(g)}if(c.z!=0){g.setRotZ(c.z);this.rotationMatrix.multiplySelf(g)}this.matrix.multiplySelf(this.rotationMatrix);if(e.x!=0||e.y!=0||e.z!=0){g.setScale(e.x,e.y,e.z);this.matrix.multiplySelf(g)}}};THREE.Object3DCounter={value:0}; THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; -THREE.Line=function(a,c,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.Line=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; @@ -94,120 +94,121 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
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,h,j,m){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=h!==undefined?h:THREE.ClampToEdgeWrapping;this.mag_filter=j!==undefined?j:THREE.LinearFilter;this.min_filter=m!==undefined?m: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,e,g,i,j){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=g!==undefined?g:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=j!==undefined?j:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
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,h,j={};for(c in a){j[c]={};for(d in a[c]){h=a[c][d];j[c][d]=h instanceof THREE.Color||h instanceof THREE.Vector3||h instanceof THREE.Texture?h.clone():h}}return j},merge:function(a){var c,d,h,j={};for(c=0;c=0&&E>=0&&v>=0&&C>=0)return true;else if(w<0&&E<0||v<0&&C<0)return false;else{if(w<0)z=Math.max(z,w/(w-E));else if(E<0)s=Math.min(s,w/(w-E));if(v<0)z=Math.max(z,v/(v-C));else if(C<0)s=Math.min(s,v/(v-C));if(sw&&J.z0&&e.z<1){u=H[y]=H[y]||new THREE.RenderableParticle;u.x=e.x/e.w;u.y=e.y/e.w;u.z=e.z;u.rotation=F.rotation.z;u.scale.x=F.scale.x*Math.abs(u.x-(e.x+n.projectionMatrix.n11)/(e.w+n.projectionMatrix.n14)); -u.scale.y=F.scale.y*Math.abs(u.y-(e.y+n.projectionMatrix.n22)/(e.w+n.projectionMatrix.n24));u.materials=F.materials;s.push(u);y++}}}}z&&s.sort(a);return s};this.unprojectVector=function(q,n){var z=THREE.Matrix4.makeInvert(n.matrix);z.multiplySelf(THREE.Matrix4.makeInvert(n.projectionMatrix));z.multiplyVector3(q);return q}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,h,j,m;this.domElement=document.createElement("div");this.setSize=function(b,r){d=b;h=r;j=d/2;m=h/2};this.render=function(b,r){var o,p,B,A,u,y,H,L;a=c.projectScene(b,r);o=0;for(p=a.length;o0){G.r+=ea.r*Y;G.g+=ea.g*Y;G.b+=ea.b*Y}}else if(Y instanceof THREE.PointLight){$.sub(Y.position,X);$.normalize();Y=Q.dot($)*ga;if(Y> -0){G.r+=ea.r*Y;G.g+=ea.g*Y;G.b+=ea.b*Y}}}}function Na(D,X,Q){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);var G,N,Y,ea,ga,ha;if(Q instanceof THREE.ParticleBasicMaterial){if(Q.map&&Q.map.image.loaded){ea=Q.map.image;ga=ea.width>>1;ha=ea.height>>1;N=X.scale.x*r;Y=X.scale.y*o;Q=N*ga;G=Y*ha;x.set(D.x-Q,D.y-G,D.x+Q,D.y+G);if(V.instersects(x)){p.save();p.translate(D.x,D.y);p.rotate(-X.rotation);p.scale(N,-Y);p.translate(-ga,-ha);p.drawImage(ea,0,0);p.restore()}}}else if(Q instanceof THREE.ParticleCircleMaterial){if(K){T.r= -Z.r+ma.r+ca.r;T.g=Z.g+ma.g+ca.g;T.b=Z.b+ma.b+ca.b;s.r=Q.color.r*T.r;s.g=Q.color.g*T.g;s.b=Q.color.b*T.b;s.updateStyleString()}else s.__styleString=Q.color.__styleString;Q=X.scale.x*r;G=X.scale.y*o;x.set(D.x-Q,D.y-G,D.x+Q,D.y+G);if(V.instersects(x)){N=s.__styleString;if(L!=N)p.fillStyle=L=N;p.save();p.translate(D.x,D.y);p.rotate(-X.rotation);p.scale(Q,G);p.beginPath();p.arc(0,0,1,0,xa,true);p.closePath();p.fill();p.restore()}}}}function Oa(D,X,Q,G){if(G.opacity!=0){a(G.opacity);c(G.blending);p.beginPath(); -p.moveTo(D.positionScreen.x,D.positionScreen.y);p.lineTo(X.positionScreen.x,X.positionScreen.y);p.closePath();if(G instanceof THREE.LineBasicMaterial){s.__styleString=G.color.__styleString;D=G.linewidth;if(e!=D)p.lineWidth=e=D;D=s.__styleString;if(H!=D)p.strokeStyle=H=D;p.stroke();x.inflate(G.linewidth*2)}}}function Ja(D,X,Q,G,N,Y){if(N.opacity!=0){a(N.opacity);c(N.blending);k=D.positionScreen.x;l=D.positionScreen.y;t=X.positionScreen.x;q=X.positionScreen.y;n=Q.positionScreen.x;z=Q.positionScreen.y; -p.beginPath();p.moveTo(k,l);p.lineTo(t,q);p.lineTo(n,z);p.lineTo(k,l);p.closePath();if(N instanceof THREE.MeshBasicMaterial)if(N.map)N.map.image.loaded&&N.map.mapping instanceof THREE.UVMapping&&ya(k,l,t,q,n,z,N.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);else if(N.env_map){if(N.env_map.image.loaded)if(N.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=ja.matrix;$.copy(G.vertexNormalsWorld[0]);O=($.x*D.n11+$.y*D.n12+$.z*D.n13)*0.5+0.5;F=-($.x*D.n21+$.y* -D.n22+$.z*D.n23)*0.5+0.5;$.copy(G.vertexNormalsWorld[1]);U=($.x*D.n11+$.y*D.n12+$.z*D.n13)*0.5+0.5;S=-($.x*D.n21+$.y*D.n22+$.z*D.n23)*0.5+0.5;$.copy(G.vertexNormalsWorld[2]);I=($.x*D.n11+$.y*D.n12+$.z*D.n13)*0.5+0.5;M=-($.x*D.n21+$.y*D.n22+$.z*D.n23)*0.5+0.5;ya(k,l,t,q,n,z,N.env_map.image,O,F,U,S,I,M)}}else N.wireframe?Ca(N.color.__styleString,N.wireframe_linewidth):Da(N.color.__styleString);else if(N instanceof THREE.MeshLambertMaterial){if(N.map&&!N.wireframe){N.map.mapping instanceof THREE.UVMapping&& -ya(k,l,t,q,n,z,N.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);c(THREE.SubtractiveBlending)}if(K)if(!N.wireframe&&N.shading==THREE.SmoothShading&&G.vertexNormalsWorld.length==3){w.r=E.r=v.r=Z.r;w.g=E.g=v.g=Z.g;w.b=E.b=v.b=Z.b;Ba(Y,G.v1.positionWorld,G.vertexNormalsWorld[0],w);Ba(Y,G.v2.positionWorld,G.vertexNormalsWorld[1],E);Ba(Y,G.v3.positionWorld,G.vertexNormalsWorld[2],v);C.r=(E.r+v.r)*0.5;C.g=(E.g+v.g)*0.5;C.b=(E.b+v.b)*0.5;P=Ka(w,E,v,C);ya(k,l,t,q,n,z,P,0,0,1, -0,0,1)}else{T.r=Z.r;T.g=Z.g;T.b=Z.b;Ba(Y,G.centroidWorld,G.normalWorld,T);s.r=N.color.r*T.r;s.g=N.color.g*T.g;s.b=N.color.b*T.b;s.updateStyleString();N.wireframe?Ca(s.__styleString,N.wireframe_linewidth):Da(s.__styleString)}else N.wireframe?Ca(N.color.__styleString,N.wireframe_linewidth):Da(N.color.__styleString)}else if(N instanceof THREE.MeshDepthMaterial){W=ja.near;J=ja.far;w.r=w.g=w.b=1-Fa(D.positionScreen.z,W,J);E.r=E.g=E.b=1-Fa(X.positionScreen.z,W,J);v.r=v.g=v.b=1-Fa(Q.positionScreen.z,W,J); -C.r=(E.r+v.r)*0.5;C.g=(E.g+v.g)*0.5;C.b=(E.b+v.b)*0.5;P=Ka(w,E,v,C);ya(k,l,t,q,n,z,P,0,0,1,0,0,1)}else if(N instanceof THREE.MeshNormalMaterial){s.r=Ga(G.normalWorld.x);s.g=Ga(G.normalWorld.y);s.b=Ga(G.normalWorld.z);s.updateStyleString();N.wireframe?Ca(s.__styleString,N.wireframe_linewidth):Da(s.__styleString)}}}function Ca(D,X){if(H!=D)p.strokeStyle=H=D;if(e!=X)p.lineWidth=e=X;p.stroke();x.inflate(X*2)}function Da(D){if(L!=D)p.fillStyle=L=D;p.fill()}function ya(D,X,Q,G,N,Y,ea,ga,ha,qa,ka,ra,za){var na, -sa;na=ea.width-1;sa=ea.height-1;ga*=na;ha*=sa;qa*=na;ka*=sa;ra*=na;za*=sa;Q-=D;G-=X;N-=D;Y-=X;qa-=ga;ka-=ha;ra-=ga;za-=ha;na=qa*za-ra*ka;if(na!=0){sa=1/na;na=(za*Q-ka*N)*sa;ka=(za*G-ka*Y)*sa;Q=(qa*N-ra*Q)*sa;G=(qa*Y-ra*G)*sa;D=D-na*ga-Q*ha;X=X-ka*ga-G*ha;p.save();p.transform(na,ka,Q,G,D,X);p.clip();p.drawImage(ea,0,0);p.restore()}}function Ka(D,X,Q,G){var N=~~(D.r*255),Y=~~(D.g*255);D=~~(D.b*255);var ea=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ha=~~(Q.r*255),qa=~~(Q.g*255);Q=~~(Q.b*255);var ka= -~~(G.r*255),ra=~~(G.g*255);G=~~(G.b*255);fa[0]=N<0?0:N>255?255:N;fa[1]=Y<0?0:Y>255?255:Y;fa[2]=D<0?0:D>255?255:D;fa[4]=ea<0?0:ea>255?255:ea;fa[5]=ga<0?0:ga>255?255:ga;fa[6]=X<0?0:X>255?255:X;fa[8]=ha<0?0:ha>255?255:ha;fa[9]=qa<0?0:qa>255?255:qa;fa[10]=Q<0?0:Q>255?255:Q;fa[12]=ka<0?0:ka>255?255:ka;fa[13]=ra<0?0:ra>255?255:ra;fa[14]=G<0?0:G>255?255:G;pa.putImageData(ua,0,0);va.drawImage(ia,0,0);return da}function Fa(D,X,Q){D=(D-X)/(Q-X);return D*D*(3-2*D)}function Ga(D){D=(D+1)*0.5;return D<0?0:D>1? -1:D}function Ha(D,X){var Q=X.x-D.x,G=X.y-D.y,N=1/Math.sqrt(Q*Q+G*G);Q*=N;G*=N;X.x+=Q;X.y+=G;D.x-=Q;D.y-=G}var Ea,La,aa,oa,wa,Ia,Ma,Aa;this.autoClear?this.clear():p.setTransform(1,0,0,-1,r,o);d=h.projectScene(ba,ja,this.sortElements);(K=ba.lights.length>0)&&la(ba);Ea=0;for(La=d.length;Ea=0&&u>=0&&y>=0&&B>=0)return true;else if(x<0&&u<0||y<0&&B<0)return false;else{if(x<0)q=Math.max(q,x/(x-u));else if(u<0)v=Math.min(v,x/(x-u));if(y<0)q=Math.max(q,y/(y-B));else if(B<0)v=Math.min(v,y/(y-B));if(vx&&K.z0&&M.z<1){w=H[z]=H[z]||new THREE.RenderableParticle;w.x=M.x/M.w;w.y=M.y/M.w;w.z=M.z;w.rotation=J.rotation.z;w.scale.x=J.scale.x*Math.abs(w.x-(M.x+o.projectionMatrix.n11)/(M.w+o.projectionMatrix.n14)); +w.scale.y=J.scale.y*Math.abs(w.y-(M.y+o.projectionMatrix.n22)/(M.w+o.projectionMatrix.n24));w.materials=J.materials;v.push(w);z++}}}}q&&v.sort(a);return v};this.unprojectVector=function(t,o){var q=THREE.Matrix4.makeInvert(o.matrix);q.multiplySelf(THREE.Matrix4.makeInvert(o.projectionMatrix));q.multiplyVector3(t);return t}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,i,j;this.domElement=document.createElement("div");this.setSize=function(b,s){e=b;g=s;i=e/2;j=g/2};this.render=function(b,s){var n,p,r,A,w,z,H,L;a=c.projectScene(b,s);n=0;for(p=a.length;n0){F.r+=da.r*Y;F.g+=da.g*Y;F.b+=da.b*Y}}else if(Y instanceof THREE.PointLight){Z.sub(Y.position,W);Z.normalize();Y=S.dot(Z)*ga;if(Y> +0){F.r+=da.r*Y;F.g+=da.g*Y;F.b+=da.b*Y}}}}function Na(D,W,S){if(S.opacity!=0){a(S.opacity);c(S.blending);var F,Q,Y,da,ga,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ga=da.width>>1;ia=da.height>>1;Q=W.scale.x*s;Y=W.scale.y*n;S=Q*ga;F=Y*ia;C.set(D.x-S,D.y-F,D.x+S,D.y+F);if(V.instersects(C)){p.save();p.translate(D.x,D.y);p.rotate(-W.rotation);p.scale(Q,-Y);p.translate(-ga,-ia);p.drawImage(da,0,0);p.restore()}}}else if(S instanceof THREE.ParticleCircleMaterial){if(G){P.r= +$.r+aa.r+na.r;P.g=$.g+aa.g+na.g;P.b=$.b+aa.b+na.b;v.r=S.color.r*P.r;v.g=S.color.g*P.g;v.b=S.color.b*P.b;v.updateStyleString()}else v.__styleString=S.color.__styleString;S=W.scale.x*s;F=W.scale.y*n;C.set(D.x-S,D.y-F,D.x+S,D.y+F);if(V.instersects(C)){Q=v.__styleString;if(L!=Q)p.fillStyle=L=Q;p.save();p.translate(D.x,D.y);p.rotate(-W.rotation);p.scale(S,F);p.beginPath();p.arc(0,0,1,0,ha,true);p.closePath();p.fill();p.restore()}}}}function Oa(D,W,S,F){if(F.opacity!=0){a(F.opacity);c(F.blending);p.beginPath(); +p.moveTo(D.positionScreen.x,D.positionScreen.y);p.lineTo(W.positionScreen.x,W.positionScreen.y);p.closePath();if(F instanceof THREE.LineBasicMaterial){v.__styleString=F.color.__styleString;D=F.linewidth;if(M!=D)p.lineWidth=M=D;D=v.__styleString;if(H!=D)p.strokeStyle=H=D;p.stroke();C.inflate(F.linewidth*2)}}}function Ja(D,W,S,F,Q,Y){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);f=D.positionScreen.x;k=D.positionScreen.y;m=W.positionScreen.x;t=W.positionScreen.y;o=S.positionScreen.x;q=S.positionScreen.y; +p.beginPath();p.moveTo(f,k);p.lineTo(m,t);p.lineTo(o,q);p.lineTo(f,k);p.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&ya(f,k,m,t,o,q,Q.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=la.matrix;Z.copy(F.vertexNormalsWorld[0]);R=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;J=-(Z.x*D.n21+Z.y* +D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[1]);O=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;X=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[2]);I=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;E=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;ya(f,k,m,t,o,q,Q.env_map.image,R,J,O,X,I,E)}}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&& +ya(f,k,m,t,o,q,Q.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(G)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){x.r=u.r=y.r=$.r;x.g=u.g=y.g=$.g;x.b=u.b=y.b=$.b;ja(Y,F.v1.positionWorld,F.vertexNormalsWorld[0],x);ja(Y,F.v2.positionWorld,F.vertexNormalsWorld[1],u);ja(Y,F.v3.positionWorld,F.vertexNormalsWorld[2],y);B.r=(u.r+y.r)*0.5;B.g=(u.g+y.g)*0.5;B.b=(u.b+y.b)*0.5;T=Ka(x,u,y,B);ya(f,k,m,t,o,q,T,0,0,1, +0,0,1)}else{P.r=$.r;P.g=$.g;P.b=$.b;ja(Y,F.centroidWorld,F.normalWorld,P);v.r=Q.color.r*P.r;v.g=Q.color.g*P.g;v.b=Q.color.b*P.b;v.updateStyleString();Q.wireframe?Ba(v.__styleString,Q.wireframe_linewidth):Ca(v.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){N=la.near;K=la.far;x.r=x.g=x.b=1-Fa(D.positionScreen.z,N,K);u.r=u.g=u.b=1-Fa(W.positionScreen.z,N,K);y.r=y.g=y.b=1-Fa(S.positionScreen.z,N,K); +B.r=(u.r+y.r)*0.5;B.g=(u.g+y.g)*0.5;B.b=(u.b+y.b)*0.5;T=Ka(x,u,y,B);ya(f,k,m,t,o,q,T,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){v.r=Ga(F.normalWorld.x);v.g=Ga(F.normalWorld.y);v.b=Ga(F.normalWorld.z);v.updateStyleString();Q.wireframe?Ba(v.__styleString,Q.wireframe_linewidth):Ca(v.__styleString)}}}function Ba(D,W){if(H!=D)p.strokeStyle=H=D;if(M!=W)p.lineWidth=M=W;p.stroke();C.inflate(W*2)}function Ca(D){if(L!=D)p.fillStyle=L=D;p.fill()}function ya(D,W,S,F,Q,Y,da,ga,ia,ta,ma,ua,za){var oa, +va;oa=da.width-1;va=da.height-1;ga*=oa;ia*=va;ta*=oa;ma*=va;ua*=oa;za*=va;S-=D;F-=W;Q-=D;Y-=W;ta-=ga;ma-=ia;ua-=ga;za-=ia;oa=ta*za-ua*ma;if(oa!=0){va=1/oa;oa=(za*S-ma*Q)*va;ma=(za*F-ma*Y)*va;S=(ta*Q-ua*S)*va;F=(ta*Y-ua*F)*va;D=D-oa*ga-S*ia;W=W-ma*ga-F*ia;p.save();p.transform(oa,ma,S,F,D,W);p.clip();p.drawImage(da,0,0);p.restore()}}function Ka(D,W,S,F){var Q=~~(D.r*255),Y=~~(D.g*255);D=~~(D.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ia=~~(S.r*255),ta=~~(S.g*255);S=~~(S.b*255);var ma= +~~(F.r*255),ua=~~(F.g*255);F=~~(F.b*255);fa[0]=Q<0?0:Q>255?255:Q;fa[1]=Y<0?0:Y>255?255:Y;fa[2]=D<0?0:D>255?255:D;fa[4]=da<0?0:da>255?255:da;fa[5]=ga<0?0:ga>255?255:ga;fa[6]=W<0?0:W>255?255:W;fa[8]=ia<0?0:ia>255?255:ia;fa[9]=ta<0?0:ta>255?255:ta;fa[10]=S<0?0:S>255?255:S;fa[12]=ma<0?0:ma>255?255:ma;fa[13]=ua<0?0:ua>255?255:ua;fa[14]=F<0?0:F>255?255:F;ka.putImageData(wa,0,0);ea.drawImage(qa,0,0);return ra}function Fa(D,W,S){D=(D-W)/(S-W);return D*D*(3-2*D)}function Ga(D){D=(D+1)*0.5;return D<0?0:D>1? +1:D}function Ha(D,W){var S=W.x-D.x,F=W.y-D.y,Q=1/Math.sqrt(S*S+F*F);S*=Q;F*=Q;W.x+=S;W.y+=F;D.x-=S;D.y-=F}var Da,La,ba,pa,xa,Ia,Ma,Aa;this.autoClear?this.clear():p.setTransform(1,0,0,-1,s,n);e=g.projectScene(ca,la,this.sortElements);(G=ca.lights.length>0)&&Ea(ca);Da=0;for(La=e.length;Da0){U.r+=M.color.r*V;U.g+=M.color.g*V;U.b+=M.color.b*V}}else if(M instanceof THREE.PointLight){z.sub(M.position,F.centroidWorld);z.normalize();V=F.normalWorld.dot(z)*M.intensity;if(V>0){U.r+=M.color.r*V;U.g+=M.color.g*V;U.b+=M.color.b*V}}}}function c(O,F,U,S,I,M){v=h(C++);v.setAttribute("d","M "+O.positionScreen.x+ -" "+O.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)f.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(i){k.r=l.r;k.g=l.g;k.b=l.b;a(M,S,k);f.r=I.color.r*k.r;f.g=I.color.g*k.g;f.b=I.color.b*k.b;f.updateStyleString()}else f.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){n=1-I.__2near/(I.__farPlusNear-S.z*I.__farMinusNear); -f.setRGB(n,n,n)}else I instanceof THREE.MeshNormalMaterial&&f.setRGB(j(S.normalWorld.x),j(S.normalWorld.y),j(S.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+I.opacity);r.appendChild(v)}function d(O,F,U,S,I,M,V){v=h(C++);v.setAttribute("d", -"M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)f.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(i){k.r=l.r;k.g=l.g;k.b=l.b;a(V,I,k);f.r=M.color.r*k.r;f.g=M.color.g*k.g;f.b=M.color.b*k.b;f.updateStyleString()}else f.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){n= -1-M.__2near/(M.__farPlusNear-I.z*M.__farMinusNear);f.setRGB(n,n,n)}else M instanceof THREE.MeshNormalMaterial&&f.setRGB(j(I.normalWorld.x),j(I.normalWorld.y),j(I.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+M.opacity);r.appendChild(v)} -function h(O){if(s[O]==null){s[O]=document.createElementNS("http://www.w3.org/2000/svg","path");P==0&&s[O].setAttribute("shape-rendering","crispEdges");return s[O]}return s[O]}function j(O){return O<0?Math.min((1+O)*0.5,0.5):0.5+Math.min(O*0.5,0.5)}var m=null,b=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,B,A,u,y,H,L,e=new THREE.Rectangle,g=new THREE.Rectangle,i=false,f=new THREE.Color(16777215),k=new THREE.Color(16777215),l=new THREE.Color(0),t=new THREE.Color(0), -q=new THREE.Color(0),n,z=new THREE.Vector3,s=[],w=[],E=[],v,C,W,J,P=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(O){switch(O){case "high":P=1;break;case "low":P=0}};this.setSize=function(O,F){o=O;p=F;B=o/2;A=p/2;r.setAttribute("viewBox",-B+" "+-A+" "+o+" "+p);r.setAttribute("width",o);r.setAttribute("height",p);e.set(-B,-A,B,A)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(O,F){var U,S, -I,M,V,R,x,K;this.autoClear&&this.clear();m=b.projectScene(O,F,this.sortElements);J=W=C=0;if(i=O.lights.length>0){x=O.lights;l.setRGB(0,0,0);t.setRGB(0,0,0);q.setRGB(0,0,0);U=0;for(S=x.length;U0){O.r+=E.color.r*V;O.g+=E.color.g*V;O.b+=E.color.b*V}}else if(E instanceof THREE.PointLight){q.sub(E.position,J.centroidWorld);q.normalize();V=J.normalWorld.dot(q)*E.intensity;if(V>0){O.r+=E.color.r*V;O.g+=E.color.g*V;O.b+=E.color.b*V}}}}function c(R,J,O,X,I,E){y=g(B++);y.setAttribute("d","M "+R.positionScreen.x+ +" "+R.positionScreen.y+" L "+J.positionScreen.x+" "+J.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)h.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(l){f.r=k.r;f.g=k.g;f.b=k.b;a(E,X,f);h.r=I.color.r*f.r;h.g=I.color.g*f.g;h.b=I.color.b*f.b;h.updateStyleString()}else h.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){o=1-I.__2near/(I.__farPlusNear-X.z*I.__farMinusNear); +h.setRGB(o,o,o)}else I instanceof THREE.MeshNormalMaterial&&h.setRGB(i(X.normalWorld.x),i(X.normalWorld.y),i(X.normalWorld.z));I.wireframe?y.setAttribute("style","fill: none; stroke: "+h.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):y.setAttribute("style","fill: "+h.__styleString+"; fill-opacity: "+I.opacity);s.appendChild(y)}function e(R,J,O,X,I,E,V){y=g(B++);y.setAttribute("d", +"M "+R.positionScreen.x+" "+R.positionScreen.y+" L "+J.positionScreen.x+" "+J.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)h.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(l){f.r=k.r;f.g=k.g;f.b=k.b;a(V,I,f);h.r=E.color.r*f.r;h.g=E.color.g*f.g;h.b=E.color.b*f.b;h.updateStyleString()}else h.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){o= +1-E.__2near/(E.__farPlusNear-I.z*E.__farMinusNear);h.setRGB(o,o,o)}else E instanceof THREE.MeshNormalMaterial&&h.setRGB(i(I.normalWorld.x),i(I.normalWorld.y),i(I.normalWorld.z));E.wireframe?y.setAttribute("style","fill: none; stroke: "+h.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):y.setAttribute("style","fill: "+h.__styleString+"; fill-opacity: "+E.opacity);s.appendChild(y)} +function g(R){if(v[R]==null){v[R]=document.createElementNS("http://www.w3.org/2000/svg","path");T==0&&v[R].setAttribute("shape-rendering","crispEdges");return v[R]}return v[R]}function i(R){return R<0?Math.min((1+R)*0.5,0.5):0.5+Math.min(R*0.5,0.5)}var j=null,b=new THREE.Projector,s=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,p,r,A,w,z,H,L,M=new THREE.Rectangle,d=new THREE.Rectangle,l=false,h=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),m=new THREE.Color(0), +t=new THREE.Color(0),o,q=new THREE.Vector3,v=[],x=[],u=[],y,B,N,K,T=1;this.domElement=s;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(R){switch(R){case "high":T=1;break;case "low":T=0}};this.setSize=function(R,J){n=R;p=J;r=n/2;A=p/2;s.setAttribute("viewBox",-r+" "+-A+" "+n+" "+p);s.setAttribute("width",n);s.setAttribute("height",p);M.set(-r,-A,r,A)};this.clear=function(){for(;s.childNodes.length>0;)s.removeChild(s.childNodes[0])};this.render=function(R,J){var O,X, +I,E,V,U,C,G;this.autoClear&&this.clear();j=b.projectScene(R,J,this.sortElements);K=N=B=0;if(l=R.lights.length>0){C=R.lights;k.setRGB(0,0,0);m.setRGB(0,0,0);t.setRGB(0,0,0);O=0;for(X=C.length;O0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,M,i)}if(ia&&J>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,V,i)}if($){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, -e.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,T,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Z,i)}};this.setLineBuffers=function(e,g){var i,f,k,l=e.vertices,t=e.colors,q=l.length,n=t.length,z=e.__vertexArray,s=e.__colorArray,w=e.__lineArray,E=e.__dirtyColors,v=e.__dirtyElements;if(e.__dirtyVertices){for(i=0;i0?"#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":"",l.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,h("fragment",k+n));b.attachShader(i,h("vertex",l+g));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={};e.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(f in e.uniforms)i.push(f);f=e.program;n=0;for(g=i.length;n=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.color)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.normal)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent, -4,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.tangent)}if(e.uv>=0)if(k.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(k.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(f.wireframe||f instanceof THREE.LineBasicMaterial){e= -f.wireframe_linewidth!==undefined?f.wireframe_linewidth:f.linewidth!==undefined?f.linewidth:1;f=f instanceof THREE.LineBasicMaterial&&l.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(e);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.drawElements(f,k.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(f instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLParticleBuffer);b.drawElements(b.POINTS,k.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, -k.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,k.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,i,f,k,l,t){var q,n,z,s,w;z=0;for(s=f.materials.length;z=0;i--){f=e.__webGLObjects[i].object;g==f&&e.__webGLObjects.splice(i,1)}};this.setupMatrices=function(e,g){e._modelViewMatrix.multiply(g.matrix,e.matrix);e._modelViewMatrixArray.set(e._modelViewMatrix.flatten());e._normalMatrix=THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transpose(); -e._normalMatrixArray.set(e._normalMatrix.m);e._objectMatrixArray.set(e.matrix.flatten())};this.loadMatrices=function(e,g){b.uniformMatrix4fv(e.uniforms.viewMatrix,false,A);b.uniformMatrix4fv(e.uniforms.projectionMatrix,false,B);b.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,g._modelViewMatrixArray);b.uniformMatrix3fv(e.uniforms.normalMatrix,false,g._normalMatrixArray);b.uniformMatrix4fv(e.uniforms.objectMatrix,false,g._objectMatrixArray)};this.loadCamera=function(e,g){b.uniform3f(e.uniforms.cameraPosition, -g.position.x,g.position.y,g.position.z)};this.setDepthTest=function(e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}}; -this.setFaceCulling=function(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", -envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", -envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", -map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", -lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +var j=document.createElement("canvas"),b,s=null,n=null,p=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],r=new THREE.Matrix4,A=new Float32Array(16),w=new Float32Array(16),z=new THREE.Vector4,H=true,L=new THREE.Color(0),M=0;if(a){if(a.antialias!==undefined)H=a.antialias;a.clearColor!==undefined&&L.setHex(a.clearColor);if(a.clearAlpha!==undefined)M=a.clearAlpha}this.domElement=j;this.autoClear=true;(function(d,l,h){try{b=j.getContext("experimental-webgl", +{antialias:d})}catch(f){console.log(f)}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(l.r,l.g,l.b,h)})(H,L,M);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(d, +l){j.width=d;j.height=l;b.viewport(0,0,j.width,j.height)};this.setClearColorHex=function(d,l){var h=new THREE.Color(d);b.clearColor(h.r,h.g,h.b,l)};this.setClearColor=function(d,l){b.clearColor(d.r,d.g,d.b,l)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(d,l){var h,f,k,m=0,t=0,o=0,q,v,x,u=this.lights,y=u.directional.colors,B=u.directional.positions,N=u.point.colors,K=u.point.positions,T=0,R=0;h=k=k=0;for(f=l.length;h0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER, +V,h)}if(ka&&T>0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,U,h)}if(qa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,$,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,h)}};this.setLineBuffers=function(d,l){var h,f,k,m=d.vertices,t=d.colors,o=m.length,q=t.length,v=d.__vertexArray,x=d.__colorArray,u=d.__lineArray,y=d.__dirtyColors,B=d.__dirtyElements;if(d.__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":"",m.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(h,g("fragment",k+q));b.attachShader(h, +g("vertex",m+l));b.linkProgram(h);b.getProgramParameter(h,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(h,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");h.uniforms={};h.attributes={};d.program=h;h=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(f in d.uniforms)h.push(f);f=d.program;q=0;for(l=h.length;q=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.vertexAttribPointer(d.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.color)}if(d.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.normal)}if(d.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER, +k.__webGLTangentBuffer);b.vertexAttribPointer(d.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.tangent)}if(d.uv>=0)if(k.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv)}else b.disableVertexAttribArray(d.uv);if(d.uv2>=0)if(k.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.vertexAttribPointer(d.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv2)}else b.disableVertexAttribArray(d.uv2); +if(f.wireframe||f instanceof THREE.LineBasicMaterial){d=f.wireframe_linewidth!==undefined?f.wireframe_linewidth:f.linewidth!==undefined?f.linewidth:1;f=f instanceof THREE.LineBasicMaterial&&m.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(d);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.drawElements(f,k.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(f instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLParticleBuffer);b.drawElements(b.POINTS,k.__webGLParticleCount, +b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,k.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(d,l,h,f,k,m,t){var o,q,v,x,u;v=0;for(x=f.materials.length;v=0;h--){f=d.__webGLObjects[h].object; +l==f&&d.__webGLObjects.splice(h,1)}};this.setupMatrices=function(d,l){d._modelViewMatrix.multiply(l.matrix,d.matrix);d._modelViewMatrixArray.set(d._modelViewMatrix.flatten());d._normalMatrix=THREE.Matrix4.makeInvert3x3(d._modelViewMatrix).transpose();d._normalMatrixArray.set(d._normalMatrix.m);d._objectMatrixArray.set(d.matrix.flatten())};this.loadMatrices=function(d,l){b.uniformMatrix4fv(d.uniforms.viewMatrix,false,w);b.uniformMatrix4fv(d.uniforms.projectionMatrix,false,A);b.uniformMatrix4fv(d.uniforms.modelViewMatrix, +false,l._modelViewMatrixArray);b.uniformMatrix3fv(d.uniforms.normalMatrix,false,l._normalMatrixArray);b.uniformMatrix4fv(d.uniforms.objectMatrix,false,l._objectMatrixArray)};this.loadCamera=function(d,l){b.uniform3f(d.uniforms.cameraPosition,l.position.x,l.position.y,l.position.z)};this.setDepthTest=function(d){d?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setBlending=function(d){switch(d){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR, +b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(d,l){if(d){!l||l=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(d=="back")b.cullFace(b.BACK);else d=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> +0}}; +THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", +envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", +map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", +lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"}; diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index 93210502..28b353b2 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -1,68 +1,68 @@ // 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 h,j,m,b,r,o;if(d==0)h=j=m=0;else{b=Math.floor(a*6);r=a*6-b;a=d*(1-c);o=d*(1-c*r);c=d*(1-c*(1-r));switch(b){case 1:h=o;j=d;m=a;break;case 2:h=a;j=d;m=c;break;case 3:h=a;j=o;m=d;break;case 4:h=c;j=a;m=d;break;case 5:h=d;j=a;m=o;break;case 6:case 0:h=d;j=c;m=a}}this.r=h;this.g=j;this.b=m;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,e){var g,i,j,b,s,o;if(e==0)g=i=j=0;else{b=Math.floor(a*6);s=a*6-b;a=e*(1-c);o=e*(1-c*s);c=e*(1-c*(1-s));switch(b){case 1:g=o;i=e;j=a;break;case 2:g=a;i=e;j=c;break;case 3:g=a;i=o;j=e;break;case 4:g=c;i=a;j=e;break;case 5:g=e;i=a;j=o;break;case 6:case 0:g=e;i=c;j=a}}this.r=g;this.g=i;this.b=j;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* -this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; -THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,h=this.z;this.x=d*a.z-h*a.y;this.y=h*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= +this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0}; +THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,g=this.z;this.x=e*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,c,d,h){this.x=a||0;this.y=c||0;this.z=d||0;this.w=h||1}; -THREE.Vector4.prototype={set:function(a,c,d,h){this.x=a;this.y=c;this.z=d;this.w=h;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; +THREE.Vector4=function(a,c,e,g){this.x=a||0;this.y=c||0;this.z=e||0;this.w=g||1}; +THREE.Vector4.prototype={set:function(a,c,e,g){this.x=a;this.y=c;this.z=e;this.w=g;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,h=a.objects,j=[];a=0;for(c=h.length;a0&&e>0&&l+e<1}var d,h,j,m,b,r,o,p,B,A, -u,y=a.geometry,H=y.vertices,L=[];d=0;for(h=y.faces.length;do?h:o;j=j>p? -j:p}a()};this.add3Points=function(o,p,B,A,u,y){if(r){r=false;c=oB?o>u?o:u:B>u?B:u;j=p>A?p>y?p:y:A>y?A:y}else{c=oB?o>u?o>h?o:h:u>h?u:h:B>u?B>h?B:h:u>h?u:h;j=p>A?p>y?p>j?p:j:y>j?y:j:A>y?A>j?A:j:y>j?y:j}a()};this.addRectangle=function(o){if(r){r=false;c=o.getLeft();d=o.getTop();h=o.getRight();j=o.getBottom()}else{c=co.getRight()?h:o.getRight();j=j>o.getBottom()?j:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;h+=o;j+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();h=h=0&&Math.min(j,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){r=true;j=h=d=c=0;a()};this.isEmpty=function(){return r};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+h+", top: "+d+", bottom: "+j+", width: "+m+", height: "+b+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,h,j,m,b,r,o,p,B,A,u,y,H,L){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=h||0;this.n21=j||0;this.n22=m||1;this.n23=b||0;this.n24=r||0;this.n31=o||0;this.n32=p||0;this.n33=B||1;this.n34=A||0;this.n41=u||0;this.n42=y||0;this.n43=H||0;this.n44=L||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,h,j,m,b,r,o,p,B,A,u,y,H,L){this.n11=a;this.n12=c;this.n13=d;this.n14=h;this.n21=j;this.n22=m;this.n23=b;this.n24=r;this.n31=o;this.n32=p;this.n33=B;this.n34=A;this.n41=u;this.n42=y;this.n43=H;this.n44=L;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 h=THREE.Matrix4.__tmpVec1,j=THREE.Matrix4.__tmpVec2,m=THREE.Matrix4.__tmpVec3;m.sub(a,c).normalize();h.cross(d,m).normalize();j.cross(m,h).normalize();this.n11=h.x;this.n12=h.y;this.n13=h.z;this.n14=-h.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a); -this.n31=m.x;this.n32=m.y;this.n33=m.z;this.n34=-m.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,h=a.z,j=1/(this.n41*c+this.n42*d+this.n43*h+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*h+this.n14)*j;a.y=(this.n21*c+this.n22*d+this.n23*h+this.n24)*j;a.z=(this.n31*c+this.n32*d+this.n33*h+this.n34)*j;return a},multiplyVector4:function(a){var c=a.x,d=a.y,h=a.z,j=a.w;a.x=this.n11*c+this.n12*d+this.n13*h+this.n14*j;a.y=this.n21*c+this.n22*d+this.n23* -h+this.n24*j;a.z=this.n31*c+this.n32*d+this.n33*h+this.n34*j;a.w=this.n41*c+this.n42*d+this.n43*h+this.n44*j;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,h=a.n12,j=a.n13,m=a.n14,b=a.n21,r=a.n22,o=a.n23,p=a.n24,B=a.n31, -A=a.n32,u=a.n33,y=a.n34,H=a.n41,L=a.n42,e=a.n43,g=a.n44,i=c.n11,f=c.n12,k=c.n13,l=c.n14,t=c.n21,q=c.n22,n=c.n23,z=c.n24,s=c.n31,w=c.n32,E=c.n33,v=c.n34,D=c.n41,W=c.n42,J=c.n43,Q=c.n44;this.n11=d*i+h*t+j*s+m*D;this.n12=d*f+h*q+j*w+m*W;this.n13=d*k+h*n+j*E+m*J;this.n14=d*l+h*z+j*v+m*Q;this.n21=b*i+r*t+o*s+p*D;this.n22=b*f+r*q+o*w+p*W;this.n23=b*k+r*n+o*E+p*J;this.n24=b*l+r*z+o*v+p*Q;this.n31=B*i+A*t+u*s+y*D;this.n32=B*f+A*q+u*w+y*W;this.n33=B*k+A*n+u*E+y*J;this.n34=B*l+A*z+u*v+y*Q;this.n41=H*i+L*t+ -e*s+g*D;this.n42=H*f+L*q+e*w+g*W;this.n43=H*k+L*n+e*E+g*J;this.n44=H*l+L*z+e*v+g*Q;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,h=this.n13,j=this.n14,m=this.n21,b=this.n22,r=this.n23,o=this.n24,p=this.n31,B=this.n32,A=this.n33,u=this.n34,y=this.n41,H=this.n42,L=this.n43,e=this.n44,g=a.n11,i=a.n21,f=a.n31,k=a.n41,l=a.n12,t=a.n22,q=a.n32,n=a.n42,z=a.n13,s=a.n23,w=a.n33,E=a.n43,v=a.n14,D=a.n24,W=a.n34;a=a.n44;this.n11=c*g+d*i+h*f+j*k;this.n12=c*l+d*t+h*q+j*n;this.n13=c*z+d*s+h*w+j* -E;this.n14=c*v+d*D+h*W+j*a;this.n21=m*g+b*i+r*f+o*k;this.n22=m*l+b*t+r*q+o*n;this.n23=m*z+b*s+r*w+o*E;this.n24=m*v+b*D+r*W+o*a;this.n31=p*g+B*i+A*f+u*k;this.n32=p*l+B*t+A*q+u*n;this.n33=p*z+B*s+A*w+u*E;this.n34=p*v+B*D+A*W+u*a;this.n41=y*g+H*i+L*f+e*k;this.n42=y*l+H*t+L*q+e*n;this.n43=y*z+H*s+L*w+e*E;this.n44=y*v+H*D+L*W+e*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,h=this.n14,j=this.n21,m=this.n22,b=this.n23,r=this.n24,o=this.n31,p=this.n32,B=this.n33,A=this.n34,u=this.n41,y=this.n42,H=this.n43,L=this.n44;return h*b*p*u-d*r*p*u-h*m*B*u+c*r*B*u+d*m*A*u-c*b*A*u-h*b*o*y+d*r*o*y+h*j*B*y-a*r*B*y-d*j*A*y+a*b*A*y+h*m*o*H-c*r*o*H-h*j*p*H+a*r*p*H+c*j*A*H-a*m*A*H-d*m*o*L+c*b*o*L+d*j*p*L-a*b*p*L-c*j*B*L+a*m*B*L},transpose:function(){function a(c,d, -h){var j=c[d];c[d]=c[h];c[h]=j}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),h=Math.sin(c),j=1-d,m=a.x,b=a.y,r=a.z,o=j*m,p=j*b;this.set(o*m+d,o*b-h*r,o*r+h*b,0,o*b+h*r,p*b+d,p*r-h*m,0,o*r-h*b,p*r+h*m,j*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 h=new THREE.Matrix4;h.setTranslation(a,c,d);return h};THREE.Matrix4.scaleMatrix=function(a,c,d){var h=new THREE.Matrix4;h.setScale(a,c,d);return h};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,h=a.n13,j=a.n14,m=a.n21,b=a.n22,r=a.n23,o=a.n24,p=a.n31,B=a.n32,A=a.n33,u=a.n34,y=a.n41,H=a.n42,L=a.n43,e=a.n44,g=new THREE.Matrix4;g.n11=r*u*H-o*A*H+o*B*L-b*u*L-r*B*e+b*A*e;g.n12=j*A*H-h*u*H-j*B*L+d*u*L+h*B*e-d*A*e;g.n13=h*o*H-j*r*H+j*b*L-d*o*L-h*b*e+d*r*e;g.n14=j*r*B-h*o*B-j*b*A+d*o*A+h*b*u-d*r*u;g.n21=o*A*y-r*u*y-o*p*L+m*u*L+r*p*e-m*A*e;g.n22=h*u*y-j*A*y+j*p*L-c*u*L-h*p*e+c*A*e;g.n23=j*r*y-h*o*y-j*m*L+c*o*L+h*m*e-c*r*e;g.n24=h*o*p-j*r*p+ -j*m*A-c*o*A-h*m*u+c*r*u;g.n31=b*u*y-o*B*y+o*p*H-m*u*H-b*p*e+m*B*e;g.n32=j*B*y-d*u*y-j*p*H+c*u*H+d*p*e-c*B*e;g.n33=h*o*y-j*b*y+j*m*H-c*o*H-d*m*e+c*b*e;g.n34=j*b*p-d*o*p-j*m*B+c*o*B+d*m*u-c*b*u;g.n41=r*B*y-b*A*y-r*p*H+m*A*H+b*p*L-m*B*L;g.n42=d*A*y-h*B*y+h*p*H-c*A*H-d*p*L+c*B*L;g.n43=h*b*y-d*r*y-h*m*H+c*r*H+d*m*L-c*b*L;g.n44=d*r*p-h*b*p+h*m*B-c*r*B-d*m*A+c*b*A;g.multiplyScalar(1/a.determinant());return g}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,h=c[10]*c[5]-c[6]*c[9],j=-c[10]*c[1]+c[2]*c[9],m=c[6]*c[1]-c[2]*c[5],b=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],o=-c[6]*c[0]+c[2]*c[4],p=c[9]*c[4]-c[5]*c[8],B=-c[9]*c[0]+c[1]*c[8],A=c[5]*c[0]-c[1]*c[4];c=c[0]*h+c[1]*b+c[2]*p;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*h;d[1]=c*j;d[2]=c*m;d[3]=c*b;d[4]=c*r;d[5]=c*o;d[6]=c*p;d[7]=c*B;d[8]=c*A;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,h,j,m){var b,r,o;b=new THREE.Matrix4;r=2*j/(c-a);o=2*j/(h-d);a=(c+a)/(c-a);d=(h+d)/(h-d);h=-(m+j)/(m-j);j=-2*m*j/(m-j);b.n11=r;b.n12=0;b.n13=a;b.n14=0;b.n21=0;b.n22=o;b.n23=d;b.n24=0;b.n31=0;b.n32=0;b.n33=h;b.n34=j;b.n41=0;b.n42=0;b.n43=-1;b.n44=0;return b};THREE.Matrix4.makePerspective=function(a,c,d,h){var j;a=d*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*c,a*c,j,a,d,h)}; -THREE.Matrix4.makeOrtho=function(a,c,d,h,j,m){var b,r,o,p;b=new THREE.Matrix4;r=c-a;o=d-h;p=m-j;a=(c+a)/r;d=(d+h)/o;j=(m+j)/p;b.n11=2/r;b.n12=0;b.n13=0;b.n14=-a;b.n21=0;b.n22=2/o;b.n23=0;b.n24=-d;b.n31=0;b.n32=0;b.n33=-2/p;b.n34=-j;b.n41=0;b.n42=0;b.n43=0;b.n44=1;return b};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Ray.prototype={intersectScene:function(a){var c,e,g=a.objects,i=[];a=0;for(c=g.length;a0&&M>0&&k+M<1}var e,g,i,j,b,s,o,l,r,A, +w,z=a.geometry,H=z.vertices,L=[];e=0;for(g=z.faces.length;eo?g:o;i=i>l? +i:l}a()};this.add3Points=function(o,l,r,A,w,z){if(s){s=false;c=or?o>w?o:w:r>w?r:w;i=l>A?l>z?l:z:A>z?A:z}else{c=or?o>w?o>g?o:g:w>g?w:g:r>w?r>g?r:g:w>g?w:g;i=l>A?l>z?l>i?l:i:z>i?z:i:A>z?A>i?A:i:z>i?z:i}a()};this.addRectangle=function(o){if(s){s=false;c=o.getLeft();e=o.getTop();g=o.getRight();i=o.getBottom()}else{c=co.getRight()?g:o.getRight();i=i>o.getBottom()?i:o.getBottom()}a()};this.inflate=function(o){c-=o;e-=o;g+=o;i+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();e=e>o.getTop()?e:o.getTop();g=g=0&&Math.min(i,o.getBottom())-Math.max(e,o.getTop())>=0};this.empty=function(){s=true;i=g=e=c=0;a()};this.isEmpty=function(){return s};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", bottom: "+i+", width: "+j+", height: "+b+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,e,g,i,j,b,s,o,l,r,A,w,z,H,L){this.n11=a||1;this.n12=c||0;this.n13=e||0;this.n14=g||0;this.n21=i||0;this.n22=j||1;this.n23=b||0;this.n24=s||0;this.n31=o||0;this.n32=l||0;this.n33=r||1;this.n34=A||0;this.n41=w||0;this.n42=z||0;this.n43=H||0;this.n44=L||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,e,g,i,j,b,s,o,l,r,A,w,z,H,L){this.n11=a;this.n12=c;this.n13=e;this.n14=g;this.n21=i;this.n22=j;this.n23=b;this.n24=s;this.n31=o;this.n32=l;this.n33=r;this.n34=A;this.n41=w;this.n42=z;this.n43=H;this.n44=L;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,e){var g=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,j=THREE.Matrix4.__tmpVec3;j.sub(a,c).normalize();g.cross(e,j).normalize();i.cross(j,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a); +this.n31=j.x;this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,e=a.y,g=a.z,i=1/(this.n41*c+this.n42*e+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*e+this.n13*g+this.n14)*i;a.y=(this.n21*c+this.n22*e+this.n23*g+this.n24)*i;a.z=(this.n31*c+this.n32*e+this.n33*g+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,e=a.y,g=a.z,i=a.w;a.x=this.n11*c+this.n12*e+this.n13*g+this.n14*i;a.y=this.n21*c+this.n22*e+this.n23* +g+this.n24*i;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*i;a.w=this.n41*c+this.n42*e+this.n43*g+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var e=a.n11,g=a.n12,i=a.n13,j=a.n14,b=a.n21,s=a.n22,o=a.n23,l=a.n24,r=a.n31, +A=a.n32,w=a.n33,z=a.n34,H=a.n41,L=a.n42,M=a.n43,d=a.n44,m=c.n11,h=c.n12,f=c.n13,k=c.n14,n=c.n21,t=c.n22,p=c.n23,q=c.n24,v=c.n31,x=c.n32,u=c.n33,y=c.n34,B=c.n41,N=c.n42,K=c.n43,T=c.n44;this.n11=e*m+g*n+i*v+j*B;this.n12=e*h+g*t+i*x+j*N;this.n13=e*f+g*p+i*u+j*K;this.n14=e*k+g*q+i*y+j*T;this.n21=b*m+s*n+o*v+l*B;this.n22=b*h+s*t+o*x+l*N;this.n23=b*f+s*p+o*u+l*K;this.n24=b*k+s*q+o*y+l*T;this.n31=r*m+A*n+w*v+z*B;this.n32=r*h+A*t+w*x+z*N;this.n33=r*f+A*p+w*u+z*K;this.n34=r*k+A*q+w*y+z*T;this.n41=H*m+L*n+ +M*v+d*B;this.n42=H*h+L*t+M*x+d*N;this.n43=H*f+L*p+M*u+d*K;this.n44=H*k+L*q+M*y+d*T;return this},multiplySelf:function(a){var c=this.n11,e=this.n12,g=this.n13,i=this.n14,j=this.n21,b=this.n22,s=this.n23,o=this.n24,l=this.n31,r=this.n32,A=this.n33,w=this.n34,z=this.n41,H=this.n42,L=this.n43,M=this.n44,d=a.n11,m=a.n21,h=a.n31,f=a.n41,k=a.n12,n=a.n22,t=a.n32,p=a.n42,q=a.n13,v=a.n23,x=a.n33,u=a.n43,y=a.n14,B=a.n24,N=a.n34;a=a.n44;this.n11=c*d+e*m+g*h+i*f;this.n12=c*k+e*n+g*t+i*p;this.n13=c*q+e*v+g*x+i* +u;this.n14=c*y+e*B+g*N+i*a;this.n21=j*d+b*m+s*h+o*f;this.n22=j*k+b*n+s*t+o*p;this.n23=j*q+b*v+s*x+o*u;this.n24=j*y+b*B+s*N+o*a;this.n31=l*d+r*m+A*h+w*f;this.n32=l*k+r*n+A*t+w*p;this.n33=l*q+r*v+A*x+w*u;this.n34=l*y+r*B+A*N+w*a;this.n41=z*d+H*m+L*h+M*f;this.n42=z*k+H*n+L*t+M*p;this.n43=z*q+H*v+L*x+M*u;this.n44=z*y+H*B+L*N+M*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= +a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,j=this.n22,b=this.n23,s=this.n24,o=this.n31,l=this.n32,r=this.n33,A=this.n34,w=this.n41,z=this.n42,H=this.n43,L=this.n44;return g*b*l*w-e*s*l*w-g*j*r*w+c*s*r*w+e*j*A*w-c*b*A*w-g*b*o*z+e*s*o*z+g*i*r*z-a*s*r*z-e*i*A*z+a*b*A*z+g*j*o*H-c*s*o*H-g*i*l*H+a*s*l*H+c*i*A*H-a*j*A*H-e*j*o*L+c*b*o*L+e*i*l*L-a*b*l*L-c*i*r*L+a*j*r*L},transpose:function(){function a(c,e, +g){var i=c[e];c[e]=c[g];c[g]=i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; +a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,e){this.set(1,0,0,a,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(a,c,e){this.set(a,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var e=Math.cos(c),g=Math.sin(c),i=1-e,j=a.x,b=a.y,s=a.z,o=i*j,l=i*b;this.set(o*j+e,o*b-g*s,o*s+g*b,0,o*b+g*s,l*b+e,l*s-g*j,0,o*s-g*b,l*s+g*j,i*s*s+e,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setTranslation(a,c,e);return g};THREE.Matrix4.scaleMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setScale(a,c,e);return g};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; +THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4;e.setRotAxis(a,c);return e}; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,j=a.n21,b=a.n22,s=a.n23,o=a.n24,l=a.n31,r=a.n32,A=a.n33,w=a.n34,z=a.n41,H=a.n42,L=a.n43,M=a.n44,d=new THREE.Matrix4;d.n11=s*w*H-o*A*H+o*r*L-b*w*L-s*r*M+b*A*M;d.n12=i*A*H-g*w*H-i*r*L+e*w*L+g*r*M-e*A*M;d.n13=g*o*H-i*s*H+i*b*L-e*o*L-g*b*M+e*s*M;d.n14=i*s*r-g*o*r-i*b*A+e*o*A+g*b*w-e*s*w;d.n21=o*A*z-s*w*z-o*l*L+j*w*L+s*l*M-j*A*M;d.n22=g*w*z-i*A*z+i*l*L-c*w*L-g*l*M+c*A*M;d.n23=i*s*z-g*o*z-i*j*L+c*o*L+g*j*M-c*s*M;d.n24=g*o*l-i*s*l+ +i*j*A-c*o*A-g*j*w+c*s*w;d.n31=b*w*z-o*r*z+o*l*H-j*w*H-b*l*M+j*r*M;d.n32=i*r*z-e*w*z-i*l*H+c*w*H+e*l*M-c*r*M;d.n33=g*o*z-i*b*z+i*j*H-c*o*H-e*j*M+c*b*M;d.n34=i*b*l-e*o*l-i*j*r+c*o*r+e*j*w-c*b*w;d.n41=s*r*z-b*A*z-s*l*H+j*A*H+b*l*L-j*r*L;d.n42=e*A*z-g*r*z+g*l*H-c*A*H-e*l*L+c*r*L;d.n43=g*b*z-e*s*z-g*j*H+c*s*H+e*j*L-c*b*L;d.n44=e*s*l-g*b*l+g*j*r-c*s*r-e*j*A+c*b*A;d.multiplyScalar(1/a.determinant());return d}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var e=a.m,g=c[10]*c[5]-c[6]*c[9],i=-c[10]*c[1]+c[2]*c[9],j=c[6]*c[1]-c[2]*c[5],b=-c[10]*c[4]+c[6]*c[8],s=c[10]*c[0]-c[2]*c[8],o=-c[6]*c[0]+c[2]*c[4],l=c[9]*c[4]-c[5]*c[8],r=-c[9]*c[0]+c[1]*c[8],A=c[5]*c[0]-c[1]*c[4];c=c[0]*g+c[1]*b+c[2]*l;if(c==0)throw"matrix not invertible";c=1/c;e[0]=c*g;e[1]=c*i;e[2]=c*j;e[3]=c*b;e[4]=c*s;e[5]=c*o;e[6]=c*l;e[7]=c*r;e[8]=c*A;return a}; +THREE.Matrix4.makeFrustum=function(a,c,e,g,i,j){var b,s,o;b=new THREE.Matrix4;s=2*i/(c-a);o=2*i/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);g=-(j+i)/(j-i);i=-2*j*i/(j-i);b.n11=s;b.n12=0;b.n13=a;b.n14=0;b.n21=0;b.n22=o;b.n23=e;b.n24=0;b.n31=0;b.n32=0;b.n33=g;b.n34=i;b.n41=0;b.n42=0;b.n43=-1;b.n44=0;return b};THREE.Matrix4.makePerspective=function(a,c,e,g){var i;a=e*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,e,g)}; +THREE.Matrix4.makeOrtho=function(a,c,e,g,i,j){var b,s,o,l;b=new THREE.Matrix4;s=c-a;o=e-g;l=j-i;a=(c+a)/s;e=(e+g)/o;i=(j+i)/l;b.n11=2/s;b.n12=0;b.n13=0;b.n14=-a;b.n21=0;b.n22=2/o;b.n23=0;b.n24=-e;b.n31=0;b.n32=0;b.n33=-2/l;b.n34=-i;b.n41=0;b.n42=0;b.n43=0;b.n44=1;return b};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,h,j){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; -THREE.Face4=function(a,c,d,h,j,m){this.a=a;this.b=c;this.c=d;this.d=h;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.materials=m instanceof Array?m:[m]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,e,g,i){this.a=a;this.b=c;this.c=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,e,g,i,j){this.a=a;this.b=c;this.c=e;this.d=g;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; -THREE.Geometry.prototype={computeCentroids:function(){var a,c,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], -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){p[r].counter+=1;o=p[r].hash+"_"+p[r].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],materials:b,vertices:0}}this.geometryChunks[o].faces.push(h);this.geometryChunks[o].vertices+=m}},toString:function(){return"THREE.Geometry ( vertices: "+ +THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;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], +z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=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,e=this.vertices.length;c65535){l[s].counter+=1;o=l[s].hash+"_"+l[s].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],materials:b,vertices:0}}this.geometryChunks[o].faces.push(g);this.geometryChunks[o].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,h){this.fov=a;this.aspect=c;this.near=d;this.far=h;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(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; -this.translateZ=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);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,e,g){this.fov=a;this.aspect=c;this.near=e;this.far=g;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,h=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){h.setRotY(c.y);this.rotationMatrix.multiplySelf(h)}if(c.z!=0){h.setRotZ(c.z);this.rotationMatrix.multiplySelf(h)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){h.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(h)}}};THREE.Object3DCounter={value:0}; +THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,e=this.scale,g=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){g.setRotY(c.y);this.rotationMatrix.multiplySelf(g)}if(c.z!=0){g.setRotZ(c.z);this.rotationMatrix.multiplySelf(g)}this.matrix.multiplySelf(this.rotationMatrix);if(e.x!=0||e.y!=0||e.z!=0){g.setScale(e.x,e.y,e.z);this.matrix.multiplySelf(g)}}};THREE.Object3DCounter={value:0}; THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem; -THREE.Line=function(a,c,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.Line=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()}; THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; @@ -94,120 +94,121 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
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,h,j,m){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=h!==undefined?h:THREE.ClampToEdgeWrapping;this.mag_filter=j!==undefined?j:THREE.LinearFilter;this.min_filter=m!==undefined?m: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,e,g,i,j){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=g!==undefined?g:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=j!==undefined?j:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
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,h,j={};for(c in a){j[c]={};for(d in a[c]){h=a[c][d];j[c][d]=h instanceof THREE.Color||h instanceof THREE.Vector3||h instanceof THREE.Texture?h.clone():h}}return j},merge:function(a){var c,d,h,j={};for(c=0;c=0&&E>=0&&v>=0&&D>=0)return true;else if(w<0&&E<0||v<0&&D<0)return false;else{if(w<0)z=Math.max(z,w/(w-E));else if(E<0)s=Math.min(s,w/(w-E));if(v<0)z=Math.max(z,v/(v-D));else if(D<0)s=Math.min(s,v/(v-D));if(sw&&J.z0&&e.z<1){u=H[y]=H[y]||new THREE.RenderableParticle;u.x=e.x/e.w;u.y=e.y/e.w;u.z=e.z;u.rotation=F.rotation.z;u.scale.x=F.scale.x*Math.abs(u.x-(e.x+n.projectionMatrix.n11)/(e.w+n.projectionMatrix.n14)); -u.scale.y=F.scale.y*Math.abs(u.y-(e.y+n.projectionMatrix.n22)/(e.w+n.projectionMatrix.n24));u.materials=F.materials;s.push(u);y++}}}}z&&s.sort(a);return s};this.unprojectVector=function(q,n){var z=THREE.Matrix4.makeInvert(n.matrix);z.multiplySelf(THREE.Matrix4.makeInvert(n.projectionMatrix));z.multiplyVector3(q);return q}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,h,j,m;this.domElement=document.createElement("div");this.setSize=function(b,r){d=b;h=r;j=d/2;m=h/2};this.render=function(b,r){var o,p,B,A,u,y,H,L;a=c.projectScene(b,r);o=0;for(p=a.length;o0){G.r+=ea.r*Y;G.g+=ea.g*Y;G.b+=ea.b*Y}}else if(Y instanceof THREE.PointLight){$.sub(Y.position,X);$.normalize();Y=R.dot($)*ga;if(Y> -0){G.r+=ea.r*Y;G.g+=ea.g*Y;G.b+=ea.b*Y}}}}function Na(C,X,R){if(R.opacity!=0){a(R.opacity);c(R.blending);var G,N,Y,ea,ga,ha;if(R instanceof THREE.ParticleBasicMaterial){if(R.map&&R.map.image.loaded){ea=R.map.image;ga=ea.width>>1;ha=ea.height>>1;N=X.scale.x*r;Y=X.scale.y*o;R=N*ga;G=Y*ha;x.set(C.x-R,C.y-G,C.x+R,C.y+G);if(!T.instersects(x))return;p.save();p.translate(C.x,C.y);p.rotate(-X.rotation);p.scale(N,-Y);p.translate(-ga,-ha);p.drawImage(ea,0,0);p.restore()}p.beginPath();p.moveTo(C.x-10,C.y);p.lineTo(C.x+ -10,C.y);p.moveTo(C.x,C.y-10);p.lineTo(C.x,C.y+10);p.closePath();p.strokeStyle="rgb(255,255,0)";p.stroke()}else if(R instanceof THREE.ParticleCircleMaterial){if(K){U.r=Z.r+ma.r+ca.r;U.g=Z.g+ma.g+ca.g;U.b=Z.b+ma.b+ca.b;s.r=R.color.r*U.r;s.g=R.color.g*U.g;s.b=R.color.b*U.b;s.updateStyleString()}else s.__styleString=R.color.__styleString;R=X.scale.x*r;G=X.scale.y*o;x.set(C.x-R,C.y-G,C.x+R,C.y+G);if(T.instersects(x)){N=s.__styleString;if(L!=N)p.fillStyle=L=N;p.save();p.translate(C.x,C.y);p.rotate(-X.rotation); -p.scale(R,G);p.beginPath();p.arc(0,0,1,0,xa,true);p.closePath();p.fill();p.restore()}}}}function Oa(C,X,R,G){if(G.opacity!=0){a(G.opacity);c(G.blending);p.beginPath();p.moveTo(C.positionScreen.x,C.positionScreen.y);p.lineTo(X.positionScreen.x,X.positionScreen.y);p.closePath();if(G instanceof THREE.LineBasicMaterial){s.__styleString=G.color.__styleString;C=G.linewidth;if(e!=C)p.lineWidth=e=C;C=s.__styleString;if(H!=C)p.strokeStyle=H=C;p.stroke();x.inflate(G.linewidth*2)}}}function Ja(C,X,R,G,N,Y){if(N.opacity!= -0){a(N.opacity);c(N.blending);k=C.positionScreen.x;l=C.positionScreen.y;t=X.positionScreen.x;q=X.positionScreen.y;n=R.positionScreen.x;z=R.positionScreen.y;p.beginPath();p.moveTo(k,l);p.lineTo(t,q);p.lineTo(n,z);p.lineTo(k,l);p.closePath();if(N instanceof THREE.MeshBasicMaterial)if(N.map)N.map.image.loaded&&N.map.mapping instanceof THREE.UVMapping&&ya(k,l,t,q,n,z,N.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);else if(N.env_map){if(N.env_map.image.loaded)if(N.env_map.mapping instanceof -THREE.SphericalReflectionMapping){C=ja.matrix;$.copy(G.vertexNormalsWorld[0]);P=($.x*C.n11+$.y*C.n12+$.z*C.n13)*0.5+0.5;F=-($.x*C.n21+$.y*C.n22+$.z*C.n23)*0.5+0.5;$.copy(G.vertexNormalsWorld[1]);V=($.x*C.n11+$.y*C.n12+$.z*C.n13)*0.5+0.5;S=-($.x*C.n21+$.y*C.n22+$.z*C.n23)*0.5+0.5;$.copy(G.vertexNormalsWorld[2]);I=($.x*C.n11+$.y*C.n12+$.z*C.n13)*0.5+0.5;M=-($.x*C.n21+$.y*C.n22+$.z*C.n23)*0.5+0.5;ya(k,l,t,q,n,z,N.env_map.image,P,F,V,S,I,M)}}else N.wireframe?Ca(N.color.__styleString,N.wireframe_linewidth): -Da(N.color.__styleString);else if(N instanceof THREE.MeshLambertMaterial){if(N.map&&!N.wireframe){N.map.mapping instanceof THREE.UVMapping&&ya(k,l,t,q,n,z,N.map.image,G.uvs[0].u,G.uvs[0].v,G.uvs[1].u,G.uvs[1].v,G.uvs[2].u,G.uvs[2].v);c(THREE.SubtractiveBlending)}if(K)if(!N.wireframe&&N.shading==THREE.SmoothShading&&G.vertexNormalsWorld.length==3){w.r=E.r=v.r=Z.r;w.g=E.g=v.g=Z.g;w.b=E.b=v.b=Z.b;Ba(Y,G.v1.positionWorld,G.vertexNormalsWorld[0],w);Ba(Y,G.v2.positionWorld,G.vertexNormalsWorld[1],E);Ba(Y, -G.v3.positionWorld,G.vertexNormalsWorld[2],v);D.r=(E.r+v.r)*0.5;D.g=(E.g+v.g)*0.5;D.b=(E.b+v.b)*0.5;Q=Ka(w,E,v,D);ya(k,l,t,q,n,z,Q,0,0,1,0,0,1)}else{U.r=Z.r;U.g=Z.g;U.b=Z.b;Ba(Y,G.centroidWorld,G.normalWorld,U);s.r=N.color.r*U.r;s.g=N.color.g*U.g;s.b=N.color.b*U.b;s.updateStyleString();N.wireframe?Ca(s.__styleString,N.wireframe_linewidth):Da(s.__styleString)}else N.wireframe?Ca(N.color.__styleString,N.wireframe_linewidth):Da(N.color.__styleString)}else if(N instanceof THREE.MeshDepthMaterial){W=ja.near; -J=ja.far;w.r=w.g=w.b=1-Fa(C.positionScreen.z,W,J);E.r=E.g=E.b=1-Fa(X.positionScreen.z,W,J);v.r=v.g=v.b=1-Fa(R.positionScreen.z,W,J);D.r=(E.r+v.r)*0.5;D.g=(E.g+v.g)*0.5;D.b=(E.b+v.b)*0.5;Q=Ka(w,E,v,D);ya(k,l,t,q,n,z,Q,0,0,1,0,0,1)}else if(N instanceof THREE.MeshNormalMaterial){s.r=Ga(G.normalWorld.x);s.g=Ga(G.normalWorld.y);s.b=Ga(G.normalWorld.z);s.updateStyleString();N.wireframe?Ca(s.__styleString,N.wireframe_linewidth):Da(s.__styleString)}}}function Ca(C,X){if(H!=C)p.strokeStyle=H=C;if(e!=X)p.lineWidth= -e=X;p.stroke();x.inflate(X*2)}function Da(C){if(L!=C)p.fillStyle=L=C;p.fill()}function ya(C,X,R,G,N,Y,ea,ga,ha,qa,ka,ra,za){var na,sa;na=ea.width-1;sa=ea.height-1;ga*=na;ha*=sa;qa*=na;ka*=sa;ra*=na;za*=sa;R-=C;G-=X;N-=C;Y-=X;qa-=ga;ka-=ha;ra-=ga;za-=ha;na=qa*za-ra*ka;if(na!=0){sa=1/na;na=(za*R-ka*N)*sa;ka=(za*G-ka*Y)*sa;R=(qa*N-ra*R)*sa;G=(qa*Y-ra*G)*sa;C=C-na*ga-R*ha;X=X-ka*ga-G*ha;p.save();p.transform(na,ka,R,G,C,X);p.clip();p.drawImage(ea,0,0);p.restore()}}function Ka(C,X,R,G){var N=~~(C.r*255), -Y=~~(C.g*255);C=~~(C.b*255);var ea=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ha=~~(R.r*255),qa=~~(R.g*255);R=~~(R.b*255);var ka=~~(G.r*255),ra=~~(G.g*255);G=~~(G.b*255);fa[0]=N<0?0:N>255?255:N;fa[1]=Y<0?0:Y>255?255:Y;fa[2]=C<0?0:C>255?255:C;fa[4]=ea<0?0:ea>255?255:ea;fa[5]=ga<0?0:ga>255?255:ga;fa[6]=X<0?0:X>255?255:X;fa[8]=ha<0?0:ha>255?255:ha;fa[9]=qa<0?0:qa>255?255:qa;fa[10]=R<0?0:R>255?255:R;fa[12]=ka<0?0:ka>255?255:ka;fa[13]=ra<0?0:ra>255?255:ra;fa[14]=G<0?0:G>255?255:G;pa.putImageData(ua, -0,0);va.drawImage(ia,0,0);return da}function Fa(C,X,R){C=(C-X)/(R-X);return C*C*(3-2*C)}function Ga(C){C=(C+1)*0.5;return C<0?0:C>1?1:C}function Ha(C,X){var R=X.x-C.x,G=X.y-C.y,N=1/Math.sqrt(R*R+G*G);R*=N;G*=N;X.x+=R;X.y+=G;C.x-=R;C.y-=G}var Ea,La,aa,oa,wa,Ia,Ma,Aa;this.autoClear?this.clear():p.setTransform(1,0,0,-1,r,o);d=h.projectScene(ba,ja,this.sortElements);p.fillStyle="rgba( 0, 255, 255, 0.5 )";p.fillRect(T.getX(),T.getY(),T.getWidth(),T.getHeight());(K=ba.lights.length>0)&&la(ba);Ea=0;for(La= -d.length;Ea0){V.r+=M.color.r*T;V.g+=M.color.g*T;V.b+=M.color.b*T}}else if(M instanceof THREE.PointLight){z.sub(M.position,F.centroidWorld);z.normalize();T=F.normalWorld.dot(z)*M.intensity;if(T>0){V.r+=M.color.r*T;V.g+=M.color.g*T;V.b+=M.color.b*T}}}}function c(P,F,V,S,I,M){v=h(D++);v.setAttribute("d","M "+P.positionScreen.x+ -" "+P.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)f.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(i){k.r=l.r;k.g=l.g;k.b=l.b;a(M,S,k);f.r=I.color.r*k.r;f.g=I.color.g*k.g;f.b=I.color.b*k.b;f.updateStyleString()}else f.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){n=1-I.__2near/(I.__farPlusNear-S.z*I.__farMinusNear); -f.setRGB(n,n,n)}else I instanceof THREE.MeshNormalMaterial&&f.setRGB(j(S.normalWorld.x),j(S.normalWorld.y),j(S.normalWorld.z));I.wireframe?v.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):v.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+I.opacity);r.appendChild(v)}function d(P,F,V,S,I,M,T){v=h(D++);v.setAttribute("d", -"M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+F.positionScreen.x+" "+F.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)f.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(i){k.r=l.r;k.g=l.g;k.b=l.b;a(T,I,k);f.r=M.color.r*k.r;f.g=M.color.g*k.g;f.b=M.color.b*k.b;f.updateStyleString()}else f.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){n= -1-M.__2near/(M.__farPlusNear-I.z*M.__farMinusNear);f.setRGB(n,n,n)}else M instanceof THREE.MeshNormalMaterial&&f.setRGB(j(I.normalWorld.x),j(I.normalWorld.y),j(I.normalWorld.z));M.wireframe?v.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):v.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+M.opacity);r.appendChild(v)} -function h(P){if(s[P]==null){s[P]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&s[P].setAttribute("shape-rendering","crispEdges");return s[P]}return s[P]}function j(P){return P<0?Math.min((1+P)*0.5,0.5):0.5+Math.min(P*0.5,0.5)}var m=null,b=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,p,B,A,u,y,H,L,e=new THREE.Rectangle,g=new THREE.Rectangle,i=false,f=new THREE.Color(16777215),k=new THREE.Color(16777215),l=new THREE.Color(0),t=new THREE.Color(0), -q=new THREE.Color(0),n,z=new THREE.Vector3,s=[],w=[],E=[],v,D,W,J,Q=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(P){switch(P){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(P,F){o=P;p=F;B=o/2;A=p/2;r.setAttribute("viewBox",-B+" "+-A+" "+o+" "+p);r.setAttribute("width",o);r.setAttribute("height",p);e.set(-B,-A,B,A)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(P,F){var V,S, -I,M,T,O,x,K;this.autoClear&&this.clear();m=b.projectScene(P,F,this.sortElements);J=W=D=0;if(i=P.lights.length>0){x=P.lights;l.setRGB(0,0,0);t.setRGB(0,0,0);q.setRGB(0,0,0);V=0;for(S=x.length;V=0&&u>=0&&y>=0&&B>=0)return true;else if(x<0&&u<0||y<0&&B<0)return false;else{if(x<0)q=Math.max(q,x/(x-u));else if(u<0)v=Math.min(v,x/(x-u));if(y<0)q=Math.max(q,y/(y-B));else if(B<0)v=Math.min(v,y/(y-B));if(vx&&K.z0&&M.z<1){w=H[z]=H[z]||new THREE.RenderableParticle;w.x=M.x/M.w;w.y=M.y/M.w;w.z=M.z;w.rotation=J.rotation.z;w.scale.x=J.scale.x*Math.abs(w.x-(M.x+p.projectionMatrix.n11)/(M.w+p.projectionMatrix.n14)); +w.scale.y=J.scale.y*Math.abs(w.y-(M.y+p.projectionMatrix.n22)/(M.w+p.projectionMatrix.n24));w.materials=J.materials;v.push(w);z++}}}}q&&v.sort(a);return v};this.unprojectVector=function(t,p){var q=THREE.Matrix4.makeInvert(p.matrix);q.multiplySelf(THREE.Matrix4.makeInvert(p.projectionMatrix));q.multiplyVector3(t);return t}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,i,j;this.domElement=document.createElement("div");this.setSize=function(b,s){e=b;g=s;i=e/2;j=g/2};this.render=function(b,s){var o,l,r,A,w,z,H,L;a=c.projectScene(b,s);o=0;for(l=a.length;o0){F.r+=da.r*Y;F.g+=da.g*Y;F.b+=da.b*Y}}else if(Y instanceof THREE.PointLight){Z.sub(Y.position,W);Z.normalize();Y=S.dot(Z)*ga;if(Y> +0){F.r+=da.r*Y;F.g+=da.g*Y;F.b+=da.b*Y}}}}function Na(C,W,S){if(S.opacity!=0){a(S.opacity);c(S.blending);var F,Q,Y,da,ga,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ga=da.width>>1;ia=da.height>>1;Q=W.scale.x*s;Y=W.scale.y*o;S=Q*ga;F=Y*ia;D.set(C.x-S,C.y-F,C.x+S,C.y+F);if(!V.instersects(D))return;l.save();l.translate(C.x,C.y);l.rotate(-W.rotation);l.scale(Q,-Y);l.translate(-ga,-ia);l.drawImage(da,0,0);l.restore()}l.beginPath();l.moveTo(C.x-10,C.y);l.lineTo(C.x+ +10,C.y);l.moveTo(C.x,C.y-10);l.lineTo(C.x,C.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)";l.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(G){P.r=$.r+aa.r+na.r;P.g=$.g+aa.g+na.g;P.b=$.b+aa.b+na.b;v.r=S.color.r*P.r;v.g=S.color.g*P.g;v.b=S.color.b*P.b;v.updateStyleString()}else v.__styleString=S.color.__styleString;S=W.scale.x*s;F=W.scale.y*o;D.set(C.x-S,C.y-F,C.x+S,C.y+F);if(V.instersects(D)){Q=v.__styleString;if(L!=Q)l.fillStyle=L=Q;l.save();l.translate(C.x,C.y);l.rotate(-W.rotation); +l.scale(S,F);l.beginPath();l.arc(0,0,1,0,ha,true);l.closePath();l.fill();l.restore()}}}}function Oa(C,W,S,F){if(F.opacity!=0){a(F.opacity);c(F.blending);l.beginPath();l.moveTo(C.positionScreen.x,C.positionScreen.y);l.lineTo(W.positionScreen.x,W.positionScreen.y);l.closePath();if(F instanceof THREE.LineBasicMaterial){v.__styleString=F.color.__styleString;C=F.linewidth;if(M!=C)l.lineWidth=M=C;C=v.__styleString;if(H!=C)l.strokeStyle=H=C;l.stroke();D.inflate(F.linewidth*2)}}}function Ja(C,W,S,F,Q,Y){if(Q.opacity!= +0){a(Q.opacity);c(Q.blending);f=C.positionScreen.x;k=C.positionScreen.y;n=W.positionScreen.x;t=W.positionScreen.y;p=S.positionScreen.x;q=S.positionScreen.y;l.beginPath();l.moveTo(f,k);l.lineTo(n,t);l.lineTo(p,q);l.lineTo(f,k);l.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&ya(f,k,n,t,p,q,Q.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof +THREE.SphericalReflectionMapping){C=la.matrix;Z.copy(F.vertexNormalsWorld[0]);R=(Z.x*C.n11+Z.y*C.n12+Z.z*C.n13)*0.5+0.5;J=-(Z.x*C.n21+Z.y*C.n22+Z.z*C.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[1]);O=(Z.x*C.n11+Z.y*C.n12+Z.z*C.n13)*0.5+0.5;X=-(Z.x*C.n21+Z.y*C.n22+Z.z*C.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[2]);I=(Z.x*C.n11+Z.y*C.n12+Z.z*C.n13)*0.5+0.5;E=-(Z.x*C.n21+Z.y*C.n22+Z.z*C.n23)*0.5+0.5;ya(f,k,n,t,p,q,Q.env_map.image,R,J,O,X,I,E)}}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth): +Ca(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&ya(f,k,n,t,p,q,Q.map.image,F.uvs[0].u,F.uvs[0].v,F.uvs[1].u,F.uvs[1].v,F.uvs[2].u,F.uvs[2].v);c(THREE.SubtractiveBlending)}if(G)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){x.r=u.r=y.r=$.r;x.g=u.g=y.g=$.g;x.b=u.b=y.b=$.b;ja(Y,F.v1.positionWorld,F.vertexNormalsWorld[0],x);ja(Y,F.v2.positionWorld,F.vertexNormalsWorld[1],u);ja(Y, +F.v3.positionWorld,F.vertexNormalsWorld[2],y);B.r=(u.r+y.r)*0.5;B.g=(u.g+y.g)*0.5;B.b=(u.b+y.b)*0.5;T=Ka(x,u,y,B);ya(f,k,n,t,p,q,T,0,0,1,0,0,1)}else{P.r=$.r;P.g=$.g;P.b=$.b;ja(Y,F.centroidWorld,F.normalWorld,P);v.r=Q.color.r*P.r;v.g=Q.color.g*P.g;v.b=Q.color.b*P.b;v.updateStyleString();Q.wireframe?Ba(v.__styleString,Q.wireframe_linewidth):Ca(v.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){N=la.near; +K=la.far;x.r=x.g=x.b=1-Fa(C.positionScreen.z,N,K);u.r=u.g=u.b=1-Fa(W.positionScreen.z,N,K);y.r=y.g=y.b=1-Fa(S.positionScreen.z,N,K);B.r=(u.r+y.r)*0.5;B.g=(u.g+y.g)*0.5;B.b=(u.b+y.b)*0.5;T=Ka(x,u,y,B);ya(f,k,n,t,p,q,T,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){v.r=Ga(F.normalWorld.x);v.g=Ga(F.normalWorld.y);v.b=Ga(F.normalWorld.z);v.updateStyleString();Q.wireframe?Ba(v.__styleString,Q.wireframe_linewidth):Ca(v.__styleString)}}}function Ba(C,W){if(H!=C)l.strokeStyle=H=C;if(M!=W)l.lineWidth= +M=W;l.stroke();D.inflate(W*2)}function Ca(C){if(L!=C)l.fillStyle=L=C;l.fill()}function ya(C,W,S,F,Q,Y,da,ga,ia,ta,ma,ua,za){var oa,va;oa=da.width-1;va=da.height-1;ga*=oa;ia*=va;ta*=oa;ma*=va;ua*=oa;za*=va;S-=C;F-=W;Q-=C;Y-=W;ta-=ga;ma-=ia;ua-=ga;za-=ia;oa=ta*za-ua*ma;if(oa!=0){va=1/oa;oa=(za*S-ma*Q)*va;ma=(za*F-ma*Y)*va;S=(ta*Q-ua*S)*va;F=(ta*Y-ua*F)*va;C=C-oa*ga-S*ia;W=W-ma*ga-F*ia;l.save();l.transform(oa,ma,S,F,C,W);l.clip();l.drawImage(da,0,0);l.restore()}}function Ka(C,W,S,F){var Q=~~(C.r*255), +Y=~~(C.g*255);C=~~(C.b*255);var da=~~(W.r*255),ga=~~(W.g*255);W=~~(W.b*255);var ia=~~(S.r*255),ta=~~(S.g*255);S=~~(S.b*255);var ma=~~(F.r*255),ua=~~(F.g*255);F=~~(F.b*255);fa[0]=Q<0?0:Q>255?255:Q;fa[1]=Y<0?0:Y>255?255:Y;fa[2]=C<0?0:C>255?255:C;fa[4]=da<0?0:da>255?255:da;fa[5]=ga<0?0:ga>255?255:ga;fa[6]=W<0?0:W>255?255:W;fa[8]=ia<0?0:ia>255?255:ia;fa[9]=ta<0?0:ta>255?255:ta;fa[10]=S<0?0:S>255?255:S;fa[12]=ma<0?0:ma>255?255:ma;fa[13]=ua<0?0:ua>255?255:ua;fa[14]=F<0?0:F>255?255:F;ka.putImageData(wa, +0,0);ea.drawImage(qa,0,0);return ra}function Fa(C,W,S){C=(C-W)/(S-W);return C*C*(3-2*C)}function Ga(C){C=(C+1)*0.5;return C<0?0:C>1?1:C}function Ha(C,W){var S=W.x-C.x,F=W.y-C.y,Q=1/Math.sqrt(S*S+F*F);S*=Q;F*=Q;W.x+=S;W.y+=F;C.x-=S;C.y-=F}var Da,La,ba,pa,xa,Ia,Ma,Aa;this.autoClear?this.clear():l.setTransform(1,0,0,-1,s,o);e=g.projectScene(ca,la,this.sortElements);l.fillStyle="rgba( 0, 255, 255, 0.5 )";l.fillRect(V.getX(),V.getY(),V.getWidth(),V.getHeight());(G=ca.lights.length>0)&&Ea(ca);Da=0;for(La= +e.length;Da0){O.r+=E.color.r*V;O.g+=E.color.g*V;O.b+=E.color.b*V}}else if(E instanceof THREE.PointLight){q.sub(E.position,J.centroidWorld);q.normalize();V=J.normalWorld.dot(q)*E.intensity;if(V>0){O.r+=E.color.r*V;O.g+=E.color.g*V;O.b+=E.color.b*V}}}}function c(R,J,O,X,I,E){y=g(B++);y.setAttribute("d","M "+R.positionScreen.x+ +" "+R.positionScreen.y+" L "+J.positionScreen.x+" "+J.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)h.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(m){f.r=k.r;f.g=k.g;f.b=k.b;a(E,X,f);h.r=I.color.r*f.r;h.g=I.color.g*f.g;h.b=I.color.b*f.b;h.updateStyleString()}else h.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){p=1-I.__2near/(I.__farPlusNear-X.z*I.__farMinusNear); +h.setRGB(p,p,p)}else I instanceof THREE.MeshNormalMaterial&&h.setRGB(i(X.normalWorld.x),i(X.normalWorld.y),i(X.normalWorld.z));I.wireframe?y.setAttribute("style","fill: none; stroke: "+h.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):y.setAttribute("style","fill: "+h.__styleString+"; fill-opacity: "+I.opacity);s.appendChild(y)}function e(R,J,O,X,I,E,V){y=g(B++);y.setAttribute("d", +"M "+R.positionScreen.x+" "+R.positionScreen.y+" L "+J.positionScreen.x+" "+J.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)h.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(m){f.r=k.r;f.g=k.g;f.b=k.b;a(V,I,f);h.r=E.color.r*f.r;h.g=E.color.g*f.g;h.b=E.color.b*f.b;h.updateStyleString()}else h.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){p= +1-E.__2near/(E.__farPlusNear-I.z*E.__farMinusNear);h.setRGB(p,p,p)}else E instanceof THREE.MeshNormalMaterial&&h.setRGB(i(I.normalWorld.x),i(I.normalWorld.y),i(I.normalWorld.z));E.wireframe?y.setAttribute("style","fill: none; stroke: "+h.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):y.setAttribute("style","fill: "+h.__styleString+"; fill-opacity: "+E.opacity);s.appendChild(y)} +function g(R){if(v[R]==null){v[R]=document.createElementNS("http://www.w3.org/2000/svg","path");T==0&&v[R].setAttribute("shape-rendering","crispEdges");return v[R]}return v[R]}function i(R){return R<0?Math.min((1+R)*0.5,0.5):0.5+Math.min(R*0.5,0.5)}var j=null,b=new THREE.Projector,s=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,l,r,A,w,z,H,L,M=new THREE.Rectangle,d=new THREE.Rectangle,m=false,h=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),n=new THREE.Color(0), +t=new THREE.Color(0),p,q=new THREE.Vector3,v=[],x=[],u=[],y,B,N,K,T=1;this.domElement=s;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(R){switch(R){case "high":T=1;break;case "low":T=0}};this.setSize=function(R,J){o=R;l=J;r=o/2;A=l/2;s.setAttribute("viewBox",-r+" "+-A+" "+o+" "+l);s.setAttribute("width",o);s.setAttribute("height",l);M.set(-r,-A,r,A)};this.clear=function(){for(;s.childNodes.length>0;)s.removeChild(s.childNodes[0])};this.render=function(R,J){var O,X, +I,E,V,U,D,G;this.autoClear&&this.clear();j=b.projectScene(R,J,this.sortElements);K=N=B=0;if(m=R.lights.length>0){D=R.lights;k.setRGB(0,0,0);n.setRGB(0,0,0);t.setRGB(0,0,0);O=0;for(X=D.length;O0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,M,i)}if(ia&&J>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,T,i)}if($){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, -e.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,U,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Z,i)}};this.setLineBuffers=function(e,g){var i,f,k,l=e.vertices,t=e.colors,q=l.length,n=t.length,z=e.__vertexArray,s=e.__colorArray,w=e.__lineArray,E=e.__dirtyColors,v=e.__dirtyElements;if(e.__dirtyVertices){for(i=0;i0?"#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":"",l.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,h("fragment",k+n));b.attachShader(i,h("vertex",l+g));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={};e.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(f in e.uniforms)i.push(f);f=e.program;n=0;for(g=i.length;n=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.color)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.normal)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent, -4,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.tangent)}if(e.uv>=0)if(k.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(k.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(f.wireframe||f instanceof THREE.LineBasicMaterial){e= -f.wireframe_linewidth!==undefined?f.wireframe_linewidth:f.linewidth!==undefined?f.linewidth:1;f=f instanceof THREE.LineBasicMaterial&&l.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(e);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.drawElements(f,k.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(f instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLParticleBuffer);b.drawElements(b.POINTS,k.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, -k.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,k.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(e,g,i,f,k,l,t){var q,n,z,s,w;z=0;for(s=f.materials.length;z=0;i--){f=e.__webGLObjects[i].object;g==f&&e.__webGLObjects.splice(i,1)}};this.setupMatrices=function(e,g){e._modelViewMatrix.multiply(g.matrix,e.matrix);e._modelViewMatrixArray.set(e._modelViewMatrix.flatten());e._normalMatrix=THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transpose(); -e._normalMatrixArray.set(e._normalMatrix.m);e._objectMatrixArray.set(e.matrix.flatten())};this.loadMatrices=function(e,g){b.uniformMatrix4fv(e.uniforms.viewMatrix,false,A);b.uniformMatrix4fv(e.uniforms.projectionMatrix,false,B);b.uniformMatrix4fv(e.uniforms.modelViewMatrix,false,g._modelViewMatrixArray);b.uniformMatrix3fv(e.uniforms.normalMatrix,false,g._normalMatrixArray);b.uniformMatrix4fv(e.uniforms.objectMatrix,false,g._objectMatrixArray)};this.loadCamera=function(e,g){b.uniform3f(e.uniforms.cameraPosition, -g.position.x,g.position.y,g.position.z)};this.setDepthTest=function(e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setBlending=function(e){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}}; -this.setFaceCulling=function(e,g){if(e){!g||g=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", -envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", -envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", -map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", -lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +var j=document.createElement("canvas"),b,s=null,o=null,l=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],r=new THREE.Matrix4,A=new Float32Array(16),w=new Float32Array(16),z=new THREE.Vector4,H=true,L=new THREE.Color(0),M=0;if(a){if(a.antialias!==undefined)H=a.antialias;a.clearColor!==undefined&&L.setHex(a.clearColor);if(a.clearAlpha!==undefined)M=a.clearAlpha}this.domElement=j;this.autoClear=true;(function(d,m,h){try{b=j.getContext("experimental-webgl", +{antialias:d})}catch(f){console.log(f)}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(m.r,m.g,m.b,h)})(H,L,M);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(d, +m){j.width=d;j.height=m;b.viewport(0,0,j.width,j.height)};this.setClearColorHex=function(d,m){var h=new THREE.Color(d);b.clearColor(h.r,h.g,h.b,m)};this.setClearColor=function(d,m){b.clearColor(d.r,d.g,d.b,m)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(d,m){var h,f,k,n=0,t=0,p=0,q,v,x,u=this.lights,y=u.directional.colors,B=u.directional.positions,N=u.point.colors,K=u.point.positions,T=0,R=0;h=k=k=0;for(f=m.length;h0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER, +V,h)}if(ka&&T>0){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,U,h)}if(qa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,$,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,h)}};this.setLineBuffers=function(d,m){var h,f,k,n=d.vertices,t=d.colors,p=n.length,q=t.length,v=d.__vertexArray,x=d.__colorArray,u=d.__lineArray,y=d.__dirtyColors,B=d.__dirtyElements;if(d.__dirtyVertices){for(h= +0;h0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+ +n.maxPointLights,n.map?"#define USE_MAP":"",n.env_map?"#define USE_ENVMAP":"",n.light_map?"#define USE_LIGHTMAP":"",n.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(h,g("fragment",k+q));b.attachShader(h, +g("vertex",n+m));b.linkProgram(h);b.getProgramParameter(h,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(h,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");h.uniforms={};h.attributes={};d.program=h;h=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(f in d.uniforms)h.push(f);f=d.program;q=0;for(m=h.length;q=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.vertexAttribPointer(d.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.color)}if(d.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.normal)}if(d.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER, +k.__webGLTangentBuffer);b.vertexAttribPointer(d.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.tangent)}if(d.uv>=0)if(k.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv)}else b.disableVertexAttribArray(d.uv);if(d.uv2>=0)if(k.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.vertexAttribPointer(d.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv2)}else b.disableVertexAttribArray(d.uv2); +if(f.wireframe||f instanceof THREE.LineBasicMaterial){d=f.wireframe_linewidth!==undefined?f.wireframe_linewidth:f.linewidth!==undefined?f.linewidth:1;f=f instanceof THREE.LineBasicMaterial&&n.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(d);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.drawElements(f,k.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(f instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLParticleBuffer);b.drawElements(b.POINTS,k.__webGLParticleCount, +b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,k.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(d,m,h,f,k,n,t){var p,q,v,x,u;v=0;for(x=f.materials.length;v=0;h--){f=d.__webGLObjects[h].object; +m==f&&d.__webGLObjects.splice(h,1)}};this.setupMatrices=function(d,m){d._modelViewMatrix.multiply(m.matrix,d.matrix);d._modelViewMatrixArray.set(d._modelViewMatrix.flatten());d._normalMatrix=THREE.Matrix4.makeInvert3x3(d._modelViewMatrix).transpose();d._normalMatrixArray.set(d._normalMatrix.m);d._objectMatrixArray.set(d.matrix.flatten())};this.loadMatrices=function(d,m){b.uniformMatrix4fv(d.uniforms.viewMatrix,false,w);b.uniformMatrix4fv(d.uniforms.projectionMatrix,false,A);b.uniformMatrix4fv(d.uniforms.modelViewMatrix, +false,m._modelViewMatrixArray);b.uniformMatrix3fv(d.uniforms.normalMatrix,false,m._normalMatrixArray);b.uniformMatrix4fv(d.uniforms.objectMatrix,false,m._objectMatrixArray)};this.loadCamera=function(d,m){b.uniform3f(d.uniforms.cameraPosition,m.position.x,m.position.y,m.position.z)};this.setDepthTest=function(d){d?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setBlending=function(d){switch(d){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR, +b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(d,m){if(d){!m||m=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(d=="back")b.cullFace(b.BACK);else d=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> +0}}; +THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", +envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", +map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", +lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"}; diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 79aa7751..f4369766 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,h,g,b,m,k;if(d==0)e=h=g=0;else{b=Math.floor(a*6);m=a*6-b;a=d*(1-c);k=d*(1-c*m);c=d*(1-c*(1-m));switch(b){case 1:e=k;h=d;g=a;break;case 2:e=a;h=d;g=c;break;case 3:e=a;h=k;g=d;break;case 4:e=c;h=a;g=d;break;case 5:e=d;h=a;g=k;break;case 6:case 0:e=d;h=c;g=a}}this.r=e;this.g=h;this.b=g;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,j,g,b,m,k;if(d==0)e=j=g=0;else{b=Math.floor(a*6);m=a*6-b;a=d*(1-c);k=d*(1-c*m);c=d*(1-c*(1-m));switch(b){case 1:e=k;j=d;g=a;break;case 2:e=a;j=d;g=c;break;case 3:e=a;j=k;g=d;break;case 4:e=c;j=a;g=d;break;case 5:e=d;j=a;g=k;break;case 6:case 0:e=d;j=c;g=a}}this.r=e;this.g=j;this.b=g;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,50 +13,50 @@ 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,h=[];a=0;for(c=e.length;a0&&j>0&&q+j<1}var d,e,h,g,b,m,k,o,t,y, -w,u=a.geometry,z=u.vertices,A=[];d=0;for(e=u.faces.length;dk?e:k;h=h>o? -h:o}a()};this.add3Points=function(k,o,t,y,w,u){if(m){m=false;c=kt?k>w?k:w:t>w?t:w;h=o>y?o>u?o:u:y>u?y:u}else{c=kt?k>w?k>e?k:e:w>e?w:e:t>w?t>e?t:e:w>e?w:e;h=o>y?o>u?o>h?o:h:u>h?u:h:y>u?y>h?y:h:u>h?u:h}a()};this.addRectangle=function(k){if(m){m=false;c=k.getLeft();d=k.getTop();e=k.getRight();h=k.getBottom()}else{c=ck.getRight()?e:k.getRight();h=h>k.getBottom()?h:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;h+=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(h,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){m=true;h=e=d=c=0;a()};this.isEmpty=function(){return m};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+h+", width: "+g+", height: "+b+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,e,h,g,b,m,k,o,t,y,w,u,z,A){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=h||0;this.n22=g||1;this.n23=b||0;this.n24=m||0;this.n31=k||0;this.n32=o||0;this.n33=t||1;this.n34=y||0;this.n41=w||0;this.n42=u||0;this.n43=z||0;this.n44=A||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,g,b,m,k,o,t,y,w,u,z,A){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=g;this.n23=b;this.n24=m;this.n31=k;this.n32=o;this.n33=t;this.n34=y;this.n41=w;this.n42=u;this.n43=z;this.n44=A;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,g=THREE.Matrix4.__tmpVec3;g.sub(a,c).normalize();e.cross(d,g).normalize();h.cross(g,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=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.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,g=a.n14,b=a.n21,m=a.n22,k=a.n23,o=a.n24,t=a.n31, -y=a.n32,w=a.n33,u=a.n34,z=a.n41,A=a.n42,j=a.n43,l=a.n44,n=c.n11,f=c.n12,p=c.n13,q=c.n14,E=c.n21,x=c.n22,v=c.n23,F=c.n24,B=c.n31,G=c.n32,J=c.n33,C=c.n34,I=c.n41,aa=c.n42,O=c.n43,U=c.n44;this.n11=d*n+e*E+h*B+g*I;this.n12=d*f+e*x+h*G+g*aa;this.n13=d*p+e*v+h*J+g*O;this.n14=d*q+e*F+h*C+g*U;this.n21=b*n+m*E+k*B+o*I;this.n22=b*f+m*x+k*G+o*aa;this.n23=b*p+m*v+k*J+o*O;this.n24=b*q+m*F+k*C+o*U;this.n31=t*n+y*E+w*B+u*I;this.n32=t*f+y*x+w*G+u*aa;this.n33=t*p+y*v+w*J+u*O;this.n34=t*q+y*F+w*C+u*U;this.n41=z*n+ -A*E+j*B+l*I;this.n42=z*f+A*x+j*G+l*aa;this.n43=z*p+A*v+j*J+l*O;this.n44=z*q+A*F+j*C+l*U;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,h=this.n14,g=this.n21,b=this.n22,m=this.n23,k=this.n24,o=this.n31,t=this.n32,y=this.n33,w=this.n34,u=this.n41,z=this.n42,A=this.n43,j=this.n44,l=a.n11,n=a.n21,f=a.n31,p=a.n41,q=a.n12,E=a.n22,x=a.n32,v=a.n42,F=a.n13,B=a.n23,G=a.n33,J=a.n43,C=a.n14,I=a.n24,aa=a.n34;a=a.n44;this.n11=c*l+d*n+e*f+h*p;this.n12=c*q+d*E+e*x+h*v;this.n13=c*F+d*B+ -e*G+h*J;this.n14=c*C+d*I+e*aa+h*a;this.n21=g*l+b*n+m*f+k*p;this.n22=g*q+b*E+m*x+k*v;this.n23=g*F+b*B+m*G+k*J;this.n24=g*C+b*I+m*aa+k*a;this.n31=o*l+t*n+y*f+w*p;this.n32=o*q+t*E+y*x+w*v;this.n33=o*F+t*B+y*G+w*J;this.n34=o*C+t*I+y*aa+w*a;this.n41=u*l+z*n+A*f+j*p;this.n42=u*q+z*E+A*x+j*v;this.n43=u*F+z*B+A*G+j*J;this.n44=u*C+z*I+A*aa+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,h=this.n21,g=this.n22,b=this.n23,m=this.n24,k=this.n31,o=this.n32,t=this.n33,y=this.n34,w=this.n41,u=this.n42,z=this.n43,A=this.n44;return e*b*o*w-d*m*o*w-e*g*t*w+c*m*t*w+d*g*y*w-c*b*y*w-e*b*k*u+d*m*k*u+e*h*t*u-a*m*t*u-d*h*y*u+a*b*y*u+e*g*k*z-c*m*k*z-e*h*o*z+a*m*o*z+c*h*y*z-a*g*y*z-d*g*k*A+c*b*k*A+d*h*o*A-a*b*o*A-c*h*t*A+a*g*t*A},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; +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,j=[];a=0;for(c=e.length;a0&&H>0&&t+H<1}var d,e,j,g,b,m,k,n,o,y, +u,q=a.geometry,z=q.vertices,B=[];d=0;for(e=q.faces.length;dk?e:k;j=j>n? +j:n}a()};this.add3Points=function(k,n,o,y,u,q){if(m){m=false;c=ko?k>u?k:u:o>u?o:u;j=n>y?n>q?n:q:y>q?y:q}else{c=ko?k>u?k>e?k:e:u>e?u:e:o>u?o>e?o:e:u>e?u:e;j=n>y?n>q?n>j?n:j:q>j?q:j:y>q?y>j?y:j:q>j?q:j}a()};this.addRectangle=function(k){if(m){m=false;c=k.getLeft();d=k.getTop();e=k.getRight();j=k.getBottom()}else{c=ck.getRight()?e:k.getRight();j=j>k.getBottom()?j:k.getBottom()}a()};this.inflate=function(k){c-=k;d-=k;e+=k;j+=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(j,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){m=true;j=e=d=c=0;a()};this.isEmpty=function(){return m};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+j+", width: "+g+", height: "+b+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,e,j,g,b,m,k,n,o,y,u,q,z,B){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=j||0;this.n22=g||1;this.n23=b||0;this.n24=m||0;this.n31=k||0;this.n32=n||0;this.n33=o||1;this.n34=y||0;this.n41=u||0;this.n42=q||0;this.n43=z||0;this.n44=B||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,j,g,b,m,k,n,o,y,u,q,z,B){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=g;this.n23=b;this.n24=m;this.n31=k;this.n32=n;this.n33=o;this.n34=y;this.n41=u;this.n42=q;this.n43=z;this.n44=B;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,j=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,c).normalize();e.cross(d,g).normalize();j.cross(g,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=j.x;this.n22=j.y;this.n23=j.z;this.n24=-j.dot(a); +this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.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,j=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)*j;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*j;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*j;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,j=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*j;a.y=this.n21*c+this.n22*d+this.n23* +e+this.n24*j;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*j;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*j;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,j=a.n13,g=a.n14,b=a.n21,m=a.n22,k=a.n23,n=a.n24,o=a.n31, +y=a.n32,u=a.n33,q=a.n34,z=a.n41,B=a.n42,H=a.n43,f=a.n44,p=c.n11,h=c.n12,l=c.n13,t=c.n14,w=c.n21,x=c.n22,v=c.n23,A=c.n24,C=c.n31,E=c.n32,F=c.n33,D=c.n34,I=c.n41,T=c.n42,P=c.n43,X=c.n44;this.n11=d*p+e*w+j*C+g*I;this.n12=d*h+e*x+j*E+g*T;this.n13=d*l+e*v+j*F+g*P;this.n14=d*t+e*A+j*D+g*X;this.n21=b*p+m*w+k*C+n*I;this.n22=b*h+m*x+k*E+n*T;this.n23=b*l+m*v+k*F+n*P;this.n24=b*t+m*A+k*D+n*X;this.n31=o*p+y*w+u*C+q*I;this.n32=o*h+y*x+u*E+q*T;this.n33=o*l+y*v+u*F+q*P;this.n34=o*t+y*A+u*D+q*X;this.n41=z*p+B*w+ +H*C+f*I;this.n42=z*h+B*x+H*E+f*T;this.n43=z*l+B*v+H*F+f*P;this.n44=z*t+B*A+H*D+f*X;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,j=this.n14,g=this.n21,b=this.n22,m=this.n23,k=this.n24,n=this.n31,o=this.n32,y=this.n33,u=this.n34,q=this.n41,z=this.n42,B=this.n43,H=this.n44,f=a.n11,p=a.n21,h=a.n31,l=a.n41,t=a.n12,w=a.n22,x=a.n32,v=a.n42,A=a.n13,C=a.n23,E=a.n33,F=a.n43,D=a.n14,I=a.n24,T=a.n34;a=a.n44;this.n11=c*f+d*p+e*h+j*l;this.n12=c*t+d*w+e*x+j*v;this.n13=c*A+d*C+e*E+j* +F;this.n14=c*D+d*I+e*T+j*a;this.n21=g*f+b*p+m*h+k*l;this.n22=g*t+b*w+m*x+k*v;this.n23=g*A+b*C+m*E+k*F;this.n24=g*D+b*I+m*T+k*a;this.n31=n*f+o*p+y*h+u*l;this.n32=n*t+o*w+y*x+u*v;this.n33=n*A+o*C+y*E+u*F;this.n34=n*D+o*I+y*T+u*a;this.n41=q*f+z*p+B*h+H*l;this.n42=q*t+z*w+B*x+H*v;this.n43=q*A+z*C+B*E+H*F;this.n44=q*D+z*I+B*T+H*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,j=this.n21,g=this.n22,b=this.n23,m=this.n24,k=this.n31,n=this.n32,o=this.n33,y=this.n34,u=this.n41,q=this.n42,z=this.n43,B=this.n44;return e*b*n*u-d*m*n*u-e*g*o*u+c*m*o*u+d*g*y*u-c*b*y*u-e*b*k*q+d*m*k*q+e*j*o*q-a*m*o*q-d*j*y*q+a*b*y*q+e*g*k*z-c*m*k*z-e*j*n*z+a*m*n*z+c*j*y*z-a*g*y*z-d*g*k*B+c*b*k*B+d*j*n*B-a*b*n*B-c*j*o*B+a*g*o*B},transpose:function(){function a(c,d, +e){var j=c[d];c[d]=c[e];c[e]=j}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),h=1-d,g=a.x,b=a.y,m=a.z,k=h*g,o=h*b;this.set(k*g+d,k*b-e*m,k*m+e*b,0,k*b+e*m,o*b+d,o*m-e*g,0,k*m-e*b,o*m+e*g,h*m*m+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),j=1-d,g=a.x,b=a.y,m=a.z,k=j*g,n=j*b;this.set(k*g+d,k*b-e*m,k*m+e*b,0,k*b+e*m,n*b+d,n*m-e*g,0,k*m-e*b,n*m+e*g,j*m*m+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,h=a.n14,g=a.n21,b=a.n22,m=a.n23,k=a.n24,o=a.n31,t=a.n32,y=a.n33,w=a.n34,u=a.n41,z=a.n42,A=a.n43,j=a.n44,l=new THREE.Matrix4;l.n11=m*w*z-k*y*z+k*t*A-b*w*A-m*t*j+b*y*j;l.n12=h*y*z-e*w*z-h*t*A+d*w*A+e*t*j-d*y*j;l.n13=e*k*z-h*m*z+h*b*A-d*k*A-e*b*j+d*m*j;l.n14=h*m*t-e*k*t-h*b*y+d*k*y+e*b*w-d*m*w;l.n21=k*y*u-m*w*u-k*o*A+g*w*A+m*o*j-g*y*j;l.n22=e*w*u-h*y*u+h*o*A-c*w*A-e*o*j+c*y*j;l.n23=h*m*u-e*k*u-h*g*A+c*k*A+e*g*j-c*m*j;l.n24=e*k*o-h*m*o+ -h*g*y-c*k*y-e*g*w+c*m*w;l.n31=b*w*u-k*t*u+k*o*z-g*w*z-b*o*j+g*t*j;l.n32=h*t*u-d*w*u-h*o*z+c*w*z+d*o*j-c*t*j;l.n33=e*k*u-h*b*u+h*g*z-c*k*z-d*g*j+c*b*j;l.n34=h*b*o-d*k*o-h*g*t+c*k*t+d*g*w-c*b*w;l.n41=m*t*u-b*y*u-m*o*z+g*y*z+b*o*A-g*t*A;l.n42=d*y*u-e*t*u+e*o*z-c*y*z-d*o*A+c*t*A;l.n43=e*b*u-d*m*u-e*g*z+c*m*z+d*g*A-c*b*A;l.n44=d*m*o-e*b*o+e*g*t-c*m*t-d*g*y+c*b*y;l.multiplyScalar(1/a.determinant());return l}; -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],g=c[6]*c[1]-c[2]*c[5],b=-c[10]*c[4]+c[6]*c[8],m=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],o=c[9]*c[4]-c[5]*c[8],t=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*b+c[2]*o;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*h;d[2]=c*g;d[3]=c*b;d[4]=c*m;d[5]=c*k;d[6]=c*o;d[7]=c*t;d[8]=c*y;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,h,g){var b,m,k;b=new THREE.Matrix4;m=2*h/(c-a);k=2*h/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(g+h)/(g-h);h=-2*g*h/(g-h);b.n11=m;b.n12=0;b.n13=a;b.n14=0;b.n21=0;b.n22=k;b.n23=d;b.n24=0;b.n31=0;b.n32=0;b.n33=e;b.n34=h;b.n41=0;b.n42=0;b.n43=-1;b.n44=0;return b};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,g){var b,m,k,o;b=new THREE.Matrix4;m=c-a;k=d-e;o=g-h;a=(c+a)/m;d=(d+e)/k;h=(g+h)/o;b.n11=2/m;b.n12=0;b.n13=0;b.n14=-a;b.n21=0;b.n22=2/k;b.n23=0;b.n24=-d;b.n31=0;b.n32=0;b.n33=-2/o;b.n34=-h;b.n41=0;b.n42=0;b.n43=0;b.n44=1;return b};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,j=a.n14,g=a.n21,b=a.n22,m=a.n23,k=a.n24,n=a.n31,o=a.n32,y=a.n33,u=a.n34,q=a.n41,z=a.n42,B=a.n43,H=a.n44,f=new THREE.Matrix4;f.n11=m*u*z-k*y*z+k*o*B-b*u*B-m*o*H+b*y*H;f.n12=j*y*z-e*u*z-j*o*B+d*u*B+e*o*H-d*y*H;f.n13=e*k*z-j*m*z+j*b*B-d*k*B-e*b*H+d*m*H;f.n14=j*m*o-e*k*o-j*b*y+d*k*y+e*b*u-d*m*u;f.n21=k*y*q-m*u*q-k*n*B+g*u*B+m*n*H-g*y*H;f.n22=e*u*q-j*y*q+j*n*B-c*u*B-e*n*H+c*y*H;f.n23=j*m*q-e*k*q-j*g*B+c*k*B+e*g*H-c*m*H;f.n24=e*k*n-j*m*n+ +j*g*y-c*k*y-e*g*u+c*m*u;f.n31=b*u*q-k*o*q+k*n*z-g*u*z-b*n*H+g*o*H;f.n32=j*o*q-d*u*q-j*n*z+c*u*z+d*n*H-c*o*H;f.n33=e*k*q-j*b*q+j*g*z-c*k*z-d*g*H+c*b*H;f.n34=j*b*n-d*k*n-j*g*o+c*k*o+d*g*u-c*b*u;f.n41=m*o*q-b*y*q-m*n*z+g*y*z+b*n*B-g*o*B;f.n42=d*y*q-e*o*q+e*n*z-c*y*z-d*n*B+c*o*B;f.n43=e*b*q-d*m*q-e*g*z+c*m*z+d*g*B-c*b*B;f.n44=d*m*n-e*b*n+e*g*o-c*m*o-d*g*y+c*b*y;f.multiplyScalar(1/a.determinant());return f}; +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],j=-c[10]*c[1]+c[2]*c[9],g=c[6]*c[1]-c[2]*c[5],b=-c[10]*c[4]+c[6]*c[8],m=c[10]*c[0]-c[2]*c[8],k=-c[6]*c[0]+c[2]*c[4],n=c[9]*c[4]-c[5]*c[8],o=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*b+c[2]*n;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*j;d[2]=c*g;d[3]=c*b;d[4]=c*m;d[5]=c*k;d[6]=c*n;d[7]=c*o;d[8]=c*y;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,j,g){var b,m,k;b=new THREE.Matrix4;m=2*j/(c-a);k=2*j/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(g+j)/(g-j);j=-2*g*j/(g-j);b.n11=m;b.n12=0;b.n13=a;b.n14=0;b.n21=0;b.n22=k;b.n23=d;b.n24=0;b.n31=0;b.n32=0;b.n33=e;b.n34=j;b.n41=0;b.n42=0;b.n43=-1;b.n44=0;return b};THREE.Matrix4.makePerspective=function(a,c,d,e){var j;a=d*Math.tan(a*Math.PI/360);j=-a;return THREE.Matrix4.makeFrustum(j*c,a*c,j,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,j,g){var b,m,k,n;b=new THREE.Matrix4;m=c-a;k=d-e;n=g-j;a=(c+a)/m;d=(d+e)/k;j=(g+j)/n;b.n11=2/m;b.n12=0;b.n13=0;b.n14=-a;b.n21=0;b.n22=2/k;b.n23=0;b.n24=-d;b.n31=0;b.n32=0;b.n33=-2/n;b.n34=-j;b.n41=0;b.n42=0;b.n43=0;b.n44=1;return b};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,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,g){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=g instanceof Array?g:[g]};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.Face3=function(a,c,d,e,j){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=j instanceof Array?j:[j]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; +THREE.Face4=function(a,c,d,e,j,g){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.materials=g instanceof Array?g:[g]};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(D,I,T,P,X,Y,S){g=D.vertices[I].position;b=D.vertices[T].position;m=D.vertices[P].position;k=j[X];n=j[Y];o=j[S];y=b.x-g.x;u=m.x-g.x;q=b.y-g.y;z=m.y-g.y; +B=b.z-g.z;H=m.z-g.z;f=n.u-k.u;p=o.u-k.u;h=n.v-k.v;l=o.v-k.v;t=1/(f*l-p*h);v.set((l*y-h*u)*t,(l*q-h*z)*t,(l*B-h*H)*t);A.set((f*u-p*y)*t,(f*z-p*q)*t,(f*H-p*B)*t);w[I].addSelf(v);w[T].addSelf(v);w[P].addSelf(v);x[I].addSelf(A);x[T].addSelf(A);x[P].addSelf(A)}var c,d,e,j,g,b,m,k,n,o,y,u,q,z,B,H,f,p,h,l,t,w=[],x=[],v=new THREE.Vector3,A=new THREE.Vector3,C=new THREE.Vector3,E=new THREE.Vector3,F=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){o[m].counter+=1;k=o[m].hash+"_"+o[m].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:b,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=g}},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[m].counter+=1;k=n[m].hash+"_"+n[m].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:b,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=g}},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(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=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(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; +this.translateZ=function(j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(j);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}; @@ -94,120 +94,121 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
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,h,g){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=g!==undefined?g: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,j,g){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=j!==undefined?j:THREE.LinearFilter;this.min_filter=g!==undefined?g: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,h={};for(c in a){h[c]={};for(d in a[c]){e=a[c][d];h[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return h},merge:function(a){var c,d,e,h={};for(c=0;c=0&&J>=0&&C>=0&&I>=0)return true;else if(G<0&&J<0||C<0&&I<0)return false;else{if(G<0)F=Math.max(F,G/(G-J));else if(J<0)B=Math.min(B,G/(G-J));if(C<0)F=Math.max(F,C/(C-I));else if(I<0)B=Math.min(B,C/(C-I));if(BG&&O.z0&&j.z<1){w=z[u]=z[u]||new THREE.RenderableParticle;w.x=j.x/j.w;w.y=j.y/j.w;w.z=j.z;w.rotation=N.rotation.z;w.scale.x=N.scale.x*Math.abs(w.x-(j.x+v.projectionMatrix.n11)/(j.w+v.projectionMatrix.n14)); -w.scale.y=N.scale.y*Math.abs(w.y-(j.y+v.projectionMatrix.n22)/(j.w+v.projectionMatrix.n24));w.materials=N.materials;B.push(w);u++}}}}F&&B.sort(a);return B};this.unprojectVector=function(x,v){var F=THREE.Matrix4.makeInvert(v.matrix);F.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));F.multiplyVector3(x);return x}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,h,g;this.domElement=document.createElement("div");this.setSize=function(b,m){d=b;e=m;h=d/2;g=e/2};this.render=function(b,m){var k,o,t,y,w,u,z,A;a=c.projectScene(b,m);k=0;for(o=a.length;k0){P.r+=ma.r*ga;P.g+=ma.g*ga;P.b+=ma.b*ga}}else if(ga instanceof THREE.PointLight){L.sub(ga.position,ea);L.normalize();ga= -Y.dot(L)*oa;if(ga>0){P.r+=ma.r*ga;P.g+=ma.g*ga;P.b+=ma.b*ga}}}}function Qa(M,ea,Y){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);var P,X,ga,ma,oa,pa;if(Y instanceof THREE.ParticleBasicMaterial){if(Y.map&&Y.map.image.loaded){ma=Y.map.image;oa=ma.width>>1;pa=ma.height>>1;X=ea.scale.x*m;ga=ea.scale.y*k;Y=X*oa;P=ga*pa;H.set(M.x-Y,M.y-P,M.x+Y,M.y+P);if(ca.instersects(H)){o.save();o.translate(M.x,M.y);o.rotate(-ea.rotation);o.scale(X,-ga);o.translate(-oa,-pa);o.drawImage(ma,0,0);o.restore()}}}else if(Y instanceof -THREE.ParticleCircleMaterial){if(R){Z.r=fa.r+na.r+D.r;Z.g=fa.g+na.g+D.g;Z.b=fa.b+na.b+D.b;B.r=Y.color.r*Z.r;B.g=Y.color.g*Z.g;B.b=Y.color.b*Z.b;B.updateStyleString()}else B.__styleString=Y.color.__styleString;Y=ea.scale.x*m;P=ea.scale.y*k;H.set(M.x-Y,M.y-P,M.x+Y,M.y+P);if(ca.instersects(H)){X=B.__styleString;if(A!=X)o.fillStyle=A=X;o.save();o.translate(M.x,M.y);o.rotate(-ea.rotation);o.scale(Y,P);o.beginPath();o.arc(0,0,1,0,K,true);o.closePath();o.fill();o.restore()}}}}function Ra(M,ea,Y,P){if(P.opacity!= -0){a(P.opacity);c(P.blending);o.beginPath();o.moveTo(M.positionScreen.x,M.positionScreen.y);o.lineTo(ea.positionScreen.x,ea.positionScreen.y);o.closePath();if(P instanceof THREE.LineBasicMaterial){B.__styleString=P.color.__styleString;M=P.linewidth;if(j!=M)o.lineWidth=j=M;M=B.__styleString;if(z!=M)o.strokeStyle=z=M;o.stroke();H.inflate(P.linewidth*2)}}}function Ma(M,ea,Y,P,X,ga){if(X.opacity!=0){a(X.opacity);c(X.blending);p=M.positionScreen.x;q=M.positionScreen.y;E=ea.positionScreen.x;x=ea.positionScreen.y; -v=Y.positionScreen.x;F=Y.positionScreen.y;o.beginPath();o.moveTo(p,q);o.lineTo(E,x);o.lineTo(v,F);o.lineTo(p,q);o.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.image.loaded&&X.map.mapping instanceof THREE.UVMapping&&Ba(p,q,E,x,v,F,X.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(X.env_map){if(X.env_map.image.loaded)if(X.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=qa.matrix;L.copy(P.vertexNormalsWorld[0]);V=(L.x*M.n11+L.y* -M.n12+L.z*M.n13)*0.5+0.5;N=-(L.x*M.n21+L.y*M.n22+L.z*M.n23)*0.5+0.5;L.copy(P.vertexNormalsWorld[1]);ba=(L.x*M.n11+L.y*M.n12+L.z*M.n13)*0.5+0.5;$=-(L.x*M.n21+L.y*M.n22+L.z*M.n23)*0.5+0.5;L.copy(P.vertexNormalsWorld[2]);Q=(L.x*M.n11+L.y*M.n12+L.z*M.n13)*0.5+0.5;S=-(L.x*M.n21+L.y*M.n22+L.z*M.n23)*0.5+0.5;Ba(p,q,E,x,v,F,X.env_map.image,V,N,ba,$,Q,S)}}else X.wireframe?Fa(X.color.__styleString,X.wireframe_linewidth):Ga(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof -THREE.UVMapping&&Ba(p,q,E,x,v,F,X.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(R)if(!X.wireframe&&X.shading==THREE.SmoothShading&&P.vertexNormalsWorld.length==3){G.r=J.r=C.r=fa.r;G.g=J.g=C.g=fa.g;G.b=J.b=C.b=fa.b;Ea(ga,P.v1.positionWorld,P.vertexNormalsWorld[0],G);Ea(ga,P.v2.positionWorld,P.vertexNormalsWorld[1],J);Ea(ga,P.v3.positionWorld,P.vertexNormalsWorld[2],C);I.r=(J.r+C.r)*0.5;I.g=(J.g+C.g)*0.5;I.b=(J.b+C.b)*0.5;U=Na(G,J,C,I); -Ba(p,q,E,x,v,F,U,0,0,1,0,0,1)}else{Z.r=fa.r;Z.g=fa.g;Z.b=fa.b;Ea(ga,P.centroidWorld,P.normalWorld,Z);B.r=X.color.r*Z.r;B.g=X.color.g*Z.g;B.b=X.color.b*Z.b;B.updateStyleString();X.wireframe?Fa(B.__styleString,X.wireframe_linewidth):Ga(B.__styleString)}else X.wireframe?Fa(X.color.__styleString,X.wireframe_linewidth):Ga(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){aa=qa.near;O=qa.far;G.r=G.g=G.b=1-Ia(M.positionScreen.z,aa,O);J.r=J.g=J.b=1-Ia(ea.positionScreen.z,aa,O);C.r=C.g= -C.b=1-Ia(Y.positionScreen.z,aa,O);I.r=(J.r+C.r)*0.5;I.g=(J.g+C.g)*0.5;I.b=(J.b+C.b)*0.5;U=Na(G,J,C,I);Ba(p,q,E,x,v,F,U,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){B.r=Ja(P.normalWorld.x);B.g=Ja(P.normalWorld.y);B.b=Ja(P.normalWorld.z);B.updateStyleString();X.wireframe?Fa(B.__styleString,X.wireframe_linewidth):Ga(B.__styleString)}}}function Fa(M,ea){if(z!=M)o.strokeStyle=z=M;if(j!=ea)o.lineWidth=j=ea;o.stroke();H.inflate(ea*2)}function Ga(M){if(A!=M)o.fillStyle=A=M;o.fill()}function Ba(M, -ea,Y,P,X,ga,ma,oa,pa,wa,ra,xa,Ca){var ua,ya;ua=ma.width-1;ya=ma.height-1;oa*=ua;pa*=ya;wa*=ua;ra*=ya;xa*=ua;Ca*=ya;Y-=M;P-=ea;X-=M;ga-=ea;wa-=oa;ra-=pa;xa-=oa;Ca-=pa;ua=wa*Ca-xa*ra;if(ua!=0){ya=1/ua;ua=(Ca*Y-ra*X)*ya;ra=(Ca*P-ra*ga)*ya;Y=(wa*X-xa*Y)*ya;P=(wa*ga-xa*P)*ya;M=M-ua*oa-Y*pa;ea=ea-ra*oa-P*pa;o.save();o.transform(ua,ra,Y,P,M,ea);o.clip();o.drawImage(ma,0,0);o.restore()}}function Na(M,ea,Y,P){var X=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var ma=~~(ea.r*255),oa=~~(ea.g*255);ea=~~(ea.b*255); -var pa=~~(Y.r*255),wa=~~(Y.g*255);Y=~~(Y.b*255);var ra=~~(P.r*255),xa=~~(P.g*255);P=~~(P.b*255);ha[0]=X<0?0:X>255?255:X;ha[1]=ga<0?0:ga>255?255:ga;ha[2]=M<0?0:M>255?255:M;ha[4]=ma<0?0:ma>255?255:ma;ha[5]=oa<0?0:oa>255?255:oa;ha[6]=ea<0?0:ea>255?255:ea;ha[8]=pa<0?0:pa>255?255:pa;ha[9]=wa<0?0:wa>255?255:wa;ha[10]=Y<0?0:Y>255?255:Y;ha[12]=ra<0?0:ra>255?255:ra;ha[13]=xa<0?0:xa>255?255:xa;ha[14]=P<0?0:P>255?255:P;da.putImageData(la,0,0);ta.drawImage(T,0,0);return ia}function Ia(M,ea,Y){M=(M-ea)/(Y-ea); -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,ea){var Y=ea.x-M.x,P=ea.y-M.y,X=1/Math.sqrt(Y*Y+P*P);Y*=X;P*=X;ea.x+=Y;ea.y+=P;M.x-=Y;M.y-=P}var Ha,Oa,ja,va,Aa,La,Pa,Da;this.autoClear?this.clear():o.setTransform(1,0,0,-1,m,k);d=e.projectScene(ka,qa,this.sortElements);(R=ka.lights.length>0)&&sa(ka);Ha=0;for(Oa=d.length;Ha0){ba.r+=S.color.r*ca;ba.g+=S.color.g*ca;ba.b+=S.color.b*ca}}else if(S instanceof THREE.PointLight){F.sub(S.position,N.centroidWorld);F.normalize();ca=N.normalWorld.dot(F)*S.intensity;if(ca>0){ba.r+=S.color.r*ca;ba.g+=S.color.g*ca;ba.b+=S.color.b*ca}}}}function c(V,N,ba,$,Q,S){C=e(I++);C.setAttribute("d", -"M "+V.positionScreen.x+" "+V.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(Q instanceof THREE.MeshBasicMaterial)f.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshLambertMaterial)if(n){p.r=q.r;p.g=q.g;p.b=q.b;a(S,$,p);f.r=Q.color.r*p.r;f.g=Q.color.g*p.g;f.b=Q.color.b*p.b;f.updateStyleString()}else f.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshDepthMaterial){v=1-Q.__2near/(Q.__farPlusNear- -$.z*Q.__farMinusNear);f.setRGB(v,v,v)}else Q instanceof THREE.MeshNormalMaterial&&f.setRGB(h($.normalWorld.x),h($.normalWorld.y),h($.normalWorld.z));Q.wireframe?C.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+Q.wireframe_linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframe_linecap+"; stroke-linejoin: "+Q.wireframe_linejoin):C.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+Q.opacity);m.appendChild(C)}function d(V,N,ba,$,Q,S,ca){C= -e(I++);C.setAttribute("d","M "+V.positionScreen.x+" "+V.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)f.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(n){p.r=q.r;p.g=q.g;p.b=q.b;a(ca,Q,p);f.r=S.color.r*p.r;f.g=S.color.g*p.g;f.b=S.color.b*p.b;f.updateStyleString()}else f.__styleString=S.color.__styleString; -else if(S instanceof THREE.MeshDepthMaterial){v=1-S.__2near/(S.__farPlusNear-Q.z*S.__farMinusNear);f.setRGB(v,v,v)}else S instanceof THREE.MeshNormalMaterial&&f.setRGB(h(Q.normalWorld.x),h(Q.normalWorld.y),h(Q.normalWorld.z));S.wireframe?C.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):C.setAttribute("style","fill: "+f.__styleString+ -"; fill-opacity: "+S.opacity);m.appendChild(C)}function e(V){if(B[V]==null){B[V]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&B[V].setAttribute("shape-rendering","crispEdges");return B[V]}return B[V]}function h(V){return V<0?Math.min((1+V)*0.5,0.5):0.5+Math.min(V*0.5,0.5)}var g=null,b=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,t,y,w,u,z,A,j=new THREE.Rectangle,l=new THREE.Rectangle,n=false,f=new THREE.Color(16777215),p=new THREE.Color(16777215), -q=new THREE.Color(0),E=new THREE.Color(0),x=new THREE.Color(0),v,F=new THREE.Vector3,B=[],G=[],J=[],C,I,aa,O,U=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(V){switch(V){case "high":U=1;break;case "low":U=0}};this.setSize=function(V,N){k=V;o=N;t=k/2;y=o/2;m.setAttribute("viewBox",-t+" "+-y+" "+k+" "+o);m.setAttribute("width",k);m.setAttribute("height",o);j.set(-t,-y,t,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])}; -this.render=function(V,N){var ba,$,Q,S,ca,W,H,R;this.autoClear&&this.clear();g=b.projectScene(V,N,this.sortElements);O=aa=I=0;if(n=V.lights.length>0){H=V.lights;q.setRGB(0,0,0);E.setRGB(0,0,0);x.setRGB(0,0,0);ba=0;for($=H.length;ba<$;ba++){Q=H[ba];S=Q.color;if(Q instanceof THREE.AmbientLight){q.r+=S.r;q.g+=S.g;q.b+=S.b}else if(Q instanceof THREE.DirectionalLight){E.r+=S.r;E.g+=S.g;E.b+=S.b}else if(Q instanceof THREE.PointLight){x.r+=S.r;x.g+=S.g;x.b+=S.b}}}ba=0;for($=g.length;ba<$;ba++){H=g[ba];l.empty(); -if(H instanceof THREE.RenderableParticle){w=H;w.x*=t;w.y*=-y;Q=0;for(S=H.materials.length;Q=0&&F>=0&&D>=0&&I>=0)return true;else if(E<0&&F<0||D<0&&I<0)return false;else{if(E<0)A=Math.max(A,E/(E-F));else if(F<0)C=Math.min(C,E/(E-F));if(D<0)A=Math.max(A,D/(D-I));else if(I<0)C=Math.min(C,D/(D-I));if(CE&&P.z0&&H.z<1){u=z[q]=z[q]||new THREE.RenderableParticle;u.x=H.x/H.w;u.y=H.y/H.w;u.z=H.z;u.rotation=S.rotation.z;u.scale.x=S.scale.x*Math.abs(u.x-(H.x+v.projectionMatrix.n11)/(H.w+v.projectionMatrix.n14)); +u.scale.y=S.scale.y*Math.abs(u.y-(H.y+v.projectionMatrix.n22)/(H.w+v.projectionMatrix.n24));u.materials=S.materials;C.push(u);q++}}}}A&&C.sort(a);return C};this.unprojectVector=function(x,v){var A=THREE.Matrix4.makeInvert(v.matrix);A.multiplySelf(THREE.Matrix4.makeInvert(v.projectionMatrix));A.multiplyVector3(x);return x}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,j,g;this.domElement=document.createElement("div");this.setSize=function(b,m){d=b;e=m;j=d/2;g=e/2};this.render=function(b,m){var k,n,o,y,u,q,z,B;a=c.projectScene(b,m);k=0;for(n=a.length;k0){Q.r+=na.r*fa;Q.g+=na.g*fa;Q.b+=na.b*fa}}else if(fa instanceof THREE.PointLight){L.sub(fa.position, +ea);L.normalize();fa=$.dot(L)*oa;if(fa>0){Q.r+=na.r*fa;Q.g+=na.g*fa;Q.b+=na.b*fa}}}}function Qa(M,ea,$){if($.opacity!=0){a($.opacity);c($.blending);var Q,Z,fa,na,oa,pa;if($ instanceof THREE.ParticleBasicMaterial){if($.map&&$.map.image.loaded){na=$.map.image;oa=na.width>>1;pa=na.height>>1;Z=ea.scale.x*m;fa=ea.scale.y*k;$=Z*oa;Q=fa*pa;K.set(M.x-$,M.y-Q,M.x+$,M.y+Q);if(ba.instersects(K)){n.save();n.translate(M.x,M.y);n.rotate(-ea.rotation);n.scale(Z,-fa);n.translate(-oa,-pa);n.drawImage(na,0,0);n.restore()}}}else if($ instanceof +THREE.ParticleCircleMaterial){if(O){U.r=ha.r+ga.r+G.r;U.g=ha.g+ga.g+G.g;U.b=ha.b+ga.b+G.b;C.r=$.color.r*U.r;C.g=$.color.g*U.g;C.b=$.color.b*U.b;C.updateStyleString()}else C.__styleString=$.color.__styleString;$=ea.scale.x*m;Q=ea.scale.y*k;K.set(M.x-$,M.y-Q,M.x+$,M.y+Q);if(ba.instersects(K)){Z=C.__styleString;if(B!=Z)n.fillStyle=B=Z;n.save();n.translate(M.x,M.y);n.rotate(-ea.rotation);n.scale($,Q);n.beginPath();n.arc(0,0,1,0,J,true);n.closePath();n.fill();n.restore()}}}}function Ra(M,ea,$,Q){if(Q.opacity!= +0){a(Q.opacity);c(Q.blending);n.beginPath();n.moveTo(M.positionScreen.x,M.positionScreen.y);n.lineTo(ea.positionScreen.x,ea.positionScreen.y);n.closePath();if(Q instanceof THREE.LineBasicMaterial){C.__styleString=Q.color.__styleString;M=Q.linewidth;if(H!=M)n.lineWidth=H=M;M=C.__styleString;if(z!=M)n.strokeStyle=z=M;n.stroke();K.inflate(Q.linewidth*2)}}}function Ma(M,ea,$,Q,Z,fa){if(Z.opacity!=0){a(Z.opacity);c(Z.blending);l=M.positionScreen.x;t=M.positionScreen.y;w=ea.positionScreen.x;x=ea.positionScreen.y; +v=$.positionScreen.x;A=$.positionScreen.y;n.beginPath();n.moveTo(l,t);n.lineTo(w,x);n.lineTo(v,A);n.lineTo(l,t);n.closePath();if(Z instanceof THREE.MeshBasicMaterial)if(Z.map)Z.map.image.loaded&&Z.map.mapping instanceof THREE.UVMapping&&Ba(l,t,w,x,v,A,Z.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if(Z.env_map){if(Z.env_map.image.loaded)if(Z.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=sa.matrix;L.copy(Q.vertexNormalsWorld[0]);Y=(L.x*M.n11+L.y* +M.n12+L.z*M.n13)*0.5+0.5;S=-(L.x*M.n21+L.y*M.n22+L.z*M.n23)*0.5+0.5;L.copy(Q.vertexNormalsWorld[1]);V=(L.x*M.n11+L.y*M.n12+L.z*M.n13)*0.5+0.5;da=-(L.x*M.n21+L.y*M.n22+L.z*M.n23)*0.5+0.5;L.copy(Q.vertexNormalsWorld[2]);R=(L.x*M.n11+L.y*M.n12+L.z*M.n13)*0.5+0.5;N=-(L.x*M.n21+L.y*M.n22+L.z*M.n23)*0.5+0.5;Ba(l,t,w,x,v,A,Z.env_map.image,Y,S,V,da,R,N)}}else Z.wireframe?Ea(Z.color.__styleString,Z.wireframe_linewidth):Fa(Z.color.__styleString);else if(Z instanceof THREE.MeshLambertMaterial){if(Z.map&&!Z.wireframe){Z.map.mapping instanceof +THREE.UVMapping&&Ba(l,t,w,x,v,A,Z.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);c(THREE.SubtractiveBlending)}if(O)if(!Z.wireframe&&Z.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){E.r=F.r=D.r=ha.r;E.g=F.g=D.g=ha.g;E.b=F.b=D.b=ha.b;qa(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],E);qa(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],F);qa(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],D);I.r=(F.r+D.r)*0.5;I.g=(F.g+D.g)*0.5;I.b=(F.b+D.b)*0.5;X=Na(E,F,D,I); +Ba(l,t,w,x,v,A,X,0,0,1,0,0,1)}else{U.r=ha.r;U.g=ha.g;U.b=ha.b;qa(fa,Q.centroidWorld,Q.normalWorld,U);C.r=Z.color.r*U.r;C.g=Z.color.g*U.g;C.b=Z.color.b*U.b;C.updateStyleString();Z.wireframe?Ea(C.__styleString,Z.wireframe_linewidth):Fa(C.__styleString)}else Z.wireframe?Ea(Z.color.__styleString,Z.wireframe_linewidth):Fa(Z.color.__styleString)}else if(Z instanceof THREE.MeshDepthMaterial){T=sa.near;P=sa.far;E.r=E.g=E.b=1-Ia(M.positionScreen.z,T,P);F.r=F.g=F.b=1-Ia(ea.positionScreen.z,T,P);D.r=D.g=D.b= +1-Ia($.positionScreen.z,T,P);I.r=(F.r+D.r)*0.5;I.g=(F.g+D.g)*0.5;I.b=(F.b+D.b)*0.5;X=Na(E,F,D,I);Ba(l,t,w,x,v,A,X,0,0,1,0,0,1)}else if(Z instanceof THREE.MeshNormalMaterial){C.r=Ja(Q.normalWorld.x);C.g=Ja(Q.normalWorld.y);C.b=Ja(Q.normalWorld.z);C.updateStyleString();Z.wireframe?Ea(C.__styleString,Z.wireframe_linewidth):Fa(C.__styleString)}}}function Ea(M,ea){if(z!=M)n.strokeStyle=z=M;if(H!=ea)n.lineWidth=H=ea;n.stroke();K.inflate(ea*2)}function Fa(M){if(B!=M)n.fillStyle=B=M;n.fill()}function Ba(M, +ea,$,Q,Z,fa,na,oa,pa,xa,ta,ya,Ca){var ua,za;ua=na.width-1;za=na.height-1;oa*=ua;pa*=za;xa*=ua;ta*=za;ya*=ua;Ca*=za;$-=M;Q-=ea;Z-=M;fa-=ea;xa-=oa;ta-=pa;ya-=oa;Ca-=pa;ua=xa*Ca-ya*ta;if(ua!=0){za=1/ua;ua=(Ca*$-ta*Z)*za;ta=(Ca*Q-ta*fa)*za;$=(xa*Z-ya*$)*za;Q=(xa*fa-ya*Q)*za;M=M-ua*oa-$*pa;ea=ea-ta*oa-Q*pa;n.save();n.transform(ua,ta,$,Q,M,ea);n.clip();n.drawImage(na,0,0);n.restore()}}function Na(M,ea,$,Q){var Z=~~(M.r*255),fa=~~(M.g*255);M=~~(M.b*255);var na=~~(ea.r*255),oa=~~(ea.g*255);ea=~~(ea.b*255); +var pa=~~($.r*255),xa=~~($.g*255);$=~~($.b*255);var ta=~~(Q.r*255),ya=~~(Q.g*255);Q=~~(Q.b*255);ia[0]=Z<0?0:Z>255?255:Z;ia[1]=fa<0?0:fa>255?255:fa;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]=ea<0?0:ea>255?255:ea;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=xa<0?0:xa>255?255:xa;ia[10]=$<0?0:$>255?255:$;ia[12]=ta<0?0:ta>255?255:ta;ia[13]=ya<0?0:ya>255?255:ya;ia[14]=Q<0?0:Q>255?255:Q;ca.putImageData(ma,0,0);la.drawImage(W,0,0);return ra}function Ia(M,ea,$){M=(M-ea)/($-ea); +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,ea){var $=ea.x-M.x,Q=ea.y-M.y,Z=1/Math.sqrt($*$+Q*Q);$*=Z;Q*=Z;ea.x+=$;ea.y+=Q;M.x-=$;M.y-=Q}var Ga,Oa,ja,va,Aa,La,Pa,Da;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,k);d=e.projectScene(ka,sa,this.sortElements);(O=ka.lights.length>0)&&Ha(ka);Ga=0;for(Oa=d.length;Ga0){V.r+=N.color.r*ba;V.g+=N.color.g*ba;V.b+=N.color.b*ba}}else if(N instanceof THREE.PointLight){A.sub(N.position,S.centroidWorld);A.normalize();ba=S.normalWorld.dot(A)*N.intensity;if(ba>0){V.r+=N.color.r*ba;V.g+=N.color.g*ba;V.b+=N.color.b*ba}}}}function c(Y,S,V,da,R,N){D=e(I++);D.setAttribute("d", +"M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+S.positionScreen.x+" "+S.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)h.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(p){l.r=t.r;l.g=t.g;l.b=t.b;a(N,da,l);h.r=R.color.r*l.r;h.g=R.color.g*l.g;h.b=R.color.b*l.b;h.updateStyleString()}else h.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){v=1-R.__2near/(R.__farPlusNear- +da.z*R.__farMinusNear);h.setRGB(v,v,v)}else R instanceof THREE.MeshNormalMaterial&&h.setRGB(j(da.normalWorld.x),j(da.normalWorld.y),j(da.normalWorld.z));R.wireframe?D.setAttribute("style","fill: none; stroke: "+h.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):D.setAttribute("style","fill: "+h.__styleString+"; fill-opacity: "+R.opacity);m.appendChild(D)}function d(Y,S,V,da,R, +N,ba){D=e(I++);D.setAttribute("d","M "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+S.positionScreen.x+" "+S.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)h.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(p){l.r=t.r;l.g=t.g;l.b=t.b;a(ba,R,l);h.r=N.color.r*l.r;h.g=N.color.g*l.g;h.b=N.color.b*l.b;h.updateStyleString()}else h.__styleString=N.color.__styleString; +else if(N instanceof THREE.MeshDepthMaterial){v=1-N.__2near/(N.__farPlusNear-R.z*N.__farMinusNear);h.setRGB(v,v,v)}else N instanceof THREE.MeshNormalMaterial&&h.setRGB(j(R.normalWorld.x),j(R.normalWorld.y),j(R.normalWorld.z));N.wireframe?D.setAttribute("style","fill: none; stroke: "+h.__styleString+"; stroke-width: "+N.wireframe_linewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframe_linecap+"; stroke-linejoin: "+N.wireframe_linejoin):D.setAttribute("style","fill: "+h.__styleString+ +"; fill-opacity: "+N.opacity);m.appendChild(D)}function e(Y){if(C[Y]==null){C[Y]=document.createElementNS("http://www.w3.org/2000/svg","path");X==0&&C[Y].setAttribute("shape-rendering","crispEdges");return C[Y]}return C[Y]}function j(Y){return Y<0?Math.min((1+Y)*0.5,0.5):0.5+Math.min(Y*0.5,0.5)}var g=null,b=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,o,y,u,q,z,B,H=new THREE.Rectangle,f=new THREE.Rectangle,p=false,h=new THREE.Color(16777215),l=new THREE.Color(16777215), +t=new THREE.Color(0),w=new THREE.Color(0),x=new THREE.Color(0),v,A=new THREE.Vector3,C=[],E=[],F=[],D,I,T,P,X=1;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(Y){switch(Y){case "high":X=1;break;case "low":X=0}};this.setSize=function(Y,S){k=Y;n=S;o=k/2;y=n/2;m.setAttribute("viewBox",-o+" "+-y+" "+k+" "+n);m.setAttribute("width",k);m.setAttribute("height",n);H.set(-o,-y,o,y)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])}; +this.render=function(Y,S){var V,da,R,N,ba,aa,K,O;this.autoClear&&this.clear();g=b.projectScene(Y,S,this.sortElements);P=T=I=0;if(p=Y.lights.length>0){K=Y.lights;t.setRGB(0,0,0);w.setRGB(0,0,0);x.setRGB(0,0,0);V=0;for(da=K.length;V0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,S,n)}if(T&&O>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER, -ca,n)}if(L){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Z,n);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,n)}};this.setLineBuffers=function(j,l){var n,f,p,q=j.vertices,E=j.colors,x=q.length,v=E.length,F=j.__vertexArray,B=j.__colorArray,G=j.__lineArray,J=j.__dirtyColors,C=j.__dirtyElements;if(j.__dirtyVertices){for(n=0;n0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"", -q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP":"",q.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(n,e("fragment",p+v));b.attachShader(n,e("vertex",q+l));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={};j.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(f in j.uniforms)n.push(f);f=j.program;v=0;for(l=n.length;v=0){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLColorBuffer);b.vertexAttribPointer(j.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(j.color)}if(j.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLNormalBuffer);b.vertexAttribPointer(j.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(j.normal)}if(j.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER, -p.__webGLTangentBuffer);b.vertexAttribPointer(j.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(j.tangent)}if(j.uv>=0)if(p.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUVBuffer);b.vertexAttribPointer(j.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(j.uv)}else b.disableVertexAttribArray(j.uv);if(j.uv2>=0)if(p.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,p.__webGLUV2Buffer);b.vertexAttribPointer(j.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(j.uv2)}else b.disableVertexAttribArray(j.uv2); -if(f.wireframe||f instanceof THREE.LineBasicMaterial){j=f.wireframe_linewidth!==undefined?f.wireframe_linewidth:f.linewidth!==undefined?f.linewidth:1;f=f instanceof THREE.LineBasicMaterial&&q.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(j);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);b.drawElements(f,p.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(f instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLParticleBuffer);b.drawElements(b.POINTS,p.__webGLParticleCount, -b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,p.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(j,l,n,f,p,q,E){var x,v,F,B,G;F=0;for(B=f.materials.length;F=0;n--){f=j.__webGLObjects[n].object;l==f&&j.__webGLObjects.splice(n,1)}};this.setupMatrices=function(j, -l){j._modelViewMatrix.multiply(l.matrix,j.matrix);j._modelViewMatrixArray.set(j._modelViewMatrix.flatten());j._normalMatrix=THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transpose();j._normalMatrixArray.set(j._normalMatrix.m);j._objectMatrixArray.set(j.matrix.flatten())};this.loadMatrices=function(j,l){b.uniformMatrix4fv(j.uniforms.viewMatrix,false,y);b.uniformMatrix4fv(j.uniforms.projectionMatrix,false,t);b.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,l._modelViewMatrixArray);b.uniformMatrix3fv(j.uniforms.normalMatrix, -false,l._normalMatrixArray);b.uniformMatrix4fv(j.uniforms.objectMatrix,false,l._objectMatrixArray)};this.loadCamera=function(j,l){b.uniform3f(j.uniforms.cameraPosition,l.position.x,l.position.y,l.position.z)};this.setDepthTest=function(j){j?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setBlending=function(j){switch(j){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(j,l){if(j){!l||l=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(j=="back")b.cullFace(b.BACK);else j=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", -envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", -envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", -map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", -lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +var g=document.createElement("canvas"),b,m=null,k=null,n=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],o=new THREE.Matrix4,y=new Float32Array(16),u=new Float32Array(16),q=new THREE.Vector4,z=true,B=new THREE.Color(0),H=0;if(a){if(a.antialias!==undefined)z=a.antialias;a.clearColor!==undefined&&B.setHex(a.clearColor);if(a.clearAlpha!==undefined)H=a.clearAlpha}this.domElement=g;this.autoClear=true;(function(f,p,h){try{b=g.getContext("experimental-webgl", +{antialias:f})}catch(l){console.log(l)}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(p.r,p.g,p.b,h)})(z,B,H);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f, +p){g.width=f;g.height=p;b.viewport(0,0,g.width,g.height)};this.setClearColorHex=function(f,p){var h=new THREE.Color(f);b.clearColor(h.r,h.g,h.b,p)};this.setClearColor=function(f,p){b.clearColor(f.r,f.g,f.b,p)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(f,p){var h,l,t,w=0,x=0,v=0,A,C,E,F=this.lights,D=F.directional.colors,I=F.directional.positions,T=F.point.colors,P=F.point.positions,X=0,Y=0;h=t=t=0;for(l=p.length;h0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer); +b.bufferData(b.ARRAY_BUFFER,ba,h)}if(ca&&X>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,aa,h)}if(W){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ga,h)}};this.setLineBuffers=function(f,p){var h,l,t,w=f.vertices,x=f.colors,v=w.length,A=x.length,C=f.__vertexArray,E=f.__colorArray,F=f.__lineArray,D=f.__dirtyColors,I=f.__dirtyElements; +if(f.__dirtyVertices){for(h=0;h0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+ +w.maxPointLights,w.map?"#define USE_MAP":"",w.env_map?"#define USE_ENVMAP":"",w.light_map?"#define USE_LIGHTMAP":"",w.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(h,e("fragment",t+A));b.attachShader(h, +e("vertex",w+p));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(l in f.uniforms)h.push(l);l=f.program;A=0;for(p=h.length;A=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLColorBuffer);b.vertexAttribPointer(f.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.color)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.normal)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER, +t.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.tangent)}if(f.uv>=0)if(t.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUVBuffer);b.vertexAttribPointer(f.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.uv)}else b.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(t.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,t.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2); +if(l.wireframe||l instanceof THREE.LineBasicMaterial){f=l.wireframe_linewidth!==undefined?l.wireframe_linewidth:l.linewidth!==undefined?l.linewidth:1;l=l instanceof THREE.LineBasicMaterial&&w.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);b.drawElements(l,t.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(l instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLParticleBuffer);b.drawElements(b.POINTS,t.__webGLParticleCount, +b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,t.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,p,h,l,t,w,x){var v,A,C,E,F;C=0;for(E=l.materials.length;C=0;h--){l=f.__webGLObjects[h].object; +p==l&&f.__webGLObjects.splice(h,1)}};this.setupMatrices=function(f,p){f._modelViewMatrix.multiply(p.matrix,f.matrix);f._modelViewMatrixArray.set(f._modelViewMatrix.flatten());f._normalMatrix=THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transpose();f._normalMatrixArray.set(f._normalMatrix.m);f._objectMatrixArray.set(f.matrix.flatten())};this.loadMatrices=function(f,p){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,u);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,y);b.uniformMatrix4fv(f.uniforms.modelViewMatrix, +false,p._modelViewMatrixArray);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,p._normalMatrixArray);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,p._objectMatrixArray)};this.loadCamera=function(f,p){b.uniform3f(f.uniforms.cameraPosition,p.position.x,p.position.y,p.position.z)};this.setDepthTest=function(f){f?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};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,p){if(f){!p||p=="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\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", +map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", +lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"}; @@ -226,20 +227,20 @@ THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() "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}; -var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,h=d?c.geometry:c,g=a.vertices,b=h.vertices,m=a.faces,k=h.faces,o=a.uvs;h=h.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var t=0,y=b.length;t= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}", @@ -248,38 +249,38 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying ve value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i25)g=25;h=(g-1)*0.5;d=Array(g);for(c=e=0;c25)g=25;j=(g-1)*0.5;d=Array(g);for(c=e=0;c0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,m,w)))-1);o.push(t)}c.push(o)}var u,z,A;h=c.length;for(d=0;d0)for(e=0;e1){u=this.vertices[b].position.clone(); -z=this.vertices[k].position.clone();A=this.vertices[o].position.clone();u.normalize();z.normalize();A.normalize();this.faces.push(new THREE.Face3(b,k,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([t,y,j])}}}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 h=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(e),(this.radius+this.tube*Math.cos(h))*Math.sin(e),this.tube*Math.sin(h))));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;h=(this.segmentsT+1)*c+d-1;var g=(this.segmentsT+1)*(c-1)+d-1,b=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,h,g,b));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[b][0],a[b][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(y,w,u){var z=Math.sqrt(y*y+w*w+u*u);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(y/z,w/z,u/z)))-1}function d(y,w,u,z){z.faces.push(new THREE.Face3(y,w,u))}function e(y,w){var u=h.vertices[y].position,z=h.vertices[w].position;return c((u.x+z.x)/2,(u.y+z.y)/2,(u.z+z.z)/2)}var h=this,g=new THREE.Geometry,b;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,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(a=0;a0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,m,u)))-1);n.push(o)}c.push(n)}var q,z,B;j=c.length;for(d=0;d0)for(e=0;e1){q=this.vertices[b].position.clone(); +z=this.vertices[k].position.clone();B=this.vertices[n].position.clone();q.normalize();z.normalize();B.normalize();this.faces.push(new THREE.Face3(b,k,n,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([o,y,H])}}}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 j=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(j))*Math.cos(e),(this.radius+this.tube*Math.cos(j))*Math.sin(e),this.tube*Math.sin(j))));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;j=(this.segmentsT+1)*c+d-1;var g=(this.segmentsT+1)*(c-1)+d-1,b=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,j,g,b));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[j][0],a[j][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[b][0],a[b][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(y,u,q){var z=Math.sqrt(y*y+u*u+q*q);return j.vertices.push(new THREE.Vertex(new THREE.Vector3(y/z,u/z,q/z)))-1}function d(y,u,q,z){z.faces.push(new THREE.Face3(y,u,q))}function e(y,u){var q=j.vertices[y].position,z=j.vertices[u].position;return c((q.x+z.x)/2,(q.y+z.y)/2,(q.z+z.z)/2)}var j=this,g=new THREE.Geometry,b;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,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(a=0;a=this.maxCount-3&&m(this)};this.begin= -function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(d){if(this.count!=0){for(var e=this.count*3;ethis.size-1)k=this.size-1;var w=Math.floor(o-m);if(w<1)w=1;o=Math.floor(o+m);if(o>this.size-1)o=this.size-1;var u=Math.floor(t-m);if(u<1)u=1;m=Math.floor(t+m); -if(m>this.size-1)m=this.size-1;var z,A,j,l,n,f;for(y=y;y0)this.field[j+z]+=l}}}};this.addPlaneX=function(d,e){var h,g,b,m,k,o=this.size,t=this.yd,y=this.zd,w=this.field,u=o*Math.sqrt(d/e);if(u>o)u=o;for(h=0;h0)for(g=0;gt)z=t;for(g=0;g0){k=g*y;for(h=0;hsize)dist=size;for(b=0;b0){k=zd*b;for(g=0;g=this.maxCount-3&&m(this)};this.begin= +function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(d){if(this.count!=0){for(var e=this.count*3;ethis.size-1)k=this.size-1;var u=Math.floor(n-m);if(u<1)u=1;n=Math.floor(n+m);if(n>this.size-1)n=this.size-1;var q=Math.floor(o-m);if(q<1)q=1;m=Math.floor(o+m); +if(m>this.size-1)m=this.size-1;var z,B,H,f,p,h;for(y=y;y0)this.field[H+z]+=f}}}};this.addPlaneX=function(d,e){var j,g,b,m,k,n=this.size,o=this.yd,y=this.zd,u=this.field,q=n*Math.sqrt(d/e);if(q>n)q=n;for(j=0;j0)for(g=0;go)z=o;for(g=0;g0){k=g*y;for(j=0;jsize)dist=size;for(b=0;b0){k=zd*b;for(g=0;g>7)-127;L=(da&127)<<16|T<<8|L;if(L==0&&ha==-127)return 0;return(1-2*(la>>7))*(1+L*Math.pow(2,-23))*Math.pow(2,ha)}function m(D,K){var L=t(D,K),T=t(D,K+1),da=t(D,K+2);return(t(D,K+3)<<24)+(da<<16)+(T<<8)+L}function k(D,K){var L=t(D,K);return(t(D,K+1)<<8)+L}function o(D,K){var L=t(D,K);return L>127?L-256:L}function t(D,K){return D.charCodeAt(K)&255}function y(D){var K, -L,T;K=m(a,D);L=m(a,D+E);T=m(a,D+x);D=k(a,D+v);THREE.Loader.prototype.f3(l,K,L,T,D)}function w(D){var K,L,T,da,la,ha;K=m(a,D);L=m(a,D+E);T=m(a,D+x);da=k(a,D+v);la=m(a,D+F);ha=m(a,D+B);D=m(a,D+G);THREE.Loader.prototype.f3n(l,p,K,L,T,da,la,ha,D)}function u(D){var K,L,T,da;K=m(a,D);L=m(a,D+J);T=m(a,D+C);da=m(a,D+I);D=k(a,D+aa);THREE.Loader.prototype.f4(l,K,L,T,da,D)}function z(D){var K,L,T,da,la,ha,ia,ta;K=m(a,D);L=m(a,D+J);T=m(a,D+C);da=m(a,D+I);la=k(a,D+aa);ha=m(a,D+O);ia=m(a,D+U);ta=m(a,D+V);D=m(a, -D+N);THREE.Loader.prototype.f4n(l,p,K,L,T,da,la,ha,ia,ta,D)}function A(D){var K,L;K=m(a,D);L=m(a,D+ba);D=m(a,D+$);THREE.Loader.prototype.uv3(l.uvs,q[K*2],q[K*2+1],q[L*2],q[L*2+1],q[D*2],q[D*2+1])}function j(D){var K,L,T;K=m(a,D);L=m(a,D+Q);T=m(a,D+S);D=m(a,D+ca);THREE.Loader.prototype.uv4(l.uvs,q[K*2],q[K*2+1],q[L*2],q[L*2+1],q[T*2],q[T*2+1],q[D*2],q[D*2+1])}var l=this,n=0,f,p=[],q=[],E,x,v,F,B,G,J,C,I,aa,O,U,V,N,ba,$,Q,S,ca,W,H,R,Z,fa,na;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(l, -e,g);f={signature:a.substr(n,8),header_bytes:t(a,n+8),vertex_coordinate_bytes:t(a,n+9),normal_coordinate_bytes:t(a,n+10),uv_coordinate_bytes:t(a,n+11),vertex_index_bytes:t(a,n+12),normal_index_bytes:t(a,n+13),uv_index_bytes:t(a,n+14),material_index_bytes:t(a,n+15),nvertices:m(a,n+16),nnormals:m(a,n+16+4),nuvs:m(a,n+16+8),ntri_flat:m(a,n+16+12),ntri_smooth:m(a,n+16+16),ntri_flat_uv:m(a,n+16+20),ntri_smooth_uv:m(a,n+16+24),nquad_flat:m(a,n+16+28),nquad_smooth:m(a,n+16+32),nquad_flat_uv:m(a,n+16+36), -nquad_smooth_uv:m(a,n+16+40)};n+=f.header_bytes;E=f.vertex_index_bytes;x=f.vertex_index_bytes*2;v=f.vertex_index_bytes*3;F=f.vertex_index_bytes*3+f.material_index_bytes;B=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes;G=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes*2;J=f.vertex_index_bytes;C=f.vertex_index_bytes*2;I=f.vertex_index_bytes*3;aa=f.vertex_index_bytes*4;O=f.vertex_index_bytes*4+f.material_index_bytes;U=f.vertex_index_bytes*4+f.material_index_bytes+ -f.normal_index_bytes;V=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*2;N=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*3;ba=f.uv_index_bytes;$=f.uv_index_bytes*2;Q=f.uv_index_bytes;S=f.uv_index_bytes*2;ca=f.uv_index_bytes*3;g=f.vertex_index_bytes*3+f.material_index_bytes;na=f.vertex_index_bytes*4+f.material_index_bytes;W=f.ntri_flat*g;H=f.ntri_smooth*(g+f.normal_index_bytes*3);R=f.ntri_flat_uv*(g+f.uv_index_bytes*3);Z=f.ntri_smooth_uv*(g+f.normal_index_bytes* -3+f.uv_index_bytes*3);fa=f.nquad_flat*na;g=f.nquad_smooth*(na+f.normal_index_bytes*4);na=f.nquad_flat_uv*(na+f.uv_index_bytes*4);n+=function(D){var K,L,T,da=f.vertex_coordinate_bytes*3,la=D+f.nvertices*da;for(D=D;D>7)-127;L=(ca&127)<<16|W<<8|L;if(L==0&&ia==-127)return 0;return(1-2*(ma>>7))*(1+L*Math.pow(2,-23))*Math.pow(2,ia)}function m(G,J){var L=o(G,J),W=o(G,J+1),ca=o(G,J+2);return(o(G,J+3)<<24)+(ca<<16)+(W<<8)+L}function k(G,J){var L=o(G,J);return(o(G,J+1)<<8)+L}function n(G,J){var L=o(G,J);return L>127?L-256:L}function o(G,J){return G.charCodeAt(J)&255}function y(G){var J, +L,W;J=m(a,G);L=m(a,G+w);W=m(a,G+x);G=k(a,G+v);THREE.Loader.prototype.f3(f,J,L,W,G)}function u(G){var J,L,W,ca,ma,ia;J=m(a,G);L=m(a,G+w);W=m(a,G+x);ca=k(a,G+v);ma=m(a,G+A);ia=m(a,G+C);G=m(a,G+E);THREE.Loader.prototype.f3n(f,l,J,L,W,ca,ma,ia,G)}function q(G){var J,L,W,ca;J=m(a,G);L=m(a,G+F);W=m(a,G+D);ca=m(a,G+I);G=k(a,G+T);THREE.Loader.prototype.f4(f,J,L,W,ca,G)}function z(G){var J,L,W,ca,ma,ia,ra,la;J=m(a,G);L=m(a,G+F);W=m(a,G+D);ca=m(a,G+I);ma=k(a,G+T);ia=m(a,G+P);ra=m(a,G+X);la=m(a,G+Y);G=m(a,G+ +S);THREE.Loader.prototype.f4n(f,l,J,L,W,ca,ma,ia,ra,la,G)}function B(G){var J,L;J=m(a,G);L=m(a,G+V);G=m(a,G+da);THREE.Loader.prototype.uv3(f.uvs,t[J*2],t[J*2+1],t[L*2],t[L*2+1],t[G*2],t[G*2+1])}function H(G){var J,L,W;J=m(a,G);L=m(a,G+R);W=m(a,G+N);G=m(a,G+ba);THREE.Loader.prototype.uv4(f.uvs,t[J*2],t[J*2+1],t[L*2],t[L*2+1],t[W*2],t[W*2+1],t[G*2],t[G*2+1])}var f=this,p=0,h,l=[],t=[],w,x,v,A,C,E,F,D,I,T,P,X,Y,S,V,da,R,N,ba,aa,K,O,U,ha,ga;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f, +e,g);h={signature:a.substr(p,8),header_bytes:o(a,p+8),vertex_coordinate_bytes:o(a,p+9),normal_coordinate_bytes:o(a,p+10),uv_coordinate_bytes:o(a,p+11),vertex_index_bytes:o(a,p+12),normal_index_bytes:o(a,p+13),uv_index_bytes:o(a,p+14),material_index_bytes:o(a,p+15),nvertices:m(a,p+16),nnormals:m(a,p+16+4),nuvs:m(a,p+16+8),ntri_flat:m(a,p+16+12),ntri_smooth:m(a,p+16+16),ntri_flat_uv:m(a,p+16+20),ntri_smooth_uv:m(a,p+16+24),nquad_flat:m(a,p+16+28),nquad_smooth:m(a,p+16+32),nquad_flat_uv:m(a,p+16+36), +nquad_smooth_uv:m(a,p+16+40)};p+=h.header_bytes;w=h.vertex_index_bytes;x=h.vertex_index_bytes*2;v=h.vertex_index_bytes*3;A=h.vertex_index_bytes*3+h.material_index_bytes;C=h.vertex_index_bytes*3+h.material_index_bytes+h.normal_index_bytes;E=h.vertex_index_bytes*3+h.material_index_bytes+h.normal_index_bytes*2;F=h.vertex_index_bytes;D=h.vertex_index_bytes*2;I=h.vertex_index_bytes*3;T=h.vertex_index_bytes*4;P=h.vertex_index_bytes*4+h.material_index_bytes;X=h.vertex_index_bytes*4+h.material_index_bytes+ +h.normal_index_bytes;Y=h.vertex_index_bytes*4+h.material_index_bytes+h.normal_index_bytes*2;S=h.vertex_index_bytes*4+h.material_index_bytes+h.normal_index_bytes*3;V=h.uv_index_bytes;da=h.uv_index_bytes*2;R=h.uv_index_bytes;N=h.uv_index_bytes*2;ba=h.uv_index_bytes*3;g=h.vertex_index_bytes*3+h.material_index_bytes;ga=h.vertex_index_bytes*4+h.material_index_bytes;aa=h.ntri_flat*g;K=h.ntri_smooth*(g+h.normal_index_bytes*3);O=h.ntri_flat_uv*(g+h.uv_index_bytes*3);U=h.ntri_smooth_uv*(g+h.normal_index_bytes* +3+h.uv_index_bytes*3);ha=h.nquad_flat*ga;g=h.nquad_smooth*(ga+h.normal_index_bytes*4);ga=h.nquad_flat_uv*(ga+h.uv_index_bytes*4);p+=function(G){var J,L,W,ca=h.vertex_coordinate_bytes*3,ma=G+h.nvertices*ca;for(G=G;G