From b3ea0d5fcd444f20d35d0dc18924c8ee1a25412c Mon Sep 17 00:00:00 2001 From: alteredq Date: Tue, 8 Feb 2011 12:49:14 +0100 Subject: [PATCH] Changed a bit clear color API. Renamed: setClearColor( hex, opacity ) => setClearColorHex( hex, opacity ) New: setClearColor( color, opacity ) In this way it's a bit cheaper to animate clear color. Hope I didn't break examples - I searched for "setClearColor" and changed it in one place where it was used. --- build/Three.js | 256 +++++++++++++++---------------- build/ThreeDebug.js | 258 ++++++++++++++++---------------- build/ThreeExtras.js | 250 +++++++++++++++---------------- examples/scene_test.html | 4 +- examples/uqbiquity_test.html | 1 + src/renderers/CanvasRenderer.js | 14 +- src/renderers/WebGLRenderer.js | 8 +- src/renderers/WebGLRenderer2.js | 13 +- 8 files changed, 416 insertions(+), 388 deletions(-) diff --git a/build/Three.js b/build/Three.js index e7fc35c1..f7def60c 100755 --- a/build/Three.js +++ b/build/Three.js @@ -1,66 +1,66 @@ // Three.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var f,h,b,q,r,l;if(d==0)f=h=b=0;else{q=Math.floor(a*6);r=a*6-q;a=d*(1-c);l=d*(1-c*r);c=d*(1-c*(1-r));switch(q){case 1:f=l;h=d;b=a;break;case 2:f=a;h=d;b=c;break;case 3:f=a;h=l;b=d;break;case 4:f=c;h=a;b=d;break;case 5:f=d;h=a;b=l;break;case 6:case 0:f=d;h=c;b=a}}this.r=f;this.g=h;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,h,b,r,q,l;if(d==0)g=h=b=0;else{r=Math.floor(a*6);q=a*6-r;a=d*(1-c);l=d*(1-c*q);c=d*(1-c*(1-q));switch(r){case 1:g=l;h=d;b=a;break;case 2:g=a;h=d;b=c;break;case 3:g=a;h=l;b=d;break;case 4:g=c;h=a;b=d;break;case 5:g=d;h=a;b=l;break;case 6:case 0:g=d;h=c;b=a}}this.r=g;this.g=h;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +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,g=this.z;this.x=d*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1}; -THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +THREE.Vector4=function(a,c,d,g){this.x=a||0;this.y=c||0;this.z=d||0;this.w=g||1}; +THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;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,f=a.objects,h=[];a=0;for(c=f.length;a0&&M>0&&m+M<1}var d,f,h,b,q,r,l,p,z,y, -u,x=a.geometry,H=x.vertices,K=[];d=0;for(f=x.faces.length;dl?f:l;h=h>p? -h:p}a()};this.add3Points=function(l,p,z,y,u,x){if(r){r=false;c=lz?l>u?l:u:z>u?z:u;h=p>y?p>x?p:x:y>x?y:x}else{c=lz?l>u?l>f?l:f:u>f?u:f:z>u?z>f?z:f:u>f?u:f;h=p>y?p>x?p>h?p:h:x>h?x:h:y>x?y>h?y:h:x>h?x:h}a()};this.addRectangle=function(l){if(r){r=false;c=l.getLeft();d=l.getTop();f=l.getRight();h=l.getBottom()}else{c=cl.getRight()?f:l.getRight();h=h>l.getBottom()?h:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;f+=l;h+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();f=f=0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){r=true;h=f=d=c=0;a()};this.isEmpty=function(){return r};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+h+", width: "+b+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,f,h,b,q,r,l,p,z,y,u,x,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=h||0;this.n22=b||1;this.n23=q||0;this.n24=r||0;this.n31=l||0;this.n32=p||0;this.n33=z||1;this.n34=y||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=K||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,f,h,b,q,r,l,p,z,y,u,x,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=b;this.n23=q;this.n24=r;this.n31=l;this.n32=p;this.n33=z;this.n34=y;this.n41=u;this.n42=x;this.n43=H;this.n44=K;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();f.cross(d,b).normalize();h.cross(b,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); -this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,h=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23* -f+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*f+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,f=a.n12,h=a.n13,b=a.n14,q=a.n21,r=a.n22,l=a.n23,p=a.n24,z=a.n31, -y=a.n32,u=a.n33,x=a.n34,H=a.n41,K=a.n42,M=a.n43,s=a.n44,T=c.n11,G=c.n12,g=c.n13,m=c.n14,i=c.n21,e=c.n22,j=c.n23,k=c.n24,o=c.n31,w=c.n32,n=c.n33,t=c.n34,v=c.n41,D=c.n42,E=c.n43,I=c.n44;this.n11=d*T+f*i+h*o+b*v;this.n12=d*G+f*e+h*w+b*D;this.n13=d*g+f*j+h*n+b*E;this.n14=d*m+f*k+h*t+b*I;this.n21=q*T+r*i+l*o+p*v;this.n22=q*G+r*e+l*w+p*D;this.n23=q*g+r*j+l*n+p*E;this.n24=q*m+r*k+l*t+p*I;this.n31=z*T+y*i+u*o+x*v;this.n32=z*G+y*e+u*w+x*D;this.n33=z*g+y*j+u*n+x*E;this.n34=z*m+y*k+u*t+x*I;this.n41=H*T+K*i+ -M*o+s*v;this.n42=H*G+K*e+M*w+s*D;this.n43=H*g+K*j+M*n+s*E;this.n44=H*m+K*k+M*t+s*I;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,h=this.n14,b=this.n21,q=this.n22,r=this.n23,l=this.n24,p=this.n31,z=this.n32,y=this.n33,u=this.n34,x=this.n41,H=this.n42,K=this.n43,M=this.n44,s=a.n11,T=a.n21,G=a.n31,g=a.n41,m=a.n12,i=a.n22,e=a.n32,j=a.n42,k=a.n13,o=a.n23,w=a.n33,n=a.n43,t=a.n14,v=a.n24,D=a.n34;a=a.n44;this.n11=c*s+d*T+f*G+h*g;this.n12=c*m+d*i+f*e+h*j;this.n13=c*k+d*o+f*w+h* -n;this.n14=c*t+d*v+f*D+h*a;this.n21=b*s+q*T+r*G+l*g;this.n22=b*m+q*i+r*e+l*j;this.n23=b*k+q*o+r*w+l*n;this.n24=b*t+q*v+r*D+l*a;this.n31=p*s+z*T+y*G+u*g;this.n32=p*m+z*i+y*e+u*j;this.n33=p*k+z*o+y*w+u*n;this.n34=p*t+z*v+y*D+u*a;this.n41=x*s+H*T+K*G+M*g;this.n42=x*m+H*i+K*e+M*j;this.n43=x*k+H*o+K*w+M*n;this.n44=x*t+H*v+K*D+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,d=this.n13,f=this.n14,h=this.n21,b=this.n22,q=this.n23,r=this.n24,l=this.n31,p=this.n32,z=this.n33,y=this.n34,u=this.n41,x=this.n42,H=this.n43,K=this.n44;return f*q*p*u-d*r*p*u-f*b*z*u+c*r*z*u+d*b*y*u-c*q*y*u-f*q*l*x+d*r*l*x+f*h*z*x-a*r*z*x-d*h*y*x+a*q*y*x+f*b*l*H-c*r*l*H-f*h*p*H+a*r*p*H+c*h*y*H-a*b*y*H-d*b*l*K+c*q*l*K+d*h*p*K-a*q*p*K-c*h*z*K+a*b*z*K},transpose:function(){function a(c,d, -f){var h=c[d];c[d]=c[f];c[f]=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,g=a.objects,h=[];a=0;for(c=g.length;a0&&M>0&&m+M<1}var d,g,h,b,r,q,l,p,z,y, +u,x=a.geometry,H=x.vertices,K=[];d=0;for(g=x.faces.length;dl?g:l;h=h>p? +h:p}a()};this.add3Points=function(l,p,z,y,u,x){if(q){q=false;c=lz?l>u?l:u:z>u?z:u;h=p>y?p>x?p:x:y>x?y:x}else{c=lz?l>u?l>g?l:g:u>g?u:g:z>u?z>g?z:g:u>g?u:g;h=p>y?p>x?p>h?p:h:x>h?x:h:y>x?y>h?y:h:x>h?x:h}a()};this.addRectangle=function(l){if(q){q=false;c=l.getLeft();d=l.getTop();g=l.getRight();h=l.getBottom()}else{c=cl.getRight()?g:l.getRight();h=h>l.getBottom()?h:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;g+=l;h+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();g=g=0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){q=true;h=g=d=c=0;a()};this.isEmpty=function(){return q};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+d+", bottom: "+h+", width: "+b+", height: "+r+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,g,h,b,r,q,l,p,z,y,u,x,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=g||0;this.n21=h||0;this.n22=b||1;this.n23=r||0;this.n24=q||0;this.n31=l||0;this.n32=p||0;this.n33=z||1;this.n34=y||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=K||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,g,h,b,r,q,l,p,z,y,u,x,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=h;this.n22=b;this.n23=r;this.n24=q;this.n31=l;this.n32=p;this.n33=z;this.n34=y;this.n41=u;this.n42=x;this.n43=H;this.n44=K;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();g.cross(d,b).normalize();h.cross(b,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,h=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*g+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23* +g+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*g+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,g=a.n12,h=a.n13,b=a.n14,r=a.n21,q=a.n22,l=a.n23,p=a.n24,z=a.n31, +y=a.n32,u=a.n33,x=a.n34,H=a.n41,K=a.n42,M=a.n43,s=a.n44,T=c.n11,G=c.n12,f=c.n13,m=c.n14,i=c.n21,e=c.n22,j=c.n23,k=c.n24,o=c.n31,w=c.n32,n=c.n33,t=c.n34,v=c.n41,D=c.n42,E=c.n43,I=c.n44;this.n11=d*T+g*i+h*o+b*v;this.n12=d*G+g*e+h*w+b*D;this.n13=d*f+g*j+h*n+b*E;this.n14=d*m+g*k+h*t+b*I;this.n21=r*T+q*i+l*o+p*v;this.n22=r*G+q*e+l*w+p*D;this.n23=r*f+q*j+l*n+p*E;this.n24=r*m+q*k+l*t+p*I;this.n31=z*T+y*i+u*o+x*v;this.n32=z*G+y*e+u*w+x*D;this.n33=z*f+y*j+u*n+x*E;this.n34=z*m+y*k+u*t+x*I;this.n41=H*T+K*i+ +M*o+s*v;this.n42=H*G+K*e+M*w+s*D;this.n43=H*f+K*j+M*n+s*E;this.n44=H*m+K*k+M*t+s*I;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,g=this.n13,h=this.n14,b=this.n21,r=this.n22,q=this.n23,l=this.n24,p=this.n31,z=this.n32,y=this.n33,u=this.n34,x=this.n41,H=this.n42,K=this.n43,M=this.n44,s=a.n11,T=a.n21,G=a.n31,f=a.n41,m=a.n12,i=a.n22,e=a.n32,j=a.n42,k=a.n13,o=a.n23,w=a.n33,n=a.n43,t=a.n14,v=a.n24,D=a.n34;a=a.n44;this.n11=c*s+d*T+g*G+h*f;this.n12=c*m+d*i+g*e+h*j;this.n13=c*k+d*o+g*w+h* +n;this.n14=c*t+d*v+g*D+h*a;this.n21=b*s+r*T+q*G+l*f;this.n22=b*m+r*i+q*e+l*j;this.n23=b*k+r*o+q*w+l*n;this.n24=b*t+r*v+q*D+l*a;this.n31=p*s+z*T+y*G+u*f;this.n32=p*m+z*i+y*e+u*j;this.n33=p*k+z*o+y*w+u*n;this.n34=p*t+z*v+y*D+u*a;this.n41=x*s+H*T+K*G+M*f;this.n42=x*m+H*i+K*e+M*j;this.n43=x*k+H*o+K*w+M*n;this.n44=x*t+H*v+K*D+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,d=this.n13,g=this.n14,h=this.n21,b=this.n22,r=this.n23,q=this.n24,l=this.n31,p=this.n32,z=this.n33,y=this.n34,u=this.n41,x=this.n42,H=this.n43,K=this.n44;return g*r*p*u-d*q*p*u-g*b*z*u+c*q*z*u+d*b*y*u-c*r*y*u-g*r*l*x+d*q*l*x+g*h*z*x-a*q*z*x-d*h*y*x+a*r*y*x+g*b*l*H-c*q*l*H-g*h*p*H+a*q*p*H+c*h*y*H-a*b*y*H-d*b*l*K+c*r*l*K+d*h*p*K-a*r*p*K-c*h*z*K+a*b*z*K},transpose:function(){function a(c,d, +g){var h=c[d];c[d]=c[g];c[g]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),h=1-d,b=a.x,q=a.y,r=a.z,l=h*b,p=h*q;this.set(l*b+d,l*q-f*r,l*r+f*q,0,l*q+f*r,p*q+d,p*r-f*b,0,l*r-f*q,p*r+f*b,h*r*r+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ -this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; +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),g=Math.sin(c),h=1-d,b=a.x,r=a.y,q=a.z,l=h*b,p=h*r;this.set(l*b+d,l*r-g*q,l*q+g*r,0,l*r+g*q,p*r+d,p*q-g*b,0,l*q-g*r,p*q+g*b,h*q*q+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 g=new THREE.Matrix4;g.setTranslation(a,c,d);return g};THREE.Matrix4.scaleMatrix=function(a,c,d){var g=new THREE.Matrix4;g.setScale(a,c,d);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 d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,f=a.n13,h=a.n14,b=a.n21,q=a.n22,r=a.n23,l=a.n24,p=a.n31,z=a.n32,y=a.n33,u=a.n34,x=a.n41,H=a.n42,K=a.n43,M=a.n44,s=new THREE.Matrix4;s.n11=r*u*H-l*y*H+l*z*K-q*u*K-r*z*M+q*y*M;s.n12=h*y*H-f*u*H-h*z*K+d*u*K+f*z*M-d*y*M;s.n13=f*l*H-h*r*H+h*q*K-d*l*K-f*q*M+d*r*M;s.n14=h*r*z-f*l*z-h*q*y+d*l*y+f*q*u-d*r*u;s.n21=l*y*x-r*u*x-l*p*K+b*u*K+r*p*M-b*y*M;s.n22=f*u*x-h*y*x+h*p*K-c*u*K-f*p*M+c*y*M;s.n23=h*r*x-f*l*x-h*b*K+c*l*K+f*b*M-c*r*M;s.n24=f*l*p-h*r*p+ -h*b*y-c*l*y-f*b*u+c*r*u;s.n31=q*u*x-l*z*x+l*p*H-b*u*H-q*p*M+b*z*M;s.n32=h*z*x-d*u*x-h*p*H+c*u*H+d*p*M-c*z*M;s.n33=f*l*x-h*q*x+h*b*H-c*l*H-d*b*M+c*q*M;s.n34=h*q*p-d*l*p-h*b*z+c*l*z+d*b*u-c*q*u;s.n41=r*z*x-q*y*x-r*p*H+b*y*H+q*p*K-b*z*K;s.n42=d*y*x-f*z*x+f*p*H-c*y*H-d*p*K+c*z*K;s.n43=f*q*x-d*r*x-f*b*H+c*r*H+d*b*K-c*q*K;s.n44=d*r*p-f*q*p+f*b*z-c*r*z-d*b*y+c*q*y;s.multiplyScalar(1/a.determinant());return s}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,f=c[10]*c[5]-c[6]*c[9],h=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],p=c[9]*c[4]-c[5]*c[8],z=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*f+c[1]*q+c[2]*p;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*f;d[1]=c*h;d[2]=c*b;d[3]=c*q;d[4]=c*r;d[5]=c*l;d[6]=c*p;d[7]=c*z;d[8]=c*y;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,f,h,b){var q,r,l;q=new THREE.Matrix4;r=2*h/(c-a);l=2*h/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(b+h)/(b-h);h=-2*b*h/(b-h);q.n11=r;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=f;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,f)}; -THREE.Matrix4.makeOrtho=function(a,c,d,f,h,b){var q,r,l,p;q=new THREE.Matrix4;r=c-a;l=d-f;p=b-h;a=(c+a)/r;d=(d+f)/l;h=(b+h)/p;q.n11=2/r;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/p;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,g=a.n13,h=a.n14,b=a.n21,r=a.n22,q=a.n23,l=a.n24,p=a.n31,z=a.n32,y=a.n33,u=a.n34,x=a.n41,H=a.n42,K=a.n43,M=a.n44,s=new THREE.Matrix4;s.n11=q*u*H-l*y*H+l*z*K-r*u*K-q*z*M+r*y*M;s.n12=h*y*H-g*u*H-h*z*K+d*u*K+g*z*M-d*y*M;s.n13=g*l*H-h*q*H+h*r*K-d*l*K-g*r*M+d*q*M;s.n14=h*q*z-g*l*z-h*r*y+d*l*y+g*r*u-d*q*u;s.n21=l*y*x-q*u*x-l*p*K+b*u*K+q*p*M-b*y*M;s.n22=g*u*x-h*y*x+h*p*K-c*u*K-g*p*M+c*y*M;s.n23=h*q*x-g*l*x-h*b*K+c*l*K+g*b*M-c*q*M;s.n24=g*l*p-h*q*p+ +h*b*y-c*l*y-g*b*u+c*q*u;s.n31=r*u*x-l*z*x+l*p*H-b*u*H-r*p*M+b*z*M;s.n32=h*z*x-d*u*x-h*p*H+c*u*H+d*p*M-c*z*M;s.n33=g*l*x-h*r*x+h*b*H-c*l*H-d*b*M+c*r*M;s.n34=h*r*p-d*l*p-h*b*z+c*l*z+d*b*u-c*r*u;s.n41=q*z*x-r*y*x-q*p*H+b*y*H+r*p*K-b*z*K;s.n42=d*y*x-g*z*x+g*p*H-c*y*H-d*p*K+c*z*K;s.n43=g*r*x-d*q*x-g*b*H+c*q*H+d*b*K-c*r*K;s.n44=d*q*p-g*r*p+g*b*z-c*q*z-d*b*y+c*r*y;s.multiplyScalar(1/a.determinant());return s}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,g=c[10]*c[5]-c[6]*c[9],h=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],r=-c[10]*c[4]+c[6]*c[8],q=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],p=c[9]*c[4]-c[5]*c[8],z=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*g+c[1]*r+c[2]*p;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*g;d[1]=c*h;d[2]=c*b;d[3]=c*r;d[4]=c*q;d[5]=c*l;d[6]=c*p;d[7]=c*z;d[8]=c*y;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,g,h,b){var r,q,l;r=new THREE.Matrix4;q=2*h/(c-a);l=2*h/(g-d);a=(c+a)/(c-a);d=(g+d)/(g-d);g=-(b+h)/(b-h);h=-2*b*h/(b-h);r.n11=q;r.n12=0;r.n13=a;r.n14=0;r.n21=0;r.n22=l;r.n23=d;r.n24=0;r.n31=0;r.n32=0;r.n33=g;r.n34=h;r.n41=0;r.n42=0;r.n43=-1;r.n44=0;return r};THREE.Matrix4.makePerspective=function(a,c,d,g){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,g)}; +THREE.Matrix4.makeOrtho=function(a,c,d,g,h,b){var r,q,l,p;r=new THREE.Matrix4;q=c-a;l=d-g;p=b-h;a=(c+a)/q;d=(d+g)/l;h=(b+h)/p;r.n11=2/q;r.n12=0;r.n13=0;r.n14=-a;r.n21=0;r.n22=2/l;r.n23=0;r.n24=-d;r.n31=0;r.n32=0;r.n33=-2/p;r.n34=-h;r.n41=0;r.n42=0;r.n43=0;r.n44=1;return r};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,f,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=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,f,h,b){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,g,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];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,g,h,b){this.a=a;this.b=c;this.c=d;this.d=g;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,g,h,b,r,q=new THREE.Vector3,l=new THREE.Vector3;g=0;for(h=this.vertices.length;g0){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;l=p[r].hash+"_"+p[r].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(f);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){p[q].counter+=1;l=p[q].hash+"_"+p[q].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:r,vertices:0}}this.geometryChunks[l].faces.push(g);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(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)}; +THREE.Camera=function(a,c,d,g){this.fov=a;this.aspect=c;this.near=d;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(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){f.setRotY(c.y);this.rotationMatrix.multiplySelf(f)}if(c.z!=0){f.setRotZ(c.z);this.rotationMatrix.multiplySelf(f)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){f.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(f)}}};THREE.Object3DCounter={value:0}; +THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=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(d.x!=0||d.y!=0||d.z!=0){g.setScale(d.x,d.y,d.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.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; @@ -90,110 +90,110 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.vertex_colors=false;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
vertex_colors: "+this.vertex_colors+"
)"}}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,f,h,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,g,h,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=g!==undefined?g:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,d,f,h={};for(c in a){h[c]={};for(d in a[c]){f=a[c][d];h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var c,d,f,h={};for(c=0;c=0&&n>=0&&t>=0&&v>=0)return true;else if(w<0&&n<0||t<0&&v<0)return false;else{if(w<0)k=Math.max(k,w/(w-n));else if(n<0)o=Math.min(o,w/(w-n));if(t<0)k=Math.max(k,t/(t-v));else if(v<0)o=Math.min(o,t/(t-v));if(o=0&&n>=0&&t>=0&&v>=0)return true;else if(w<0&&n<0||t<0&&v<0)return false;else{if(w<0)k=Math.max(k,w/(w-n));else if(n<0)o=Math.min(o,w/(w-n));if(t<0)k=Math.max(k,t/(t-v));else if(v<0)o=Math.min(o,t/(t-v));if(ow&&E.z0&&M.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=M.x/M.w;u.y=M.y/M.w;u.z=M.z;u.rotation=N.rotation.z;u.scale.x=N.scale.x*Math.abs(u.x-(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)); +b.uvs[1]=N.geometry.uvs[v][1];b.uvs[2]=N.geometry.uvs[v][3]}o.push(b);q++;r=l[q]=l[q]||new THREE.RenderableFace3;r.v1.positionWorld.copy(I.positionWorld);r.v2.positionWorld.copy(Q.positionWorld);r.v3.positionWorld.copy(U.positionWorld);r.v1.positionScreen.copy(I.positionScreen);r.v2.positionScreen.copy(Q.positionScreen);r.v3.positionScreen.copy(U.positionScreen);r.normalWorld.copy(b.normalWorld);r.centroidWorld.copy(b.centroidWorld);r.centroidScreen.copy(b.centroidScreen);r.z=r.centroidScreen.z;r.meshMaterials= +J;r.faceMaterials=C.materials;r.overdraw=B;if(N.geometry.uvs[v]){r.uvs[0]=N.geometry.uvs[v][1];r.uvs[1]=N.geometry.uvs[v][2];r.uvs[2]=N.geometry.uvs[v][3]}o.push(r);q++}}}}else if(N instanceof THREE.Line){T.multiply(s,V);O=N.geometry.vertices;C=O[0];C.positionScreen.copy(C.position);T.multiplyVector4(C.positionScreen);v=1;for(D=O.length;v0&&M.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=M.x/M.w;u.y=M.y/M.w;u.z=M.z;u.rotation=N.rotation.z;u.scale.x=N.scale.x*Math.abs(u.x-(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)); u.scale.y=N.scale.y*Math.abs(u.y-(M.y+j.projectionMatrix.n22)/(M.w+j.projectionMatrix.n24));u.materials=N.materials;o.push(u);x++}}}}k&&o.sort(a);return o};this.unprojectVector=function(e,j){var k=THREE.Matrix4.makeInvert(j.matrix);k.multiplySelf(THREE.Matrix4.makeInvert(j.projectionMatrix));k.multiplyVector3(e);return e}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,h,b;this.domElement=document.createElement("div");this.setSize=function(q,r){d=q;f=r;h=d/2;b=f/2};this.render=function(q,r){var l,p,z,y,u,x,H,K;a=c.projectScene(q,r);l=0;for(p=a.length;l0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($>0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}}}function Na(A,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending); -var F,P,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;P=X.scale.x*r;$=X.scale.y*l;S=P*ha;F=$*ia;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(R.instersects(C)){p.save();p.translate(A.x,A.y);p.rotate(-X.rotation);p.scale(P,-$);p.translate(-ha,-ia);p.drawImage(da,0,0);p.restore()}}}else if(S instanceof THREE.ParticleCircleMaterial){if(Q){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;o.r=S.color.r*U.r;o.g=S.color.g*U.g; -o.b=S.color.b*U.b;o.updateStyleString()}else o.__styleString=S.color.__styleString;S=X.scale.x*r;F=X.scale.y*l;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(R.instersects(C)){P=o.__styleString;if(K!=P)p.fillStyle=K=P;p.save();p.translate(A.x,A.y);p.rotate(-X.rotation);p.scale(S,F);p.beginPath();p.arc(0,0,1,0,za,true);p.closePath();p.fill();p.restore()}}}}function Oa(A,X,S,F){if(F.opacity!=0){a(F.opacity);c(F.blending);p.beginPath();p.moveTo(A.positionScreen.x,A.positionScreen.y);p.lineTo(X.positionScreen.x,X.positionScreen.y); -p.closePath();if(F instanceof THREE.LineBasicMaterial){o.__styleString=F.color.__styleString;A=F.linewidth;if(M!=A)p.lineWidth=M=A;A=o.__styleString;if(H!=A)p.strokeStyle=H=A;p.stroke();C.inflate(F.linewidth*2)}}}function Ja(A,X,S,F,P,$){if(P.opacity!=0){a(P.opacity);c(P.blending);g=A.positionScreen.x;m=A.positionScreen.y;i=X.positionScreen.x;e=X.positionScreen.y;j=S.positionScreen.x;k=S.positionScreen.y;p.beginPath();p.moveTo(g,m);p.lineTo(i,e);p.lineTo(j,k);p.lineTo(g,m);p.closePath();if(P instanceof -THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&wa(g,m,i,e,j,k,P.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(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=la.matrix;Z.copy(F.vertexNormalsWorld[0]);L=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;N=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5; -W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[2]);J=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(g,m,i,e,j,k,P.env_map.image,L,N,V,W,J,B)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof THREE.UVMapping&&wa(g,m,i,e,j,k,P.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(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){w.r=n.r=t.r=Y.r;w.g=n.g=t.g=Y.g;w.b=n.b=t.b=Y.b;Aa($,F.v1.positionWorld,F.vertexNormalsWorld[0],w);Aa($,F.v2.positionWorld,F.vertexNormalsWorld[1],n);Aa($,F.v3.positionWorld,F.vertexNormalsWorld[2],t);v.r=(n.r+t.r)*0.5;v.g=(n.g+t.g)*0.5;v.b=(n.b+t.b)*0.5;I=Ka(w,n,t,v);wa(g,m,i,e,j,k,I,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,F.centroidWorld,F.normalWorld,U);o.r=P.color.r*U.r;o.g= -P.color.g*U.g;o.b=P.color.b*U.b;o.updateStyleString();P.wireframe?Ba(o.__styleString,P.wireframe_linewidth):Ca(o.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){D=la.near;E=la.far;w.r=w.g=w.b=1-Fa(A.positionScreen.z,D,E);n.r=n.g=n.b=1-Fa(X.positionScreen.z,D,E);t.r=t.g=t.b=1-Fa(S.positionScreen.z,D,E);v.r=(n.r+t.r)*0.5;v.g=(n.g+t.g)*0.5;v.b=(n.b+t.b)*0.5;I=Ka(w,n,t,v);wa(g,m,i,e,j,k,I,0,0,1,0,0, -1)}else if(P instanceof THREE.MeshNormalMaterial){o.r=Ga(F.normalWorld.x);o.g=Ga(F.normalWorld.y);o.b=Ga(F.normalWorld.z);o.updateStyleString();P.wireframe?Ba(o.__styleString,P.wireframe_linewidth):Ca(o.__styleString)}}}function Ba(A,X){if(H!=A)p.strokeStyle=H=A;if(M!=X)p.lineWidth=M=X;p.stroke();C.inflate(X*2)}function Ca(A){if(K!=A)p.fillStyle=K=A;p.fill()}function wa(A,X,S,F,P,$,da,ha,ia,ra,ja,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ja*=ta;sa*=ua;xa*=ta;S-=A;F-=X;P-= -A;$-=X;ra-=ha;ja-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ja);ua=(xa*S-ja*P)*ta;ja=(xa*F-ja*$)*ta;S=(ra*P-sa*S)*ta;F=(ra*$-sa*F)*ta;A=A-ua*ha-S*ia;X=X-ja*ha-F*ia;p.save();p.transform(ua,ja,S,F,A,X);p.clip();p.drawImage(da,0,0);p.restore()}function Ka(A,X,S,F){var P=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255),ra=~~(S.g*255);S=~~(S.b*255);var ja=~~(F.r*255),sa=~~(F.g*255);F=~~(F.b*255);ga[0]=P<0?0:P>255?255:P;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0: -A>255?255:A;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ja<0?0:ja>255?255:ja;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=F<0?0:F>255?255:F;oa.putImageData(ka,0,0);ea.drawImage(na,0,0);return pa}function Fa(A,X,S){A=(A-X)/(S-X);return A*A*(3-2*A)}function Ga(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A,X){var S=X.x-A.x,F=X.y-A.y,P=1/Math.sqrt(S*S+F*F);S*=P;F*=P;X.x+=S;X.y+=F;A.x-=S;A.y-= -F}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():p.setTransform(1,0,0,-1,r,l);d=f.projectScene(ca,la,this.sortElements);(Q=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}else if(B instanceof THREE.PointLight){k.sub(B.position,N.centroidWorld);k.normalize();R=N.normalWorld.dot(k)*B.intensity;if(R>0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}}}function c(L,N,V,W,J,B){t=f(v++);t.setAttribute("d","M "+L.positionScreen.x+ -" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(T){g.r=m.r;g.g=m.g;g.b=m.b;a(B,W,g);G.r=J.color.r*g.r;G.g=J.color.g*g.g;G.b=J.color.b*g.b;G.updateStyleString()}else G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){j=1-J.__2near/(J.__farPlusNear-W.z*J.__farMinusNear); -G.setRGB(j,j,j)}else J instanceof THREE.MeshNormalMaterial&&G.setRGB(h(W.normalWorld.x),h(W.normalWorld.y),h(W.normalWorld.z));J.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+J.opacity);r.appendChild(t)}function d(L,N,V,W,J,B,R){t=f(v++);t.setAttribute("d", -"M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){g.r=m.r;g.g=m.g;g.b=m.b;a(R,J,g);G.r=B.color.r*g.r;G.g=B.color.g*g.g;G.b=B.color.b*g.b;G.updateStyleString()}else G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){j= -1-B.__2near/(B.__farPlusNear-J.z*B.__farMinusNear);G.setRGB(j,j,j)}else B instanceof THREE.MeshNormalMaterial&&G.setRGB(h(J.normalWorld.x),h(J.normalWorld.y),h(J.normalWorld.z));B.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(t)} -function f(L){if(o[L]==null){o[L]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&o[L].setAttribute("shape-rendering","crispEdges");return o[L]}return o[L]}function h(L){return L<0?Math.min((1+L)*0.5,0.5):0.5+Math.min(L*0.5,0.5)}var b=null,q=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,p,z,y,u,x,H,K,M=new THREE.Rectangle,s=new THREE.Rectangle,T=false,G=new THREE.Color(16777215),g=new THREE.Color(16777215),m=new THREE.Color(0),i=new THREE.Color(0), -e=new THREE.Color(0),j,k=new THREE.Vector3,o=[],w=[],n=[],t,v,D,E,I=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(L){switch(L){case "high":I=1;break;case "low":I=0}};this.setSize=function(L,N){l=L;p=N;z=l/2;y=p/2;r.setAttribute("viewBox",-z+" "+-y+" "+l+" "+p);r.setAttribute("width",l);r.setAttribute("height",p);M.set(-z,-y,z,y)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(L,N){var V,W, -J,B,R,O,C,Q;this.autoClear&&this.clear();b=q.projectScene(L,N,this.sortElements);E=D=v=0;if(T=L.lights.length>0){C=L.lights;m.setRGB(0,0,0);i.setRGB(0,0,0);e.setRGB(0,0,0);V=0;for(W=C.length;V0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($> +0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}}}function Na(A,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending);var F,P,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;P=X.scale.x*q;$=X.scale.y*l;S=P*ha;F=$*ia;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(R.instersects(C)){p.save();p.translate(A.x,A.y);p.rotate(-X.rotation);p.scale(P,-$);p.translate(-ha,-ia);p.drawImage(da,0,0);p.restore()}}}else if(S instanceof THREE.ParticleCircleMaterial){if(Q){U.r= +Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;o.r=S.color.r*U.r;o.g=S.color.g*U.g;o.b=S.color.b*U.b;o.updateStyleString()}else o.__styleString=S.color.__styleString;S=X.scale.x*q;F=X.scale.y*l;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(R.instersects(C)){P=o.__styleString;if(K!=P)p.fillStyle=K=P;p.save();p.translate(A.x,A.y);p.rotate(-X.rotation);p.scale(S,F);p.beginPath();p.arc(0,0,1,0,za,true);p.closePath();p.fill();p.restore()}}}}function Oa(A,X,S,F){if(F.opacity!=0){a(F.opacity);c(F.blending);p.beginPath(); +p.moveTo(A.positionScreen.x,A.positionScreen.y);p.lineTo(X.positionScreen.x,X.positionScreen.y);p.closePath();if(F instanceof THREE.LineBasicMaterial){o.__styleString=F.color.__styleString;A=F.linewidth;if(M!=A)p.lineWidth=M=A;A=o.__styleString;if(H!=A)p.strokeStyle=H=A;p.stroke();C.inflate(F.linewidth*2)}}}function Ja(A,X,S,F,P,$){if(P.opacity!=0){a(P.opacity);c(P.blending);f=A.positionScreen.x;m=A.positionScreen.y;i=X.positionScreen.x;e=X.positionScreen.y;j=S.positionScreen.x;k=S.positionScreen.y; +p.beginPath();p.moveTo(f,m);p.lineTo(i,e);p.lineTo(j,k);p.lineTo(f,m);p.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&wa(f,m,i,e,j,k,P.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(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=ja.matrix;Z.copy(F.vertexNormalsWorld[0]);L=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;N=-(Z.x*A.n21+Z.y* +A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[2]);J=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(f,m,i,e,j,k,P.env_map.image,L,N,V,W,J,B)}}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof THREE.UVMapping&& +wa(f,m,i,e,j,k,P.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(Q)if(!P.wireframe&&P.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){w.r=n.r=t.r=Y.r;w.g=n.g=t.g=Y.g;w.b=n.b=t.b=Y.b;Aa($,F.v1.positionWorld,F.vertexNormalsWorld[0],w);Aa($,F.v2.positionWorld,F.vertexNormalsWorld[1],n);Aa($,F.v3.positionWorld,F.vertexNormalsWorld[2],t);v.r=(n.r+t.r)*0.5;v.g=(n.g+t.g)*0.5;v.b=(n.b+t.b)*0.5;I=Ka(w,n,t,v);wa(f,m,i,e,j,k,I,0,0,1, +0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,F.centroidWorld,F.normalWorld,U);o.r=P.color.r*U.r;o.g=P.color.g*U.g;o.b=P.color.b*U.b;o.updateStyleString();P.wireframe?Ba(o.__styleString,P.wireframe_linewidth):Ca(o.__styleString)}else P.wireframe?Ba(P.color.__styleString,P.wireframe_linewidth):Ca(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){D=ja.near;E=ja.far;w.r=w.g=w.b=1-Fa(A.positionScreen.z,D,E);n.r=n.g=n.b=1-Fa(X.positionScreen.z,D,E);t.r=t.g=t.b=1-Fa(S.positionScreen.z,D,E); +v.r=(n.r+t.r)*0.5;v.g=(n.g+t.g)*0.5;v.b=(n.b+t.b)*0.5;I=Ka(w,n,t,v);wa(f,m,i,e,j,k,I,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){o.r=Ga(F.normalWorld.x);o.g=Ga(F.normalWorld.y);o.b=Ga(F.normalWorld.z);o.updateStyleString();P.wireframe?Ba(o.__styleString,P.wireframe_linewidth):Ca(o.__styleString)}}}function Ba(A,X){if(H!=A)p.strokeStyle=H=A;if(M!=X)p.lineWidth=M=X;p.stroke();C.inflate(X*2)}function Ca(A){if(K!=A)p.fillStyle=K=A;p.fill()}function wa(A,X,S,F,P,$,da,ha,ia,ra,ka,sa,xa){var ua, +ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ka*=ta;sa*=ua;xa*=ta;S-=A;F-=X;P-=A;$-=X;ra-=ha;ka-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ka);ua=(xa*S-ka*P)*ta;ka=(xa*F-ka*$)*ta;S=(ra*P-sa*S)*ta;F=(ra*$-sa*F)*ta;A=A-ua*ha-S*ia;X=X-ka*ha-F*ia;p.save();p.transform(ua,ka,S,F,A,X);p.clip();p.drawImage(da,0,0);p.restore()}function Ka(A,X,S,F){var P=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255),ra=~~(S.g*255);S=~~(S.b*255);var ka=~~(F.r*255),sa= +~~(F.g*255);F=~~(F.b*255);ga[0]=P<0?0:P>255?255:P;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0:A>255?255:A;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ka<0?0:ka>255?255:ka;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=F<0?0:F>255?255:F;oa.putImageData(la,0,0);ea.drawImage(na,0,0);return pa}function Fa(A,X,S){A=(A-X)/(S-X);return A*A*(3-2*A)}function Ga(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A, +X){var S=X.x-A.x,F=X.y-A.y,P=1/Math.sqrt(S*S+F*F);S*=P;F*=P;X.x+=S;X.y+=F;A.x-=S;A.y-=F}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():p.setTransform(1,0,0,-1,q,l);d=g.projectScene(ca,ja,this.sortElements);(Q=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}else if(B instanceof THREE.PointLight){k.sub(B.position,N.centroidWorld);k.normalize();R=N.normalWorld.dot(k)*B.intensity;if(R>0){V.r+=B.color.r*R;V.g+=B.color.g*R;V.b+=B.color.b*R}}}}function c(L,N,V,W,J,B){t=g(v++);t.setAttribute("d","M "+L.positionScreen.x+ +" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(T){f.r=m.r;f.g=m.g;f.b=m.b;a(B,W,f);G.r=J.color.r*f.r;G.g=J.color.g*f.g;G.b=J.color.b*f.b;G.updateStyleString()}else G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){j=1-J.__2near/(J.__farPlusNear-W.z*J.__farMinusNear); +G.setRGB(j,j,j)}else J instanceof THREE.MeshNormalMaterial&&G.setRGB(h(W.normalWorld.x),h(W.normalWorld.y),h(W.normalWorld.z));J.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+J.opacity);q.appendChild(t)}function d(L,N,V,W,J,B,R){t=g(v++);t.setAttribute("d", +"M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){f.r=m.r;f.g=m.g;f.b=m.b;a(R,J,f);G.r=B.color.r*f.r;G.g=B.color.g*f.g;G.b=B.color.b*f.b;G.updateStyleString()}else G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){j= +1-B.__2near/(B.__farPlusNear-J.z*B.__farMinusNear);G.setRGB(j,j,j)}else B instanceof THREE.MeshNormalMaterial&&G.setRGB(h(J.normalWorld.x),h(J.normalWorld.y),h(J.normalWorld.z));B.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+B.opacity);q.appendChild(t)} +function g(L){if(o[L]==null){o[L]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&o[L].setAttribute("shape-rendering","crispEdges");return o[L]}return o[L]}function h(L){return L<0?Math.min((1+L)*0.5,0.5):0.5+Math.min(L*0.5,0.5)}var b=null,r=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,p,z,y,u,x,H,K,M=new THREE.Rectangle,s=new THREE.Rectangle,T=false,G=new THREE.Color(16777215),f=new THREE.Color(16777215),m=new THREE.Color(0),i=new THREE.Color(0), +e=new THREE.Color(0),j,k=new THREE.Vector3,o=[],w=[],n=[],t,v,D,E,I=1;this.domElement=q;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(L){switch(L){case "high":I=1;break;case "low":I=0}};this.setSize=function(L,N){l=L;p=N;z=l/2;y=p/2;q.setAttribute("viewBox",-z+" "+-y+" "+l+" "+p);q.setAttribute("width",l);q.setAttribute("height",p);M.set(-z,-y,z,y)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(L,N){var V,W, +J,B,R,O,C,Q;this.autoClear&&this.clear();b=r.projectScene(L,N,this.sortElements);E=D=v=0;if(T=L.lights.length>0){C=L.lights;m.setRGB(0,0,0);i.setRGB(0,0,0);e.setRGB(0,0,0);V=0;for(W=C.length;V0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,C,i)}if(ka&&V>0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Q,i)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,i)}};this.setLineBuffers=function(g,m){var i,e,j,k=g.vertices,o=k.length,w=g.__vertexArray,n=g.__lineArray,t= -g.__dirtyElements;if(g.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+k.maxDirLights,"#define MAX_POINT_LIGHTS "+k.maxPointLights,k.map?"#define USE_MAP":"",k.env_map?"#define USE_ENVMAP": -"",k.light_map?"#define USE_LIGHTMAP":"",k.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(i,d("fragment",j+n));b.attachShader(i,d("vertex",k+m));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={};g.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(e in g.uniforms)i.push(e);e=g.program;n=0;for(m=i.length;n0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,C,i)}if(la&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Q,i)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,i)}};this.setLineBuffers=function(f,m){var i,e,j,k=f.vertices, +o=k.length,w=f.__vertexArray,n=f.__lineArray,t=f.__dirtyElements;if(f.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+k.maxDirLights,"#define MAX_POINT_LIGHTS "+k.maxPointLights,k.map?"#define USE_MAP":"", +k.env_map?"#define USE_ENVMAP":"",k.light_map?"#define USE_LIGHTMAP":"",k.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(i,d("fragment",j+n));b.attachShader(i,d("vertex",k+m));b.linkProgram(i); +b.getProgramParameter(i,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(e in f.uniforms)i.push(e);e=f.program;n=0;for(m=i.length;n=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.vertexAttribPointer(g.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.color)}if(g.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.vertexAttribPointer(g.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.normal)}if(g.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);b.vertexAttribPointer(g.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.tangent)}if(g.uv>= -0)if(j.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.vertexAttribPointer(g.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.uv)}else b.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(j.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.vertexAttribPointer(g.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.uv2)}else b.disableVertexAttribArray(g.uv2);if(e.wireframe||e instanceof THREE.LineBasicMaterial){g=e.wireframe_linewidth!==undefined?e.wireframe_linewidth: -e.linewidth!==undefined?e.linewidth:1;e=e instanceof THREE.LineBasicMaterial&&k.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.drawElements(e,j.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(e instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLParticleBuffer);b.drawElements(b.POINTS,j.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.drawElements(b.TRIANGLES, -j.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(g,m,i,e,j,k,o){var w,n,t,v,D;t=0;for(v=e.materials.length;t=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.vertexAttribPointer(f.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.color)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.normal)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.tangent)}if(f.uv>= +0)if(j.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,j.__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(j.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(e.wireframe||e instanceof THREE.LineBasicMaterial){f=e.wireframe_linewidth!==undefined?e.wireframe_linewidth: +e.linewidth!==undefined?e.linewidth:1;e=e instanceof THREE.LineBasicMaterial&&k.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.drawElements(e,j.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(e instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLParticleBuffer);b.drawElements(b.POINTS,j.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.drawElements(b.TRIANGLES, +j.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,m,i,e,j,k,o){var w,n,t,v,D;t=0;for(v=e.materials.length;t=0;i--){e=g.__webGLObjects[i].object;m==e&&g.__webGLObjects.splice(i,1)}};this.setupMatrices=function(g,m){l.multiply(m.matrix,g.matrix);y.set(l.flatten());p=THREE.Matrix4.makeInvert3x3(l).transpose();x.set(p.m);H.set(g.matrix.flatten())};this.loadMatrices=function(g){b.uniformMatrix4fv(g.uniforms.viewMatrix,false,z);b.uniformMatrix4fv(g.uniforms.modelViewMatrix, -false,y);b.uniformMatrix4fv(g.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(g.uniforms.normalMatrix,false,x);b.uniformMatrix4fv(g.uniforms.objectMatrix,false,H)};this.loadCamera=function(g,m){b.uniform3f(g.uniforms.cameraPosition,m.position.x,m.position.y,m.position.z)};this.setBlending=function(g){switch(g){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(g,m){if(g){!m||m=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(g=="back")b.cullFace(b.BACK);else g=="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}}; +false;n.__dirtyElements=false}else o instanceof THREE.MarchingCubes&&e(v,0,o)}};this.removeObject=function(f,m){var i,e;for(i=f.__webGLObjects.length-1;i>=0;i--){e=f.__webGLObjects[i].object;m==e&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f,m){l.multiply(m.matrix,f.matrix);y.set(l.flatten());p=THREE.Matrix4.makeInvert3x3(l).transpose();x.set(p.m);H.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,z);b.uniformMatrix4fv(f.uniforms.modelViewMatrix, +false,y);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,x);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,H)};this.loadCamera=function(f,m){b.uniform3f(f.uniforms.cameraPosition,m.position.x,m.position.y,m.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD); +b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,m){if(f){!m||m=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index b8f79f8b..725faad4 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -1,66 +1,66 @@ // 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 f,h,b,q,r,l;if(d==0)f=h=b=0;else{q=Math.floor(a*6);r=a*6-q;a=d*(1-c);l=d*(1-c*r);c=d*(1-c*(1-r));switch(q){case 1:f=l;h=d;b=a;break;case 2:f=a;h=d;b=c;break;case 3:f=a;h=l;b=d;break;case 4:f=c;h=a;b=d;break;case 5:f=d;h=a;b=l;break;case 6:case 0:f=d;h=c;b=a}}this.r=f;this.g=h;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,h,b,r,q,l;if(d==0)g=h=b=0;else{r=Math.floor(a*6);q=a*6-r;a=d*(1-c);l=d*(1-c*q);c=d*(1-c*(1-q));switch(r){case 1:g=l;h=d;b=a;break;case 2:g=a;h=d;b=c;break;case 3:g=a;h=l;b=d;break;case 4:g=c;h=a;b=d;break;case 5:g=d;h=a;b=l;break;case 6:case 0:g=d;h=c;b=a}}this.r=g;this.g=h;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0}; THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, -cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,f=this.z;this.x=d*a.z-f*a.y;this.y=f*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= +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,g=this.z;this.x=d*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/= a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x= -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,c,d,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1}; -THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; +THREE.Vector4=function(a,c,d,g){this.x=a||0;this.y=c||0;this.z=d||0;this.w=g||1}; +THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;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,f=a.objects,h=[];a=0;for(c=f.length;a0&&M>0&&n+M<1}var d,f,h,b,q,r,l,m,z,y, -u,x=a.geometry,H=x.vertices,K=[];d=0;for(f=x.faces.length;dl?f:l;h=h>m? -h:m}a()};this.add3Points=function(l,m,z,y,u,x){if(r){r=false;c=lz?l>u?l:u:z>u?z:u;h=m>y?m>x?m:x:y>x?y:x}else{c=lz?l>u?l>f?l:f:u>f?u:f:z>u?z>f?z:f:u>f?u:f;h=m>y?m>x?m>h?m:h:x>h?x:h:y>x?y>h?y:h:x>h?x:h}a()};this.addRectangle=function(l){if(r){r=false;c=l.getLeft();d=l.getTop();f=l.getRight();h=l.getBottom()}else{c=cl.getRight()?f:l.getRight();h=h>l.getBottom()?h:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;f+=l;h+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();f=f=0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){r=true;h=f=d=c=0;a()};this.isEmpty=function(){return r};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+h+", width: "+b+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,f,h,b,q,r,l,m,z,y,u,x,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=h||0;this.n22=b||1;this.n23=q||0;this.n24=r||0;this.n31=l||0;this.n32=m||0;this.n33=z||1;this.n34=y||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=K||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,f,h,b,q,r,l,m,z,y,u,x,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=h;this.n22=b;this.n23=q;this.n24=r;this.n31=l;this.n32=m;this.n33=z;this.n34=y;this.n41=u;this.n42=x;this.n43=H;this.n44=K;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= -a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();f.cross(d,b).normalize();h.cross(b,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); -this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,h=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23* -f+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*f+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,f=a.n12,h=a.n13,b=a.n14,q=a.n21,r=a.n22,l=a.n23,m=a.n24,z=a.n31, -y=a.n32,u=a.n33,x=a.n34,H=a.n41,K=a.n42,M=a.n43,s=a.n44,T=c.n11,G=c.n12,g=c.n13,n=c.n14,i=c.n21,e=c.n22,j=c.n23,k=c.n24,p=c.n31,w=c.n32,o=c.n33,t=c.n34,v=c.n41,D=c.n42,E=c.n43,I=c.n44;this.n11=d*T+f*i+h*p+b*v;this.n12=d*G+f*e+h*w+b*D;this.n13=d*g+f*j+h*o+b*E;this.n14=d*n+f*k+h*t+b*I;this.n21=q*T+r*i+l*p+m*v;this.n22=q*G+r*e+l*w+m*D;this.n23=q*g+r*j+l*o+m*E;this.n24=q*n+r*k+l*t+m*I;this.n31=z*T+y*i+u*p+x*v;this.n32=z*G+y*e+u*w+x*D;this.n33=z*g+y*j+u*o+x*E;this.n34=z*n+y*k+u*t+x*I;this.n41=H*T+K*i+ -M*p+s*v;this.n42=H*G+K*e+M*w+s*D;this.n43=H*g+K*j+M*o+s*E;this.n44=H*n+K*k+M*t+s*I;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,h=this.n14,b=this.n21,q=this.n22,r=this.n23,l=this.n24,m=this.n31,z=this.n32,y=this.n33,u=this.n34,x=this.n41,H=this.n42,K=this.n43,M=this.n44,s=a.n11,T=a.n21,G=a.n31,g=a.n41,n=a.n12,i=a.n22,e=a.n32,j=a.n42,k=a.n13,p=a.n23,w=a.n33,o=a.n43,t=a.n14,v=a.n24,D=a.n34;a=a.n44;this.n11=c*s+d*T+f*G+h*g;this.n12=c*n+d*i+f*e+h*j;this.n13=c*k+d*p+f*w+h* -o;this.n14=c*t+d*v+f*D+h*a;this.n21=b*s+q*T+r*G+l*g;this.n22=b*n+q*i+r*e+l*j;this.n23=b*k+q*p+r*w+l*o;this.n24=b*t+q*v+r*D+l*a;this.n31=m*s+z*T+y*G+u*g;this.n32=m*n+z*i+y*e+u*j;this.n33=m*k+z*p+y*w+u*o;this.n34=m*t+z*v+y*D+u*a;this.n41=x*s+H*T+K*G+M*g;this.n42=x*n+H*i+K*e+M*j;this.n43=x*k+H*p+K*w+M*o;this.n44=x*t+H*v+K*D+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,d=this.n13,f=this.n14,h=this.n21,b=this.n22,q=this.n23,r=this.n24,l=this.n31,m=this.n32,z=this.n33,y=this.n34,u=this.n41,x=this.n42,H=this.n43,K=this.n44;return f*q*m*u-d*r*m*u-f*b*z*u+c*r*z*u+d*b*y*u-c*q*y*u-f*q*l*x+d*r*l*x+f*h*z*x-a*r*z*x-d*h*y*x+a*q*y*x+f*b*l*H-c*r*l*H-f*h*m*H+a*r*m*H+c*h*y*H-a*b*y*H-d*b*l*K+c*q*l*K+d*h*m*K-a*q*m*K-c*h*z*K+a*b*z*K},transpose:function(){function a(c,d, -f){var h=c[d];c[d]=c[f];c[f]=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,g=a.objects,h=[];a=0;for(c=g.length;a0&&M>0&&n+M<1}var d,g,h,b,r,q,l,m,z,y, +u,x=a.geometry,H=x.vertices,K=[];d=0;for(g=x.faces.length;dl?g:l;h=h>m? +h:m}a()};this.add3Points=function(l,m,z,y,u,x){if(q){q=false;c=lz?l>u?l:u:z>u?z:u;h=m>y?m>x?m:x:y>x?y:x}else{c=lz?l>u?l>g?l:g:u>g?u:g:z>u?z>g?z:g:u>g?u:g;h=m>y?m>x?m>h?m:h:x>h?x:h:y>x?y>h?y:h:x>h?x:h}a()};this.addRectangle=function(l){if(q){q=false;c=l.getLeft();d=l.getTop();g=l.getRight();h=l.getBottom()}else{c=cl.getRight()?g:l.getRight();h=h>l.getBottom()?h:l.getBottom()}a()};this.inflate=function(l){c-=l;d-=l;g+=l;h+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();d=d>l.getTop()?d:l.getTop();g=g=0&&Math.min(h,l.getBottom())-Math.max(d,l.getTop())>=0};this.empty=function(){q=true;h=g=d=c=0;a()};this.isEmpty=function(){return q};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+d+", bottom: "+h+", width: "+b+", height: "+r+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,g,h,b,r,q,l,m,z,y,u,x,H,K){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=g||0;this.n21=h||0;this.n22=b||1;this.n23=r||0;this.n24=q||0;this.n31=l||0;this.n32=m||0;this.n33=z||1;this.n34=y||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=K||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,g,h,b,r,q,l,m,z,y,u,x,H,K){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=h;this.n22=b;this.n23=r;this.n24=q;this.n31=l;this.n32=m;this.n33=z;this.n34=y;this.n41=u;this.n42=x;this.n43=H;this.n44=K;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();g.cross(d,b).normalize();h.cross(b,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a); +this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,h=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*g+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*h;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23* +g+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*g+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,g=a.n12,h=a.n13,b=a.n14,r=a.n21,q=a.n22,l=a.n23,m=a.n24,z=a.n31, +y=a.n32,u=a.n33,x=a.n34,H=a.n41,K=a.n42,M=a.n43,s=a.n44,T=c.n11,G=c.n12,f=c.n13,n=c.n14,i=c.n21,e=c.n22,j=c.n23,k=c.n24,p=c.n31,w=c.n32,o=c.n33,t=c.n34,v=c.n41,D=c.n42,E=c.n43,I=c.n44;this.n11=d*T+g*i+h*p+b*v;this.n12=d*G+g*e+h*w+b*D;this.n13=d*f+g*j+h*o+b*E;this.n14=d*n+g*k+h*t+b*I;this.n21=r*T+q*i+l*p+m*v;this.n22=r*G+q*e+l*w+m*D;this.n23=r*f+q*j+l*o+m*E;this.n24=r*n+q*k+l*t+m*I;this.n31=z*T+y*i+u*p+x*v;this.n32=z*G+y*e+u*w+x*D;this.n33=z*f+y*j+u*o+x*E;this.n34=z*n+y*k+u*t+x*I;this.n41=H*T+K*i+ +M*p+s*v;this.n42=H*G+K*e+M*w+s*D;this.n43=H*f+K*j+M*o+s*E;this.n44=H*n+K*k+M*t+s*I;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,g=this.n13,h=this.n14,b=this.n21,r=this.n22,q=this.n23,l=this.n24,m=this.n31,z=this.n32,y=this.n33,u=this.n34,x=this.n41,H=this.n42,K=this.n43,M=this.n44,s=a.n11,T=a.n21,G=a.n31,f=a.n41,n=a.n12,i=a.n22,e=a.n32,j=a.n42,k=a.n13,p=a.n23,w=a.n33,o=a.n43,t=a.n14,v=a.n24,D=a.n34;a=a.n44;this.n11=c*s+d*T+g*G+h*f;this.n12=c*n+d*i+g*e+h*j;this.n13=c*k+d*p+g*w+h* +o;this.n14=c*t+d*v+g*D+h*a;this.n21=b*s+r*T+q*G+l*f;this.n22=b*n+r*i+q*e+l*j;this.n23=b*k+r*p+q*w+l*o;this.n24=b*t+r*v+q*D+l*a;this.n31=m*s+z*T+y*G+u*f;this.n32=m*n+z*i+y*e+u*j;this.n33=m*k+z*p+y*w+u*o;this.n34=m*t+z*v+y*D+u*a;this.n41=x*s+H*T+K*G+M*f;this.n42=x*n+H*i+K*e+M*j;this.n43=x*k+H*p+K*w+M*o;this.n44=x*t+H*v+K*D+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,d=this.n13,g=this.n14,h=this.n21,b=this.n22,r=this.n23,q=this.n24,l=this.n31,m=this.n32,z=this.n33,y=this.n34,u=this.n41,x=this.n42,H=this.n43,K=this.n44;return g*r*m*u-d*q*m*u-g*b*z*u+c*q*z*u+d*b*y*u-c*r*y*u-g*r*l*x+d*q*l*x+g*h*z*x-a*q*z*x-d*h*y*x+a*r*y*x+g*b*l*H-c*q*l*H-g*h*m*H+a*q*m*H+c*h*y*H-a*b*y*H-d*b*l*K+c*r*l*K+d*h*m*K-a*r*m*K-c*h*z*K+a*b*z*K},transpose:function(){function a(c,d, +g){var h=c[d];c[d]=c[g];c[g]=h}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),f=Math.sin(c),h=1-d,b=a.x,q=a.y,r=a.z,l=h*b,m=h*q;this.set(l*b+d,l*q-f*r,l*r+f*q,0,l*q+f*r,m*q+d,m*r-f*b,0,l*r-f*q,m*r+f*b,h*r*r+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ -this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; +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),g=Math.sin(c),h=1-d,b=a.x,r=a.y,q=a.z,l=h*b,m=h*r;this.set(l*b+d,l*r-g*q,l*q+g*r,0,l*r+g*q,m*r+d,m*q-g*b,0,l*q-g*r,m*q+g*b,h*q*q+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 g=new THREE.Matrix4;g.setTranslation(a,c,d);return g};THREE.Matrix4.scaleMatrix=function(a,c,d){var g=new THREE.Matrix4;g.setScale(a,c,d);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 d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,f=a.n13,h=a.n14,b=a.n21,q=a.n22,r=a.n23,l=a.n24,m=a.n31,z=a.n32,y=a.n33,u=a.n34,x=a.n41,H=a.n42,K=a.n43,M=a.n44,s=new THREE.Matrix4;s.n11=r*u*H-l*y*H+l*z*K-q*u*K-r*z*M+q*y*M;s.n12=h*y*H-f*u*H-h*z*K+d*u*K+f*z*M-d*y*M;s.n13=f*l*H-h*r*H+h*q*K-d*l*K-f*q*M+d*r*M;s.n14=h*r*z-f*l*z-h*q*y+d*l*y+f*q*u-d*r*u;s.n21=l*y*x-r*u*x-l*m*K+b*u*K+r*m*M-b*y*M;s.n22=f*u*x-h*y*x+h*m*K-c*u*K-f*m*M+c*y*M;s.n23=h*r*x-f*l*x-h*b*K+c*l*K+f*b*M-c*r*M;s.n24=f*l*m-h*r*m+ -h*b*y-c*l*y-f*b*u+c*r*u;s.n31=q*u*x-l*z*x+l*m*H-b*u*H-q*m*M+b*z*M;s.n32=h*z*x-d*u*x-h*m*H+c*u*H+d*m*M-c*z*M;s.n33=f*l*x-h*q*x+h*b*H-c*l*H-d*b*M+c*q*M;s.n34=h*q*m-d*l*m-h*b*z+c*l*z+d*b*u-c*q*u;s.n41=r*z*x-q*y*x-r*m*H+b*y*H+q*m*K-b*z*K;s.n42=d*y*x-f*z*x+f*m*H-c*y*H-d*m*K+c*z*K;s.n43=f*q*x-d*r*x-f*b*H+c*r*H+d*b*K-c*q*K;s.n44=d*r*m-f*q*m+f*b*z-c*r*z-d*b*y+c*q*y;s.multiplyScalar(1/a.determinant());return s}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,f=c[10]*c[5]-c[6]*c[9],h=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],q=-c[10]*c[4]+c[6]*c[8],r=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],z=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*f+c[1]*q+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*f;d[1]=c*h;d[2]=c*b;d[3]=c*q;d[4]=c*r;d[5]=c*l;d[6]=c*m;d[7]=c*z;d[8]=c*y;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,f,h,b){var q,r,l;q=new THREE.Matrix4;r=2*h/(c-a);l=2*h/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(b+h)/(b-h);h=-2*b*h/(b-h);q.n11=r;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=d;q.n24=0;q.n31=0;q.n32=0;q.n33=f;q.n34=h;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,d,f){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,f)}; -THREE.Matrix4.makeOrtho=function(a,c,d,f,h,b){var q,r,l,m;q=new THREE.Matrix4;r=c-a;l=d-f;m=b-h;a=(c+a)/r;d=(d+f)/l;h=(b+h)/m;q.n11=2/r;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-d;q.n31=0;q.n32=0;q.n33=-2/m;q.n34=-h;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,g=a.n13,h=a.n14,b=a.n21,r=a.n22,q=a.n23,l=a.n24,m=a.n31,z=a.n32,y=a.n33,u=a.n34,x=a.n41,H=a.n42,K=a.n43,M=a.n44,s=new THREE.Matrix4;s.n11=q*u*H-l*y*H+l*z*K-r*u*K-q*z*M+r*y*M;s.n12=h*y*H-g*u*H-h*z*K+d*u*K+g*z*M-d*y*M;s.n13=g*l*H-h*q*H+h*r*K-d*l*K-g*r*M+d*q*M;s.n14=h*q*z-g*l*z-h*r*y+d*l*y+g*r*u-d*q*u;s.n21=l*y*x-q*u*x-l*m*K+b*u*K+q*m*M-b*y*M;s.n22=g*u*x-h*y*x+h*m*K-c*u*K-g*m*M+c*y*M;s.n23=h*q*x-g*l*x-h*b*K+c*l*K+g*b*M-c*q*M;s.n24=g*l*m-h*q*m+ +h*b*y-c*l*y-g*b*u+c*q*u;s.n31=r*u*x-l*z*x+l*m*H-b*u*H-r*m*M+b*z*M;s.n32=h*z*x-d*u*x-h*m*H+c*u*H+d*m*M-c*z*M;s.n33=g*l*x-h*r*x+h*b*H-c*l*H-d*b*M+c*r*M;s.n34=h*r*m-d*l*m-h*b*z+c*l*z+d*b*u-c*r*u;s.n41=q*z*x-r*y*x-q*m*H+b*y*H+r*m*K-b*z*K;s.n42=d*y*x-g*z*x+g*m*H-c*y*H-d*m*K+c*z*K;s.n43=g*r*x-d*q*x-g*b*H+c*q*H+d*b*K-c*r*K;s.n44=d*q*m-g*r*m+g*b*z-c*q*z-d*b*y+c*r*y;s.multiplyScalar(1/a.determinant());return s}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,g=c[10]*c[5]-c[6]*c[9],h=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],r=-c[10]*c[4]+c[6]*c[8],q=c[10]*c[0]-c[2]*c[8],l=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],z=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*g+c[1]*r+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*g;d[1]=c*h;d[2]=c*b;d[3]=c*r;d[4]=c*q;d[5]=c*l;d[6]=c*m;d[7]=c*z;d[8]=c*y;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,g,h,b){var r,q,l;r=new THREE.Matrix4;q=2*h/(c-a);l=2*h/(g-d);a=(c+a)/(c-a);d=(g+d)/(g-d);g=-(b+h)/(b-h);h=-2*b*h/(b-h);r.n11=q;r.n12=0;r.n13=a;r.n14=0;r.n21=0;r.n22=l;r.n23=d;r.n24=0;r.n31=0;r.n32=0;r.n33=g;r.n34=h;r.n41=0;r.n42=0;r.n43=-1;r.n44=0;return r};THREE.Matrix4.makePerspective=function(a,c,d,g){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,g)}; +THREE.Matrix4.makeOrtho=function(a,c,d,g,h,b){var r,q,l,m;r=new THREE.Matrix4;q=c-a;l=d-g;m=b-h;a=(c+a)/q;d=(d+g)/l;h=(b+h)/m;r.n11=2/q;r.n12=0;r.n13=0;r.n14=-a;r.n21=0;r.n22=2/l;r.n23=0;r.n24=-d;r.n31=0;r.n32=0;r.n33=-2/m;r.n34=-h;r.n41=0;r.n42=0;r.n43=0;r.n44=1;return r};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; -THREE.Face3=function(a,c,d,f,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=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,f,h,b){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; +THREE.Face3=function(a,c,d,g,h){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];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,g,h,b){this.a=a;this.b=c;this.c=d;this.d=g;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false}; THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,g,h,b,r,q=new THREE.Vector3,l=new THREE.Vector3;g=0;for(h=this.vertices.length;g0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z -this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[r].counter+=1;l=m[r].hash+"_"+m[r].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(f);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[q].counter+=1;l=m[q].hash+"_"+m[q].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:r,vertices:0}}this.geometryChunks[l].faces.push(g);this.geometryChunks[l].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; -THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(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)}; +THREE.Camera=function(a,c,d,g){this.fov=a;this.aspect=c;this.near=d;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(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light; THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true}; -THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){f.setRotY(c.y);this.rotationMatrix.multiplySelf(f)}if(c.z!=0){f.setRotZ(c.z);this.rotationMatrix.multiplySelf(f)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){f.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(f)}}};THREE.Object3DCounter={value:0}; +THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=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(d.x!=0||d.y!=0||d.z!=0){g.setScale(d.x,d.y,d.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.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; @@ -90,111 +90,111 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=this.opacity=1;this.vertex_colors=false;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
color: "+this.color+"
map: "+this.map+"
opacity: "+this.opacity+"
size: "+this.size+"
blending: "+this.blending+"
vertex_colors: "+this.vertex_colors+"
)"}}; THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,f,h,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; +THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,g,h,b){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=g!==undefined?g:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=b!==undefined?b:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType}; -var Uniforms={clone:function(a){var c,d,f,h={};for(c in a){h[c]={};for(d in a[c]){f=a[c][d];h[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var c,d,f,h={};for(c=0;c=0&&o>=0&&t>=0&&v>=0)return true;else if(w<0&&o<0||t<0&&v<0)return false;else{if(w<0)k=Math.max(k,w/(w-o));else if(o<0)p=Math.min(p,w/(w-o));if(t<0)k=Math.max(k,t/(t-v));else if(v<0)p=Math.min(p,t/(t-v));if(p=0&&o>=0&&t>=0&&v>=0)return true;else if(w<0&&o<0||t<0&&v<0)return false;else{if(w<0)k=Math.max(k,w/(w-o));else if(o<0)p=Math.min(p,w/(w-o));if(t<0)k=Math.max(k,t/(t-v));else if(v<0)p=Math.min(p,t/(t-v));if(pw&&E.z0&&M.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=M.x/M.w;u.y=M.y/M.w;u.z=M.z;u.rotation=N.rotation.z;u.scale.x=N.scale.x*Math.abs(u.x-(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)); +b.uvs[1]=N.geometry.uvs[v][1];b.uvs[2]=N.geometry.uvs[v][3]}p.push(b);q++;r=l[q]=l[q]||new THREE.RenderableFace3;r.v1.positionWorld.copy(I.positionWorld);r.v2.positionWorld.copy(R.positionWorld);r.v3.positionWorld.copy(U.positionWorld);r.v1.positionScreen.copy(I.positionScreen);r.v2.positionScreen.copy(R.positionScreen);r.v3.positionScreen.copy(U.positionScreen);r.normalWorld.copy(b.normalWorld);r.centroidWorld.copy(b.centroidWorld);r.centroidScreen.copy(b.centroidScreen);r.z=r.centroidScreen.z;r.meshMaterials= +J;r.faceMaterials=C.materials;r.overdraw=B;if(N.geometry.uvs[v]){r.uvs[0]=N.geometry.uvs[v][1];r.uvs[1]=N.geometry.uvs[v][2];r.uvs[2]=N.geometry.uvs[v][3]}p.push(r);q++}}}}else if(N instanceof THREE.Line){T.multiply(s,V);O=N.geometry.vertices;C=O[0];C.positionScreen.copy(C.position);T.multiplyVector4(C.positionScreen);v=1;for(D=O.length;v0&&M.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=M.x/M.w;u.y=M.y/M.w;u.z=M.z;u.rotation=N.rotation.z;u.scale.x=N.scale.x*Math.abs(u.x-(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)); u.scale.y=N.scale.y*Math.abs(u.y-(M.y+j.projectionMatrix.n22)/(M.w+j.projectionMatrix.n24));u.materials=N.materials;p.push(u);x++}}}}k&&p.sort(a);return p};this.unprojectVector=function(e,j){var k=THREE.Matrix4.makeInvert(j.matrix);k.multiplySelf(THREE.Matrix4.makeInvert(j.projectionMatrix));k.multiplyVector3(e);return e}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,h,b;this.domElement=document.createElement("div");this.setSize=function(q,r){d=q;f=r;h=d/2;b=f/2};this.render=function(q,r){var l,m,z,y,u,x,H,K;a=c.projectScene(q,r);l=0;for(m=a.length;l0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($>0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}}}function Na(A,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending); -var F,Q,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;Q=X.scale.x*r;$=X.scale.y*l;S=Q*ha;F=$*ia;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(!P.instersects(C))return;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(Q,-$);m.translate(-ha,-ia);m.drawImage(da,0,0);m.restore()}m.beginPath();m.moveTo(A.x-10,A.y);m.lineTo(A.x+10,A.y);m.moveTo(A.x,A.y-10);m.lineTo(A.x,A.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)"; -m.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(R){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;p.r=S.color.r*U.r;p.g=S.color.g*U.g;p.b=S.color.b*U.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;S=X.scale.x*r;F=X.scale.y*l;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(P.instersects(C)){Q=p.__styleString;if(K!=Q)m.fillStyle=K=Q;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(S,F);m.beginPath();m.arc(0,0,1,0,za,true);m.closePath();m.fill();m.restore()}}}} -function Oa(A,X,S,F){if(F.opacity!=0){a(F.opacity);c(F.blending);m.beginPath();m.moveTo(A.positionScreen.x,A.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(F instanceof THREE.LineBasicMaterial){p.__styleString=F.color.__styleString;A=F.linewidth;if(M!=A)m.lineWidth=M=A;A=p.__styleString;if(H!=A)m.strokeStyle=H=A;m.stroke();C.inflate(F.linewidth*2)}}}function Ja(A,X,S,F,Q,$){if(Q.opacity!=0){a(Q.opacity);c(Q.blending);g=A.positionScreen.x;n=A.positionScreen.y;i= -X.positionScreen.x;e=X.positionScreen.y;j=S.positionScreen.x;k=S.positionScreen.y;m.beginPath();m.moveTo(g,n);m.lineTo(i,e);m.lineTo(j,k);m.lineTo(g,n);m.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&wa(g,n,i,e,j,k,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){A=la.matrix;Z.copy(F.vertexNormalsWorld[0]); -L=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;N=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[2]);J=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(g,n,i,e,j,k,Q.env_map.image,L,N,V,W,J,B)}}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&& -!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&wa(g,n,i,e,j,k,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(R)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){w.r=o.r=t.r=Y.r;w.g=o.g=t.g=Y.g;w.b=o.b=t.b=Y.b;Aa($,F.v1.positionWorld,F.vertexNormalsWorld[0],w);Aa($,F.v2.positionWorld,F.vertexNormalsWorld[1],o);Aa($,F.v3.positionWorld,F.vertexNormalsWorld[2],t);v.r=(o.r+t.r)*0.5;v.g=(o.g+t.g)*0.5; -v.b=(o.b+t.b)*0.5;I=Ka(w,o,t,v);wa(g,n,i,e,j,k,I,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,F.centroidWorld,F.normalWorld,U);p.r=Q.color.r*U.r;p.g=Q.color.g*U.g;p.b=Q.color.b*U.b;p.updateStyleString();Q.wireframe?Ba(p.__styleString,Q.wireframe_linewidth):Ca(p.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){D=la.near;E=la.far;w.r=w.g=w.b=1-Fa(A.positionScreen.z,D,E);o.r=o.g=o.b=1-Fa(X.positionScreen.z, -D,E);t.r=t.g=t.b=1-Fa(S.positionScreen.z,D,E);v.r=(o.r+t.r)*0.5;v.g=(o.g+t.g)*0.5;v.b=(o.b+t.b)*0.5;I=Ka(w,o,t,v);wa(g,n,i,e,j,k,I,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){p.r=Ga(F.normalWorld.x);p.g=Ga(F.normalWorld.y);p.b=Ga(F.normalWorld.z);p.updateStyleString();Q.wireframe?Ba(p.__styleString,Q.wireframe_linewidth):Ca(p.__styleString)}}}function Ba(A,X){if(H!=A)m.strokeStyle=H=A;if(M!=X)m.lineWidth=M=X;m.stroke();C.inflate(X*2)}function Ca(A){if(K!=A)m.fillStyle=K=A;m.fill()} -function wa(A,X,S,F,Q,$,da,ha,ia,ra,ja,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ja*=ta;sa*=ua;xa*=ta;S-=A;F-=X;Q-=A;$-=X;ra-=ha;ja-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ja);ua=(xa*S-ja*Q)*ta;ja=(xa*F-ja*$)*ta;S=(ra*Q-sa*S)*ta;F=(ra*$-sa*F)*ta;A=A-ua*ha-S*ia;X=X-ja*ha-F*ia;m.save();m.transform(ua,ja,S,F,A,X);m.clip();m.drawImage(da,0,0);m.restore()}function Ka(A,X,S,F){var Q=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255), -ra=~~(S.g*255);S=~~(S.b*255);var ja=~~(F.r*255),sa=~~(F.g*255);F=~~(F.b*255);ga[0]=Q<0?0:Q>255?255:Q;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0:A>255?255:A;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ja<0?0:ja>255?255:ja;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=F<0?0:F>255?255:F;oa.putImageData(ka,0,0);ea.drawImage(na,0,0);return pa}function Fa(A,X,S){A=(A-X)/(S-X);return A*A*(3-2*A)}function Ga(A){A= -(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A,X){var S=X.x-A.x,F=X.y-A.y,Q=1/Math.sqrt(S*S+F*F);S*=Q;F*=Q;X.x+=S;X.y+=F;A.x-=S;A.y-=F}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():m.setTransform(1,0,0,-1,r,l);d=f.projectScene(ca,la,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight());(R=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}else if(B instanceof THREE.PointLight){k.sub(B.position,N.centroidWorld);k.normalize();P=N.normalWorld.dot(k)*B.intensity;if(P>0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}}}function c(L,N,V,W,J,B){t=f(v++);t.setAttribute("d","M "+L.positionScreen.x+ -" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(T){g.r=n.r;g.g=n.g;g.b=n.b;a(B,W,g);G.r=J.color.r*g.r;G.g=J.color.g*g.g;G.b=J.color.b*g.b;G.updateStyleString()}else G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){j=1-J.__2near/(J.__farPlusNear-W.z*J.__farMinusNear); -G.setRGB(j,j,j)}else J instanceof THREE.MeshNormalMaterial&&G.setRGB(h(W.normalWorld.x),h(W.normalWorld.y),h(W.normalWorld.z));J.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+J.opacity);r.appendChild(t)}function d(L,N,V,W,J,B,P){t=f(v++);t.setAttribute("d", -"M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){g.r=n.r;g.g=n.g;g.b=n.b;a(P,J,g);G.r=B.color.r*g.r;G.g=B.color.g*g.g;G.b=B.color.b*g.b;G.updateStyleString()}else G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){j= -1-B.__2near/(B.__farPlusNear-J.z*B.__farMinusNear);G.setRGB(j,j,j)}else B instanceof THREE.MeshNormalMaterial&&G.setRGB(h(J.normalWorld.x),h(J.normalWorld.y),h(J.normalWorld.z));B.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+B.opacity);r.appendChild(t)} -function f(L){if(p[L]==null){p[L]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&p[L].setAttribute("shape-rendering","crispEdges");return p[L]}return p[L]}function h(L){return L<0?Math.min((1+L)*0.5,0.5):0.5+Math.min(L*0.5,0.5)}var b=null,q=new THREE.Projector,r=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,m,z,y,u,x,H,K,M=new THREE.Rectangle,s=new THREE.Rectangle,T=false,G=new THREE.Color(16777215),g=new THREE.Color(16777215),n=new THREE.Color(0),i=new THREE.Color(0), -e=new THREE.Color(0),j,k=new THREE.Vector3,p=[],w=[],o=[],t,v,D,E,I=1;this.domElement=r;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(L){switch(L){case "high":I=1;break;case "low":I=0}};this.setSize=function(L,N){l=L;m=N;z=l/2;y=m/2;r.setAttribute("viewBox",-z+" "+-y+" "+l+" "+m);r.setAttribute("width",l);r.setAttribute("height",m);M.set(-z,-y,z,y)};this.clear=function(){for(;r.childNodes.length>0;)r.removeChild(r.childNodes[0])};this.render=function(L,N){var V,W, -J,B,P,O,C,R;this.autoClear&&this.clear();b=q.projectScene(L,N,this.sortElements);E=D=v=0;if(T=L.lights.length>0){C=L.lights;n.setRGB(0,0,0);i.setRGB(0,0,0);e.setRGB(0,0,0);V=0;for(W=C.length;V0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}else if($ instanceof THREE.PointLight){Z.sub($.position,X);Z.normalize();$=S.dot(Z)*ha;if($> +0){F.r+=da.r*$;F.g+=da.g*$;F.b+=da.b*$}}}}function Na(A,X,S){if(S.opacity!=0){a(S.opacity);c(S.blending);var F,Q,$,da,ha,ia;if(S instanceof THREE.ParticleBasicMaterial){if(S.map&&S.map.image.loaded){da=S.map.image;ha=da.width>>1;ia=da.height>>1;Q=X.scale.x*q;$=X.scale.y*l;S=Q*ha;F=$*ia;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(!P.instersects(C))return;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation);m.scale(Q,-$);m.translate(-ha,-ia);m.drawImage(da,0,0);m.restore()}m.beginPath();m.moveTo(A.x-10,A.y);m.lineTo(A.x+ +10,A.y);m.moveTo(A.x,A.y-10);m.lineTo(A.x,A.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(S instanceof THREE.ParticleCircleMaterial){if(R){U.r=Y.r+fa.r+aa.r;U.g=Y.g+fa.g+aa.g;U.b=Y.b+fa.b+aa.b;p.r=S.color.r*U.r;p.g=S.color.g*U.g;p.b=S.color.b*U.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;S=X.scale.x*q;F=X.scale.y*l;C.set(A.x-S,A.y-F,A.x+S,A.y+F);if(P.instersects(C)){Q=p.__styleString;if(K!=Q)m.fillStyle=K=Q;m.save();m.translate(A.x,A.y);m.rotate(-X.rotation); +m.scale(S,F);m.beginPath();m.arc(0,0,1,0,za,true);m.closePath();m.fill();m.restore()}}}}function Oa(A,X,S,F){if(F.opacity!=0){a(F.opacity);c(F.blending);m.beginPath();m.moveTo(A.positionScreen.x,A.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(F instanceof THREE.LineBasicMaterial){p.__styleString=F.color.__styleString;A=F.linewidth;if(M!=A)m.lineWidth=M=A;A=p.__styleString;if(H!=A)m.strokeStyle=H=A;m.stroke();C.inflate(F.linewidth*2)}}}function Ja(A,X,S,F,Q,$){if(Q.opacity!= +0){a(Q.opacity);c(Q.blending);f=A.positionScreen.x;n=A.positionScreen.y;i=X.positionScreen.x;e=X.positionScreen.y;j=S.positionScreen.x;k=S.positionScreen.y;m.beginPath();m.moveTo(f,n);m.lineTo(i,e);m.lineTo(j,k);m.lineTo(f,n);m.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&wa(f,n,i,e,j,k,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){A=ja.matrix;Z.copy(F.vertexNormalsWorld[0]);L=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;N=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[1]);V=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;W=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;Z.copy(F.vertexNormalsWorld[2]);J=(Z.x*A.n11+Z.y*A.n12+Z.z*A.n13)*0.5+0.5;B=-(Z.x*A.n21+Z.y*A.n22+Z.z*A.n23)*0.5+0.5;wa(f,n,i,e,j,k,Q.env_map.image,L,N,V,W,J,B)}}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth): +Ca(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&wa(f,n,i,e,j,k,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(R)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&F.vertexNormalsWorld.length==3){w.r=o.r=t.r=Y.r;w.g=o.g=t.g=Y.g;w.b=o.b=t.b=Y.b;Aa($,F.v1.positionWorld,F.vertexNormalsWorld[0],w);Aa($,F.v2.positionWorld,F.vertexNormalsWorld[1],o);Aa($, +F.v3.positionWorld,F.vertexNormalsWorld[2],t);v.r=(o.r+t.r)*0.5;v.g=(o.g+t.g)*0.5;v.b=(o.b+t.b)*0.5;I=Ka(w,o,t,v);wa(f,n,i,e,j,k,I,0,0,1,0,0,1)}else{U.r=Y.r;U.g=Y.g;U.b=Y.b;Aa($,F.centroidWorld,F.normalWorld,U);p.r=Q.color.r*U.r;p.g=Q.color.g*U.g;p.b=Q.color.b*U.b;p.updateStyleString();Q.wireframe?Ba(p.__styleString,Q.wireframe_linewidth):Ca(p.__styleString)}else Q.wireframe?Ba(Q.color.__styleString,Q.wireframe_linewidth):Ca(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){D=ja.near; +E=ja.far;w.r=w.g=w.b=1-Fa(A.positionScreen.z,D,E);o.r=o.g=o.b=1-Fa(X.positionScreen.z,D,E);t.r=t.g=t.b=1-Fa(S.positionScreen.z,D,E);v.r=(o.r+t.r)*0.5;v.g=(o.g+t.g)*0.5;v.b=(o.b+t.b)*0.5;I=Ka(w,o,t,v);wa(f,n,i,e,j,k,I,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){p.r=Ga(F.normalWorld.x);p.g=Ga(F.normalWorld.y);p.b=Ga(F.normalWorld.z);p.updateStyleString();Q.wireframe?Ba(p.__styleString,Q.wireframe_linewidth):Ca(p.__styleString)}}}function Ba(A,X){if(H!=A)m.strokeStyle=H=A;if(M!=X)m.lineWidth= +M=X;m.stroke();C.inflate(X*2)}function Ca(A){if(K!=A)m.fillStyle=K=A;m.fill()}function wa(A,X,S,F,Q,$,da,ha,ia,ra,ka,sa,xa){var ua,ta;ua=da.width-1;ta=da.height-1;ha*=ua;ia*=ta;ra*=ua;ka*=ta;sa*=ua;xa*=ta;S-=A;F-=X;Q-=A;$-=X;ra-=ha;ka-=ia;sa-=ha;xa-=ia;ta=1/(ra*xa-sa*ka);ua=(xa*S-ka*Q)*ta;ka=(xa*F-ka*$)*ta;S=(ra*Q-sa*S)*ta;F=(ra*$-sa*F)*ta;A=A-ua*ha-S*ia;X=X-ka*ha-F*ia;m.save();m.transform(ua,ka,S,F,A,X);m.clip();m.drawImage(da,0,0);m.restore()}function Ka(A,X,S,F){var Q=~~(A.r*255),$=~~(A.g*255); +A=~~(A.b*255);var da=~~(X.r*255),ha=~~(X.g*255);X=~~(X.b*255);var ia=~~(S.r*255),ra=~~(S.g*255);S=~~(S.b*255);var ka=~~(F.r*255),sa=~~(F.g*255);F=~~(F.b*255);ga[0]=Q<0?0:Q>255?255:Q;ga[1]=$<0?0:$>255?255:$;ga[2]=A<0?0:A>255?255:A;ga[4]=da<0?0:da>255?255:da;ga[5]=ha<0?0:ha>255?255:ha;ga[6]=X<0?0:X>255?255:X;ga[8]=ia<0?0:ia>255?255:ia;ga[9]=ra<0?0:ra>255?255:ra;ga[10]=S<0?0:S>255?255:S;ga[12]=ka<0?0:ka>255?255:ka;ga[13]=sa<0?0:sa>255?255:sa;ga[14]=F<0?0:F>255?255:F;oa.putImageData(la,0,0);ea.drawImage(na, +0,0);return pa}function Fa(A,X,S){A=(A-X)/(S-X);return A*A*(3-2*A)}function Ga(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ha(A,X){var S=X.x-A.x,F=X.y-A.y,Q=1/Math.sqrt(S*S+F*F);S*=Q;F*=Q;X.x+=S;X.y+=F;A.x-=S;A.y-=F}var Da,La,ba,ma,va,Ia,Ma,ya;this.autoClear?this.clear():m.setTransform(1,0,0,-1,q,l);d=g.projectScene(ca,ja,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight());(R=ca.lights.length>0)&&Ea(ca);Da=0;for(La=d.length;Da0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}else if(B instanceof THREE.PointLight){k.sub(B.position,N.centroidWorld);k.normalize();P=N.normalWorld.dot(k)*B.intensity;if(P>0){V.r+=B.color.r*P;V.g+=B.color.g*P;V.b+=B.color.b*P}}}}function c(L,N,V,W,J,B){t=g(v++);t.setAttribute("d","M "+L.positionScreen.x+ +" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(J instanceof THREE.MeshBasicMaterial)G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshLambertMaterial)if(T){f.r=n.r;f.g=n.g;f.b=n.b;a(B,W,f);G.r=J.color.r*f.r;G.g=J.color.g*f.g;G.b=J.color.b*f.b;G.updateStyleString()}else G.__styleString=J.color.__styleString;else if(J instanceof THREE.MeshDepthMaterial){j=1-J.__2near/(J.__farPlusNear-W.z*J.__farMinusNear); +G.setRGB(j,j,j)}else J instanceof THREE.MeshNormalMaterial&&G.setRGB(h(W.normalWorld.x),h(W.normalWorld.y),h(W.normalWorld.z));J.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+J.wireframe_linewidth+"; stroke-opacity: "+J.opacity+"; stroke-linecap: "+J.wireframe_linecap+"; stroke-linejoin: "+J.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+J.opacity);q.appendChild(t)}function d(L,N,V,W,J,B,P){t=g(v++);t.setAttribute("d", +"M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(T){f.r=n.r;f.g=n.g;f.b=n.b;a(P,J,f);G.r=B.color.r*f.r;G.g=B.color.g*f.g;G.b=B.color.b*f.b;G.updateStyleString()}else G.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){j= +1-B.__2near/(B.__farPlusNear-J.z*B.__farMinusNear);G.setRGB(j,j,j)}else B instanceof THREE.MeshNormalMaterial&&G.setRGB(h(J.normalWorld.x),h(J.normalWorld.y),h(J.normalWorld.z));B.wireframe?t.setAttribute("style","fill: none; stroke: "+G.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):t.setAttribute("style","fill: "+G.__styleString+"; fill-opacity: "+B.opacity);q.appendChild(t)} +function g(L){if(p[L]==null){p[L]=document.createElementNS("http://www.w3.org/2000/svg","path");I==0&&p[L].setAttribute("shape-rendering","crispEdges");return p[L]}return p[L]}function h(L){return L<0?Math.min((1+L)*0.5,0.5):0.5+Math.min(L*0.5,0.5)}var b=null,r=new THREE.Projector,q=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,m,z,y,u,x,H,K,M=new THREE.Rectangle,s=new THREE.Rectangle,T=false,G=new THREE.Color(16777215),f=new THREE.Color(16777215),n=new THREE.Color(0),i=new THREE.Color(0), +e=new THREE.Color(0),j,k=new THREE.Vector3,p=[],w=[],o=[],t,v,D,E,I=1;this.domElement=q;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(L){switch(L){case "high":I=1;break;case "low":I=0}};this.setSize=function(L,N){l=L;m=N;z=l/2;y=m/2;q.setAttribute("viewBox",-z+" "+-y+" "+l+" "+m);q.setAttribute("width",l);q.setAttribute("height",m);M.set(-z,-y,z,y)};this.clear=function(){for(;q.childNodes.length>0;)q.removeChild(q.childNodes[0])};this.render=function(L,N){var V,W, +J,B,P,O,C,R;this.autoClear&&this.clear();b=r.projectScene(L,N,this.sortElements);E=D=v=0;if(T=L.lights.length>0){C=L.lights;n.setRGB(0,0,0);i.setRGB(0,0,0);e.setRGB(0,0,0);V=0;for(W=C.length;V0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,C,i)}if(ka&&V>0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,R,i)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,i)}};this.setLineBuffers=function(g,n){var i,e,j,k=g.vertices,p=k.length,w=g.__vertexArray,o=g.__lineArray,t= -g.__dirtyElements;if(g.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+k.maxDirLights,"#define MAX_POINT_LIGHTS "+k.maxPointLights,k.map?"#define USE_MAP":"",k.env_map?"#define USE_ENVMAP": -"",k.light_map?"#define USE_LIGHTMAP":"",k.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(i,d("fragment",j+o));b.attachShader(i,d("vertex",k+n));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={};g.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(e in g.uniforms)i.push(e);e=g.program;o=0;for(n=i.length;o0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,C,i)}if(la&&V>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,R,i)}if(oa){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,fa,i);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,aa,i)}};this.setLineBuffers=function(f,n){var i,e,j,k=f.vertices, +p=k.length,w=f.__vertexArray,o=f.__lineArray,t=f.__dirtyElements;if(f.__dirtyVertices){for(i=0;i0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+k.maxDirLights,"#define MAX_POINT_LIGHTS "+k.maxPointLights,k.map?"#define USE_MAP":"", +k.env_map?"#define USE_ENVMAP":"",k.light_map?"#define USE_LIGHTMAP":"",k.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(i,d("fragment",j+o));b.attachShader(i,d("vertex",k+n));b.linkProgram(i); +b.getProgramParameter(i,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(i,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(e in f.uniforms)i.push(e);e=f.program;o=0;for(n=i.length;o=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.vertexAttribPointer(g.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.color)}if(g.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.vertexAttribPointer(g.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.normal)}if(g.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);b.vertexAttribPointer(g.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.tangent)}if(g.uv>= -0)if(j.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.vertexAttribPointer(g.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.uv)}else b.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(j.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.vertexAttribPointer(g.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(g.uv2)}else b.disableVertexAttribArray(g.uv2);if(e.wireframe||e instanceof THREE.LineBasicMaterial){g=e.wireframe_linewidth!==undefined?e.wireframe_linewidth: -e.linewidth!==undefined?e.linewidth:1;e=e instanceof THREE.LineBasicMaterial&&k.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(g);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.drawElements(e,j.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(e instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLParticleBuffer);b.drawElements(b.POINTS,j.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.drawElements(b.TRIANGLES, -j.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(g,n,i,e,j,k,p){var w,o,t,v,D;t=0;for(v=e.materials.length;t=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.vertexAttribPointer(f.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.color)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.normal)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.tangent)}if(f.uv>= +0)if(j.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,j.__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(j.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(e.wireframe||e instanceof THREE.LineBasicMaterial){f=e.wireframe_linewidth!==undefined?e.wireframe_linewidth: +e.linewidth!==undefined?e.linewidth:1;e=e instanceof THREE.LineBasicMaterial&&k.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.drawElements(e,j.__webGLLineCount,b.UNSIGNED_SHORT,0)}else if(e instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLParticleBuffer);b.drawElements(b.POINTS,j.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.drawElements(b.TRIANGLES, +j.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,n,i,e,j,k,p){var w,o,t,v,D;t=0;for(v=e.materials.length;t=0;i--){e=g.__webGLObjects[i].object;n==e&&g.__webGLObjects.splice(i,1)}};this.setupMatrices=function(g,n){l.multiply(n.matrix,g.matrix);y.set(l.flatten());m=THREE.Matrix4.makeInvert3x3(l).transpose();x.set(m.m);H.set(g.matrix.flatten())};this.loadMatrices=function(g){b.uniformMatrix4fv(g.uniforms.viewMatrix,false,z);b.uniformMatrix4fv(g.uniforms.modelViewMatrix, -false,y);b.uniformMatrix4fv(g.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(g.uniforms.normalMatrix,false,x);b.uniformMatrix4fv(g.uniforms.objectMatrix,false,H)};this.loadCamera=function(g,n){b.uniform3f(g.uniforms.cameraPosition,n.position.x,n.position.y,n.position.z)};this.setBlending=function(g){switch(g){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(g,n){if(g){!n||n=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(g=="back")b.cullFace(b.BACK);else g=="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}}; +false;o.__dirtyElements=false}else p instanceof THREE.MarchingCubes&&e(v,0,p)}};this.removeObject=function(f,n){var i,e;for(i=f.__webGLObjects.length-1;i>=0;i--){e=f.__webGLObjects[i].object;n==e&&f.__webGLObjects.splice(i,1)}};this.setupMatrices=function(f,n){l.multiply(n.matrix,f.matrix);y.set(l.flatten());m=THREE.Matrix4.makeInvert3x3(l).transpose();x.set(m.m);H.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,z);b.uniformMatrix4fv(f.uniforms.modelViewMatrix, +false,y);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,x);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,H)};this.loadCamera=function(f,n){b.uniform3f(f.uniforms.cameraPosition,n.position.x,n.position.y,n.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD); +b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,n){if(f){!n||n=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index a582fa17..ab54f002 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -1,6 +1,6 @@ // ThreeExtras.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,f,b,g,j,h;if(d==0)e=f=b=0;else{g=Math.floor(a*6);j=a*6-g;a=d*(1-c);h=d*(1-c*j);c=d*(1-c*(1-j));switch(g){case 1:e=h;f=d;b=a;break;case 2:e=a;f=d;b=c;break;case 3:e=a;f=h;b=d;break;case 4:e=c;f=a;b=d;break;case 5:e=d;f=a;b=h;break;case 6:case 0:e=d;f=c;b=a}}this.r=e;this.g=f;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,f,b,h,j,g;if(d==0)e=f=b=0;else{h=Math.floor(a*6);j=a*6-h;a=d*(1-c);g=d*(1-c*j);c=d*(1-c*(1-j));switch(h){case 1:e=g;f=d;b=a;break;case 2:e=a;f=d;b=c;break;case 3:e=a;f=g;b=d;break;case 4:e=c;f=a;b=d;break;case 5:e=d;f=a;b=g;break;case 6:case 0:e=d;f=c;b=a}}this.r=e;this.g=f;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+ this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0}; THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x* @@ -13,47 +13,47 @@ THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1} THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w; return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}}; THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,f=[];a=0;for(c=e.length;a0&&G>0&&v+G<1}var d,e,f,b,g,j,h,m,n,y, -u,o=a.geometry,A=o.vertices,C=[];d=0;for(e=o.faces.length;dh?e:h;f=f>m? -f:m}a()};this.add3Points=function(h,m,n,y,u,o){if(j){j=false;c=hn?h>u?h:u:n>u?n:u;f=m>y?m>o?m:o:y>o?y:o}else{c=hn?h>u?h>e?h:e:u>e?u:e:n>u?n>e?n:e:u>e?u:e;f=m>y?m>o?m>f?m:f:o>f?o:f:y>o?y>f?y:f:o>f?o:f}a()};this.addRectangle=function(h){if(j){j=false;c=h.getLeft();d=h.getTop();e=h.getRight();f=h.getBottom()}else{c=ch.getRight()?e:h.getRight();f=f>h.getBottom()?f:h.getBottom()}a()};this.inflate=function(h){c-=h;d-=h;e+=h;f+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e=0&&Math.min(f,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){j=true;f=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString= -function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+f+", width: "+b+", height: "+g+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; -THREE.Matrix4=function(a,c,d,e,f,b,g,j,h,m,n,y,u,o,A,C){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=b||1;this.n23=g||0;this.n24=j||0;this.n31=h||0;this.n32=m||0;this.n33=n||1;this.n34=y||0;this.n41=u||0;this.n42=o||0;this.n43=A||0;this.n44=C||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,f,b,g,j,h,m,n,y,u,o,A,C){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=b;this.n23=g;this.n24=j;this.n31=h;this.n32=m;this.n33=n;this.n34=y;this.n41=u;this.n42=o;this.n43=A;this.n44=C;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,f=[];a=0;for(c=e.length;a0&&G>0&&v+G<1}var d,e,f,b,h,j,g,m,n,y, +u,o=a.geometry,A=o.vertices,C=[];d=0;for(e=o.faces.length;dg?e:g;f=f>m? +f:m}a()};this.add3Points=function(g,m,n,y,u,o){if(j){j=false;c=gn?g>u?g:u:n>u?n:u;f=m>y?m>o?m:o:y>o?y:o}else{c=gn?g>u?g>e?g:e:u>e?u:e:n>u?n>e?n:e:u>e?u:e;f=m>y?m>o?m>f?m:f:o>f?o:f:y>o?y>f?y:f:o>f?o:f}a()};this.addRectangle=function(g){if(j){j=false;c=g.getLeft();d=g.getTop();e=g.getRight();f=g.getBottom()}else{c=cg.getRight()?e:g.getRight();f=f>g.getBottom()?f:g.getBottom()}a()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;a()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e=0&&Math.min(f,g.getBottom())-Math.max(d,g.getTop())>=0};this.empty=function(){j=true;f=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString= +function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+f+", width: "+b+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}}; +THREE.Matrix4=function(a,c,d,e,f,b,h,j,g,m,n,y,u,o,A,C){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=f||0;this.n22=b||1;this.n23=h||0;this.n24=j||0;this.n31=g||0;this.n32=m||0;this.n33=n||1;this.n34=y||0;this.n41=u||0;this.n42=o||0;this.n43=A||0;this.n44=C||1;this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,f,b,h,j,g,m,n,y,u,o,A,C){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=b;this.n23=h;this.n24=j;this.n31=g;this.n32=m;this.n33=n;this.n34=y;this.n41=u;this.n42=o;this.n43=A;this.n44=C;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();f.cross(b,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a); this.n31=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23* -e+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,f=a.n13,b=a.n14,g=a.n21,j=a.n22,h=a.n23,m=a.n24,n=a.n31, -y=a.n32,u=a.n33,o=a.n34,A=a.n41,C=a.n42,G=a.n43,w=a.n44,H=c.n11,p=c.n12,l=c.n13,v=c.n14,t=c.n21,k=c.n22,q=c.n23,x=c.n24,z=c.n31,F=c.n32,B=c.n33,D=c.n34,I=c.n41,N=c.n42,O=c.n43,Q=c.n44;this.n11=d*H+e*t+f*z+b*I;this.n12=d*p+e*k+f*F+b*N;this.n13=d*l+e*q+f*B+b*O;this.n14=d*v+e*x+f*D+b*Q;this.n21=g*H+j*t+h*z+m*I;this.n22=g*p+j*k+h*F+m*N;this.n23=g*l+j*q+h*B+m*O;this.n24=g*v+j*x+h*D+m*Q;this.n31=n*H+y*t+u*z+o*I;this.n32=n*p+y*k+u*F+o*N;this.n33=n*l+y*q+u*B+o*O;this.n34=n*v+y*x+u*D+o*Q;this.n41=A*H+C*t+ -G*z+w*I;this.n42=A*p+C*k+G*F+w*N;this.n43=A*l+C*q+G*B+w*O;this.n44=A*v+C*x+G*D+w*Q;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,f=this.n14,b=this.n21,g=this.n22,j=this.n23,h=this.n24,m=this.n31,n=this.n32,y=this.n33,u=this.n34,o=this.n41,A=this.n42,C=this.n43,G=this.n44,w=a.n11,H=a.n21,p=a.n31,l=a.n41,v=a.n12,t=a.n22,k=a.n32,q=a.n42,x=a.n13,z=a.n23,F=a.n33,B=a.n43,D=a.n14,I=a.n24,N=a.n34;a=a.n44;this.n11=c*w+d*H+e*p+f*l;this.n12=c*v+d*t+e*k+f*q;this.n13=c*x+d*z+e*F+f* -B;this.n14=c*D+d*I+e*N+f*a;this.n21=b*w+g*H+j*p+h*l;this.n22=b*v+g*t+j*k+h*q;this.n23=b*x+g*z+j*F+h*B;this.n24=b*D+g*I+j*N+h*a;this.n31=m*w+n*H+y*p+u*l;this.n32=m*v+n*t+y*k+u*q;this.n33=m*x+n*z+y*F+u*B;this.n34=m*D+n*I+y*N+u*a;this.n41=o*w+A*H+C*p+G*l;this.n42=o*v+A*t+C*k+G*q;this.n43=o*x+A*z+C*F+G*B;this.n44=o*D+A*I+C*N+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= -a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,b=this.n22,g=this.n23,j=this.n24,h=this.n31,m=this.n32,n=this.n33,y=this.n34,u=this.n41,o=this.n42,A=this.n43,C=this.n44;return e*g*m*u-d*j*m*u-e*b*n*u+c*j*n*u+d*b*y*u-c*g*y*u-e*g*h*o+d*j*h*o+e*f*n*o-a*j*n*o-d*f*y*o+a*g*y*o+e*b*h*A-c*j*h*A-e*f*m*A+a*j*m*A+c*f*y*A-a*b*y*A-d*b*h*C+c*g*h*C+d*f*m*C-a*g*m*C-c*f*n*C+a*b*n*C},transpose:function(){function a(c,d, +e+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,f=a.n13,b=a.n14,h=a.n21,j=a.n22,g=a.n23,m=a.n24,n=a.n31, +y=a.n32,u=a.n33,o=a.n34,A=a.n41,C=a.n42,G=a.n43,w=a.n44,H=c.n11,p=c.n12,l=c.n13,v=c.n14,t=c.n21,k=c.n22,q=c.n23,x=c.n24,z=c.n31,F=c.n32,B=c.n33,D=c.n34,I=c.n41,N=c.n42,O=c.n43,Q=c.n44;this.n11=d*H+e*t+f*z+b*I;this.n12=d*p+e*k+f*F+b*N;this.n13=d*l+e*q+f*B+b*O;this.n14=d*v+e*x+f*D+b*Q;this.n21=h*H+j*t+g*z+m*I;this.n22=h*p+j*k+g*F+m*N;this.n23=h*l+j*q+g*B+m*O;this.n24=h*v+j*x+g*D+m*Q;this.n31=n*H+y*t+u*z+o*I;this.n32=n*p+y*k+u*F+o*N;this.n33=n*l+y*q+u*B+o*O;this.n34=n*v+y*x+u*D+o*Q;this.n41=A*H+C*t+ +G*z+w*I;this.n42=A*p+C*k+G*F+w*N;this.n43=A*l+C*q+G*B+w*O;this.n44=A*v+C*x+G*D+w*Q;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,f=this.n14,b=this.n21,h=this.n22,j=this.n23,g=this.n24,m=this.n31,n=this.n32,y=this.n33,u=this.n34,o=this.n41,A=this.n42,C=this.n43,G=this.n44,w=a.n11,H=a.n21,p=a.n31,l=a.n41,v=a.n12,t=a.n22,k=a.n32,q=a.n42,x=a.n13,z=a.n23,F=a.n33,B=a.n43,D=a.n14,I=a.n24,N=a.n34;a=a.n44;this.n11=c*w+d*H+e*p+f*l;this.n12=c*v+d*t+e*k+f*q;this.n13=c*x+d*z+e*F+f* +B;this.n14=c*D+d*I+e*N+f*a;this.n21=b*w+h*H+j*p+g*l;this.n22=b*v+h*t+j*k+g*q;this.n23=b*x+h*z+j*F+g*B;this.n24=b*D+h*I+j*N+g*a;this.n31=m*w+n*H+y*p+u*l;this.n32=m*v+n*t+y*k+u*q;this.n33=m*x+n*z+y*F+u*B;this.n34=m*D+n*I+y*N+u*a;this.n41=o*w+A*H+C*p+G*l;this.n42=o*v+A*t+C*k+G*q;this.n43=o*x+A*z+C*F+G*B;this.n44=o*D+A*I+C*N+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*= +a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,b=this.n22,h=this.n23,j=this.n24,g=this.n31,m=this.n32,n=this.n33,y=this.n34,u=this.n41,o=this.n42,A=this.n43,C=this.n44;return e*h*m*u-d*j*m*u-e*b*n*u+c*j*n*u+d*b*y*u-c*h*y*u-e*h*g*o+d*j*g*o+e*f*n*o-a*j*n*o-d*f*y*o+a*h*y*o+e*b*g*A-c*j*g*A-e*f*m*A+a*j*m*A+c*f*y*A-a*b*y*A-d*b*g*C+c*h*g*C+d*f*m*C-a*h*m*C-c*f*n*C+a*b*n*C},transpose:function(){function a(c,d, e){var f=c[d];c[d]=c[e];c[e]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11; a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c= -Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,b=a.x,g=a.y,j=a.z,h=f*b,m=f*g;this.set(h*b+d,h*g-e*j,h*j+e*g,0,h*g+e*j,m*g+d,m*j-e*b,0,h*j-e*g,m*j+e*b,f*j*j+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ +Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,b=a.x,h=a.y,j=a.z,g=f*b,m=f*h;this.set(g*b+d,g*h-e*j,g*j+e*h,0,g*h+e*j,m*h+d,m*j-e*b,0,g*j-e*h,m*j+e*b,f*j*j+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+ this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c}; THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d}; -THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,b=a.n21,g=a.n22,j=a.n23,h=a.n24,m=a.n31,n=a.n32,y=a.n33,u=a.n34,o=a.n41,A=a.n42,C=a.n43,G=a.n44,w=new THREE.Matrix4;w.n11=j*u*A-h*y*A+h*n*C-g*u*C-j*n*G+g*y*G;w.n12=f*y*A-e*u*A-f*n*C+d*u*C+e*n*G-d*y*G;w.n13=e*h*A-f*j*A+f*g*C-d*h*C-e*g*G+d*j*G;w.n14=f*j*n-e*h*n-f*g*y+d*h*y+e*g*u-d*j*u;w.n21=h*y*o-j*u*o-h*m*C+b*u*C+j*m*G-b*y*G;w.n22=e*u*o-f*y*o+f*m*C-c*u*C-e*m*G+c*y*G;w.n23=f*j*o-e*h*o-f*b*C+c*h*C+e*b*G-c*j*G;w.n24=e*h*m-f*j*m+ -f*b*y-c*h*y-e*b*u+c*j*u;w.n31=g*u*o-h*n*o+h*m*A-b*u*A-g*m*G+b*n*G;w.n32=f*n*o-d*u*o-f*m*A+c*u*A+d*m*G-c*n*G;w.n33=e*h*o-f*g*o+f*b*A-c*h*A-d*b*G+c*g*G;w.n34=f*g*m-d*h*m-f*b*n+c*h*n+d*b*u-c*g*u;w.n41=j*n*o-g*y*o-j*m*A+b*y*A+g*m*C-b*n*C;w.n42=d*y*o-e*n*o+e*m*A-c*y*A-d*m*C+c*n*C;w.n43=e*g*o-d*j*o-e*b*A+c*j*A+d*b*C-c*g*C;w.n44=d*j*m-e*g*m+e*b*n-c*j*n-d*b*y+c*g*y;w.multiplyScalar(1/a.determinant());return w}; -THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],g=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],h=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],n=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*g+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*f;d[2]=c*b;d[3]=c*g;d[4]=c*j;d[5]=c*h;d[6]=c*m;d[7]=c*n;d[8]=c*y;return a}; -THREE.Matrix4.makeFrustum=function(a,c,d,e,f,b){var g,j,h;g=new THREE.Matrix4;j=2*f/(c-a);h=2*f/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+f)/(b-f);f=-2*b*f/(b-f);g.n11=j;g.n12=0;g.n13=a;g.n14=0;g.n21=0;g.n22=h;g.n23=d;g.n24=0;g.n31=0;g.n32=0;g.n33=e;g.n34=f;g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,c,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,e)}; -THREE.Matrix4.makeOrtho=function(a,c,d,e,f,b){var g,j,h,m;g=new THREE.Matrix4;j=c-a;h=d-e;m=b-f;a=(c+a)/j;d=(d+e)/h;f=(b+f)/m;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-a;g.n21=0;g.n22=2/h;g.n23=0;g.n24=-d;g.n31=0;g.n32=0;g.n33=-2/m;g.n34=-f;g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,b=a.n21,h=a.n22,j=a.n23,g=a.n24,m=a.n31,n=a.n32,y=a.n33,u=a.n34,o=a.n41,A=a.n42,C=a.n43,G=a.n44,w=new THREE.Matrix4;w.n11=j*u*A-g*y*A+g*n*C-h*u*C-j*n*G+h*y*G;w.n12=f*y*A-e*u*A-f*n*C+d*u*C+e*n*G-d*y*G;w.n13=e*g*A-f*j*A+f*h*C-d*g*C-e*h*G+d*j*G;w.n14=f*j*n-e*g*n-f*h*y+d*g*y+e*h*u-d*j*u;w.n21=g*y*o-j*u*o-g*m*C+b*u*C+j*m*G-b*y*G;w.n22=e*u*o-f*y*o+f*m*C-c*u*C-e*m*G+c*y*G;w.n23=f*j*o-e*g*o-f*b*C+c*g*C+e*b*G-c*j*G;w.n24=e*g*m-f*j*m+ +f*b*y-c*g*y-e*b*u+c*j*u;w.n31=h*u*o-g*n*o+g*m*A-b*u*A-h*m*G+b*n*G;w.n32=f*n*o-d*u*o-f*m*A+c*u*A+d*m*G-c*n*G;w.n33=e*g*o-f*h*o+f*b*A-c*g*A-d*b*G+c*h*G;w.n34=f*h*m-d*g*m-f*b*n+c*g*n+d*b*u-c*h*u;w.n41=j*n*o-h*y*o-j*m*A+b*y*A+h*m*C-b*n*C;w.n42=d*y*o-e*n*o+e*m*A-c*y*A-d*m*C+c*n*C;w.n43=e*h*o-d*j*o-e*b*A+c*j*A+d*b*C-c*h*C;w.n44=d*j*m-e*h*m+e*b*n-c*j*n-d*b*y+c*h*y;w.multiplyScalar(1/a.determinant());return w}; +THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],f=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],h=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],g=-c[6]*c[0]+c[2]*c[4],m=c[9]*c[4]-c[5]*c[8],n=-c[9]*c[0]+c[1]*c[8],y=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*h+c[2]*m;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*f;d[2]=c*b;d[3]=c*h;d[4]=c*j;d[5]=c*g;d[6]=c*m;d[7]=c*n;d[8]=c*y;return a}; +THREE.Matrix4.makeFrustum=function(a,c,d,e,f,b){var h,j,g;h=new THREE.Matrix4;j=2*f/(c-a);g=2*f/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+f)/(b-f);f=-2*b*f/(b-f);h.n11=j;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=g;h.n23=d;h.n24=0;h.n31=0;h.n32=0;h.n33=e;h.n34=f;h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,d,e){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,e)}; +THREE.Matrix4.makeOrtho=function(a,c,d,e,f,b){var h,j,g,m;h=new THREE.Matrix4;j=c-a;g=d-e;m=b-f;a=(c+a)/j;d=(d+e)/g;f=(b+f)/m;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/g;h.n23=0;h.n24=-d;h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-f;h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,c,d,e,f){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; THREE.Face4=function(a,c,d,e,f,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0}; THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.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){m[j].counter+=1;h=m[j].hash+"_"+m[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:g,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ +this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c65535){m[j].counter+=1;g=m[j].hash+"_"+m[j].counter;if(this.geometryChunks[g]==undefined)this.geometryChunks[g]={faces:[],materials:h,vertices:0}}this.geometryChunks[g].faces.push(e);this.geometryChunks[g].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}}; THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)}; this.translateZ=function(f){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(f);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()}; @@ -98,47 +98,47 @@ var Uniforms={clone:function(a){var c,d,e,f={};for(c in a){f[c]={};for(d in a[c] THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){}; THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}}; THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4}; -THREE.Projector=function(){function a(k,q){return q.z-k.z}function c(k,q){var x=0,z=1,F=k.z+k.w,B=q.z+q.w,D=-k.z+k.w,I=-q.z+q.w;if(F>=0&&B>=0&&D>=0&&I>=0)return true;else if(F<0&&B<0||D<0&&I<0)return false;else{if(F<0)x=Math.max(x,F/(F-B));else if(B<0)z=Math.min(z,F/(F-B));if(D<0)x=Math.max(x,D/(D-I));else if(I<0)z=Math.min(z,D/(D-I));if(z=0&&B>=0&&D>=0&&I>=0)return true;else if(F<0&&B<0||D<0&&I<0)return false;else{if(F<0)x=Math.max(x,F/(F-B));else if(B<0)z=Math.min(z,F/(F-B));if(D<0)x=Math.max(x,D/(D-I));else if(I<0)z=Math.min(z,D/(D-I));if(zF&&O.z0&&G.z<1){u=A[o]=A[o]||new THREE.RenderableParticle;u.x=G.x/G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=U.rotation.z;u.scale.x=U.scale.x*Math.abs(u.x-(G.x+q.projectionMatrix.n11)/(G.w+q.projectionMatrix.n14)); u.scale.y=U.scale.y*Math.abs(u.y-(G.y+q.projectionMatrix.n22)/(G.w+q.projectionMatrix.n24));u.materials=U.materials;z.push(u);o++}}}}x&&z.sort(a);return z};this.unprojectVector=function(k,q){var x=THREE.Matrix4.makeInvert(q.matrix);x.multiplySelf(THREE.Matrix4.makeInvert(q.projectionMatrix));x.multiplyVector3(k);return k}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,f,b;this.domElement=document.createElement("div");this.setSize=function(g,j){d=g;e=j;f=d/2;b=e/2};this.render=function(g,j){var h,m,n,y,u,o,A,C;a=c.projectScene(g,j);h=0;for(m=a.length;h0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}else if(ga instanceof THREE.PointLight){J.sub(ga.position,fa);J.normalize();ga=aa.dot(J)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}}}function Qa(M,fa,aa){if(aa.opacity!= -0){a(aa.opacity);c(aa.blending);var R,Y,ga,na,oa,pa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map&&aa.map.image.loaded){na=aa.map.image;oa=na.width>>1;pa=na.height>>1;Y=fa.scale.x*j;ga=fa.scale.y*h;aa=Y*oa;R=ga*pa;P.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(P)){m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(Y,-ga);m.translate(-oa,-pa);m.drawImage(na,0,0);m.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(W){$.r=da.r+ha.r+E.r;$.g=da.g+ha.g+E.g;$.b=da.b+ -ha.b+E.b;z.r=aa.color.r*$.r;z.g=aa.color.g*$.g;z.b=aa.color.b*$.b;z.updateStyleString()}else z.__styleString=aa.color.__styleString;aa=fa.scale.x*j;R=fa.scale.y*h;P.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(P)){Y=z.__styleString;if(C!=Y)m.fillStyle=C=Y;m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(aa,R);m.beginPath();m.arc(0,0,1,0,L,true);m.closePath();m.fill();m.restore()}}}}function Ra(M,fa,aa,R){if(R.opacity!=0){a(R.opacity);c(R.blending);m.beginPath();m.moveTo(M.positionScreen.x, -M.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){z.__styleString=R.color.__styleString;M=R.linewidth;if(G!=M)m.lineWidth=G=M;M=z.__styleString;if(A!=M)m.strokeStyle=A=M;m.stroke();P.inflate(R.linewidth*2)}}}function Ma(M,fa,aa,R,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);l=M.positionScreen.x;v=M.positionScreen.y;t=fa.positionScreen.x;k=fa.positionScreen.y;q=aa.positionScreen.x;x=aa.positionScreen.y;m.beginPath();m.moveTo(l, -v);m.lineTo(t,k);m.lineTo(q,x);m.lineTo(l,v);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(l,v,t,k,q,x,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=sa.matrix;J.copy(R.vertexNormalsWorld[0]);T=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;U=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5; -J.copy(R.vertexNormalsWorld[1]);ba=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;ca=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(R.vertexNormalsWorld[2]);S=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;K=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;Aa(l,v,t,k,q,x,Y.env_map.image,T,U,ba,ca,S,K)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(l,v,t,k,q, -x,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){F.r=B.r=D.r=da.r;F.g=B.g=D.g=da.g;F.b=B.b=D.b=da.b;Da(ga,R.v1.positionWorld,R.vertexNormalsWorld[0],F);Da(ga,R.v2.positionWorld,R.vertexNormalsWorld[1],B);Da(ga,R.v3.positionWorld,R.vertexNormalsWorld[2],D);I.r=(B.r+D.r)*0.5;I.g=(B.g+D.g)*0.5;I.b=(B.b+D.b)*0.5;Q=Na(F,B,D,I);Aa(l,v,t,k,q,x,Q,0,0,1,0,0,1)}else{$.r= -da.r;$.g=da.g;$.b=da.b;Da(ga,R.centroidWorld,R.normalWorld,$);z.r=Y.color.r*$.r;z.g=Y.color.g*$.g;z.b=Y.color.b*$.b;z.updateStyleString();Y.wireframe?Ea(z.__styleString,Y.wireframe_linewidth):Fa(z.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){N=sa.near;O=sa.far;F.r=F.g=F.b=1-Ia(M.positionScreen.z,N,O);B.r=B.g=B.b=1-Ia(fa.positionScreen.z,N,O);D.r=D.g=D.b=1-Ia(aa.positionScreen.z,N,O);I.r=(B.r+ -D.r)*0.5;I.g=(B.g+D.g)*0.5;I.b=(B.b+D.b)*0.5;Q=Na(F,B,D,I);Aa(l,v,t,k,q,x,Q,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){z.r=Ja(R.normalWorld.x);z.g=Ja(R.normalWorld.y);z.b=Ja(R.normalWorld.z);z.updateStyleString();Y.wireframe?Ea(z.__styleString,Y.wireframe_linewidth):Fa(z.__styleString)}}}function Ea(M,fa){if(A!=M)m.strokeStyle=A=M;if(G!=fa)m.lineWidth=G=fa;m.stroke();P.inflate(fa*2)}function Fa(M){if(C!=M)m.fillStyle=C=M;m.fill()}function Aa(M,fa,aa,R,Y,ga,na,oa,pa,va,ra,wa,Ba){var ya, -xa;ya=na.width-1;xa=na.height-1;oa*=ya;pa*=xa;va*=ya;ra*=xa;wa*=ya;Ba*=xa;aa-=M;R-=fa;Y-=M;ga-=fa;va-=oa;ra-=pa;wa-=oa;Ba-=pa;xa=1/(va*Ba-wa*ra);ya=(Ba*aa-ra*Y)*xa;ra=(Ba*R-ra*ga)*xa;aa=(va*Y-wa*aa)*xa;R=(va*ga-wa*R)*xa;M=M-ya*oa-aa*pa;fa=fa-ra*oa-R*pa;m.save();m.transform(ya,ra,aa,R,M,fa);m.clip();m.drawImage(na,0,0);m.restore()}function Na(M,fa,aa,R){var Y=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var na=~~(fa.r*255),oa=~~(fa.g*255);fa=~~(fa.b*255);var pa=~~(aa.r*255),va=~~(aa.g*255);aa=~~(aa.b* -255);var ra=~~(R.r*255),wa=~~(R.g*255);R=~~(R.b*255);ia[0]=Y<0?0:Y>255?255:Y;ia[1]=ga<0?0:ga>255?255:ga;ia[2]=M<0?0:M>255?255:M;ia[4]=na<0?0:na>255?255:na;ia[5]=oa<0?0:oa>255?255:oa;ia[6]=fa<0?0:fa>255?255:fa;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=va<0?0:va>255?255:va;ia[10]=aa<0?0:aa>255?255:aa;ia[12]=ra<0?0:ra>255?255:ra;ia[13]=wa<0?0:wa>255?255:wa;ia[14]=R<0?0:R>255?255:R;ea.putImageData(ja,0,0);la.drawImage(X,0,0);return qa}function Ia(M,fa,aa){M=(M-fa)/(aa-fa);return M*M*(3-2*M)}function Ja(M){M=(M+ -1)*0.5;return M<0?0:M>1?1:M}function Ka(M,fa){var aa=fa.x-M.x,R=fa.y-M.y,Y=1/Math.sqrt(aa*aa+R*R);aa*=Y;R*=Y;fa.x+=aa;fa.y+=R;M.x-=aa;M.y-=R}var Ga,Oa,ka,ta,za,La,Pa,Ca;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,h);d=e.projectScene(ma,sa,this.sortElements);(W=ma.lights.length>0)&&Ha(ma);Ga=0;for(Oa=d.length;Ga0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}else if(ga instanceof THREE.PointLight){J.sub(ga.position,fa);J.normalize(); +ga=aa.dot(J)*oa;if(ga>0){R.r+=na.r*ga;R.g+=na.g*ga;R.b+=na.b*ga}}}}function Qa(M,fa,aa){if(aa.opacity!=0){a(aa.opacity);c(aa.blending);var R,Y,ga,na,oa,pa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map&&aa.map.image.loaded){na=aa.map.image;oa=na.width>>1;pa=na.height>>1;Y=fa.scale.x*j;ga=fa.scale.y*g;aa=Y*oa;R=ga*pa;P.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(P)){m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(Y,-ga);m.translate(-oa,-pa);m.drawImage(na,0,0);m.restore()}}}else if(aa instanceof +THREE.ParticleCircleMaterial){if(W){$.r=da.r+ha.r+E.r;$.g=da.g+ha.g+E.g;$.b=da.b+ha.b+E.b;z.r=aa.color.r*$.r;z.g=aa.color.g*$.g;z.b=aa.color.b*$.b;z.updateStyleString()}else z.__styleString=aa.color.__styleString;aa=fa.scale.x*j;R=fa.scale.y*g;P.set(M.x-aa,M.y-R,M.x+aa,M.y+R);if(Z.instersects(P)){Y=z.__styleString;if(C!=Y)m.fillStyle=C=Y;m.save();m.translate(M.x,M.y);m.rotate(-fa.rotation);m.scale(aa,R);m.beginPath();m.arc(0,0,1,0,L,true);m.closePath();m.fill();m.restore()}}}}function Ra(M,fa,aa, +R){if(R.opacity!=0){a(R.opacity);c(R.blending);m.beginPath();m.moveTo(M.positionScreen.x,M.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){z.__styleString=R.color.__styleString;M=R.linewidth;if(G!=M)m.lineWidth=G=M;M=z.__styleString;if(A!=M)m.strokeStyle=A=M;m.stroke();P.inflate(R.linewidth*2)}}}function Ma(M,fa,aa,R,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);l=M.positionScreen.x;v=M.positionScreen.y;t=fa.positionScreen.x; +k=fa.positionScreen.y;q=aa.positionScreen.x;x=aa.positionScreen.y;m.beginPath();m.moveTo(l,v);m.lineTo(t,k);m.lineTo(q,x);m.lineTo(l,v);m.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(l,v,t,k,q,x,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){M=ra.matrix;J.copy(R.vertexNormalsWorld[0]); +T=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;U=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(R.vertexNormalsWorld[1]);ba=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;ca=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;J.copy(R.vertexNormalsWorld[2]);S=(J.x*M.n11+J.y*M.n12+J.z*M.n13)*0.5+0.5;K=-(J.x*M.n21+J.y*M.n22+J.z*M.n23)*0.5+0.5;Aa(l,v,t,k,q,x,Y.env_map.image,T,U,ba,ca,S,K)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&& +!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(l,v,t,k,q,x,Y.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);c(THREE.SubtractiveBlending)}if(W)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){F.r=B.r=D.r=da.r;F.g=B.g=D.g=da.g;F.b=B.b=D.b=da.b;Da(ga,R.v1.positionWorld,R.vertexNormalsWorld[0],F);Da(ga,R.v2.positionWorld,R.vertexNormalsWorld[1],B);Da(ga,R.v3.positionWorld,R.vertexNormalsWorld[2],D);I.r=(B.r+D.r)*0.5;I.g=(B.g+D.g)* +0.5;I.b=(B.b+D.b)*0.5;Q=Na(F,B,D,I);Aa(l,v,t,k,q,x,Q,0,0,1,0,0,1)}else{$.r=da.r;$.g=da.g;$.b=da.b;Da(ga,R.centroidWorld,R.normalWorld,$);z.r=Y.color.r*$.r;z.g=Y.color.g*$.g;z.b=Y.color.b*$.b;z.updateStyleString();Y.wireframe?Ea(z.__styleString,Y.wireframe_linewidth):Fa(z.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){N=ra.near;O=ra.far;F.r=F.g=F.b=1-Ia(M.positionScreen.z,N,O);B.r=B.g=B.b=1-Ia(fa.positionScreen.z, +N,O);D.r=D.g=D.b=1-Ia(aa.positionScreen.z,N,O);I.r=(B.r+D.r)*0.5;I.g=(B.g+D.g)*0.5;I.b=(B.b+D.b)*0.5;Q=Na(F,B,D,I);Aa(l,v,t,k,q,x,Q,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){z.r=Ja(R.normalWorld.x);z.g=Ja(R.normalWorld.y);z.b=Ja(R.normalWorld.z);z.updateStyleString();Y.wireframe?Ea(z.__styleString,Y.wireframe_linewidth):Fa(z.__styleString)}}}function Ea(M,fa){if(A!=M)m.strokeStyle=A=M;if(G!=fa)m.lineWidth=G=fa;m.stroke();P.inflate(fa*2)}function Fa(M){if(C!=M)m.fillStyle=C=M;m.fill()} +function Aa(M,fa,aa,R,Y,ga,na,oa,pa,va,sa,wa,Ba){var ya,xa;ya=na.width-1;xa=na.height-1;oa*=ya;pa*=xa;va*=ya;sa*=xa;wa*=ya;Ba*=xa;aa-=M;R-=fa;Y-=M;ga-=fa;va-=oa;sa-=pa;wa-=oa;Ba-=pa;xa=1/(va*Ba-wa*sa);ya=(Ba*aa-sa*Y)*xa;sa=(Ba*R-sa*ga)*xa;aa=(va*Y-wa*aa)*xa;R=(va*ga-wa*R)*xa;M=M-ya*oa-aa*pa;fa=fa-sa*oa-R*pa;m.save();m.transform(ya,sa,aa,R,M,fa);m.clip();m.drawImage(na,0,0);m.restore()}function Na(M,fa,aa,R){var Y=~~(M.r*255),ga=~~(M.g*255);M=~~(M.b*255);var na=~~(fa.r*255),oa=~~(fa.g*255);fa=~~(fa.b* +255);var pa=~~(aa.r*255),va=~~(aa.g*255);aa=~~(aa.b*255);var sa=~~(R.r*255),wa=~~(R.g*255);R=~~(R.b*255);ia[0]=Y<0?0:Y>255?255:Y;ia[1]=ga<0?0:ga>255?255:ga;ia[2]=M<0?0:M>255?255:M;ia[4]=na<0?0:na>255?255:na;ia[5]=oa<0?0:oa>255?255:oa;ia[6]=fa<0?0:fa>255?255:fa;ia[8]=pa<0?0:pa>255?255:pa;ia[9]=va<0?0:va>255?255:va;ia[10]=aa<0?0:aa>255?255:aa;ia[12]=sa<0?0:sa>255?255:sa;ia[13]=wa<0?0:wa>255?255:wa;ia[14]=R<0?0:R>255?255:R;ea.putImageData(ja,0,0);ma.drawImage(X,0,0);return qa}function Ia(M,fa,aa){M= +(M-fa)/(aa-fa);return M*M*(3-2*M)}function Ja(M){M=(M+1)*0.5;return M<0?0:M>1?1:M}function Ka(M,fa){var aa=fa.x-M.x,R=fa.y-M.y,Y=1/Math.sqrt(aa*aa+R*R);aa*=Y;R*=Y;fa.x+=aa;fa.y+=R;M.x-=aa;M.y-=R}var Ga,Oa,ka,ta,za,La,Pa,Ca;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,g);d=e.projectScene(la,ra,this.sortElements);(W=la.lights.length>0)&&Ha(la);Ga=0;for(Oa=d.length;Ga0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}else if(K instanceof THREE.PointLight){x.sub(K.position,U.centroidWorld);x.normalize();Z=U.normalWorld.dot(x)*K.intensity;if(Z>0){ba.r+=K.color.r*Z;ba.g+=K.color.g*Z;ba.b+=K.color.b*Z}}}}function c(T,U,ba,ca,S,K){D=e(I++);D.setAttribute("d", "M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)p.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(H){l.r=v.r;l.g=v.g;l.b=v.b;a(K,ca,l);p.r=S.color.r*l.r;p.g=S.color.g*l.g;p.b=S.color.b*l.b;p.updateStyleString()}else p.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){q=1-S.__2near/(S.__farPlusNear- ca.z*S.__farMinusNear);p.setRGB(q,q,q)}else S instanceof THREE.MeshNormalMaterial&&p.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?D.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):D.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+S.opacity);j.appendChild(D)}function d(T,U,ba,ca,S, K,Z){D=e(I++);D.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(K instanceof THREE.MeshBasicMaterial)p.__styleString=K.color.__styleString;else if(K instanceof THREE.MeshLambertMaterial)if(H){l.r=v.r;l.g=v.g;l.b=v.b;a(Z,S,l);p.r=K.color.r*l.r;p.g=K.color.g*l.g;p.b=K.color.b*l.b;p.updateStyleString()}else p.__styleString=K.color.__styleString; else if(K instanceof THREE.MeshDepthMaterial){q=1-K.__2near/(K.__farPlusNear-S.z*K.__farMinusNear);p.setRGB(q,q,q)}else K instanceof THREE.MeshNormalMaterial&&p.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));K.wireframe?D.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+K.wireframe_linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.wireframe_linecap+"; stroke-linejoin: "+K.wireframe_linejoin):D.setAttribute("style","fill: "+p.__styleString+ -"; fill-opacity: "+K.opacity);j.appendChild(D)}function e(T){if(z[T]==null){z[T]=document.createElementNS("http://www.w3.org/2000/svg","path");Q==0&&z[T].setAttribute("shape-rendering","crispEdges");return z[T]}return z[T]}function f(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var b=null,g=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,m,n,y,u,o,A,C,G=new THREE.Rectangle,w=new THREE.Rectangle,H=false,p=new THREE.Color(16777215),l=new THREE.Color(16777215), -v=new THREE.Color(0),t=new THREE.Color(0),k=new THREE.Color(0),q,x=new THREE.Vector3,z=[],F=[],B=[],D,I,N,O,Q=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":Q=1;break;case "low":Q=0}};this.setSize=function(T,U){h=T;m=U;n=h/2;y=m/2;j.setAttribute("viewBox",-n+" "+-y+" "+h+" "+m);j.setAttribute("width",h);j.setAttribute("height",m);G.set(-n,-y,n,y)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])}; -this.render=function(T,U){var ba,ca,S,K,Z,V,P,W;this.autoClear&&this.clear();b=g.projectScene(T,U,this.sortElements);O=N=I=0;if(H=T.lights.length>0){P=T.lights;v.setRGB(0,0,0);t.setRGB(0,0,0);k.setRGB(0,0,0);ba=0;for(ca=P.length;ba0;)j.removeChild(j.childNodes[0])}; +this.render=function(T,U){var ba,ca,S,K,Z,V,P,W;this.autoClear&&this.clear();b=h.projectScene(T,U,this.sortElements);O=N=I=0;if(H=T.lights.length>0){P=T.lights;v.setRGB(0,0,0);t.setRGB(0,0,0);k.setRGB(0,0,0);ba=0;for(ca=P.length;ba0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,P,t)}if(ja&&ba>0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,W,t)}if(ea){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,t);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,E,t)}};this.setLineBuffers= -function(l,v){var t,k,q,x=l.vertices,z=x.length,F=l.__vertexArray,B=l.__lineArray,D=l.__dirtyElements;if(l.__dirtyVertices){for(t=0;t0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+ +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(v.r,v.g,v.b,t)})(w,H,p);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,v){f.width=l;f.height=v;b.viewport(0,0,f.width,f.height)};this.setClearColorHex=function(l,v){var t=new THREE.Color(l);b.clearColor(t.r, +t.g,t.b,v)};this.setClearColor=function(l,v){b.clearColor(l.r,l.g,l.b,v)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(l,v){var t,k,q,x=0,z=0,F=0,B,D,I,N=this.lights,O=N.directional.colors,Q=N.directional.positions,T=N.point.colors,U=N.point.positions,ba=0,ca=0;t=0;for(k=v.length;t0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,P,t)}if(ja&&ba>0){b.bindBuffer(b.ARRAY_BUFFER,l.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,W,t)}if(ea){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ha,t);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER, +E,t)}};this.setLineBuffers=function(l,v){var t,k,q,x=l.vertices,z=x.length,F=l.__vertexArray,B=l.__lineArray,D=l.__dirtyElements;if(l.__dirtyVertices){for(t=0;t0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+x.maxDirLights,"#define MAX_POINT_LIGHTS "+ x.maxPointLights,x.map?"#define USE_MAP":"",x.env_map?"#define USE_ENVMAP":"",x.light_map?"#define USE_LIGHTMAP":"",x.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(t,d("fragment",q+B));b.attachShader(t, d("vertex",x+v));b.linkProgram(t);b.getProgramParameter(t,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(t,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");t.uniforms={};t.attributes={};l.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(k in l.uniforms)t.push(k);k=l.program;B=0;for(v=t.length;B=0;t--){k=l.__webGLObjects[t].object;v==k&&l.__webGLObjects.splice(t,1)}};this.setupMatrices=function(l,v){h.multiply(v.matrix,l.matrix);y.set(h.flatten());m=THREE.Matrix4.makeInvert3x3(h).transpose();o.set(m.m);A.set(l.matrix.flatten())};this.loadMatrices=function(l){b.uniformMatrix4fv(l.uniforms.viewMatrix,false,n);b.uniformMatrix4fv(l.uniforms.modelViewMatrix, +false;B.__dirtyElements=false}else z instanceof THREE.MarchingCubes&&k(I,0,z)}};this.removeObject=function(l,v){var t,k;for(t=l.__webGLObjects.length-1;t>=0;t--){k=l.__webGLObjects[t].object;v==k&&l.__webGLObjects.splice(t,1)}};this.setupMatrices=function(l,v){g.multiply(v.matrix,l.matrix);y.set(g.flatten());m=THREE.Matrix4.makeInvert3x3(g).transpose();o.set(m.m);A.set(l.matrix.flatten())};this.loadMatrices=function(l){b.uniformMatrix4fv(l.uniforms.viewMatrix,false,n);b.uniformMatrix4fv(l.uniforms.modelViewMatrix, false,y);b.uniformMatrix4fv(l.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(l.uniforms.normalMatrix,false,o);b.uniformMatrix4fv(l.uniforms.objectMatrix,false,A)};this.loadCamera=function(l,v){b.uniform3f(l.uniforms.cameraPosition,v.position.x,v.position.y,v.position.z)};this.setBlending=function(l){switch(l){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD); b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(l,v){if(l){!v||v=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(l=="back")b.cullFace(b.BACK);else l=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; 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", @@ -217,17 +217,17 @@ THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"]. "gl_FragColor = mColor * mapColor * vertexColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null}; THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null}; THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; -var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,f=d?c.geometry:c,b=a.vertices,g=f.vertices,j=a.faces,h=f.faces,m=a.uvs;f=f.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var n=0,y=g.length;n25)b=25;f=(b-1)*0.5;d=Array(b);for(c=e=0;c25)b=25;f=(b-1)*0.5;d=Array(b);for(c=e=0;c0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,j,u)))-1);m.push(n)}c.push(m)}var o,A,C;f=c.length;for(d=0;d0)for(e=0;e1){o=this.vertices[g].position.clone(); -A=this.vertices[h].position.clone();C=this.vertices[m].position.clone();o.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(g,h,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([n,y,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; +var Sphere=function(a,c,d){THREE.Geometry.call(this);var e,f=Math.PI,b=Math.max(3,c||8),h=Math.max(2,d||6);c=[];for(d=0;d0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,j,u)))-1);m.push(n)}c.push(m)}var o,A,C;f=c.length;for(d=0;d0)for(e=0;e1){o=this.vertices[h].position.clone(); +A=this.vertices[g].position.clone();C=this.vertices[m].position.clone();o.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,g,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([n,y,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere; var Torus=function(a,c,d,e){this.radius=a||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d= -1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;f=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,b,g));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[b][0],a[b][1]),new THREE.UV(a[g][0],a[g][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,o){var A=Math.sqrt(y*y+u*u+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(y/A,u/A,o/A)))-1}function d(y,u,o,A){A.faces.push(new THREE.Face3(y,u,o))}function e(y,u){var o=f.vertices[y].position,A=f.vertices[u].position;return c((o.x+A.x)/2,(o.y+A.y)/2,(o.z+A.z)/2)}var f=this,b=new THREE.Geometry,g;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0, -1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);d(0,11,5,b);d(0,5,1,b);d(0,1,7,b);d(0,7,10,b);d(0,10,11,b);d(1,5,9,b);d(5,11,4,b);d(11,10,2,b);d(10,7,6,b);d(7,1,8,b);d(3,9,4,b);d(3,4,2,b);d(3,2,6,b);d(3,6,8,b);d(3,8,9,b);d(4,9,5,b);d(2,4,11,b);d(6,2,10,b);d(8,6,7,b);d(9,8,1,b);for(a=0;a=this.maxCount-3&&j(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)h=this.size-1;var u=Math.floor(m-j);if(u<1)u=1;m=Math.floor(m+j);if(m>this.size-1)m=this.size-1;var o=Math.floor(n-j);if(o<1)o=1;j=Math.floor(n+j); -if(j>this.size-1)j=this.size-1;var A,C,G,w,H,p;for(y=y;y0)this.field[G+A]+=w}}}};this.addPlaneX=function(d,e){var f,b,g,j,h,m=this.size,n=this.yd,y=this.zd,u=this.field,o=m*Math.sqrt(d/e);if(o>m)o=m;for(f=0;f0)for(b=0;bn)A=n;for(b=0;b0){h=b*y;for(f=0;fsize)dist=size;for(g=0;g0){h=zd*g;for(b=0;b=this.maxCount-3&&j(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)g=this.size-1;var u=Math.floor(m-j);if(u<1)u=1;m=Math.floor(m+j);if(m>this.size-1)m=this.size-1;var o=Math.floor(n-j);if(o<1)o=1;j=Math.floor(n+j); +if(j>this.size-1)j=this.size-1;var A,C,G,w,H,p;for(y=y;y0)this.field[G+A]+=w}}}};this.addPlaneX=function(d,e){var f,b,h,j,g,m=this.size,n=this.yd,y=this.zd,u=this.field,o=m*Math.sqrt(d/e);if(o>m)o=m;for(f=0;f0)for(b=0;bn)A=n;for(b=0;b0){g=b*y;for(f=0;fsize)dist=size;for(h=0;h0){g=zd*h;for(b=0;b>7)-127;J=(ea&127)<<16|X<<8|J;if(J==0&&ia==-127)return 0;return(1-2*(ja>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ia)}function j(E,L){var J=n(E,L),X=n(E,L+1),ea=n(E,L+2);return(n(E,L+3)<<24)+(ea<<16)+(X<<8)+J}function h(E,L){var J=n(E,L);return(n(E,L+1)<<8)+J}function m(E,L){var J=n(E,L);return J>127?J-256:J}function n(E,L){return E.charCodeAt(L)&255}function y(E){var L, -J,X;L=j(a,E);J=j(a,E+t);X=j(a,E+k);E=h(a,E+q);THREE.Loader.prototype.f3(w,L,J,X,E)}function u(E){var L,J,X,ea,ja,ia;L=j(a,E);J=j(a,E+t);X=j(a,E+k);ea=h(a,E+q);ja=j(a,E+x);ia=j(a,E+z);E=j(a,E+F);THREE.Loader.prototype.f3n(w,l,L,J,X,ea,ja,ia,E)}function o(E){var L,J,X,ea;L=j(a,E);J=j(a,E+B);X=j(a,E+D);ea=j(a,E+I);E=h(a,E+N);THREE.Loader.prototype.f4(w,L,J,X,ea,E)}function A(E){var L,J,X,ea,ja,ia,qa,la;L=j(a,E);J=j(a,E+B);X=j(a,E+D);ea=j(a,E+I);ja=h(a,E+N);ia=j(a,E+O);qa=j(a,E+Q);la=j(a,E+T);E=j(a,E+ -U);THREE.Loader.prototype.f4n(w,l,L,J,X,ea,ja,ia,qa,la,E)}function C(E){var L,J;L=j(a,E);J=j(a,E+ba);E=j(a,E+ca);THREE.Loader.prototype.uv3(w.uvs,v[L*2],v[L*2+1],v[J*2],v[J*2+1],v[E*2],v[E*2+1])}function G(E){var L,J,X;L=j(a,E);J=j(a,E+S);X=j(a,E+K);E=j(a,E+Z);THREE.Loader.prototype.uv4(w.uvs,v[L*2],v[L*2+1],v[J*2],v[J*2+1],v[X*2],v[X*2+1],v[E*2],v[E*2+1])}var w=this,H=0,p,l=[],v=[],t,k,q,x,z,F,B,D,I,N,O,Q,T,U,ba,ca,S,K,Z,V,P,W,$,da,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w, +THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var b=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,d,f,e,b)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,d,e,f,b){var h=new XMLHttpRequest,j=e+"/"+a,g=0; +h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,d,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(b){if(g==0)g=h.getResponseHeader("Content-Length");b({total:g,loaded:h.responseText.length})}}else if(h.readyState==2)g=h.getResponseHeader("Content-Length")};h.open("GET",j,true);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)}, +createBinModel:function(a,c,d,e){var f=function(b){function h(E,L){var J=n(E,L),X=n(E,L+1),ea=n(E,L+2),ja=n(E,L+3),ia=(ja<<1&255|ea>>7)-127;J=(ea&127)<<16|X<<8|J;if(J==0&&ia==-127)return 0;return(1-2*(ja>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,ia)}function j(E,L){var J=n(E,L),X=n(E,L+1),ea=n(E,L+2);return(n(E,L+3)<<24)+(ea<<16)+(X<<8)+J}function g(E,L){var J=n(E,L);return(n(E,L+1)<<8)+J}function m(E,L){var J=n(E,L);return J>127?J-256:J}function n(E,L){return E.charCodeAt(L)&255}function y(E){var L, +J,X;L=j(a,E);J=j(a,E+t);X=j(a,E+k);E=g(a,E+q);THREE.Loader.prototype.f3(w,L,J,X,E)}function u(E){var L,J,X,ea,ja,ia;L=j(a,E);J=j(a,E+t);X=j(a,E+k);ea=g(a,E+q);ja=j(a,E+x);ia=j(a,E+z);E=j(a,E+F);THREE.Loader.prototype.f3n(w,l,L,J,X,ea,ja,ia,E)}function o(E){var L,J,X,ea;L=j(a,E);J=j(a,E+B);X=j(a,E+D);ea=j(a,E+I);E=g(a,E+N);THREE.Loader.prototype.f4(w,L,J,X,ea,E)}function A(E){var L,J,X,ea,ja,ia,qa,ma;L=j(a,E);J=j(a,E+B);X=j(a,E+D);ea=j(a,E+I);ja=g(a,E+N);ia=j(a,E+O);qa=j(a,E+Q);ma=j(a,E+T);E=j(a,E+ +U);THREE.Loader.prototype.f4n(w,l,L,J,X,ea,ja,ia,qa,ma,E)}function C(E){var L,J;L=j(a,E);J=j(a,E+ba);E=j(a,E+ca);THREE.Loader.prototype.uv3(w.uvs,v[L*2],v[L*2+1],v[J*2],v[J*2+1],v[E*2],v[E*2+1])}function G(E){var L,J,X;L=j(a,E);J=j(a,E+S);X=j(a,E+K);E=j(a,E+Z);THREE.Loader.prototype.uv4(w.uvs,v[L*2],v[L*2+1],v[J*2],v[J*2+1],v[X*2],v[X*2+1],v[E*2],v[E*2+1])}var w=this,H=0,p,l=[],v=[],t,k,q,x,z,F,B,D,I,N,O,Q,T,U,ba,ca,S,K,Z,V,P,W,$,da,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w, e,b);p={signature:a.substr(H,8),header_bytes:n(a,H+8),vertex_coordinate_bytes:n(a,H+9),normal_coordinate_bytes:n(a,H+10),uv_coordinate_bytes:n(a,H+11),vertex_index_bytes:n(a,H+12),normal_index_bytes:n(a,H+13),uv_index_bytes:n(a,H+14),material_index_bytes:n(a,H+15),nvertices:j(a,H+16),nnormals:j(a,H+16+4),nuvs:j(a,H+16+8),ntri_flat:j(a,H+16+12),ntri_smooth:j(a,H+16+16),ntri_flat_uv:j(a,H+16+20),ntri_smooth_uv:j(a,H+16+24),nquad_flat:j(a,H+16+28),nquad_smooth:j(a,H+16+32),nquad_flat_uv:j(a,H+16+36), nquad_smooth_uv:j(a,H+16+40)};H+=p.header_bytes;t=p.vertex_index_bytes;k=p.vertex_index_bytes*2;q=p.vertex_index_bytes*3;x=p.vertex_index_bytes*3+p.material_index_bytes;z=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;F=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;B=p.vertex_index_bytes;D=p.vertex_index_bytes*2;I=p.vertex_index_bytes*3;N=p.vertex_index_bytes*4;O=p.vertex_index_bytes*4+p.material_index_bytes;Q=p.vertex_index_bytes*4+p.material_index_bytes+ p.normal_index_bytes;T=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;U=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;ba=p.uv_index_bytes;ca=p.uv_index_bytes*2;S=p.uv_index_bytes;K=p.uv_index_bytes*2;Z=p.uv_index_bytes*3;b=p.vertex_index_bytes*3+p.material_index_bytes;ha=p.vertex_index_bytes*4+p.material_index_bytes;V=p.ntri_flat*b;P=p.ntri_smooth*(b+p.normal_index_bytes*3);W=p.ntri_flat_uv*(b+p.uv_index_bytes*3);$=p.ntri_smooth_uv*(b+p.normal_index_bytes* -3+p.uv_index_bytes*3);da=p.nquad_flat*ha;b=p.nquad_smooth*(ha+p.normal_index_bytes*4);ha=p.nquad_flat_uv*(ha+p.uv_index_bytes*4);H+=function(E){var L,J,X,ea=p.vertex_coordinate_bytes*3,ja=E+p.nvertices*ea;for(E=E;E + diff --git a/src/renderers/CanvasRenderer.js b/src/renderers/CanvasRenderer.js index 0077e351..37479daf 100644 --- a/src/renderers/CanvasRenderer.js +++ b/src/renderers/CanvasRenderer.js @@ -95,7 +95,19 @@ THREE.CanvasRenderer = function () { }; - this.setClearColor = function( hex, opacity ) { + this.setClearColor = function( color, opacity ) { + + _clearColor = color; + _clearOpacity = opacity; + + _clearRect.set( - _canvasWidthHalf, - _canvasHeightHalf, _canvasWidthHalf, _canvasHeightHalf ); + _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf ); + + this.clear(); + + }; + + this.setClearColorHex = function( hex, opacity ) { _clearColor.setHex( hex ); _clearOpacity = opacity; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index 2d62d027..c54a86b9 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -74,13 +74,19 @@ THREE.WebGLRenderer = function ( parameters ) { }; - this.setClearColor = function( hex, alpha ) { + this.setClearColorHex = function( hex, alpha ) { var color = new THREE.Color( hex ); _gl.clearColor( color.r, color.g, color.b, alpha ); }; + this.setClearColor = function( color, alpha ) { + + _gl.clearColor( color.r, color.g, color.b, alpha ); + + }; + this.clear = function () { _gl.clear( _gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT ); diff --git a/src/renderers/WebGLRenderer2.js b/src/renderers/WebGLRenderer2.js index eb595126..ed2eeb52 100644 --- a/src/renderers/WebGLRenderer2.js +++ b/src/renderers/WebGLRenderer2.js @@ -67,9 +67,18 @@ THREE.WebGLRenderer2 = function ( antialias ) { }; - this.setClearColor = function( hex, opacity ) { + this.setClearColor = function( color, opacity ) { - _clearColor = hex.setHex( hex ); + _clearColor = color; + _clearOpacity = opacity; + + _gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearOpacity ); + + }; + + this.setClearColorHex = function( hex, opacity ) { + + _clearColor.setHex( hex ); _clearOpacity = opacity; _gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearOpacity );