diff --git a/build/Three.js b/build/Three.js index c8b68ca1..39d5fb0b 100755 --- a/build/Three.js +++ b/build/Three.js @@ -4,55 +4,52 @@ THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this 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,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.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,b,c){this.x=a||0;this.y=b||0;this.z=c||0;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},set x(e){this.that.x=e;this.isDirty=!0},set y(e){this.that.y=e;this.isDirty=!0},set z(e){this.that.z=e;this.isDirty=!0}};this.api.__proto__=THREE.Vector3.prototype;return this.api}; -THREE.Vector3.prototype={set:function(a,b,c){var e=this.that;e.x=a;e.y=b;e.z=c;this.isDirty=!0;return this},copy:function(a){var b=this.that;b.x=a.x;b.y=a.y;b.z=a.z;this.isDirty=!0;return this},add:function(a,b){var c=this.that;c.x=a.x+b.x;c.y=a.y+b.y;c.z=a.z+b.z;this.isDirty=!0;return this},addSelf:function(a){var b=this.that;b.x+=a.x;b.y+=a.y;b.z+=a.z;this.isDirty=!0;return this},addScalar:function(a){var b=this.that;b.x+=a;b.y+=a;b.z+=a;this.isDirty=!0;return this},sub:function(a,b){var c=this.that; -c.x=a.x-b.x;c.y=a.y-b.y;c.z=a.z-b.z;this.isDirty=!0;return this},subSelf:function(a){var b=this.that;b.x-=a.x;b.y-=a.y;b.z-=a.z;this.isDirty=!0;return this},cross:function(a,b){var c=this.that;c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x;this.isDirty=!0;return this},crossSelf:function(a){var b=this.that,c=b.x,e=b.y,g=b.z;b.x=e*a.z-g*a.y;b.y=g*a.x-c*a.z;b.z=c*a.y-e*a.x;this.isDirty=!0;return this},multiply:function(a,b){var c=this.that;c.x=a.x*b.x;c.y=a.y*b.y;c.z=a.z*b.z;this.isDirty= -!0;return this},multiplySelf:function(a){var b=this.that;b.x*=a.x;b.y*=a.y;b.z*=a.z;this.isDirty=!0;return this},multiplyScalar:function(a){var b=this.that;b.x*=a;b.y*=a;b.z*=a;this.isDirty=!0;return this},divideSelf:function(a){var b=this.that;b.x/=a.x;b.y/=a.y;b.z/=a.z;this.isDirty=!0;return this},divideScalar:function(a){var b=this.that;b.x/=a;b.y/=a;b.z/=a;this.isDirty=!0;return this},dot:function(a){var b=this.that;return b.x*a.x+b.y*a.y+b.z*a.z},distanceTo:function(a){var b=this.that,c=b.x- -a.x,e=b.y-a.y;a=b.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var b=this.that,c=b.x-a.x,e=b.y-a.y;a=b.z-a.z;return c*c+e*e+a*a},length:function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},lengthSq:function(){var a=this.that;return a.x*a.x+a.y*a.y+a.z*a.z},lengthManhattan:function(){var a=this.that;return a.x+a.y+a.z},negate:function(){var a=this.that;a.x=-this.x;a.y=-this.y;a.z=-this.z;this.isDirty=!0;return this},normalize:function(){var a=this.that;a=Math.sqrt(a.x* -a.x+a.y*a.y+a.z*a.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);this.isDirty=!0;return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=this.that;return Math.abs(a.x)<1.0E-4&&Math.abs(a.y)<1.0E-4&&Math.abs(a.z)<1.0E-4},clone:function(){var a=this.that;return new THREE.Vector3(a.x,a.y,a.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1}; +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,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; +THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.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 b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+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},lengthManhattan:function(){return this.x+ +this.y+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,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1}; THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},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,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&A>0&&W+A<1}var c,e,g,h,l,m,k,n,u,w, -v,z=a.geometry,K=z.vertices,N=[];c=0;for(e=z.faces.length;ck?e:k;g=g>n?g:n}a()}; -this.add3Points=function(k,n,u,w,v,z){if(m){m=!1;b=ku?k>v?k:v:u>v?u:v;g=n>w?n>z?n:z:w>z?w:z}else{b=ku?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e;g=n>w?n>z?n>g?n:g:z>g?z:g:w>z?w>g?w:g:z>g?z:g}a()};this.addRectangle=function(k){if(m){m=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? +THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&J>0&&V+J<1}var c,e,g,h,l,m,k,o,u,x, +v,A=a.geometry,K=A.vertices,N=[];c=0;for(e=A.faces.length;ck?e:k;g=g>o?g:o}a()}; +this.add3Points=function(k,o,u,x,v,A){if(m){m=!1;b=ku?k>v?k:v:u>v?u:v;g=o>x?o>A?o:A:x>A?x:A}else{b=ku?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e;g=o>x?o>A?o>g?o:g:A>g?A:g:x>A?x>g?x:g:A>g?A:g}a()};this.addRectangle=function(k){if(m){m=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){m=!0;g=e=c=b=0;a()};this.isEmpty=function(){return m};this.toString=function(){return"THREE.Rectangle ( left: "+ b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+h+", height: "+l+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; -THREE.Matrix4=function(a,b,c,e,g,h,l,m,k,n,u,w,v,z,K,N){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=l||0;this.n24=m||0;this.n31=k||0;this.n32=n||0;this.n33=u||1;this.n34=w||0;this.n41=v||0;this.n42=z||0;this.n43=K||0;this.n44=N||1;this.flat=Array(16);this.m33=new THREE.Matrix3;if(typeof Float32Array!=="undefined"){var A=this;this.float32Array=new Float32Array(16);this.float32Array3x3=new Float32Array(9);this.flatten32=function(){var p=A.float32Array; -p[0]=A.n11;p[1]=A.n21;p[2]=A.n31;p[3]=A.n41;p[4]=A.n12;p[5]=A.n22;p[6]=A.n32;p[7]=A.n42;p[8]=A.n13;p[9]=A.n23;p[10]=A.n33;p[11]=A.n43;p[12]=A.n14;p[13]=A.n24;p[14]=A.n34;p[15]=A.n44;return p};this.flatten323x3=function(){var p=A.float32Array3x3;p[0]=A.n11;p[1]=A.n21;p[2]=A.n31;p[3]=A.n12;p[4]=A.n22;p[5]=A.n32;p[6]=A.n13;p[7]=A.n23;p[8]=A.n33;return p}}}; -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,b,c,e,g,h,l,m,k,n,u,w,v,z,K,N){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=h;this.n23=l;this.n24=m;this.n31=k;this.n32=n;this.n33=u;this.n34=w;this.n41=v;this.n42=z;this.n43=K;this.n44=N;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +THREE.Matrix4=function(a,b,c,e,g,h,l,m,k,o,u,x,v,A,K,N){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=l||0;this.n24=m||0;this.n31=k||0;this.n32=o||0;this.n33=u||1;this.n34=x||0;this.n41=v||0;this.n42=A||0;this.n43=K||0;this.n44=N||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,b,c,e,g,h,l,m,k,o,u,x,v,A,K,N){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=h;this.n23=l;this.n24=m;this.n31=k;this.n32=o;this.n33=u;this.n34=x;this.n41=v;this.n42=A;this.n43=K;this.n44=N;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,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,b).normalize();e.cross(c,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43* a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41* -a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,l=a.n21,m=a.n22,k=a.n23,n=a.n24,u=a.n31,w=a.n32,v=a.n33,z=a.n34,K=a.n41,N=a.n42,A=a.n43,p=a.n44,d=b.n11,J=b.n12,T=b.n13,W=b.n14,ea=b.n21,V=b.n22,L=b.n23,aa=b.n24,R=b.n31,ba=b.n32,Q=b.n33,H=b.n34,O=b.n41,ia=b.n42,S=b.n43,f=b.n44;this.n11=c*d+e*ea+g*R+h*O;this.n12=c*J+e*V+g*ba+h*ia;this.n13=c*T+e*L+g*Q+h*S;this.n14=c*W+e*aa+g*H+h*f;this.n21=l*d+m*ea+k*R+n*O;this.n22=l*J+m*V+k*ba+n*ia;this.n23= -l*T+m*L+k*Q+n*S;this.n24=l*W+m*aa+k*H+n*f;this.n31=u*d+w*ea+v*R+z*O;this.n32=u*J+w*V+v*ba+z*ia;this.n33=u*T+w*L+v*Q+z*S;this.n34=u*W+w*aa+v*H+z*f;this.n41=K*d+N*ea+A*R+p*O;this.n42=K*J+N*V+A*ba+p*ia;this.n43=K*T+N*L+A*Q+p*S;this.n44=K*W+N*aa+A*H+p*f;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,h=a.n13,l=a.n14,m=a.n21,k=a.n22,n=a.n23,u=a.n24,w=a.n31,v=a.n32,z=a.n33,K=a.n34,N=a.n41,A=a.n42,p=a.n43;a=a.n44;var d=b.n11,J=b.n12,T=b.n13,W=b.n14,ea=b.n21,V=b.n22,L=b.n23,aa=b.n24,R=b.n31, -ba=b.n32,Q=b.n33,H=b.n34,O=b.n41,ia=b.n42,S=b.n43;b=b.n44;this.n11=e*d+g*ea+h*R+l*O;this.n12=e*J+g*V+h*ba+l*ia;this.n13=e*T+g*L+h*Q+l*S;this.n14=e*W+g*aa+h*H+l*b;this.n21=m*d+k*ea+n*R+u*O;this.n22=m*J+k*V+n*ba+u*ia;this.n23=m*T+k*L+n*Q+u*S;this.n24=m*W+k*aa+n*H+u*b;this.n31=w*d+v*ea+z*R+K*O;this.n32=w*J+v*V+z*ba+K*ia;this.n33=w*T+v*L+z*Q+K*S;this.n34=w*W+v*aa+z*H+K*b;this.n41=N*d+A*ea+p*R+a*O;this.n42=N*J+A*V+p*ba+a*ia;this.n43=N*T+A*L+p*Q+a*S;this.n44=N*W+A*aa+p*H+a*b;c[0]=this.n11;c[1]=this.n21; -c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,h=this.n21,l=this.n22,m=this.n23,k=this.n24,n=this.n31,u=this.n32,w=this.n33,v=this.n34,z=this.n41,K=this.n42,N=this.n43,A=this.n44,p=a.n11,d=a.n21,J=a.n31,T=a.n41,W=a.n12,ea=a.n22,V=a.n32,L=a.n42,aa=a.n13,R=a.n23, -ba=a.n33,Q=a.n43,H=a.n14,O=a.n24,ia=a.n34;a=a.n44;this.n11=b*p+c*d+e*J+g*T;this.n12=b*W+c*ea+e*V+g*L;this.n13=b*aa+c*R+e*ba+g*Q;this.n14=b*H+c*O+e*ia+g*a;this.n21=h*p+l*d+m*J+k*T;this.n22=h*W+l*ea+m*V+k*L;this.n23=h*aa+l*R+m*ba+k*Q;this.n24=h*H+l*O+m*ia+k*a;this.n31=n*p+u*d+w*J+v*T;this.n32=n*W+u*ea+w*V+v*L;this.n33=n*aa+u*R+w*ba+v*Q;this.n34=n*H+u*O+w*ia+v*a;this.n41=z*p+K*d+N*J+A*T;this.n42=z*W+K*ea+N*V+A*L;this.n43=z*aa+K*R+N*ba+A*Q;this.n44=z*H+K*O+N*ia+A*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,b=this.n12,c=this.n13,e=this.n14,g=this.n21,h=this.n22,l=this.n23,m=this.n24,k=this.n31,n=this.n32,u=this.n33,w=this.n34,v=this.n41,z=this.n42,K=this.n43,N=this.n44;return e*l*n*v-c*m*n*v-e*h*u*v+b*m*u*v+c*h*w*v-b*l*w*v-e*l*k*z+c*m*k*z+e*g*u*z-a*m*u*z-c*g*w*z+a*l*w*z+ -e*h*k*K-b*m*k*K-e*g*n*K+a*m*n*K+b*g*w*K-a*h*w*K-c*h*k*N+b*l*k*N+c*g*n*N-a*l*n*N-b*g*u*N+a*h*u*N},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}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.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,l=a.n21,m=a.n22,k=a.n23,o=a.n24,u=a.n31,x=a.n32,v=a.n33,A=a.n34,K=a.n41,N=a.n42,J=a.n43,r=a.n44,d=b.n11,I=b.n12,S=b.n13,V=b.n14,ea=b.n21,T=b.n22,M=b.n23,aa=b.n24,R=b.n31,ca=b.n32,W=b.n33,E=b.n34,O=b.n41,ia=b.n42,Q=b.n43,f=b.n44;this.n11=c*d+e*ea+g*R+h*O;this.n12=c*I+e*T+g*ca+h*ia;this.n13=c*S+e*M+g*W+h*Q;this.n14=c*V+e*aa+g*E+h*f;this.n21=l*d+m*ea+k*R+o*O;this.n22=l*I+m*T+k*ca+o*ia;this.n23= +l*S+m*M+k*W+o*Q;this.n24=l*V+m*aa+k*E+o*f;this.n31=u*d+x*ea+v*R+A*O;this.n32=u*I+x*T+v*ca+A*ia;this.n33=u*S+x*M+v*W+A*Q;this.n34=u*V+x*aa+v*E+A*f;this.n41=K*d+N*ea+J*R+r*O;this.n42=K*I+N*T+J*ca+r*ia;this.n43=K*S+N*M+J*W+r*Q;this.n44=K*V+N*aa+J*E+r*f;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,h=a.n13,l=a.n14,m=a.n21,k=a.n22,o=a.n23,u=a.n24,x=a.n31,v=a.n32,A=a.n33,K=a.n34,N=a.n41,J=a.n42,r=a.n43;a=a.n44;var d=b.n11,I=b.n12,S=b.n13,V=b.n14,ea=b.n21,T=b.n22,M=b.n23,aa=b.n24,R=b.n31, +ca=b.n32,W=b.n33,E=b.n34,O=b.n41,ia=b.n42,Q=b.n43;b=b.n44;this.n11=e*d+g*ea+h*R+l*O;this.n12=e*I+g*T+h*ca+l*ia;this.n13=e*S+g*M+h*W+l*Q;this.n14=e*V+g*aa+h*E+l*b;this.n21=m*d+k*ea+o*R+u*O;this.n22=m*I+k*T+o*ca+u*ia;this.n23=m*S+k*M+o*W+u*Q;this.n24=m*V+k*aa+o*E+u*b;this.n31=x*d+v*ea+A*R+K*O;this.n32=x*I+v*T+A*ca+K*ia;this.n33=x*S+v*M+A*W+K*Q;this.n34=x*V+v*aa+A*E+K*b;this.n41=N*d+J*ea+r*R+a*O;this.n42=N*I+J*T+r*ca+a*ia;this.n43=N*S+J*M+r*W+a*Q;this.n44=N*V+J*aa+r*E+a*b;c[0]=this.n11;c[1]=this.n21; +c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,h=this.n21,l=this.n22,m=this.n23,k=this.n24,o=this.n31,u=this.n32,x=this.n33,v=this.n34,A=this.n41,K=this.n42,N=this.n43,J=this.n44,r=a.n11,d=a.n21,I=a.n31,S=a.n41,V=a.n12,ea=a.n22,T=a.n32,M=a.n42,aa=a.n13,R=a.n23, +ca=a.n33,W=a.n43,E=a.n14,O=a.n24,ia=a.n34;a=a.n44;this.n11=b*r+c*d+e*I+g*S;this.n12=b*V+c*ea+e*T+g*M;this.n13=b*aa+c*R+e*ca+g*W;this.n14=b*E+c*O+e*ia+g*a;this.n21=h*r+l*d+m*I+k*S;this.n22=h*V+l*ea+m*T+k*M;this.n23=h*aa+l*R+m*ca+k*W;this.n24=h*E+l*O+m*ia+k*a;this.n31=o*r+u*d+x*I+v*S;this.n32=o*V+u*ea+x*T+v*M;this.n33=o*aa+u*R+x*ca+v*W;this.n34=o*E+u*O+x*ia+v*a;this.n41=A*r+K*d+N*I+J*S;this.n42=A*V+K*ea+N*T+J*M;this.n43=A*aa+K*R+N*ca+J*W;this.n44=A*E+K*O+N*ia+J*a;return this},multiplyScalar:function(a){this.n11*= +a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,g=this.n21,h=this.n22,l=this.n23,m=this.n24,k=this.n31,o=this.n32,u=this.n33,x=this.n34,v=this.n41,A=this.n42,K=this.n43,N=this.n44;return e*l*o*v-c*m*o*v-e*h*u*v+b*m*u*v+c*h*x*v-b*l*x*v-e*l*k*A+c*m*k*A+e*g*u*A-a*m*u*A-c*g*x*A+a*l*x*A+ +e*h*k*K-b*m*k*K-e*g*o*K+a*m*o*K+b*g*x*K-a*h*x*K-c*h*k*N+b*l*k*N+c*g*o*N-a*l*o*N-b*g*u*N+a*h*u*N},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]= this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1); return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,h=a.x,l=a.y,m=a.z,k=g* -h,n=g*l;this.set(k*h+c,k*l-e*m,k*m+e*l,0,k*l+e*m,n*l+c,n*m-e*h,0,k*m-e*l,n*m+e*h,g*m*m+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var l=a*e,m=c*e;this.n11=a*g;this.n12=c*b-l*h;this.n13=l*b+c*h;this.n21=e;this.n22=g*h;this.n23=-g*b;this.n31=-c*g;this.n32=m*h+a*b;this.n33=-m*b+a*h},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,e=a.z,g=a.w,h=b+b,l=c+c,m=e+e;a=b*h;var k=b*l;b*=m;var n=c*l;c*=m;e*=m;h*=g;l*=g;g*=m;this.n11=1-(n+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-h;this.n31=b-l;this.n32=c+h;this.n33=1-(a+n)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;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,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b}; -THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,l=a.n21,m=a.n22,k=a.n23,n=a.n24,u=a.n31,w=a.n32,v=a.n33,z=a.n34,K=a.n41,N=a.n42,A=a.n43,p=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*z*N-n*v*N+n*w*A-m*z*A-k*w*p+m*v*p;b.n12=h*v*N-g*z*N-h*w*A+e*z*A+g*w*p-e*v*p;b.n13=g*n*N-h*k*N+h*m*A-e*n*A-g*m*p+e*k*p;b.n14=h*k*w-g*n*w-h*m*v+e*n*v+g*m*z-e*k*z;b.n21=n*v*K-k*z*K-n*u*A+l*z*A+k*u*p-l*v*p;b.n22=g*z*K-h*v*K+h*u*A-c*z*A-g*u*p+c*v*p;b.n23=h*k*K-g*n*K-h*l*A+c*n*A+g*l*p-c*k*p; -b.n24=g*n*u-h*k*u+h*l*v-c*n*v-g*l*z+c*k*z;b.n31=m*z*K-n*w*K+n*u*N-l*z*N-m*u*p+l*w*p;b.n32=h*w*K-e*z*K-h*u*N+c*z*N+e*u*p-c*w*p;b.n33=g*n*K-h*m*K+h*l*N-c*n*N-e*l*p+c*m*p;b.n34=h*m*u-e*n*u-h*l*w+c*n*w+e*l*z-c*m*z;b.n41=k*w*K-m*v*K-k*u*N+l*v*N+m*u*A-l*w*A;b.n42=e*v*K-g*w*K+g*u*N-c*v*N-e*u*A+c*w*A;b.n43=g*m*K-e*k*K-g*l*N+c*k*N+e*l*A-c*m*A;b.n44=e*k*u-g*m*u+g*l*w-c*k*w-e*l*v+c*m*v;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*h;c[3]=a*l;c[4]=a*m;c[5]=a*k;c[6]=a*n;c[7]=a*u;c[8]=a*w;return b}; +h,o=g*l;this.set(k*h+c,k*l-e*m,k*m+e*l,0,k*l+e*m,o*l+c,o*m-e*h,0,k*m-e*l,o*m+e*h,g*m*m+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var l=a*e,m=c*e;this.n11=a*g;this.n12=c*b-l*h;this.n13=l*b+c*h;this.n21=e;this.n22=g*h;this.n23=-g*b;this.n31=-c*g;this.n32=m*h+a*b;this.n33=-m*b+a*h},setRotationFromQuaternion:function(a){var b= +a.x,c=a.y,e=a.z,g=a.w,h=b+b,l=c+c,m=e+e;a=b*h;var k=b*l;b*=m;var o=c*l;c*=m;e*=m;h*=g;l*=g;g*=m;this.n11=1-(o+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-h;this.n31=b-l;this.n32=c+h;this.n33=1-(a+o)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; +a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e}; +THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,l=a.n21,m=a.n22,k=a.n23,o=a.n24,u=a.n31,x=a.n32,v=a.n33,A=a.n34,K=a.n41,N=a.n42,J=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*A*N-o*v*N+o*x*J-m*A*J-k*x*r+m*v*r;b.n12=h*v*N-g*A*N-h*x*J+e*A*J+g*x*r-e*v*r;b.n13=g*o*N-h*k*N+h*m*J-e*o*J-g*m*r+e*k*r;b.n14=h*k*x-g*o*x-h*m*v+e*o*v+g*m*A-e*k*A;b.n21=o*v*K-k*A*K-o*u*J+l*A*J+k*u*r-l*v*r;b.n22=g*A*K-h*v*K+h*u*J-c*A*J-g*u*r+c*v*r;b.n23=h*k*K-g*o*K-h*l*J+c*o*J+g*l*r-c*k*r; +b.n24=g*o*u-h*k*u+h*l*v-c*o*v-g*l*A+c*k*A;b.n31=m*A*K-o*x*K+o*u*N-l*A*N-m*u*r+l*x*r;b.n32=h*x*K-e*A*K-h*u*N+c*A*N+e*u*r-c*x*r;b.n33=g*o*K-h*m*K+h*l*N-c*o*N-e*l*r+c*m*r;b.n34=h*m*u-e*o*u-h*l*x+c*o*x+e*l*A-c*m*A;b.n41=k*x*K-m*v*K-k*u*N+l*v*N+m*u*J-l*x*J;b.n42=e*v*K-g*x*K+g*u*N-c*v*N-e*u*J+c*x*J;b.n43=g*m*K-e*k*K-g*l*N+c*k*N+e*l*J-c*m*J;b.n44=e*k*u-g*m*u+g*l*x-c*k*x-e*l*v+c*m*v;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*h;c[3]=a*l;c[4]=a*m;c[5]=a*k;c[6]=a*o;c[7]=a*u;c[8]=a*x;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,e,g,h){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-c);l.n23=(e+c)/(e-c);l.n24=0;l.n31=0;l.n32=0;l.n33=-(h+g)/(h-g);l.n34=-2*h*g/(h-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)}; -THREE.Matrix4.makeOrtho=function(a,b,c,e,g,h){var l,m,k,n;l=new THREE.Matrix4;m=b-a;k=c-e;n=h-g;l.n11=2/m;l.n12=0;l.n13=0;l.n14=-((b+a)/m);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/n;l.n34=-((h+g)/n);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +THREE.Matrix4.makeOrtho=function(a,b,c,e,g,h){var l,m,k,o;l=new THREE.Matrix4;m=b-a;k=c-e;o=h-g;l.n11=2/m;l.n12=0;l.n13=0;l.n14=-((b+a)/m);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-((h+g)/o);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api}; THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var l=a*b,m=e*g,k=this.that;k.w=l*h-m*c;k.x=l*c+m*h;k.y=e*b*h+a*g*c;k.z=a*g*h-e*b*c;this.isDirty=!0;return this}; THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)}; THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,h=Math.sqrt(b*b+c*c+e*e+g*g);if(h==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}h=1/h;a.x=b*h;a.y=c*h;a.z=e*h;a.w=g*h;this.isDirty=!0;return this}; THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this}; -THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,h=a.z,l=c.x,m=c.y,k=c.z;c=c.w;var n=c*e+m*h-k*g,u=c*g+k*e-l*h,w=c*h+l*g-m*e;e=-l*e-m*g-k*h;b.x=n*c+e*-l+u*-k-w*-m;b.y=u*c+e*-m+w*-l-n*-k;b.z=w*c+e*-k+n*-m-u*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; +THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,h=a.z,l=c.x,m=c.y,k=c.z;c=c.w;var o=c*e+m*h-k*g,u=c*g+k*e-l*h,x=c*h+l*g-m*e;e=-l*e-m*g-k*h;b.x=o*c+e*-l+u*-k-x*-m;b.y=u*c+e*-m+x*-l-o*-k;b.z=x*c+e*-k+o*-m-u*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*h)/l;e=Math.sin(e*h)/l;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; @@ -62,31 +59,29 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,g,h,l,m=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b0){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 b=1,c=this.vertices.length;bthis.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,b=0,c=this.vertices.length;b65535){n[m].counter+=1;k=n[m].hash+"_"+n[m].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=h}},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,b=0,c=this.vertices.length;b65535){o[m].counter+=1;k=o[m].hash+"_"+o[m].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0; -THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1}; -THREE.Object3D.prototype.update=function(a,b,c,e){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;athis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var u=0,w=this.hierarchy.length;uthis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var u=0,x=this.hierarchy.length;u1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,h.quaternion,b)}else{c=c==="pos"?h.position:h.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(m[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u-this.zNear)return!1;if(l+h<-this.zFar)return!1;l-=h;var m=this.projectionMatrix,k=1/(m.n43*l),n=k*this.screenCenterX,u=(g.n11*b+g.n12*c+g.n13*e+g.n14)*m.n11*n;h=m.n11*h*n;if(u+h<-this.screenCenterX)return!1;if(u-h>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*m.n22*k*this.screenCenterY; +THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix, +this.inverseMatrix)}}for(a=0;a-this.zNear)return!1;if(l+h<-this.zFar)return!1;l-=h;var m=this.projectionMatrix,k=1/(m.n43*l),o=k*this.screenCenterX,u=(g.n11*b+g.n12*c+g.n13*e+g.n14)*m.n11*o;h=m.n11*h*o;if(u+h<-this.screenCenterX)return!1;if(u-h>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*m.n22*k*this.screenCenterY; if(b+h<-this.screenCenterY)return!1;if(b-h>this.screenCenterY)return!1;a.screenPosition.set(u,b,l,h);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;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,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1; -THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; -THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= +THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0}; +THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; -THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.LineBasicMaterialCounter={value:0}; -THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== +THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}}; +THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!== undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+ -"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshBasicMaterialCounter={value:0}; -THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1; -if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading; -if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning= -a.skinning}}; -THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+ -this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshLambertMaterialCounter={value:0}; -THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin= +"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== +undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!== +undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; +THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+ +"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin= this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map; if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth; if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (
id: "+this.id+"
color: "+this.color+"
ambient: "+this.ambient+"
specular: "+this.specular+"
shininess: "+this.shininess+"
opacity: "+this.opacity+"
map: "+this.map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+ -this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshPhongMaterialCounter={value:0}; -THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== -undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshDepthMaterialCounter={value:0}; -THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== -undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; -THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader= +this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== +undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}}; +THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== +undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; +THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader= a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!== undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; -THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; -THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; -if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; -THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,e,g,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter}; +THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!== +undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}}; +THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;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.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; +THREE.Texture=function(a,b,c,e,g,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h: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,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b=0&&Q>=0&&H>=0&&O>=0)return!0;else if(ba<0&&Q<0||H<0&&O<0)return!1;else{if(ba<0)aa=Math.max(aa,ba/(ba-Q));else Q<0&&(R=Math.min(R,ba/(ba-Q)));if(H<0)aa=Math.max(aa,H/(H-O));else O<0&&(R=Math.min(R,H/(H-O)));if(Rba&&S.z0&&A.z<1){v=K[z]=K[z]||new THREE.RenderableParticle;v.x=A.x/A.w;v.y=A.y/A.w;v.z=A.z;v.rotation=o.rotation.z;v.scale.x=o.scale.x*Math.abs(v.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14)); -v.scale.y=o.scale.y*Math.abs(v.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24));v.materials=o.materials;R.push(v);z++}}}}aa&&R.sort(a);return R};this.unprojectVector=function(V,L){var aa=THREE.Matrix4.makeInvert(L.matrix);aa.multiplySelf(THREE.Matrix4.makeInvert(L.projectionMatrix));aa.multiplyVector3(V);return V}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,h;this.domElement=document.createElement("div");this.setSize=function(l,m){c=l;e=m;g=c/2;h=e/2};this.render=function(l,m){var k,n,u,w,v,z,K,N;a=b.projectScene(l,m);k=0;for(n=a.length;k0){I.r+=sa.r*da;I.g+=sa.g*da;I.b+=sa.b*da}}else if(da instanceof THREE.PointLight){Z.sub(da.position,ca);Z.normalize();da= -X.dot(Z)*Aa;if(da>0){I.r+=sa.r*da;I.g+=sa.g*da;I.b+=sa.b*da}}}}function Ea(D,ca,X){if(X.opacity!=0){a(X.opacity);b(X.blending);var I,U,da,sa,Aa,Da;if(X instanceof THREE.ParticleBasicMaterial){if(X.map&&X.map.image.loaded){sa=X.map.image;Aa=sa.width>>1;Da=sa.height>>1;U=ca.scale.x*m;da=ca.scale.y*k;X=U*Aa;I=da*Da;r.set(D.x-X,D.y-I,D.x+X,D.y+I);if(y.instersects(r)){n.save();n.translate(D.x,D.y);n.rotate(-ca.rotation);n.scale(U,-da);n.translate(-Aa,-Da);n.drawImage(sa,0,0);n.restore()}}}else if(X instanceof -THREE.ParticleCircleMaterial){if(E){B.r=Y.r+ga.r+oa.r;B.g=Y.g+ga.g+oa.g;B.b=Y.b+ga.b+oa.b;R.r=X.color.r*B.r;R.g=X.color.g*B.g;R.b=X.color.b*B.b;R.updateStyleString()}else R.__styleString=X.color.__styleString;X=ca.scale.x*m;I=ca.scale.y*k;r.set(D.x-X,D.y-I,D.x+X,D.y+I);if(y.instersects(r)){U=R.__styleString;if(N!=U)n.fillStyle=N=U;n.save();n.translate(D.x,D.y);n.rotate(-ca.rotation);n.scale(X,I);n.beginPath();n.arc(0,0,1,0,ua,!0);n.closePath();n.fill();n.restore()}}}}function ra(D,ca,X,I){if(I.opacity!= -0){a(I.opacity);b(I.blending);n.beginPath();n.moveTo(D.positionScreen.x,D.positionScreen.y);n.lineTo(ca.positionScreen.x,ca.positionScreen.y);n.closePath();if(I instanceof THREE.LineBasicMaterial){R.__styleString=I.color.__styleString;D=I.linewidth;if(A!=D)n.lineWidth=A=D;D=R.__styleString;if(K!=D)n.strokeStyle=K=D;n.stroke();r.inflate(I.linewidth*2)}}}function x(D,ca,X,I,U,da){if(U.opacity!=0){a(U.opacity);b(U.blending);T=D.positionScreen.x;W=D.positionScreen.y;ea=ca.positionScreen.x;V=ca.positionScreen.y; -L=X.positionScreen.x;aa=X.positionScreen.y;n.beginPath();n.moveTo(T,W);n.lineTo(ea,V);n.lineTo(L,aa);n.lineTo(T,W);n.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ka(T,W,ea,V,L,aa,U.map.image,I.uvs[0].u,I.uvs[0].v,I.uvs[1].u,I.uvs[1].v,I.uvs[2].u,I.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&U.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=M.matrix;Z.copy(I.vertexNormalsWorld[0]);q=(Z.x*D.n11+ -Z.y*D.n12+Z.z*D.n13)*0.5+0.5;o=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(I.vertexNormalsWorld[1]);j=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;i=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(I.vertexNormalsWorld[2]);s=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;t=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Ka(T,W,ea,V,L,aa,U.env_map.image,q,o,j,i,s,t)}}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&& -!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ka(T,W,ea,V,L,aa,U.map.image,I.uvs[0].u,I.uvs[0].v,I.uvs[1].u,I.uvs[1].v,I.uvs[2].u,I.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!U.wireframe&&U.shading==THREE.SmoothShading&&I.vertexNormalsWorld.length==3){ba.r=Q.r=H.r=Y.r;ba.g=Q.g=H.g=Y.g;ba.b=Q.b=H.b=Y.b;ja(da,I.v1.positionWorld,I.vertexNormalsWorld[0],ba);ja(da,I.v2.positionWorld,I.vertexNormalsWorld[1],Q);ja(da,I.v3.positionWorld,I.vertexNormalsWorld[2],H);O.r=(Q.r+H.r)*0.5;O.g=(Q.g+ -H.g)*0.5;O.b=(Q.b+H.b)*0.5;f=Ha(ba,Q,H,O);Ka(T,W,ea,V,L,aa,f,0,0,1,0,0,1)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;ja(da,I.centroidWorld,I.normalWorld,B);R.r=U.color.r*B.r;R.g=U.color.g*B.g;R.b=U.color.b*B.b;R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){ia=M.near;S=M.far;ba.r=ba.g=ba.b=1-la(D.positionScreen.z,ia,S);Q.r=Q.g=Q.b= -1-la(ca.positionScreen.z,ia,S);H.r=H.g=H.b=1-la(X.positionScreen.z,ia,S);O.r=(Q.r+H.r)*0.5;O.g=(Q.g+H.g)*0.5;O.b=(Q.b+H.b)*0.5;f=Ha(ba,Q,H,O);Ka(T,W,ea,V,L,aa,f,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=qa(I.normalWorld.x);R.g=qa(I.normalWorld.y);R.b=qa(I.normalWorld.z);R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}}}function pa(D,ca){if(K!=D)n.strokeStyle=K=D;if(A!=ca)n.lineWidth=A=ca;n.stroke();r.inflate(ca*2)}function Ma(D){if(N!= -D)n.fillStyle=N=D;n.fill()}function Ka(D,ca,X,I,U,da,sa,Aa,Da,La,ta,Ga,Ja){var Fa,Ba;Fa=sa.width-1;Ba=sa.height-1;Aa*=Fa;Da*=Ba;La*=Fa;ta*=Ba;Ga*=Fa;Ja*=Ba;X-=D;I-=ca;U-=D;da-=ca;La-=Aa;ta-=Da;Ga-=Aa;Ja-=Da;Fa=La*Ja-Ga*ta;if(Fa!=0){Ba=1/Fa;Fa=(Ja*X-ta*U)*Ba;ta=(Ja*I-ta*da)*Ba;X=(La*U-Ga*X)*Ba;I=(La*da-Ga*I)*Ba;D=D-Fa*Aa-X*Da;ca=ca-ta*Aa-I*Da;n.save();n.transform(Fa,ta,X,I,D,ca);n.clip();n.drawImage(sa,0,0);n.restore()}}function Ha(D,ca,X,I){var U=~~(D.r*255),da=~~(D.g*255);D=~~(D.b*255);var sa=~~(ca.r* -255),Aa=~~(ca.g*255);ca=~~(ca.b*255);var Da=~~(X.r*255),La=~~(X.g*255);X=~~(X.b*255);var ta=~~(I.r*255),Ga=~~(I.g*255);I=~~(I.b*255);C[0]=U<0?0:U>255?255:U;C[1]=da<0?0:da>255?255:da;C[2]=D<0?0:D>255?255:D;C[4]=sa<0?0:sa>255?255:sa;C[5]=Aa<0?0:Aa>255?255:Aa;C[6]=ca<0?0:ca>255?255:ca;C[8]=Da<0?0:Da>255?255:Da;C[9]=La<0?0:La>255?255:La;C[10]=X<0?0:X>255?255:X;C[12]=ta<0?0:ta>255?255:ta;C[13]=Ga<0?0:Ga>255?255:Ga;C[14]=I<0?0:I>255?255:I;ha.putImageData(Ia,0,0);wa.drawImage(fa,0,0);return Ca}function la(D, -ca,X){D=(D-ca)/(X-ca);return D*D*(3-2*D)}function qa(D){D=(D+1)*0.5;return D<0?0:D>1?1:D}function ma(D,ca){var X=ca.x-D.x,I=ca.y-D.y,U=1/Math.sqrt(X*X+I*I);X*=U;I*=U;ca.x+=X;ca.y+=I;D.x-=X;D.y-=I}var ka,na,$,xa,va,Oa,ya,Na;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,k);c=e.projectScene(G,M,this.sortElements);(E=G.lights.length>0)&&P(G);ka=0;for(na=c.length;ka0){j.r+=t.color.r*y;j.g+=t.color.g*y;j.b+=t.color.b*y}}else if(t instanceof THREE.PointLight){aa.sub(t.position,o.centroidWorld);aa.normalize();y=o.normalWorld.dot(aa)*t.intensity;if(y>0){j.r+=t.color.r*y;j.g+=t.color.g*y;j.b+=t.color.b*y}}}}function b(q,o,j,i,s,t){H=e(O++);H.setAttribute("d","M "+q.positionScreen.x+ -" "+q.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)J.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(d){T.r=W.r;T.g=W.g;T.b=W.b;a(t,i,T);J.r=s.color.r*T.r;J.g=s.color.g*T.g;J.b=s.color.b*T.b;J.updateStyleString()}else J.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){L=1-s.__2near/(s.__farPlusNear-i.z*s.__farMinusNear); -J.setRGB(L,L,L)}else s instanceof THREE.MeshNormalMaterial&&J.setRGB(g(i.normalWorld.x),g(i.normalWorld.y),g(i.normalWorld.z));s.wireframe?H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):H.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+s.opacity);m.appendChild(H)}function c(q,o,j,i,s,t,y){H=e(O++);H.setAttribute("d", -"M "+q.positionScreen.x+" "+q.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)J.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(d){T.r=W.r;T.g=W.g;T.b=W.b;a(y,s,T);J.r=t.color.r*T.r;J.g=t.color.g*T.g;J.b=t.color.b*T.b;J.updateStyleString()}else J.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){L= -1-t.__2near/(t.__farPlusNear-s.z*t.__farMinusNear);J.setRGB(L,L,L)}else t instanceof THREE.MeshNormalMaterial&&J.setRGB(g(s.normalWorld.x),g(s.normalWorld.y),g(s.normalWorld.z));t.wireframe?H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+t.wireframe_linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframe_linecap+"; stroke-linejoin: "+t.wireframe_linejoin):H.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+t.opacity);m.appendChild(H)} -function e(q){if(R[q]==null){R[q]=document.createElementNS("http://www.w3.org/2000/svg","path");f==0&&R[q].setAttribute("shape-rendering","crispEdges")}return R[q]}function g(q){return q<0?Math.min((1+q)*0.5,0.5):0.5+Math.min(q*0.5,0.5)}var h=null,l=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,n,u,w,v,z,K,N,A=new THREE.Rectangle,p=new THREE.Rectangle,d=!1,J=new THREE.Color(16777215),T=new THREE.Color(16777215),W=new THREE.Color(0),ea=new THREE.Color(0),V=new THREE.Color(0), -L,aa=new THREE.Vector3,R=[],ba=[],Q=[],H,O,ia,S,f=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(q){switch(q){case "high":f=1;break;case "low":f=0}};this.setSize=function(q,o){k=q;n=o;u=k/2;w=n/2;m.setAttribute("viewBox",-u+" "+-w+" "+k+" "+n);m.setAttribute("width",k);m.setAttribute("height",n);A.set(-u,-w,u,w)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(q,o){var j,i,s,t,y,F,r,E;this.autoClear&& -this.clear();h=l.projectScene(q,o,this.sortElements);S=ia=O=0;if(d=q.lights.length>0){r=q.lights;W.setRGB(0,0,0);ea.setRGB(0,0,0);V.setRGB(0,0,0);j=0;for(i=r.length;j=0&&W>=0&&E>=0&&O>=0)return!0;else if(ca<0&&W<0||E<0&&O<0)return!1;else{if(ca<0)aa=Math.max(aa,ca/(ca-W));else W<0&&(R=Math.min(R,ca/(ca-W)));if(E<0)aa=Math.max(aa,E/(E-O));else O<0&&(R=Math.min(R,E/(E-O)));if(Rca&&Q.z0&&J.z<1){v=K[A]=K[A]||new THREE.RenderableParticle;v.x=J.x/J.w;v.y=J.y/J.w;v.z=J.z;v.rotation=n.rotation.z;v.scale.x=n.scale.x*Math.abs(v.x-(J.x+M.projectionMatrix.n11)/(J.w+M.projectionMatrix.n14)); +v.scale.y=n.scale.y*Math.abs(v.y-(J.y+M.projectionMatrix.n22)/(J.w+M.projectionMatrix.n24));v.materials=n.materials;R.push(v);A++}}}aa&&R.sort(a);return R};this.unprojectVector=function(T,M){var aa=THREE.Matrix4.makeInvert(M.globalMatrix);aa.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));aa.multiplyVector3(T);return T}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,h;this.domElement=document.createElement("div");this.setSize=function(l,m){c=l;e=m;g=c/2;h=e/2};this.render=function(l,m){var k,o,u,x,v,A,K,N;a=b.projectScene(l,m);k=0;for(o=a.length;k0){H.r+=sa.r*da;H.g+=sa.g*da;H.b+=sa.b*da}}else if(da instanceof THREE.PointLight){Z.sub(da.position,ba);Z.normalize();da= +X.dot(Z)*Aa;if(da>0){H.r+=sa.r*da;H.g+=sa.g*da;H.b+=sa.b*da}}}}function Ea(D,ba,X){if(X.opacity!=0){a(X.opacity);b(X.blending);var H,U,da,sa,Aa,Da;if(X instanceof THREE.ParticleBasicMaterial){if(X.map&&X.map.image.loaded){sa=X.map.image;Aa=sa.width>>1;Da=sa.height>>1;U=ba.scale.x*m;da=ba.scale.y*k;X=U*Aa;H=da*Da;t.set(D.x-X,D.y-H,D.x+X,D.y+H);if(w.instersects(t)){o.save();o.translate(D.x,D.y);o.rotate(-ba.rotation);o.scale(U,-da);o.translate(-Aa,-Da);o.drawImage(sa,0,0);o.restore()}}}else if(X instanceof +THREE.ParticleCircleMaterial){if(y){B.r=Y.r+ga.r+na.r;B.g=Y.g+ga.g+na.g;B.b=Y.b+ga.b+na.b;R.r=X.color.r*B.r;R.g=X.color.g*B.g;R.b=X.color.b*B.b;R.updateStyleString()}else R.__styleString=X.color.__styleString;X=ba.scale.x*m;H=ba.scale.y*k;t.set(D.x-X,D.y-H,D.x+X,D.y+H);if(w.instersects(t)){U=R.__styleString;if(N!=U)o.fillStyle=N=U;o.save();o.translate(D.x,D.y);o.rotate(-ba.rotation);o.scale(X,H);o.beginPath();o.arc(0,0,1,0,ua,!0);o.closePath();o.fill();o.restore()}}}}function ra(D,ba,X,H){if(H.opacity!= +0){a(H.opacity);b(H.blending);o.beginPath();o.moveTo(D.positionScreen.x,D.positionScreen.y);o.lineTo(ba.positionScreen.x,ba.positionScreen.y);o.closePath();if(H instanceof THREE.LineBasicMaterial){R.__styleString=H.color.__styleString;D=H.linewidth;if(J!=D)o.lineWidth=J=D;D=R.__styleString;if(K!=D)o.strokeStyle=K=D;o.stroke();t.inflate(H.linewidth*2)}}}function z(D,ba,X,H,U,da){if(U.opacity!=0){a(U.opacity);b(U.blending);S=D.positionScreen.x;V=D.positionScreen.y;ea=ba.positionScreen.x;T=ba.positionScreen.y; +M=X.positionScreen.x;aa=X.positionScreen.y;o.beginPath();o.moveTo(S,V);o.lineTo(ea,T);o.lineTo(M,aa);o.lineTo(S,V);o.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ka(S,V,ea,T,M,aa,U.map.image,H.uvs[0].u,H.uvs[0].v,H.uvs[1].u,H.uvs[1].v,H.uvs[2].u,H.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&U.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=L.globalMatrix;Z.copy(H.vertexNormalsWorld[0]);p=(Z.x* +D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;n=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(H.vertexNormalsWorld[1]);j=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;i=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(H.vertexNormalsWorld[2]);q=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;s=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Ka(S,V,ea,T,M,aa,U.env_map.image,p,n,j,i,q,s)}}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&& +!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ka(S,V,ea,T,M,aa,U.map.image,H.uvs[0].u,H.uvs[0].v,H.uvs[1].u,H.uvs[1].v,H.uvs[2].u,H.uvs[2].v);b(THREE.SubtractiveBlending)}if(y)if(!U.wireframe&&U.shading==THREE.SmoothShading&&H.vertexNormalsWorld.length==3){ca.r=W.r=E.r=Y.r;ca.g=W.g=E.g=Y.g;ca.b=W.b=E.b=Y.b;ja(da,H.v1.positionWorld,H.vertexNormalsWorld[0],ca);ja(da,H.v2.positionWorld,H.vertexNormalsWorld[1],W);ja(da,H.v3.positionWorld,H.vertexNormalsWorld[2],E);O.r=(W.r+E.r)*0.5;O.g=(W.g+ +E.g)*0.5;O.b=(W.b+E.b)*0.5;f=Ha(ca,W,E,O);Ka(S,V,ea,T,M,aa,f,0,0,1,0,0,1)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;ja(da,H.centroidWorld,H.normalWorld,B);R.r=U.color.r*B.r;R.g=U.color.g*B.g;R.b=U.color.b*B.b;R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){ia=L.near;Q=L.far;ca.r=ca.g=ca.b=1-la(D.positionScreen.z,ia,Q);W.r=W.g=W.b= +1-la(ba.positionScreen.z,ia,Q);E.r=E.g=E.b=1-la(X.positionScreen.z,ia,Q);O.r=(W.r+E.r)*0.5;O.g=(W.g+E.g)*0.5;O.b=(W.b+E.b)*0.5;f=Ha(ca,W,E,O);Ka(S,V,ea,T,M,aa,f,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=qa(H.normalWorld.x);R.g=qa(H.normalWorld.y);R.b=qa(H.normalWorld.z);R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}}}function pa(D,ba){if(K!=D)o.strokeStyle=K=D;if(J!=ba)o.lineWidth=J=ba;o.stroke();t.inflate(ba*2)}function Ma(D){if(N!= +D)o.fillStyle=N=D;o.fill()}function Ka(D,ba,X,H,U,da,sa,Aa,Da,La,ta,Ga,Ja){var Fa,Ba;Fa=sa.width-1;Ba=sa.height-1;Aa*=Fa;Da*=Ba;La*=Fa;ta*=Ba;Ga*=Fa;Ja*=Ba;X-=D;H-=ba;U-=D;da-=ba;La-=Aa;ta-=Da;Ga-=Aa;Ja-=Da;Fa=La*Ja-Ga*ta;if(Fa!=0){Ba=1/Fa;Fa=(Ja*X-ta*U)*Ba;ta=(Ja*H-ta*da)*Ba;X=(La*U-Ga*X)*Ba;H=(La*da-Ga*H)*Ba;D=D-Fa*Aa-X*Da;ba=ba-ta*Aa-H*Da;o.save();o.transform(Fa,ta,X,H,D,ba);o.clip();o.drawImage(sa,0,0);o.restore()}}function Ha(D,ba,X,H){var U=~~(D.r*255),da=~~(D.g*255);D=~~(D.b*255);var sa=~~(ba.r* +255),Aa=~~(ba.g*255);ba=~~(ba.b*255);var Da=~~(X.r*255),La=~~(X.g*255);X=~~(X.b*255);var ta=~~(H.r*255),Ga=~~(H.g*255);H=~~(H.b*255);C[0]=U<0?0:U>255?255:U;C[1]=da<0?0:da>255?255:da;C[2]=D<0?0:D>255?255:D;C[4]=sa<0?0:sa>255?255:sa;C[5]=Aa<0?0:Aa>255?255:Aa;C[6]=ba<0?0:ba>255?255:ba;C[8]=Da<0?0:Da>255?255:Da;C[9]=La<0?0:La>255?255:La;C[10]=X<0?0:X>255?255:X;C[12]=ta<0?0:ta>255?255:ta;C[13]=Ga<0?0:Ga>255?255:Ga;C[14]=H<0?0:H>255?255:H;ha.putImageData(Ia,0,0);wa.drawImage(fa,0,0);return Ca}function la(D, +ba,X){D=(D-ba)/(X-ba);return D*D*(3-2*D)}function qa(D){D=(D+1)*0.5;return D<0?0:D>1?1:D}function ma(D,ba){var X=ba.x-D.x,H=ba.y-D.y,U=1/Math.sqrt(X*X+H*H);X*=U;H*=U;ba.x+=X;ba.y+=H;D.x-=X;D.y-=H}var ka,oa,$,xa,va,Oa,ya,Na;this.autoClear?this.clear():o.setTransform(1,0,0,-1,m,k);c=e.projectScene(G,L,this.sortElements);(y=G.lights.length>0)&&P(G);ka=0;for(oa=c.length;ka0){j.r+=s.color.r*w;j.g+=s.color.g*w;j.b+=s.color.b*w}}else if(s instanceof THREE.PointLight){aa.sub(s.position,n.centroidWorld);aa.normalize();w=n.normalWorld.dot(aa)*s.intensity;if(w>0){j.r+=s.color.r*w;j.g+=s.color.g*w;j.b+=s.color.b*w}}}}function b(p,n,j,i,q,s){E=e(O++);E.setAttribute("d","M "+p.positionScreen.x+ +" "+p.positionScreen.y+" L "+n.positionScreen.x+" "+n.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(q instanceof THREE.MeshBasicMaterial)I.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshLambertMaterial)if(d){S.r=V.r;S.g=V.g;S.b=V.b;a(s,i,S);I.r=q.color.r*S.r;I.g=q.color.g*S.g;I.b=q.color.b*S.b;I.updateStyleString()}else I.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshDepthMaterial){M=1-q.__2near/(q.__farPlusNear-i.z*q.__farMinusNear); +I.setRGB(M,M,M)}else q instanceof THREE.MeshNormalMaterial&&I.setRGB(g(i.normalWorld.x),g(i.normalWorld.y),g(i.normalWorld.z));q.wireframe?E.setAttribute("style","fill: none; stroke: "+I.__styleString+"; stroke-width: "+q.wireframe_linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframe_linecap+"; stroke-linejoin: "+q.wireframe_linejoin):E.setAttribute("style","fill: "+I.__styleString+"; fill-opacity: "+q.opacity);m.appendChild(E)}function c(p,n,j,i,q,s,w){E=e(O++);E.setAttribute("d", +"M "+p.positionScreen.x+" "+p.positionScreen.y+" L "+n.positionScreen.x+" "+n.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)I.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(d){S.r=V.r;S.g=V.g;S.b=V.b;a(w,q,S);I.r=s.color.r*S.r;I.g=s.color.g*S.g;I.b=s.color.b*S.b;I.updateStyleString()}else I.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){M= +1-s.__2near/(s.__farPlusNear-q.z*s.__farMinusNear);I.setRGB(M,M,M)}else s instanceof THREE.MeshNormalMaterial&&I.setRGB(g(q.normalWorld.x),g(q.normalWorld.y),g(q.normalWorld.z));s.wireframe?E.setAttribute("style","fill: none; stroke: "+I.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):E.setAttribute("style","fill: "+I.__styleString+"; fill-opacity: "+s.opacity);m.appendChild(E)} +function e(p){if(R[p]==null){R[p]=document.createElementNS("http://www.w3.org/2000/svg","path");f==0&&R[p].setAttribute("shape-rendering","crispEdges")}return R[p]}function g(p){return p<0?Math.min((1+p)*0.5,0.5):0.5+Math.min(p*0.5,0.5)}var h=null,l=new THREE.Projector,m=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,o,u,x,v,A,K,N,J=new THREE.Rectangle,r=new THREE.Rectangle,d=!1,I=new THREE.Color(16777215),S=new THREE.Color(16777215),V=new THREE.Color(0),ea=new THREE.Color(0),T=new THREE.Color(0), +M,aa=new THREE.Vector3,R=[],ca=[],W=[],E,O,ia,Q,f=1;this.domElement=m;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(p){switch(p){case "high":f=1;break;case "low":f=0}};this.setSize=function(p,n){k=p;o=n;u=k/2;x=o/2;m.setAttribute("viewBox",-u+" "+-x+" "+k+" "+o);m.setAttribute("width",k);m.setAttribute("height",o);J.set(-u,-x,u,x)};this.clear=function(){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])};this.render=function(p,n){var j,i,q,s,w,F,t,y;this.autoClear&& +this.clear();h=l.projectScene(p,n,this.sortElements);Q=ia=O=0;if(d=p.lights.length>0){t=p.lights;V.setRGB(0,0,0);ea.setRGB(0,0,0);T.setRGB(0,0,0);j=0;for(i=t.length;j0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"",s.light_map?"#define USE_LIGHTMAP": -"",s.vertex_colors?"#define USE_COLOR":"",s.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -d.attachShader(o,N("fragment",i+F));d.attachShader(o,N("vertex",s+q));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};f.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)o.push(j);j=f.program;F=0;for(q=o.length;F< -q;F++){i=o[F];j.uniforms[i]=d.getUniformLocation(j,i)}f=f.program;j=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];o=0;for(F=j.length;o0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP": +"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +d.attachShader(n,N("fragment",i+F));d.attachShader(n,N("vertex",q+p));d.linkProgram(n);d.getProgramParameter(n,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(n,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");n.uniforms={};n.attributes={};f.program=n;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)n.push(j);j=f.program;F=0;for(p=n.length;F< +p;F++){i=n[F];j.uniforms[i]=d.getUniformLocation(j,i)}f=f.program;j=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];n=0;for(F=j.length;n=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.color)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.normal)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.tangent)}if(f.uv>= -0)if(i.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(s instanceof THREE.SkinnedMesh){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA, -4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexA);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexB);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinIndex);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinWeight)}if(s instanceof -THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.drawElements(d.LINES,i.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,i.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(s,0,i.__webGLLineCount)}else s instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS, -0,i.__webGLParticleCount)};this.render=function(f,q,o,j){var i,s,t,y,F,r,E,B=f.lights,Y=f.fog;q.autoUpdateMatrix&&q.update();q.globalMatrix.flattenToArray(Q);q.projectionMatrix.flattenToArray(R);q.inverseMatrix.flattenToArray(ba);aa.multiply(q.projectionMatrix,q.globalMatrix);h(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,!1,q,this);this.initWebGLObjects(f,q);K(o,j!==undefined?j:!0);this.autoClear&&this.clear();y=f.__webGLObjects.length;for(j=0;j0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,ga)}if(ca&&ua>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ka,ga)}if(D){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,ga);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,va,ga)}if(x>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer); -d.bufferData(d.ARRAY_BUFFER,ma,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ka,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,na,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,$,ga)}}w(objlist,F,s,y,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){s= -t;s.__webGLVertexBuffer=d.createBuffer();s.__webGLColorBuffer=d.createBuffer();s=t;y=s.vertices.length;s.__vertexArray=new Float32Array(y*3);s.__colorArray=new Float32Array(y*3);s.__webGLLineCount=y;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){s=t;y=d.DYNAMIC_DRAW;B=void 0;B=void 0;r=void 0;i=void 0;Y=s.vertices;ga=s.colors;ua=Y.length;oa=ga.length;Z=s.__vertexArray;E=s.__colorArray;fa=s.__dirtyColors;if(s.__dirtyVertices){for(B=0;B=0;o--){j=f.__webGLObjects[o].object;q==j&&f.__webGLObjects.splice(o,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(f,q){if(f){!q||q=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)}; -this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", -envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", -map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", -lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +0)if(i.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(q instanceof THREE.SkinnedMesh){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA, +4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexA);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexB);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinIndex);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinWeight)}if(q instanceof +THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.drawElements(d.LINES,i.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,i.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(q,0,i.__webGLLineCount)}else q instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS, +0,i.__webGLParticleCount)};this.render=function(f,p,n,j){var i,q,s,w,F,t,y,B,Y=f.lights,ga=f.fog;p.autoUpdateMatrix&&p.update();p.globalMatrix.flattenToArray(W);p.projectionMatrix.flattenToArray(R);p.inverseMatrix.flattenToArray(ca);aa.multiply(p.projectionMatrix,p.globalMatrix);h(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,!1,p);this.initWebGLObjects(f,p);K(n,j!==undefined?j:!0);this.autoClear&&this.clear();F=f.__webGLObjects.length;for(j=0;j0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer); +d.bufferData(d.ARRAY_BUFFER,Ma,ga)}if(ba&&ua>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ka,ga)}if(D){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,ga);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,va,ga)}if(z>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,ma,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER, +ka,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,oa,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,$,ga)}}x(objlist,F,q,w,j)}s.__dirtyVertices=!1;s.__dirtyElements=!1;s.__dirtyUvs=!1;s.__dirtyNormals=!1;s.__dirtyTangents=!1;s.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!s.__webGLVertexBuffer){q=s;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=s;w=q.vertices.length;q.__vertexArray= +new Float32Array(w*3);q.__colorArray=new Float32Array(w*3);q.__webGLLineCount=w;s.__dirtyVertices=!0;s.__dirtyColors=!0}if(s.__dirtyVertices||s.__dirtyColors){q=s;w=d.DYNAMIC_DRAW;B=void 0;B=void 0;t=void 0;i=void 0;Y=q.vertices;ga=q.colors;ua=Y.length;na=ga.length;Z=q.__vertexArray;y=q.__colorArray;fa=q.__dirtyColors;if(q.__dirtyVertices){for(B=0;B=0;n--){j=f.__webGLObjects[n].object;p==j&&f.__webGLObjects.splice(n, +1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(f,p){if(f){!p||p=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", +envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", +envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", +map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", +lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"}; diff --git a/build/ThreeDebug.js b/build/ThreeDebug.js index 61f9a079..31fa0cd8 100644 --- a/build/ThreeDebug.js +++ b/build/ThreeDebug.js @@ -1,92 +1,87 @@ // ThreeDebug.js r32 - http://github.com/mrdoob/three.js var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)}; -THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,h,m,n,k;if(c==0)e=g=h=0;else{m=Math.floor(a*6);n=a*6-m;a=c*(1-b);k=c*(1-b*n);b=c*(1-b*(1-n));switch(m){case 1:e=k;g=c;h=a;break;case 2:e=a;g=c;h=b;break;case 3:e=a;g=k;h=c;break;case 4:e=b;g=a;h=c;break;case 5:e=c;g=a;h=k;break;case 6:case 0:e=c;g=b;h=a}}this.r=e;this.g=g;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}}, +THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,h,l,n,k;if(c==0)e=g=h=0;else{l=Math.floor(a*6);n=a*6-l;a=c*(1-b);k=c*(1-b*n);b=c*(1-b*(1-n));switch(l){case 1:e=k;g=c;h=a;break;case 2:e=a;g=c;h=b;break;case 3:e=a;g=k;h=c;break;case 4:e=b;g=a;h=c;break;case 5:e=c;g=a;h=k;break;case 6:case 0:e=c;g=b;h=a}}this.r=e;this.g=g;this.b=h;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,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.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,b,c){this.x=a||0;this.y=b||0;this.z=c||0;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},set x(e){this.that.x=e;this.isDirty=!0},set y(e){this.that.y=e;this.isDirty=!0},set z(e){this.that.z=e;this.isDirty=!0}};this.api.__proto__=THREE.Vector3.prototype;return this.api}; -THREE.Vector3.prototype={set:function(a,b,c){var e=this.that;e.x=a;e.y=b;e.z=c;this.isDirty=!0;return this},copy:function(a){var b=this.that;b.x=a.x;b.y=a.y;b.z=a.z;this.isDirty=!0;return this},add:function(a,b){var c=this.that;c.x=a.x+b.x;c.y=a.y+b.y;c.z=a.z+b.z;this.isDirty=!0;return this},addSelf:function(a){var b=this.that;b.x+=a.x;b.y+=a.y;b.z+=a.z;this.isDirty=!0;return this},addScalar:function(a){var b=this.that;b.x+=a;b.y+=a;b.z+=a;this.isDirty=!0;return this},sub:function(a,b){var c=this.that; -c.x=a.x-b.x;c.y=a.y-b.y;c.z=a.z-b.z;this.isDirty=!0;return this},subSelf:function(a){var b=this.that;b.x-=a.x;b.y-=a.y;b.z-=a.z;this.isDirty=!0;return this},cross:function(a,b){var c=this.that;c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x;this.isDirty=!0;return this},crossSelf:function(a){var b=this.that,c=b.x,e=b.y,g=b.z;b.x=e*a.z-g*a.y;b.y=g*a.x-c*a.z;b.z=c*a.y-e*a.x;this.isDirty=!0;return this},multiply:function(a,b){var c=this.that;c.x=a.x*b.x;c.y=a.y*b.y;c.z=a.z*b.z;this.isDirty= -!0;return this},multiplySelf:function(a){var b=this.that;b.x*=a.x;b.y*=a.y;b.z*=a.z;this.isDirty=!0;return this},multiplyScalar:function(a){var b=this.that;b.x*=a;b.y*=a;b.z*=a;this.isDirty=!0;return this},divideSelf:function(a){var b=this.that;b.x/=a.x;b.y/=a.y;b.z/=a.z;this.isDirty=!0;return this},divideScalar:function(a){var b=this.that;b.x/=a;b.y/=a;b.z/=a;this.isDirty=!0;return this},dot:function(a){var b=this.that;return b.x*a.x+b.y*a.y+b.z*a.z},distanceTo:function(a){var b=this.that,c=b.x- -a.x,e=b.y-a.y;a=b.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var b=this.that,c=b.x-a.x,e=b.y-a.y;a=b.z-a.z;return c*c+e*e+a*a},length:function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},lengthSq:function(){var a=this.that;return a.x*a.x+a.y*a.y+a.z*a.z},lengthManhattan:function(){var a=this.that;return a.x+a.y+a.z},negate:function(){var a=this.that;a.x=-this.x;a.y=-this.y;a.z=-this.z;this.isDirty=!0;return this},normalize:function(){var a=this.that;a=Math.sqrt(a.x* -a.x+a.y*a.y+a.z*a.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);this.isDirty=!0;return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=this.that;return Math.abs(a.x)<1.0E-4&&Math.abs(a.y)<1.0E-4&&Math.abs(a.z)<1.0E-4},clone:function(){var a=this.that;return new THREE.Vector3(a.x,a.y,a.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1}; +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,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; +THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.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 b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+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},lengthManhattan:function(){return this.x+ +this.y+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,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1}; THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},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,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&A>0&&W+A<1}var c,e,g,h,m,n,k,l,u,w, -v,z=a.geometry,K=z.vertices,N=[];c=0;for(e=z.faces.length;ck?e:k;g=g>l?g:l}a()}; -this.add3Points=function(k,l,u,w,v,z){if(n){n=!1;b=ku?k>v?k:v:u>v?u:v;g=l>w?l>z?l:z:w>z?w:z}else{b=ku?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e;g=l>w?l>z?l>g?l:g:z>g?z:g:w>z?w>g?w:g:z>g?z:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? +THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a0&&J>0&&V+J<1}var c,e,g,h,l,n,k,m,u,x, +w,A=a.geometry,K=A.vertices,N=[];c=0;for(e=A.faces.length;ck?e:k;g=g>m?g:m}a()}; +this.add3Points=function(k,m,u,x,w,A){if(n){n=!1;b=ku?k>w?k:w:u>w?u:w;g=m>x?m>A?m:A:x>A?x:A}else{b=ku?k>w?k>e?k:e:w>e?w:e:u>w?u>e?u:e:w>e?w:e;g=m>x?m>A?m>g?m:g:A>g?A:g:x>A?x>g?x:g:A>g?A:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=bk.getRight()? e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e=0&&Math.min(g,k.getBottom())-Math.max(c,k.getTop())>=0};this.empty=function(){n=!0;g=e=c=b=0;a()};this.isEmpty=function(){return n};this.toString=function(){return"THREE.Rectangle ( left: "+ -b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+h+", height: "+m+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; -THREE.Matrix4=function(a,b,c,e,g,h,m,n,k,l,u,w,v,z,K,N){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=m||0;this.n24=n||0;this.n31=k||0;this.n32=l||0;this.n33=u||1;this.n34=w||0;this.n41=v||0;this.n42=z||0;this.n43=K||0;this.n44=N||1;this.flat=Array(16);this.m33=new THREE.Matrix3;if(typeof Float32Array!=="undefined"){var A=this;this.float32Array=new Float32Array(16);this.float32Array3x3=new Float32Array(9);this.flatten32=function(){var p=A.float32Array; -p[0]=A.n11;p[1]=A.n21;p[2]=A.n31;p[3]=A.n41;p[4]=A.n12;p[5]=A.n22;p[6]=A.n32;p[7]=A.n42;p[8]=A.n13;p[9]=A.n23;p[10]=A.n33;p[11]=A.n43;p[12]=A.n14;p[13]=A.n24;p[14]=A.n34;p[15]=A.n44;return p};this.flatten323x3=function(){var p=A.float32Array3x3;p[0]=A.n11;p[1]=A.n21;p[2]=A.n31;p[3]=A.n12;p[4]=A.n22;p[5]=A.n32;p[6]=A.n13;p[7]=A.n23;p[8]=A.n33;return p}}}; -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,b,c,e,g,h,m,n,k,l,u,w,v,z,K,N){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=h;this.n23=m;this.n24=n;this.n31=k;this.n32=l;this.n33=u;this.n34=w;this.n41=v;this.n42=z;this.n43=K;this.n44=N;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+h+", height: "+l+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; +THREE.Matrix4=function(a,b,c,e,g,h,l,n,k,m,u,x,w,A,K,N){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=l||0;this.n24=n||0;this.n31=k||0;this.n32=m||0;this.n33=u||1;this.n34=x||0;this.n41=w||0;this.n42=A||0;this.n43=K||0;this.n44=N||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,b,c,e,g,h,l,n,k,m,u,x,w,A,K,N){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=h;this.n23=l;this.n24=n;this.n31=k;this.n32=m;this.n33=u;this.n34=x;this.n41=w;this.n42=A;this.n43=K;this.n44=N;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,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,b).normalize();e.cross(c,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a); this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43* a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41* -a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,m=a.n21,n=a.n22,k=a.n23,l=a.n24,u=a.n31,w=a.n32,v=a.n33,z=a.n34,K=a.n41,N=a.n42,A=a.n43,p=a.n44,d=b.n11,J=b.n12,T=b.n13,W=b.n14,ea=b.n21,V=b.n22,L=b.n23,aa=b.n24,R=b.n31,ba=b.n32,Q=b.n33,H=b.n34,O=b.n41,ia=b.n42,S=b.n43,f=b.n44;this.n11=c*d+e*ea+g*R+h*O;this.n12=c*J+e*V+g*ba+h*ia;this.n13=c*T+e*L+g*Q+h*S;this.n14=c*W+e*aa+g*H+h*f;this.n21=m*d+n*ea+k*R+l*O;this.n22=m*J+n*V+k*ba+l*ia;this.n23= -m*T+n*L+k*Q+l*S;this.n24=m*W+n*aa+k*H+l*f;this.n31=u*d+w*ea+v*R+z*O;this.n32=u*J+w*V+v*ba+z*ia;this.n33=u*T+w*L+v*Q+z*S;this.n34=u*W+w*aa+v*H+z*f;this.n41=K*d+N*ea+A*R+p*O;this.n42=K*J+N*V+A*ba+p*ia;this.n43=K*T+N*L+A*Q+p*S;this.n44=K*W+N*aa+A*H+p*f;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,h=a.n13,m=a.n14,n=a.n21,k=a.n22,l=a.n23,u=a.n24,w=a.n31,v=a.n32,z=a.n33,K=a.n34,N=a.n41,A=a.n42,p=a.n43;a=a.n44;var d=b.n11,J=b.n12,T=b.n13,W=b.n14,ea=b.n21,V=b.n22,L=b.n23,aa=b.n24,R=b.n31, -ba=b.n32,Q=b.n33,H=b.n34,O=b.n41,ia=b.n42,S=b.n43;b=b.n44;this.n11=e*d+g*ea+h*R+m*O;this.n12=e*J+g*V+h*ba+m*ia;this.n13=e*T+g*L+h*Q+m*S;this.n14=e*W+g*aa+h*H+m*b;this.n21=n*d+k*ea+l*R+u*O;this.n22=n*J+k*V+l*ba+u*ia;this.n23=n*T+k*L+l*Q+u*S;this.n24=n*W+k*aa+l*H+u*b;this.n31=w*d+v*ea+z*R+K*O;this.n32=w*J+v*V+z*ba+K*ia;this.n33=w*T+v*L+z*Q+K*S;this.n34=w*W+v*aa+z*H+K*b;this.n41=N*d+A*ea+p*R+a*O;this.n42=N*J+A*V+p*ba+a*ia;this.n43=N*T+A*L+p*Q+a*S;this.n44=N*W+A*aa+p*H+a*b;c[0]=this.n11;c[1]=this.n21; -c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,h=this.n21,m=this.n22,n=this.n23,k=this.n24,l=this.n31,u=this.n32,w=this.n33,v=this.n34,z=this.n41,K=this.n42,N=this.n43,A=this.n44,p=a.n11,d=a.n21,J=a.n31,T=a.n41,W=a.n12,ea=a.n22,V=a.n32,L=a.n42,aa=a.n13,R=a.n23, -ba=a.n33,Q=a.n43,H=a.n14,O=a.n24,ia=a.n34;a=a.n44;this.n11=b*p+c*d+e*J+g*T;this.n12=b*W+c*ea+e*V+g*L;this.n13=b*aa+c*R+e*ba+g*Q;this.n14=b*H+c*O+e*ia+g*a;this.n21=h*p+m*d+n*J+k*T;this.n22=h*W+m*ea+n*V+k*L;this.n23=h*aa+m*R+n*ba+k*Q;this.n24=h*H+m*O+n*ia+k*a;this.n31=l*p+u*d+w*J+v*T;this.n32=l*W+u*ea+w*V+v*L;this.n33=l*aa+u*R+w*ba+v*Q;this.n34=l*H+u*O+w*ia+v*a;this.n41=z*p+K*d+N*J+A*T;this.n42=z*W+K*ea+N*V+A*L;this.n43=z*aa+K*R+N*ba+A*Q;this.n44=z*H+K*O+N*ia+A*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,b=this.n12,c=this.n13,e=this.n14,g=this.n21,h=this.n22,m=this.n23,n=this.n24,k=this.n31,l=this.n32,u=this.n33,w=this.n34,v=this.n41,z=this.n42,K=this.n43,N=this.n44;return e*m*l*v-c*n*l*v-e*h*u*v+b*n*u*v+c*h*w*v-b*m*w*v-e*m*k*z+c*n*k*z+e*g*u*z-a*n*u*z-c*g*w*z+a*m*w*z+ -e*h*k*K-b*n*k*K-e*g*l*K+a*n*l*K+b*g*w*K-a*h*w*K-c*h*k*N+b*m*k*N+c*g*l*N-a*m*l*N-b*g*u*N+a*h*u*N},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}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.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,l=a.n21,n=a.n22,k=a.n23,m=a.n24,u=a.n31,x=a.n32,w=a.n33,A=a.n34,K=a.n41,N=a.n42,J=a.n43,r=a.n44,d=b.n11,I=b.n12,S=b.n13,V=b.n14,ea=b.n21,T=b.n22,M=b.n23,aa=b.n24,R=b.n31,ca=b.n32,W=b.n33,F=b.n34,O=b.n41,ia=b.n42,Q=b.n43,f=b.n44;this.n11=c*d+e*ea+g*R+h*O;this.n12=c*I+e*T+g*ca+h*ia;this.n13=c*S+e*M+g*W+h*Q;this.n14=c*V+e*aa+g*F+h*f;this.n21=l*d+n*ea+k*R+m*O;this.n22=l*I+n*T+k*ca+m*ia;this.n23= +l*S+n*M+k*W+m*Q;this.n24=l*V+n*aa+k*F+m*f;this.n31=u*d+x*ea+w*R+A*O;this.n32=u*I+x*T+w*ca+A*ia;this.n33=u*S+x*M+w*W+A*Q;this.n34=u*V+x*aa+w*F+A*f;this.n41=K*d+N*ea+J*R+r*O;this.n42=K*I+N*T+J*ca+r*ia;this.n43=K*S+N*M+J*W+r*Q;this.n44=K*V+N*aa+J*F+r*f;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,h=a.n13,l=a.n14,n=a.n21,k=a.n22,m=a.n23,u=a.n24,x=a.n31,w=a.n32,A=a.n33,K=a.n34,N=a.n41,J=a.n42,r=a.n43;a=a.n44;var d=b.n11,I=b.n12,S=b.n13,V=b.n14,ea=b.n21,T=b.n22,M=b.n23,aa=b.n24,R=b.n31, +ca=b.n32,W=b.n33,F=b.n34,O=b.n41,ia=b.n42,Q=b.n43;b=b.n44;this.n11=e*d+g*ea+h*R+l*O;this.n12=e*I+g*T+h*ca+l*ia;this.n13=e*S+g*M+h*W+l*Q;this.n14=e*V+g*aa+h*F+l*b;this.n21=n*d+k*ea+m*R+u*O;this.n22=n*I+k*T+m*ca+u*ia;this.n23=n*S+k*M+m*W+u*Q;this.n24=n*V+k*aa+m*F+u*b;this.n31=x*d+w*ea+A*R+K*O;this.n32=x*I+w*T+A*ca+K*ia;this.n33=x*S+w*M+A*W+K*Q;this.n34=x*V+w*aa+A*F+K*b;this.n41=N*d+J*ea+r*R+a*O;this.n42=N*I+J*T+r*ca+a*ia;this.n43=N*S+J*M+r*W+a*Q;this.n44=N*V+J*aa+r*F+a*b;c[0]=this.n11;c[1]=this.n21; +c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,h=this.n21,l=this.n22,n=this.n23,k=this.n24,m=this.n31,u=this.n32,x=this.n33,w=this.n34,A=this.n41,K=this.n42,N=this.n43,J=this.n44,r=a.n11,d=a.n21,I=a.n31,S=a.n41,V=a.n12,ea=a.n22,T=a.n32,M=a.n42,aa=a.n13,R=a.n23, +ca=a.n33,W=a.n43,F=a.n14,O=a.n24,ia=a.n34;a=a.n44;this.n11=b*r+c*d+e*I+g*S;this.n12=b*V+c*ea+e*T+g*M;this.n13=b*aa+c*R+e*ca+g*W;this.n14=b*F+c*O+e*ia+g*a;this.n21=h*r+l*d+n*I+k*S;this.n22=h*V+l*ea+n*T+k*M;this.n23=h*aa+l*R+n*ca+k*W;this.n24=h*F+l*O+n*ia+k*a;this.n31=m*r+u*d+x*I+w*S;this.n32=m*V+u*ea+x*T+w*M;this.n33=m*aa+u*R+x*ca+w*W;this.n34=m*F+u*O+x*ia+w*a;this.n41=A*r+K*d+N*I+J*S;this.n42=A*V+K*ea+N*T+J*M;this.n43=A*aa+K*R+N*ca+J*W;this.n44=A*F+K*O+N*ia+J*a;return this},multiplyScalar:function(a){this.n11*= +a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,g=this.n21,h=this.n22,l=this.n23,n=this.n24,k=this.n31,m=this.n32,u=this.n33,x=this.n34,w=this.n41,A=this.n42,K=this.n43,N=this.n44;return e*l*m*w-c*n*m*w-e*h*u*w+b*n*u*w+c*h*x*w-b*l*x*w-e*l*k*A+c*n*k*A+e*g*u*A-a*n*u*A-c*g*x*A+a*l*x*A+ +e*h*k*K-b*n*k*K-e*g*m*K+a*n*m*K+b*g*x*K-a*h*x*K-c*h*k*N+b*l*k*N+c*g*m*N-a*l*m*N-b*g*u*N+a*h*u*N},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33; a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]= this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1); -return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,h=a.x,m=a.y,n=a.z,k=g* -h,l=g*m;this.set(k*h+c,k*m-e*n,k*n+e*m,0,k*m+e*n,l*m+c,l*n-e*h,0,k*n-e*m,l*n+e*h,g*n*n+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var m=a*e,n=c*e;this.n11=a*g;this.n12=c*b-m*h;this.n13=m*b+c*h;this.n21=e;this.n22=g*h;this.n23=-g*b;this.n31=-c*g;this.n32=n*h+a*b;this.n33=-n*b+a*h},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,e=a.z,g=a.w,h=b+b,m=c+c,n=e+e;a=b*h;var k=b*m;b*=n;var l=c*m;c*=n;e*=n;h*=g;m*=g;g*=n;this.n11=1-(l+e);this.n12=k-g;this.n13=b+m;this.n21=k+g;this.n22=1-(a+e);this.n23=c-h;this.n31=b-m;this.n32=c+h;this.n33=1-(a+l)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;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,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b}; -THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,m=a.n21,n=a.n22,k=a.n23,l=a.n24,u=a.n31,w=a.n32,v=a.n33,z=a.n34,K=a.n41,N=a.n42,A=a.n43,p=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*z*N-l*v*N+l*w*A-n*z*A-k*w*p+n*v*p;b.n12=h*v*N-g*z*N-h*w*A+e*z*A+g*w*p-e*v*p;b.n13=g*l*N-h*k*N+h*n*A-e*l*A-g*n*p+e*k*p;b.n14=h*k*w-g*l*w-h*n*v+e*l*v+g*n*z-e*k*z;b.n21=l*v*K-k*z*K-l*u*A+m*z*A+k*u*p-m*v*p;b.n22=g*z*K-h*v*K+h*u*A-c*z*A-g*u*p+c*v*p;b.n23=h*k*K-g*l*K-h*m*A+c*l*A+g*m*p-c*k*p; -b.n24=g*l*u-h*k*u+h*m*v-c*l*v-g*m*z+c*k*z;b.n31=n*z*K-l*w*K+l*u*N-m*z*N-n*u*p+m*w*p;b.n32=h*w*K-e*z*K-h*u*N+c*z*N+e*u*p-c*w*p;b.n33=g*l*K-h*n*K+h*m*N-c*l*N-e*m*p+c*n*p;b.n34=h*n*u-e*l*u-h*m*w+c*l*w+e*m*z-c*n*z;b.n41=k*w*K-n*v*K-k*u*N+m*v*N+n*u*A-m*w*A;b.n42=e*v*K-g*w*K+g*u*N-c*v*N-e*u*A+c*w*A;b.n43=g*n*K-e*k*K-g*m*N+c*k*N+e*m*A-c*n*A;b.n44=e*k*u-g*n*u+g*m*w-c*k*w-e*m*v+c*n*v;b.multiplyScalar(1/a.determinant());return b}; -THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*l;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*h;c[3]=a*m;c[4]=a*n;c[5]=a*k;c[6]=a*l;c[7]=a*u;c[8]=a*w;return b}; -THREE.Matrix4.makeFrustum=function(a,b,c,e,g,h){var m;m=new THREE.Matrix4;m.n11=2*g/(b-a);m.n12=0;m.n13=(b+a)/(b-a);m.n14=0;m.n21=0;m.n22=2*g/(e-c);m.n23=(e+c)/(e-c);m.n24=0;m.n31=0;m.n32=0;m.n33=-(h+g)/(h-g);m.n34=-2*h*g/(h-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)}; -THREE.Matrix4.makeOrtho=function(a,b,c,e,g,h){var m,n,k,l;m=new THREE.Matrix4;n=b-a;k=c-e;l=h-g;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((b+a)/n);m.n21=0;m.n22=2/k;m.n23=0;m.n24=-((c+e)/k);m.n31=0;m.n32=0;m.n33=-2/l;m.n34=-((h+g)/l);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; +return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,h=a.x,l=a.y,n=a.z,k=g* +h,m=g*l;this.set(k*h+c,k*l-e*n,k*n+e*l,0,k*l+e*n,m*l+c,m*n-e*h,0,k*n-e*l,m*n+e*h,g*n*n+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var l=a*e,n=c*e;this.n11=a*g;this.n12=c*b-l*h;this.n13=l*b+c*h;this.n21=e;this.n22=g*h;this.n23=-g*b;this.n31=-c*g;this.n32=n*h+a*b;this.n33=-n*b+a*h},setRotationFromQuaternion:function(a){var b= +a.x,c=a.y,e=a.z,g=a.w,h=b+b,l=c+c,n=e+e;a=b*h;var k=b*l;b*=n;var m=c*l;c*=n;e*=n;h*=g;l*=g;g*=n;this.n11=1-(m+e);this.n12=k-g;this.n13=b+l;this.n21=k+g;this.n22=1-(a+e);this.n23=c-h;this.n31=b-l;this.n32=c+h;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; +a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e}; +THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,l=a.n21,n=a.n22,k=a.n23,m=a.n24,u=a.n31,x=a.n32,w=a.n33,A=a.n34,K=a.n41,N=a.n42,J=a.n43,r=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*A*N-m*w*N+m*x*J-n*A*J-k*x*r+n*w*r;b.n12=h*w*N-g*A*N-h*x*J+e*A*J+g*x*r-e*w*r;b.n13=g*m*N-h*k*N+h*n*J-e*m*J-g*n*r+e*k*r;b.n14=h*k*x-g*m*x-h*n*w+e*m*w+g*n*A-e*k*A;b.n21=m*w*K-k*A*K-m*u*J+l*A*J+k*u*r-l*w*r;b.n22=g*A*K-h*w*K+h*u*J-c*A*J-g*u*r+c*w*r;b.n23=h*k*K-g*m*K-h*l*J+c*m*J+g*l*r-c*k*r; +b.n24=g*m*u-h*k*u+h*l*w-c*m*w-g*l*A+c*k*A;b.n31=n*A*K-m*x*K+m*u*N-l*A*N-n*u*r+l*x*r;b.n32=h*x*K-e*A*K-h*u*N+c*A*N+e*u*r-c*x*r;b.n33=g*m*K-h*n*K+h*l*N-c*m*N-e*l*r+c*n*r;b.n34=h*n*u-e*m*u-h*l*x+c*m*x+e*l*A-c*n*A;b.n41=k*x*K-n*w*K-k*u*N+l*w*N+n*u*J-l*x*J;b.n42=e*w*K-g*x*K+g*u*N-c*w*N-e*u*J+c*x*J;b.n43=g*n*K-e*k*K-g*l*N+c*k*N+e*l*J-c*n*J;b.n44=e*k*u-g*n*u+g*l*x-c*k*x-e*l*w+c*n*w;b.multiplyScalar(1/a.determinant());return b}; +THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,l=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*l+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*h;c[3]=a*l;c[4]=a*n;c[5]=a*k;c[6]=a*m;c[7]=a*u;c[8]=a*x;return b}; +THREE.Matrix4.makeFrustum=function(a,b,c,e,g,h){var l;l=new THREE.Matrix4;l.n11=2*g/(b-a);l.n12=0;l.n13=(b+a)/(b-a);l.n14=0;l.n21=0;l.n22=2*g/(e-c);l.n23=(e+c)/(e-c);l.n24=0;l.n31=0;l.n32=0;l.n33=-(h+g)/(h-g);l.n34=-2*h*g/(h-g);l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)}; +THREE.Matrix4.makeOrtho=function(a,b,c,e,g,h){var l,n,k,m;l=new THREE.Matrix4;n=b-a;k=c-e;m=h-g;l.n11=2/n;l.n12=0;l.n13=0;l.n14=-((b+a)/n);l.n21=0;l.n22=2/k;l.n23=0;l.n24=-((c+e)/k);l.n31=0;l.n32=0;l.n33=-2/m;l.n34=-((h+g)/m);l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3; THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api}; -THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var m=a*b,n=e*g,k=this.that;k.w=m*h-n*c;k.x=m*c+n*h;k.y=e*b*h+a*g*c;k.z=a*g*h-e*b*c;this.isDirty=!0;return this}; +THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var l=a*b,n=e*g,k=this.that;k.w=l*h-n*c;k.x=l*c+n*h;k.y=e*b*h+a*g*c;k.z=a*g*h-e*b*c;this.isDirty=!0;return this}; THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)}; THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,h=Math.sqrt(b*b+c*c+e*e+g*g);if(h==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}h=1/h;a.x=b*h;a.y=c*h;a.z=e*h;a.w=g*h;this.isDirty=!0;return this}; THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this}; -THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,h=a.z,m=c.x,n=c.y,k=c.z;c=c.w;var l=c*e+n*h-k*g,u=c*g+k*e-m*h,w=c*h+m*g-n*e;e=-m*e-n*g-k*h;b.x=l*c+e*-m+u*-k-w*-n;b.y=u*c+e*-n+w*-m-l*-k;b.z=w*c+e*-k+l*-n-u*-m;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; -THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*h)/m;e=Math.sin(e*h)/m;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c}; +THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,h=a.z,l=c.x,n=c.y,k=c.z;c=c.w;var m=c*e+n*h-k*g,u=c*g+k*e-l*h,x=c*h+l*g-n*e;e=-l*e-n*g-k*h;b.x=m*c+e*-l+u*-k-x*-n;b.y=u*c+e*-n+x*-l-m*-k;b.z=x*c+e*-k+m*-n-u*-l;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){}; +THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(g),l=Math.sqrt(1-g*g);if(Math.abs(l)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*h)/l;e=Math.sin(e*h)/l;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c}; THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}}; THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}}; THREE.Face4=function(a,b,c,e,g,h){this.a=a;this.b=b;this.c=c;this.d=e;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.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||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.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1}; THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b0){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 b=1,c=this.vertices.length;bthis.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,b=0,c=this.vertices.length;b65535){l[n].counter+=1;k=l[n].hash+"_"+l[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:m,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=h}},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,b=0,c=this.vertices.length;b65535){m[n].counter+=1;k=m[n].hash+"_"+m[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:l,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0; -THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1}; -THREE.Object3D.prototype.update=function(a,b,c,e){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;athis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}m=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var u=0,w=this.hierarchy.length;u1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,h.quaternion,b)}else{c=c==="pos"?h.position:h.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(n[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;uthis.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}l=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var u=0,x=this.hierarchy.length;u1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,h.quaternion,b)}else{c=c==="pos"?h.position:h.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(n[0][l]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u-this.zNear)return!1;if(m+h<-this.zFar)return!1;m-=h;var n=this.projectionMatrix,k=1/(n.n43*m),l=k*this.screenCenterX,u=(g.n11*b+g.n12*c+g.n13*e+g.n14)*n.n11*l;h=n.n11*h*l;if(u+h<-this.screenCenterX)return!1;if(u-h>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*n.n22*k*this.screenCenterY; -if(b+h<-this.screenCenterY)return!1;if(b-h>this.screenCenterY)return!1;a.screenPosition.set(u,b,m,h);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight; +THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix, +this.inverseMatrix)}}for(a=0;a-this.zNear)return!1;if(l+h<-this.zFar)return!1;l-=h;var n=this.projectionMatrix,k=1/(n.n43*l),m=k*this.screenCenterX,u=(g.n11*b+g.n12*c+g.n13*e+g.n14)*n.n11*m;h=n.n11*h*m;if(u+h<-this.screenCenterX)return!1;if(u-h>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*n.n22*k*this.screenCenterY; +if(b+h<-this.screenCenterY)return!1;if(b-h>this.screenCenterY)return!1;a.screenPosition.set(u,b,l,h);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;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,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1; -THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; -THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= +THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0}; +THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; -THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.LineBasicMaterialCounter={value:0}; -THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== +THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}}; +THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!== undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+ -"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshBasicMaterialCounter={value:0}; -THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1; -if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading; -if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning= -a.skinning}}; -THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+ -this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshLambertMaterialCounter={value:0}; -THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin= +"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== +undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!== +undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; +THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+ +"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin= this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map; if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth; if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (
id: "+this.id+"
color: "+this.color+"
ambient: "+this.ambient+"
specular: "+this.specular+"
shininess: "+this.shininess+"
opacity: "+this.opacity+"
map: "+this.map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+ -this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshPhongMaterialCounter={value:0}; -THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== -undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshDepthMaterialCounter={value:0}; -THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== -undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; -THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader= +this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== +undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}}; +THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== +undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; +THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader= a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!== undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; -THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; -THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; -if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; -THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,e,g,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter}; +THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!== +undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}}; +THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;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.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; +THREE.Texture=function(a,b,c,e,g,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h: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,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b=0&&Q>=0&&H>=0&&O>=0)return!0;else if(ba<0&&Q<0||H<0&&O<0)return!1;else{if(ba<0)aa=Math.max(aa,ba/(ba-Q));else Q<0&&(R=Math.min(R,ba/(ba-Q)));if(H<0)aa=Math.max(aa,H/(H-O));else O<0&&(R=Math.min(R,H/(H-O)));if(Rba&&S.z0&&A.z<1){v=K[z]=K[z]||new THREE.RenderableParticle;v.x=A.x/A.w;v.y=A.y/A.w;v.z=A.z;v.rotation=o.rotation.z;v.scale.x=o.scale.x*Math.abs(v.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14)); -v.scale.y=o.scale.y*Math.abs(v.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24));v.materials=o.materials;R.push(v);z++}}}}aa&&R.sort(a);return R};this.unprojectVector=function(V,L){var aa=THREE.Matrix4.makeInvert(L.matrix);aa.multiplySelf(THREE.Matrix4.makeInvert(L.projectionMatrix));aa.multiplyVector3(V);return V}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,h;this.domElement=document.createElement("div");this.setSize=function(m,n){c=m;e=n;g=c/2;h=e/2};this.render=function(m,n){var k,l,u,w,v,z,K,N;a=b.projectScene(m,n);k=0;for(l=a.length;k0){I.r+=sa.r*da;I.g+=sa.g*da;I.b+=sa.b*da}}else if(da instanceof THREE.PointLight){Z.sub(da.position,ca);Z.normalize();da= -X.dot(Z)*Aa;if(da>0){I.r+=sa.r*da;I.g+=sa.g*da;I.b+=sa.b*da}}}}function Ea(D,ca,X){if(X.opacity!=0){a(X.opacity);b(X.blending);var I,U,da,sa,Aa,Da;if(X instanceof THREE.ParticleBasicMaterial){if(X.map&&X.map.image.loaded){sa=X.map.image;Aa=sa.width>>1;Da=sa.height>>1;U=ca.scale.x*n;da=ca.scale.y*k;X=U*Aa;I=da*Da;r.set(D.x-X,D.y-I,D.x+X,D.y+I);if(!x.instersects(r))return;l.save();l.translate(D.x,D.y);l.rotate(-ca.rotation);l.scale(U,-da);l.translate(-Aa,-Da);l.drawImage(sa,0,0);l.restore()}l.beginPath(); -l.moveTo(D.x-10,D.y);l.lineTo(D.x+10,D.y);l.moveTo(D.x,D.y-10);l.lineTo(D.x,D.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)";l.stroke()}else if(X instanceof THREE.ParticleCircleMaterial){if(F){B.r=Y.r+ga.r+oa.r;B.g=Y.g+ga.g+oa.g;B.b=Y.b+ga.b+oa.b;R.r=X.color.r*B.r;R.g=X.color.g*B.g;R.b=X.color.b*B.b;R.updateStyleString()}else R.__styleString=X.color.__styleString;X=ca.scale.x*n;I=ca.scale.y*k;r.set(D.x-X,D.y-I,D.x+X,D.y+I);if(x.instersects(r)){U=R.__styleString;if(N!=U)l.fillStyle=N=U;l.save(); -l.translate(D.x,D.y);l.rotate(-ca.rotation);l.scale(X,I);l.beginPath();l.arc(0,0,1,0,ua,!0);l.closePath();l.fill();l.restore()}}}}function ra(D,ca,X,I){if(I.opacity!=0){a(I.opacity);b(I.blending);l.beginPath();l.moveTo(D.positionScreen.x,D.positionScreen.y);l.lineTo(ca.positionScreen.x,ca.positionScreen.y);l.closePath();if(I instanceof THREE.LineBasicMaterial){R.__styleString=I.color.__styleString;D=I.linewidth;if(A!=D)l.lineWidth=A=D;D=R.__styleString;if(K!=D)l.strokeStyle=K=D;l.stroke();r.inflate(I.linewidth* -2)}}}function y(D,ca,X,I,U,da){if(U.opacity!=0){a(U.opacity);b(U.blending);T=D.positionScreen.x;W=D.positionScreen.y;ea=ca.positionScreen.x;V=ca.positionScreen.y;L=X.positionScreen.x;aa=X.positionScreen.y;l.beginPath();l.moveTo(T,W);l.lineTo(ea,V);l.lineTo(L,aa);l.lineTo(T,W);l.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ka(T,W,ea,V,L,aa,U.map.image,I.uvs[0].u,I.uvs[0].v,I.uvs[1].u,I.uvs[1].v,I.uvs[2].u,I.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&& -U.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=M.matrix;Z.copy(I.vertexNormalsWorld[0]);q=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;o=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(I.vertexNormalsWorld[1]);j=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;i=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(I.vertexNormalsWorld[2]);s=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;t=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Ka(T,W,ea,V,L,aa,U.env_map.image,q,o,j,i,s,t)}}else U.wireframe?pa(U.color.__styleString, -U.wireframe_linewidth):Ma(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ka(T,W,ea,V,L,aa,U.map.image,I.uvs[0].u,I.uvs[0].v,I.uvs[1].u,I.uvs[1].v,I.uvs[2].u,I.uvs[2].v);b(THREE.SubtractiveBlending)}if(F)if(!U.wireframe&&U.shading==THREE.SmoothShading&&I.vertexNormalsWorld.length==3){ba.r=Q.r=H.r=Y.r;ba.g=Q.g=H.g=Y.g;ba.b=Q.b=H.b=Y.b;ja(da,I.v1.positionWorld,I.vertexNormalsWorld[0],ba);ja(da,I.v2.positionWorld, -I.vertexNormalsWorld[1],Q);ja(da,I.v3.positionWorld,I.vertexNormalsWorld[2],H);O.r=(Q.r+H.r)*0.5;O.g=(Q.g+H.g)*0.5;O.b=(Q.b+H.b)*0.5;f=Ha(ba,Q,H,O);Ka(T,W,ea,V,L,aa,f,0,0,1,0,0,1)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;ja(da,I.centroidWorld,I.normalWorld,B);R.r=U.color.r*B.r;R.g=U.color.g*B.g;R.b=U.color.b*B.b;R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString)}else if(U instanceof -THREE.MeshDepthMaterial){ia=M.near;S=M.far;ba.r=ba.g=ba.b=1-la(D.positionScreen.z,ia,S);Q.r=Q.g=Q.b=1-la(ca.positionScreen.z,ia,S);H.r=H.g=H.b=1-la(X.positionScreen.z,ia,S);O.r=(Q.r+H.r)*0.5;O.g=(Q.g+H.g)*0.5;O.b=(Q.b+H.b)*0.5;f=Ha(ba,Q,H,O);Ka(T,W,ea,V,L,aa,f,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=qa(I.normalWorld.x);R.g=qa(I.normalWorld.y);R.b=qa(I.normalWorld.z);R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}}}function pa(D, -ca){if(K!=D)l.strokeStyle=K=D;if(A!=ca)l.lineWidth=A=ca;l.stroke();r.inflate(ca*2)}function Ma(D){if(N!=D)l.fillStyle=N=D;l.fill()}function Ka(D,ca,X,I,U,da,sa,Aa,Da,La,ta,Ga,Ja){var Fa,Ba;Fa=sa.width-1;Ba=sa.height-1;Aa*=Fa;Da*=Ba;La*=Fa;ta*=Ba;Ga*=Fa;Ja*=Ba;X-=D;I-=ca;U-=D;da-=ca;La-=Aa;ta-=Da;Ga-=Aa;Ja-=Da;Fa=La*Ja-Ga*ta;if(Fa!=0){Ba=1/Fa;Fa=(Ja*X-ta*U)*Ba;ta=(Ja*I-ta*da)*Ba;X=(La*U-Ga*X)*Ba;I=(La*da-Ga*I)*Ba;D=D-Fa*Aa-X*Da;ca=ca-ta*Aa-I*Da;l.save();l.transform(Fa,ta,X,I,D,ca);l.clip();l.drawImage(sa, -0,0);l.restore()}}function Ha(D,ca,X,I){var U=~~(D.r*255),da=~~(D.g*255);D=~~(D.b*255);var sa=~~(ca.r*255),Aa=~~(ca.g*255);ca=~~(ca.b*255);var Da=~~(X.r*255),La=~~(X.g*255);X=~~(X.b*255);var ta=~~(I.r*255),Ga=~~(I.g*255);I=~~(I.b*255);C[0]=U<0?0:U>255?255:U;C[1]=da<0?0:da>255?255:da;C[2]=D<0?0:D>255?255:D;C[4]=sa<0?0:sa>255?255:sa;C[5]=Aa<0?0:Aa>255?255:Aa;C[6]=ca<0?0:ca>255?255:ca;C[8]=Da<0?0:Da>255?255:Da;C[9]=La<0?0:La>255?255:La;C[10]=X<0?0:X>255?255:X;C[12]=ta<0?0:ta>255?255:ta;C[13]=Ga<0?0: -Ga>255?255:Ga;C[14]=I<0?0:I>255?255:I;ha.putImageData(Ia,0,0);wa.drawImage(fa,0,0);return Ca}function la(D,ca,X){D=(D-ca)/(X-ca);return D*D*(3-2*D)}function qa(D){D=(D+1)*0.5;return D<0?0:D>1?1:D}function ma(D,ca){var X=ca.x-D.x,I=ca.y-D.y,U=1/Math.sqrt(X*X+I*I);X*=U;I*=U;ca.x+=X;ca.y+=I;D.x-=X;D.y-=I}var ka,na,$,xa,va,Oa,ya,Na;this.autoClear?this.clear():l.setTransform(1,0,0,-1,n,k);c=e.projectScene(G,M,this.sortElements);l.fillStyle="rgba( 0, 255, 255, 0.5 )";l.fillRect(x.getX(),x.getY(),x.getWidth(), -x.getHeight());(F=G.lights.length>0)&&P(G);ka=0;for(na=c.length;ka0){j.r+=t.color.r*x;j.g+=t.color.g*x;j.b+=t.color.b*x}}else if(t instanceof THREE.PointLight){aa.sub(t.position,o.centroidWorld);aa.normalize();x=o.normalWorld.dot(aa)*t.intensity;if(x>0){j.r+=t.color.r*x;j.g+=t.color.g*x;j.b+=t.color.b*x}}}}function b(q,o,j,i,s,t){H=e(O++);H.setAttribute("d","M "+q.positionScreen.x+ -" "+q.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)J.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(d){T.r=W.r;T.g=W.g;T.b=W.b;a(t,i,T);J.r=s.color.r*T.r;J.g=s.color.g*T.g;J.b=s.color.b*T.b;J.updateStyleString()}else J.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){L=1-s.__2near/(s.__farPlusNear-i.z*s.__farMinusNear); -J.setRGB(L,L,L)}else s instanceof THREE.MeshNormalMaterial&&J.setRGB(g(i.normalWorld.x),g(i.normalWorld.y),g(i.normalWorld.z));s.wireframe?H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):H.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+s.opacity);n.appendChild(H)}function c(q,o,j,i,s,t,x){H=e(O++);H.setAttribute("d", -"M "+q.positionScreen.x+" "+q.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)J.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(d){T.r=W.r;T.g=W.g;T.b=W.b;a(x,s,T);J.r=t.color.r*T.r;J.g=t.color.g*T.g;J.b=t.color.b*T.b;J.updateStyleString()}else J.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){L= -1-t.__2near/(t.__farPlusNear-s.z*t.__farMinusNear);J.setRGB(L,L,L)}else t instanceof THREE.MeshNormalMaterial&&J.setRGB(g(s.normalWorld.x),g(s.normalWorld.y),g(s.normalWorld.z));t.wireframe?H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+t.wireframe_linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframe_linecap+"; stroke-linejoin: "+t.wireframe_linejoin):H.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+t.opacity);n.appendChild(H)} -function e(q){if(R[q]==null){R[q]=document.createElementNS("http://www.w3.org/2000/svg","path");f==0&&R[q].setAttribute("shape-rendering","crispEdges")}return R[q]}function g(q){return q<0?Math.min((1+q)*0.5,0.5):0.5+Math.min(q*0.5,0.5)}var h=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,u,w,v,z,K,N,A=new THREE.Rectangle,p=new THREE.Rectangle,d=!1,J=new THREE.Color(16777215),T=new THREE.Color(16777215),W=new THREE.Color(0),ea=new THREE.Color(0),V=new THREE.Color(0), -L,aa=new THREE.Vector3,R=[],ba=[],Q=[],H,O,ia,S,f=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(q){switch(q){case "high":f=1;break;case "low":f=0}};this.setSize=function(q,o){k=q;l=o;u=k/2;w=l/2;n.setAttribute("viewBox",-u+" "+-w+" "+k+" "+l);n.setAttribute("width",k);n.setAttribute("height",l);A.set(-u,-w,u,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(q,o){var j,i,s,t,x,E,r,F;this.autoClear&& -this.clear();h=m.projectScene(q,o,this.sortElements);S=ia=O=0;if(d=q.lights.length>0){r=q.lights;W.setRGB(0,0,0);ea.setRGB(0,0,0);V.setRGB(0,0,0);j=0;for(i=r.length;j=0&&W>=0&&F>=0&&O>=0)return!0;else if(ca<0&&W<0||F<0&&O<0)return!1;else{if(ca<0)aa=Math.max(aa,ca/(ca-W));else W<0&&(R=Math.min(R,ca/(ca-W)));if(F<0)aa=Math.max(aa,F/(F-O));else O<0&&(R=Math.min(R,F/(F-O)));if(Rca&&Q.z0&&J.z<1){w=K[A]=K[A]||new THREE.RenderableParticle;w.x=J.x/J.w;w.y=J.y/J.w;w.z=J.z;w.rotation=o.rotation.z;w.scale.x=o.scale.x*Math.abs(w.x-(J.x+M.projectionMatrix.n11)/(J.w+M.projectionMatrix.n14)); +w.scale.y=o.scale.y*Math.abs(w.y-(J.y+M.projectionMatrix.n22)/(J.w+M.projectionMatrix.n24));w.materials=o.materials;R.push(w);A++}}}aa&&R.sort(a);return R};this.unprojectVector=function(T,M){var aa=THREE.Matrix4.makeInvert(M.globalMatrix);aa.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));aa.multiplyVector3(T);return T}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,h;this.domElement=document.createElement("div");this.setSize=function(l,n){c=l;e=n;g=c/2;h=e/2};this.render=function(l,n){var k,m,u,x,w,A,K,N;a=b.projectScene(l,n);k=0;for(m=a.length;k0){H.r+=sa.r*da;H.g+=sa.g*da;H.b+=sa.b*da}}else if(da instanceof THREE.PointLight){Z.sub(da.position,ba);Z.normalize();da= +X.dot(Z)*Aa;if(da>0){H.r+=sa.r*da;H.g+=sa.g*da;H.b+=sa.b*da}}}}function Ea(D,ba,X){if(X.opacity!=0){a(X.opacity);b(X.blending);var H,U,da,sa,Aa,Da;if(X instanceof THREE.ParticleBasicMaterial){if(X.map&&X.map.image.loaded){sa=X.map.image;Aa=sa.width>>1;Da=sa.height>>1;U=ba.scale.x*n;da=ba.scale.y*k;X=U*Aa;H=da*Da;t.set(D.x-X,D.y-H,D.x+X,D.y+H);if(!v.instersects(t))return;m.save();m.translate(D.x,D.y);m.rotate(-ba.rotation);m.scale(U,-da);m.translate(-Aa,-Da);m.drawImage(sa,0,0);m.restore()}m.beginPath(); +m.moveTo(D.x-10,D.y);m.lineTo(D.x+10,D.y);m.moveTo(D.x,D.y-10);m.lineTo(D.x,D.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(X instanceof THREE.ParticleCircleMaterial){if(y){B.r=Y.r+ga.r+na.r;B.g=Y.g+ga.g+na.g;B.b=Y.b+ga.b+na.b;R.r=X.color.r*B.r;R.g=X.color.g*B.g;R.b=X.color.b*B.b;R.updateStyleString()}else R.__styleString=X.color.__styleString;X=ba.scale.x*n;H=ba.scale.y*k;t.set(D.x-X,D.y-H,D.x+X,D.y+H);if(v.instersects(t)){U=R.__styleString;if(N!=U)m.fillStyle=N=U;m.save(); +m.translate(D.x,D.y);m.rotate(-ba.rotation);m.scale(X,H);m.beginPath();m.arc(0,0,1,0,ua,!0);m.closePath();m.fill();m.restore()}}}}function ra(D,ba,X,H){if(H.opacity!=0){a(H.opacity);b(H.blending);m.beginPath();m.moveTo(D.positionScreen.x,D.positionScreen.y);m.lineTo(ba.positionScreen.x,ba.positionScreen.y);m.closePath();if(H instanceof THREE.LineBasicMaterial){R.__styleString=H.color.__styleString;D=H.linewidth;if(J!=D)m.lineWidth=J=D;D=R.__styleString;if(K!=D)m.strokeStyle=K=D;m.stroke();t.inflate(H.linewidth* +2)}}}function z(D,ba,X,H,U,da){if(U.opacity!=0){a(U.opacity);b(U.blending);S=D.positionScreen.x;V=D.positionScreen.y;ea=ba.positionScreen.x;T=ba.positionScreen.y;M=X.positionScreen.x;aa=X.positionScreen.y;m.beginPath();m.moveTo(S,V);m.lineTo(ea,T);m.lineTo(M,aa);m.lineTo(S,V);m.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ka(S,V,ea,T,M,aa,U.map.image,H.uvs[0].u,H.uvs[0].v,H.uvs[1].u,H.uvs[1].v,H.uvs[2].u,H.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&& +U.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=L.globalMatrix;Z.copy(H.vertexNormalsWorld[0]);p=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;o=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(H.vertexNormalsWorld[1]);j=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;i=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(H.vertexNormalsWorld[2]);q=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;s=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Ka(S,V,ea,T,M,aa,U.env_map.image,p,o,j,i,q,s)}}else U.wireframe?pa(U.color.__styleString, +U.wireframe_linewidth):Ma(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ka(S,V,ea,T,M,aa,U.map.image,H.uvs[0].u,H.uvs[0].v,H.uvs[1].u,H.uvs[1].v,H.uvs[2].u,H.uvs[2].v);b(THREE.SubtractiveBlending)}if(y)if(!U.wireframe&&U.shading==THREE.SmoothShading&&H.vertexNormalsWorld.length==3){ca.r=W.r=F.r=Y.r;ca.g=W.g=F.g=Y.g;ca.b=W.b=F.b=Y.b;ja(da,H.v1.positionWorld,H.vertexNormalsWorld[0],ca);ja(da,H.v2.positionWorld, +H.vertexNormalsWorld[1],W);ja(da,H.v3.positionWorld,H.vertexNormalsWorld[2],F);O.r=(W.r+F.r)*0.5;O.g=(W.g+F.g)*0.5;O.b=(W.b+F.b)*0.5;f=Ha(ca,W,F,O);Ka(S,V,ea,T,M,aa,f,0,0,1,0,0,1)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;ja(da,H.centroidWorld,H.normalWorld,B);R.r=U.color.r*B.r;R.g=U.color.g*B.g;R.b=U.color.b*B.b;R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString)}else if(U instanceof +THREE.MeshDepthMaterial){ia=L.near;Q=L.far;ca.r=ca.g=ca.b=1-la(D.positionScreen.z,ia,Q);W.r=W.g=W.b=1-la(ba.positionScreen.z,ia,Q);F.r=F.g=F.b=1-la(X.positionScreen.z,ia,Q);O.r=(W.r+F.r)*0.5;O.g=(W.g+F.g)*0.5;O.b=(W.b+F.b)*0.5;f=Ha(ca,W,F,O);Ka(S,V,ea,T,M,aa,f,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=qa(H.normalWorld.x);R.g=qa(H.normalWorld.y);R.b=qa(H.normalWorld.z);R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}}}function pa(D, +ba){if(K!=D)m.strokeStyle=K=D;if(J!=ba)m.lineWidth=J=ba;m.stroke();t.inflate(ba*2)}function Ma(D){if(N!=D)m.fillStyle=N=D;m.fill()}function Ka(D,ba,X,H,U,da,sa,Aa,Da,La,ta,Ga,Ja){var Fa,Ba;Fa=sa.width-1;Ba=sa.height-1;Aa*=Fa;Da*=Ba;La*=Fa;ta*=Ba;Ga*=Fa;Ja*=Ba;X-=D;H-=ba;U-=D;da-=ba;La-=Aa;ta-=Da;Ga-=Aa;Ja-=Da;Fa=La*Ja-Ga*ta;if(Fa!=0){Ba=1/Fa;Fa=(Ja*X-ta*U)*Ba;ta=(Ja*H-ta*da)*Ba;X=(La*U-Ga*X)*Ba;H=(La*da-Ga*H)*Ba;D=D-Fa*Aa-X*Da;ba=ba-ta*Aa-H*Da;m.save();m.transform(Fa,ta,X,H,D,ba);m.clip();m.drawImage(sa, +0,0);m.restore()}}function Ha(D,ba,X,H){var U=~~(D.r*255),da=~~(D.g*255);D=~~(D.b*255);var sa=~~(ba.r*255),Aa=~~(ba.g*255);ba=~~(ba.b*255);var Da=~~(X.r*255),La=~~(X.g*255);X=~~(X.b*255);var ta=~~(H.r*255),Ga=~~(H.g*255);H=~~(H.b*255);C[0]=U<0?0:U>255?255:U;C[1]=da<0?0:da>255?255:da;C[2]=D<0?0:D>255?255:D;C[4]=sa<0?0:sa>255?255:sa;C[5]=Aa<0?0:Aa>255?255:Aa;C[6]=ba<0?0:ba>255?255:ba;C[8]=Da<0?0:Da>255?255:Da;C[9]=La<0?0:La>255?255:La;C[10]=X<0?0:X>255?255:X;C[12]=ta<0?0:ta>255?255:ta;C[13]=Ga<0?0: +Ga>255?255:Ga;C[14]=H<0?0:H>255?255:H;ha.putImageData(Ia,0,0);wa.drawImage(fa,0,0);return Ca}function la(D,ba,X){D=(D-ba)/(X-ba);return D*D*(3-2*D)}function qa(D){D=(D+1)*0.5;return D<0?0:D>1?1:D}function ma(D,ba){var X=ba.x-D.x,H=ba.y-D.y,U=1/Math.sqrt(X*X+H*H);X*=U;H*=U;ba.x+=X;ba.y+=H;D.x-=X;D.y-=H}var ka,oa,$,xa,va,Oa,ya,Na;this.autoClear?this.clear():m.setTransform(1,0,0,-1,n,k);c=e.projectScene(G,L,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(v.getX(),v.getY(),v.getWidth(), +v.getHeight());(y=G.lights.length>0)&&P(G);ka=0;for(oa=c.length;ka0){j.r+=s.color.r*v;j.g+=s.color.g*v;j.b+=s.color.b*v}}else if(s instanceof THREE.PointLight){aa.sub(s.position,o.centroidWorld);aa.normalize();v=o.normalWorld.dot(aa)*s.intensity;if(v>0){j.r+=s.color.r*v;j.g+=s.color.g*v;j.b+=s.color.b*v}}}}function b(p,o,j,i,q,s){F=e(O++);F.setAttribute("d","M "+p.positionScreen.x+ +" "+p.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(q instanceof THREE.MeshBasicMaterial)I.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshLambertMaterial)if(d){S.r=V.r;S.g=V.g;S.b=V.b;a(s,i,S);I.r=q.color.r*S.r;I.g=q.color.g*S.g;I.b=q.color.b*S.b;I.updateStyleString()}else I.__styleString=q.color.__styleString;else if(q instanceof THREE.MeshDepthMaterial){M=1-q.__2near/(q.__farPlusNear-i.z*q.__farMinusNear); +I.setRGB(M,M,M)}else q instanceof THREE.MeshNormalMaterial&&I.setRGB(g(i.normalWorld.x),g(i.normalWorld.y),g(i.normalWorld.z));q.wireframe?F.setAttribute("style","fill: none; stroke: "+I.__styleString+"; stroke-width: "+q.wireframe_linewidth+"; stroke-opacity: "+q.opacity+"; stroke-linecap: "+q.wireframe_linecap+"; stroke-linejoin: "+q.wireframe_linejoin):F.setAttribute("style","fill: "+I.__styleString+"; fill-opacity: "+q.opacity);n.appendChild(F)}function c(p,o,j,i,q,s,v){F=e(O++);F.setAttribute("d", +"M "+p.positionScreen.x+" "+p.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)I.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(d){S.r=V.r;S.g=V.g;S.b=V.b;a(v,q,S);I.r=s.color.r*S.r;I.g=s.color.g*S.g;I.b=s.color.b*S.b;I.updateStyleString()}else I.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){M= +1-s.__2near/(s.__farPlusNear-q.z*s.__farMinusNear);I.setRGB(M,M,M)}else s instanceof THREE.MeshNormalMaterial&&I.setRGB(g(q.normalWorld.x),g(q.normalWorld.y),g(q.normalWorld.z));s.wireframe?F.setAttribute("style","fill: none; stroke: "+I.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):F.setAttribute("style","fill: "+I.__styleString+"; fill-opacity: "+s.opacity);n.appendChild(F)} +function e(p){if(R[p]==null){R[p]=document.createElementNS("http://www.w3.org/2000/svg","path");f==0&&R[p].setAttribute("shape-rendering","crispEdges")}return R[p]}function g(p){return p<0?Math.min((1+p)*0.5,0.5):0.5+Math.min(p*0.5,0.5)}var h=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,u,x,w,A,K,N,J=new THREE.Rectangle,r=new THREE.Rectangle,d=!1,I=new THREE.Color(16777215),S=new THREE.Color(16777215),V=new THREE.Color(0),ea=new THREE.Color(0),T=new THREE.Color(0), +M,aa=new THREE.Vector3,R=[],ca=[],W=[],F,O,ia,Q,f=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(p){switch(p){case "high":f=1;break;case "low":f=0}};this.setSize=function(p,o){k=p;m=o;u=k/2;x=m/2;n.setAttribute("viewBox",-u+" "+-x+" "+k+" "+m);n.setAttribute("width",k);n.setAttribute("height",m);J.set(-u,-x,u,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(p,o){var j,i,q,s,v,E,t,y;this.autoClear&& +this.clear();h=l.projectScene(p,o,this.sortElements);Q=ia=O=0;if(d=p.lights.length>0){t=p.lights;V.setRGB(0,0,0);ea.setRGB(0,0,0);T.setRGB(0,0,0);j=0;for(i=t.length;j0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"",s.light_map?"#define USE_LIGHTMAP": -"",s.vertex_colors?"#define USE_COLOR":"",s.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -d.attachShader(o,N("fragment",i+E));d.attachShader(o,N("vertex",s+q));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};f.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)o.push(j);j=f.program;E=0;for(q=o.length;E< -q;E++){i=o[E];j.uniforms[i]=d.getUniformLocation(j,i)}f=f.program;j=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];o=0;for(E=j.length;o0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+q.maxDirLights,"#define MAX_POINT_LIGHTS "+q.maxPointLights,q.map?"#define USE_MAP":"",q.env_map?"#define USE_ENVMAP":"",q.light_map?"#define USE_LIGHTMAP": +"",q.vertex_colors?"#define USE_COLOR":"",q.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +d.attachShader(o,N("fragment",i+E));d.attachShader(o,N("vertex",q+p));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};f.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)o.push(j);j=f.program;E=0;for(p=o.length;E< +p;E++){i=o[E];j.uniforms[i]=d.getUniformLocation(j,i)}f=f.program;j=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];o=0;for(E=j.length;o=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.color)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.normal)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.tangent)}if(f.uv>= -0)if(i.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(s instanceof THREE.SkinnedMesh){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA, -4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexA);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexB);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinIndex);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinWeight)}if(s instanceof -THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.drawElements(d.LINES,i.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,i.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(s,0,i.__webGLLineCount)}else s instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS, -0,i.__webGLParticleCount)};this.render=function(f,q,o,j){var i,s,t,x,E,r,F,B=f.lights,Y=f.fog;q.autoUpdateMatrix&&q.update();q.globalMatrix.flattenToArray(Q);q.projectionMatrix.flattenToArray(R);q.inverseMatrix.flattenToArray(ba);aa.multiply(q.projectionMatrix,q.globalMatrix);h(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,!1,q,this);this.initWebGLObjects(f,q);K(o,j!==undefined?j:!0);this.autoClear&&this.clear();x=f.__webGLObjects.length;for(j=0;j0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,ga)}if(ca&&ua>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ka,ga)}if(D){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,ga);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,va,ga)}if(y>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer); -d.bufferData(d.ARRAY_BUFFER,ma,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ka,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,na,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,$,ga)}}w(objlist,E,s,x,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){s= -t;s.__webGLVertexBuffer=d.createBuffer();s.__webGLColorBuffer=d.createBuffer();s=t;x=s.vertices.length;s.__vertexArray=new Float32Array(x*3);s.__colorArray=new Float32Array(x*3);s.__webGLLineCount=x;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){s=t;x=d.DYNAMIC_DRAW;B=void 0;B=void 0;r=void 0;i=void 0;Y=s.vertices;ga=s.colors;ua=Y.length;oa=ga.length;Z=s.__vertexArray;F=s.__colorArray;fa=s.__dirtyColors;if(s.__dirtyVertices){for(B=0;B=0;o--){j=f.__webGLObjects[o].object;q==j&&f.__webGLObjects.splice(o,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(f,q){if(f){!q||q=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)}; -this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; -THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", -envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", -map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", -lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +0)if(i.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(q instanceof THREE.SkinnedMesh){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA, +4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexA);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexB);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinIndex);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinWeight)}if(q instanceof +THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.drawElements(d.LINES,i.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,i.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(q instanceof THREE.Line){q=q.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(q,0,i.__webGLLineCount)}else q instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS, +0,i.__webGLParticleCount)};this.render=function(f,p,o,j){var i,q,s,v,E,t,y,B,Y=f.lights,ga=f.fog;p.autoUpdateMatrix&&p.update();p.globalMatrix.flattenToArray(W);p.projectionMatrix.flattenToArray(R);p.inverseMatrix.flattenToArray(ca);aa.multiply(p.projectionMatrix,p.globalMatrix);h(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,!1,p);this.initWebGLObjects(f,p);K(o,j!==undefined?j:!0);this.autoClear&&this.clear();E=f.__webGLObjects.length;for(j=0;j0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer); +d.bufferData(d.ARRAY_BUFFER,Ma,ga)}if(ba&&ua>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ka,ga)}if(D){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,ga);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,va,ga)}if(z>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,ma,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER, +ka,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,oa,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,$,ga)}}x(objlist,E,q,v,j)}s.__dirtyVertices=!1;s.__dirtyElements=!1;s.__dirtyUvs=!1;s.__dirtyNormals=!1;s.__dirtyTangents=!1;s.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!s.__webGLVertexBuffer){q=s;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=s;v=q.vertices.length;q.__vertexArray= +new Float32Array(v*3);q.__colorArray=new Float32Array(v*3);q.__webGLLineCount=v;s.__dirtyVertices=!0;s.__dirtyColors=!0}if(s.__dirtyVertices||s.__dirtyColors){q=s;v=d.DYNAMIC_DRAW;B=void 0;B=void 0;t=void 0;i=void 0;Y=q.vertices;ga=q.colors;ua=Y.length;na=ga.length;Z=q.__vertexArray;y=q.__colorArray;fa=q.__dirtyColors;if(q.__dirtyVertices){for(B=0;B=0;o--){j=f.__webGLObjects[o].object;p==j&&f.__webGLObjects.splice(o, +1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(f,p){if(f){!p||p=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", +envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif", +envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif", +map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif", +lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif", lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}", lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;", color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"}; diff --git a/build/ThreeExtras.js b/build/ThreeExtras.js index 3c350610..64fecf84 100644 --- a/build/ThreeExtras.js +++ b/build/ThreeExtras.js @@ -4,46 +4,43 @@ THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this 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,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;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,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.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,b,c){this.x=a||0;this.y=b||0;this.z=c||0;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},set x(d){this.that.x=d;this.isDirty=!0},set y(d){this.that.y=d;this.isDirty=!0},set z(d){this.that.z=d;this.isDirty=!0}};this.api.__proto__=THREE.Vector3.prototype;return this.api}; -THREE.Vector3.prototype={set:function(a,b,c){var d=this.that;d.x=a;d.y=b;d.z=c;this.isDirty=!0;return this},copy:function(a){var b=this.that;b.x=a.x;b.y=a.y;b.z=a.z;this.isDirty=!0;return this},add:function(a,b){var c=this.that;c.x=a.x+b.x;c.y=a.y+b.y;c.z=a.z+b.z;this.isDirty=!0;return this},addSelf:function(a){var b=this.that;b.x+=a.x;b.y+=a.y;b.z+=a.z;this.isDirty=!0;return this},addScalar:function(a){var b=this.that;b.x+=a;b.y+=a;b.z+=a;this.isDirty=!0;return this},sub:function(a,b){var c=this.that; -c.x=a.x-b.x;c.y=a.y-b.y;c.z=a.z-b.z;this.isDirty=!0;return this},subSelf:function(a){var b=this.that;b.x-=a.x;b.y-=a.y;b.z-=a.z;this.isDirty=!0;return this},cross:function(a,b){var c=this.that;c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x;this.isDirty=!0;return this},crossSelf:function(a){var b=this.that,c=b.x,d=b.y,f=b.z;b.x=d*a.z-f*a.y;b.y=f*a.x-c*a.z;b.z=c*a.y-d*a.x;this.isDirty=!0;return this},multiply:function(a,b){var c=this.that;c.x=a.x*b.x;c.y=a.y*b.y;c.z=a.z*b.z;this.isDirty= -!0;return this},multiplySelf:function(a){var b=this.that;b.x*=a.x;b.y*=a.y;b.z*=a.z;this.isDirty=!0;return this},multiplyScalar:function(a){var b=this.that;b.x*=a;b.y*=a;b.z*=a;this.isDirty=!0;return this},divideSelf:function(a){var b=this.that;b.x/=a.x;b.y/=a.y;b.z/=a.z;this.isDirty=!0;return this},divideScalar:function(a){var b=this.that;b.x/=a;b.y/=a;b.z/=a;this.isDirty=!0;return this},dot:function(a){var b=this.that;return b.x*a.x+b.y*a.y+b.z*a.z},distanceTo:function(a){var b=this.that,c=b.x- -a.x,d=b.y-a.y;a=b.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var b=this.that,c=b.x-a.x,d=b.y-a.y;a=b.z-a.z;return c*c+d*d+a*a},length:function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},lengthSq:function(){var a=this.that;return a.x*a.x+a.y*a.y+a.z*a.z},lengthManhattan:function(){var a=this.that;return a.x+a.y+a.z},negate:function(){var a=this.that;a.x=-this.x;a.y=-this.y;a.z=-this.z;this.isDirty=!0;return this},normalize:function(){var a=this.that;a=Math.sqrt(a.x* -a.x+a.y*a.y+a.z*a.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);this.isDirty=!0;return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=this.that;return Math.abs(a.x)<1.0E-4&&Math.abs(a.y)<1.0E-4&&Math.abs(a.z)<1.0E-4},clone:function(){var a=this.that;return new THREE.Vector3(a.x,a.y,a.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}}; -THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==undefined?d:1}; +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,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; +THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this}, +cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.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 b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+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},lengthManhattan:function(){return this.x+ +this.y+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,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||1}; THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},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,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3}; -THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a0&&C>0&&Q+C<1}var c,d,f,g,h,k,j,m,n,w, -u,q=a.geometry,x=q.vertices,z=[];c=0;for(d=q.faces.length;c0&&F>0&&R+F<1}var c,d,f,g,h,k,j,m,n,w, +t,p=a.geometry,x=p.vertices,z=[];c=0;for(d=p.faces.length;cj?d:j;f=f>m?f:m}a()}; -this.add3Points=function(j,m,n,w,u,q){if(k){k=!1;b=jn?j>u?j:u:n>u?n:u;f=m>w?m>q?m:q:w>q?w:q}else{b=jn?j>u?j>d?j:d:u>d?u:d:n>u?n>d?n:d:u>d?u:d;f=m>w?m>q?m>f?m:f:q>f?q:f:w>q?w>f?w:f:q>f?q:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=bj.getRight()? +this.add3Points=function(j,m,n,w,t,p){if(k){k=!1;b=jn?j>t?j:t:n>t?n:t;f=m>w?m>p?m:p:w>p?w:p}else{b=jn?j>t?j>d?j:d:t>d?t:d:n>t?n>d?n:d:t>d?t:d;f=m>w?m>p?m>f?m:f:p>f?p:f:w>p?w>f?w:f:p>f?p:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=bj.getRight()? d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k};this.toString=function(){return"THREE.Rectangle ( left: "+ b+", right: "+d+", top: "+c+", bottom: "+f+", width: "+g+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}}; -THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,n,w,u,q,x,z){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=n||1;this.n34=w||0;this.n41=u||0;this.n42=q||0;this.n43=x||0;this.n44=z||1;this.flat=Array(16);this.m33=new THREE.Matrix3;if(typeof Float32Array!=="undefined"){var C=this;this.float32Array=new Float32Array(16);this.float32Array3x3=new Float32Array(9);this.flatten32=function(){var o=C.float32Array; -o[0]=C.n11;o[1]=C.n21;o[2]=C.n31;o[3]=C.n41;o[4]=C.n12;o[5]=C.n22;o[6]=C.n32;o[7]=C.n42;o[8]=C.n13;o[9]=C.n23;o[10]=C.n33;o[11]=C.n43;o[12]=C.n14;o[13]=C.n24;o[14]=C.n34;o[15]=C.n44;return o};this.flatten323x3=function(){var o=C.float32Array3x3;o[0]=C.n11;o[1]=C.n21;o[2]=C.n31;o[3]=C.n12;o[4]=C.n22;o[5]=C.n32;o[6]=C.n13;o[7]=C.n23;o[8]=C.n33;return o}}}; -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,b,c,d,f,g,h,k,j,m,n,w,u,q,x,z){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=n;this.n34=w;this.n41=u;this.n42=q;this.n43=x;this.n44=z;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13= +THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,n,w,t,p,x,z){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=n||1;this.n34=w||0;this.n41=t||0;this.n42=p||0;this.n43=x||0;this.n44=z||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,b,c,d,f,g,h,k,j,m,n,w,t,p,x,z){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=n;this.n34=w;this.n41=t;this.n42=p;this.n43=x;this.n44=z;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,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a); this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43* a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41* -a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,u=a.n33,q=a.n34,x=a.n41,z=a.n42,C=a.n43,o=a.n44,e=b.n11,t=b.n12,N=b.n13,Q=b.n14,ea=b.n21,L=b.n22,G=b.n23,Y=b.n24,T=b.n31,da=b.n32,Z=b.n33,H=b.n34,aa=b.n41,na=b.n42,ba=b.n43,l=b.n44;this.n11=c*e+d*ea+f*T+g*aa;this.n12=c*t+d*L+f*da+g*na;this.n13=c*N+d*G+f*Z+g*ba;this.n14=c*Q+d*Y+f*H+g*l;this.n21=h*e+k*ea+j*T+m*aa;this.n22=h*t+k*L+j*da+m*na; -this.n23=h*N+k*G+j*Z+m*ba;this.n24=h*Q+k*Y+j*H+m*l;this.n31=n*e+w*ea+u*T+q*aa;this.n32=n*t+w*L+u*da+q*na;this.n33=n*N+w*G+u*Z+q*ba;this.n34=n*Q+w*Y+u*H+q*l;this.n41=x*e+z*ea+C*T+o*aa;this.n42=x*t+z*L+C*da+o*na;this.n43=x*N+z*G+C*Z+o*ba;this.n44=x*Q+z*Y+C*H+o*l;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,n=a.n24,w=a.n31,u=a.n32,q=a.n33,x=a.n34,z=a.n41,C=a.n42,o=a.n43;a=a.n44;var e=b.n11,t=b.n12,N=b.n13,Q=b.n14,ea=b.n21,L=b.n22,G=b.n23,Y= -b.n24,T=b.n31,da=b.n32,Z=b.n33,H=b.n34,aa=b.n41,na=b.n42,ba=b.n43;b=b.n44;this.n11=d*e+f*ea+g*T+h*aa;this.n12=d*t+f*L+g*da+h*na;this.n13=d*N+f*G+g*Z+h*ba;this.n14=d*Q+f*Y+g*H+h*b;this.n21=k*e+j*ea+m*T+n*aa;this.n22=k*t+j*L+m*da+n*na;this.n23=k*N+j*G+m*Z+n*ba;this.n24=k*Q+j*Y+m*H+n*b;this.n31=w*e+u*ea+q*T+x*aa;this.n32=w*t+u*L+q*da+x*na;this.n33=w*N+u*G+q*Z+x*ba;this.n34=w*Q+u*Y+q*H+x*b;this.n41=z*e+C*ea+o*T+a*aa;this.n42=z*t+C*L+o*da+a*na;this.n43=z*N+C*G+o*Z+a*ba;this.n44=z*Q+C*Y+o*H+a*b;c[0]=this.n11; -c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,n=this.n32,w=this.n33,u=this.n34,q=this.n41,x=this.n42,z=this.n43,C=this.n44,o=a.n11,e=a.n21,t=a.n31,N=a.n41,Q=a.n12,ea=a.n22,L=a.n32,G=a.n42,Y= -a.n13,T=a.n23,da=a.n33,Z=a.n43,H=a.n14,aa=a.n24,na=a.n34;a=a.n44;this.n11=b*o+c*e+d*t+f*N;this.n12=b*Q+c*ea+d*L+f*G;this.n13=b*Y+c*T+d*da+f*Z;this.n14=b*H+c*aa+d*na+f*a;this.n21=g*o+h*e+k*t+j*N;this.n22=g*Q+h*ea+k*L+j*G;this.n23=g*Y+h*T+k*da+j*Z;this.n24=g*H+h*aa+k*na+j*a;this.n31=m*o+n*e+w*t+u*N;this.n32=m*Q+n*ea+w*L+u*G;this.n33=m*Y+n*T+w*da+u*Z;this.n34=m*H+n*aa+w*na+u*a;this.n41=q*o+x*e+z*t+C*N;this.n42=q*Q+x*ea+z*L+C*G;this.n43=q*Y+x*T+z*da+C*Z;this.n44=q*H+x*aa+z*na+C*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,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,n=this.n33,w=this.n34,u=this.n41,q=this.n42,x=this.n43,z=this.n44;return d*h*m*u-c*k*m*u-d*g*n*u+b*k*n*u+c*g*w*u-b*h*w*u-d*h*j*q+c*k*j*q+d*f*n*q-a*k*n*q-c*f*w*q+a*h*w*q+ +a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,t=a.n33,p=a.n34,x=a.n41,z=a.n42,F=a.n43,u=a.n44,e=b.n11,q=b.n12,O=b.n13,R=b.n14,ea=b.n21,L=b.n22,I=b.n23,Y=b.n24,V=b.n31,ca=b.n32,da=b.n33,G=b.n34,$=b.n41,na=b.n42,aa=b.n43,l=b.n44;this.n11=c*e+d*ea+f*V+g*$;this.n12=c*q+d*L+f*ca+g*na;this.n13=c*O+d*I+f*da+g*aa;this.n14=c*R+d*Y+f*G+g*l;this.n21=h*e+k*ea+j*V+m*$;this.n22=h*q+k*L+j*ca+m*na; +this.n23=h*O+k*I+j*da+m*aa;this.n24=h*R+k*Y+j*G+m*l;this.n31=n*e+w*ea+t*V+p*$;this.n32=n*q+w*L+t*ca+p*na;this.n33=n*O+w*I+t*da+p*aa;this.n34=n*R+w*Y+t*G+p*l;this.n41=x*e+z*ea+F*V+u*$;this.n42=x*q+z*L+F*ca+u*na;this.n43=x*O+z*I+F*da+u*aa;this.n44=x*R+z*Y+F*G+u*l;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,n=a.n24,w=a.n31,t=a.n32,p=a.n33,x=a.n34,z=a.n41,F=a.n42,u=a.n43;a=a.n44;var e=b.n11,q=b.n12,O=b.n13,R=b.n14,ea=b.n21,L=b.n22,I=b.n23,Y= +b.n24,V=b.n31,ca=b.n32,da=b.n33,G=b.n34,$=b.n41,na=b.n42,aa=b.n43;b=b.n44;this.n11=d*e+f*ea+g*V+h*$;this.n12=d*q+f*L+g*ca+h*na;this.n13=d*O+f*I+g*da+h*aa;this.n14=d*R+f*Y+g*G+h*b;this.n21=k*e+j*ea+m*V+n*$;this.n22=k*q+j*L+m*ca+n*na;this.n23=k*O+j*I+m*da+n*aa;this.n24=k*R+j*Y+m*G+n*b;this.n31=w*e+t*ea+p*V+x*$;this.n32=w*q+t*L+p*ca+x*na;this.n33=w*O+t*I+p*da+x*aa;this.n34=w*R+t*Y+p*G+x*b;this.n41=z*e+F*ea+u*V+a*$;this.n42=z*q+F*L+u*ca+a*na;this.n43=z*O+F*I+u*da+a*aa;this.n44=z*R+F*Y+u*G+a*b;c[0]=this.n11; +c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,n=this.n32,w=this.n33,t=this.n34,p=this.n41,x=this.n42,z=this.n43,F=this.n44,u=a.n11,e=a.n21,q=a.n31,O=a.n41,R=a.n12,ea=a.n22,L=a.n32,I=a.n42,Y= +a.n13,V=a.n23,ca=a.n33,da=a.n43,G=a.n14,$=a.n24,na=a.n34;a=a.n44;this.n11=b*u+c*e+d*q+f*O;this.n12=b*R+c*ea+d*L+f*I;this.n13=b*Y+c*V+d*ca+f*da;this.n14=b*G+c*$+d*na+f*a;this.n21=g*u+h*e+k*q+j*O;this.n22=g*R+h*ea+k*L+j*I;this.n23=g*Y+h*V+k*ca+j*da;this.n24=g*G+h*$+k*na+j*a;this.n31=m*u+n*e+w*q+t*O;this.n32=m*R+n*ea+w*L+t*I;this.n33=m*Y+n*V+w*ca+t*da;this.n34=m*G+n*$+w*na+t*a;this.n41=p*u+x*e+z*q+F*O;this.n42=p*R+x*ea+z*L+F*I;this.n43=p*Y+x*V+z*ca+F*da;this.n44=p*G+x*$+z*na+F*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,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,n=this.n33,w=this.n34,t=this.n41,p=this.n42,x=this.n43,z=this.n44;return d*h*m*t-c*k*m*t-d*g*n*t+b*k*n*t+c*g*w*t-b*h*w*t-d*h*j*p+c*k*j*p+d*f*n*p-a*k*n*p-c*f*w*p+a*h*w*p+ d*g*j*x-b*k*j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*z+b*h*j*z+c*f*m*z-a*h*m*z-b*f*n*z+a*g*n*z},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]= this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1); return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f* g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(b);b=Math.sin(b);var h=a*d,k=c*d;this.n11=a*f;this.n12=c*b-h*g;this.n13=h*b+c*g;this.n21=d;this.n22=f*g;this.n23=-f*b;this.n31=-c*f;this.n32=k*g+a*b;this.n33=-k*b+a*g},setRotationFromQuaternion:function(a){var b= -a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;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,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b}; -THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; -THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,u=a.n33,q=a.n34,x=a.n41,z=a.n42,C=a.n43,o=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*q*z-m*u*z+m*w*C-k*q*C-j*w*o+k*u*o;b.n12=g*u*z-f*q*z-g*w*C+d*q*C+f*w*o-d*u*o;b.n13=f*m*z-g*j*z+g*k*C-d*m*C-f*k*o+d*j*o;b.n14=g*j*w-f*m*w-g*k*u+d*m*u+f*k*q-d*j*q;b.n21=m*u*x-j*q*x-m*n*C+h*q*C+j*n*o-h*u*o;b.n22=f*q*x-g*u*x+g*n*C-c*q*C-f*n*o+c*u*o;b.n23=g*j*x-f*m*x-g*h*C+c*m*C+f*h*o-c*j*o; -b.n24=f*m*n-g*j*n+g*h*u-c*m*u-f*h*q+c*j*q;b.n31=k*q*x-m*w*x+m*n*z-h*q*z-k*n*o+h*w*o;b.n32=g*w*x-d*q*x-g*n*z+c*q*z+d*n*o-c*w*o;b.n33=f*m*x-g*k*x+g*h*z-c*m*z-d*h*o+c*k*o;b.n34=g*k*n-d*m*n-g*h*w+c*m*w+d*h*q-c*k*q;b.n41=j*w*x-k*u*x-j*n*z+h*u*z+k*n*C-h*w*C;b.n42=d*u*x-f*w*x+f*n*z-c*u*z-d*n*C+c*w*C;b.n43=f*k*x-d*j*x-f*h*z+c*j*z+d*h*C-c*k*C;b.n44=d*j*n-f*k*n+f*h*w-c*j*w-d*h*u+c*k*u;b.multiplyScalar(1/a.determinant());return b}; +a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22; +a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},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,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d}; +THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c}; +THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,t=a.n33,p=a.n34,x=a.n41,z=a.n42,F=a.n43,u=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*p*z-m*t*z+m*w*F-k*p*F-j*w*u+k*t*u;b.n12=g*t*z-f*p*z-g*w*F+d*p*F+f*w*u-d*t*u;b.n13=f*m*z-g*j*z+g*k*F-d*m*F-f*k*u+d*j*u;b.n14=g*j*w-f*m*w-g*k*t+d*m*t+f*k*p-d*j*p;b.n21=m*t*x-j*p*x-m*n*F+h*p*F+j*n*u-h*t*u;b.n22=f*p*x-g*t*x+g*n*F-c*p*F-f*n*u+c*t*u;b.n23=g*j*x-f*m*x-g*h*F+c*m*F+f*h*u-c*j*u; +b.n24=f*m*n-g*j*n+g*h*t-c*m*t-f*h*p+c*j*p;b.n31=k*p*x-m*w*x+m*n*z-h*p*z-k*n*u+h*w*u;b.n32=g*w*x-d*p*x-g*n*z+c*p*z+d*n*u-c*w*u;b.n33=f*m*x-g*k*x+g*h*z-c*m*z-d*h*u+c*k*u;b.n34=g*k*n-d*m*n-g*h*w+c*m*w+d*h*p-c*k*p;b.n41=j*w*x-k*t*x-j*n*z+h*t*z+k*n*F-h*w*F;b.n42=d*t*x-f*w*x+f*n*z-c*t*z-d*n*F+c*w*F;b.n43=f*k*x-d*j*x-f*h*z+c*j*z+d*h*F-c*k*F;b.n44=d*j*n-f*k*n+f*h*w-c*j*w-d*h*t+c*k*t;b.multiplyScalar(1/a.determinant());return b}; THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*w;return b}; THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)}; THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);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; @@ -62,31 +59,29 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y], +this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b0){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 b=1,c=this.vertices.length;bthis.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,b=0,c=this.vertices.length;b65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0})}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+ this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0; -THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1}; -THREE.Object3D.prototype.update=function(a,b,c,d){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;athis.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var n=0,w=this.hierarchy.length;n1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n-this.zNear)return!1;if(h+g<-this.zFar)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,n=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(n+g<-this.screenCenterX)return!1;if(n-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY; if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(n,b,h,g);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;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,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1; -THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3; -THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= +THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.MaterialCounter={value:0}; +THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth= a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}}; -THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.LineBasicMaterialCounter={value:0}; -THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== +THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
linewidth: "+this.linewidth+"
linecap: "+this.linecap+"
linejoin: "+this.linejoin+"
vertex_colors: "+this.vertex_colors+"
)"}}; +THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!== undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+ -"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshBasicMaterialCounter={value:0}; -THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1; -if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading; -if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning= -a.skinning}}; -THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+ -this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshLambertMaterialCounter={value:0}; -THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin= +"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!== +undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!== +undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; +THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
light_map: "+this.light_map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+ +"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin= this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map; if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth; if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (
id: "+this.id+"
color: "+this.color+"
ambient: "+this.ambient+"
specular: "+this.specular+"
shininess: "+this.shininess+"
opacity: "+this.opacity+"
map: "+this.map+"
env_map: "+this.env_map+"
combine: "+this.combine+"
reflectivity: "+this.reflectivity+"
refraction_ratio: "+this.refraction_ratio+"
shading: "+this.shading+"
blending: "+this.blending+"
depth_test: "+ -this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshPhongMaterialCounter={value:0}; -THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== -undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshDepthMaterialCounter={value:0}; -THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== -undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; -THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader= +this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== +undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}}; +THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!== +undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (
id: "+this.id+"
opacity: "+this.opacity+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
)"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}}; +THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader= a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!== undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}}; -THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}};THREE.MeshShaderMaterialCounter={value:0}; -THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending; -if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}};THREE.ParticleBasicMaterialCounter={value:0}; -THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (
color: "+this.color+"
opacity: "+this.opacity+"
blending: "+this.blending+"
)"}}; -THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter}; +THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (
id: "+this.id+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
wireframe: "+this.wireframe+"
wireframe_linewidth: "+this.wireframe_linewidth+"
wireframe_linecap: "+this.wireframe_linecap+"
wireframe_linejoin: "+this.wireframe_linejoin+"
vertex_colors: "+this.vertex_colors+"
skinning: "+this.skinning+"
)"}}; +THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!== +undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (
id: "+this.id+"
color: "+this.color+"
opacity: "+this.opacity+"
map: "+this.map+"
size: "+this.size+"
blending: "+this.blending+"
depth_test: "+this.depth_test+"
vertex_colors: "+this.vertex_colors+"
)"}}; +THREE.ParticleCircleMaterial=function(a){this.id=THREE.MaterialCounter.value++;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.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}}; +THREE.Texture=function(a,b,c,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter}; THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (
image: "+this.image+"
wrap_s: "+this.wrap_s+"
wrap_t: "+this.wrap_t+"
mag_filter: "+this.mag_filter+"
min_filter: "+this.min_filter+"
)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2; THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20; THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType}; var Uniforms={clone:function(a){var b,c,d,f={};for(b in a){f[b]={};for(c in a[b]){d=a[b][c];f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var b,c,d,f={};for(b=0;b=0&&Z>=0&&H>=0&&aa>=0)return!0;else if(da<0&&Z<0||H<0&&aa<0)return!1;else{if(da<0)Y=Math.max(Y,da/(da-Z));else Z<0&&(T=Math.min(T,da/(da-Z)));if(H<0)Y=Math.max(Y,H/(H-aa));else aa<0&&(T=Math.min(T,H/(H-aa)));if(Tda&&ba.z0&&C.z<1){u=x[q]=x[q]||new THREE.RenderableParticle;u.x=C.x/C.w;u.y=C.y/C.w;u.z=C.z;u.rotation=y.rotation.z;u.scale.x=y.scale.x*Math.abs(u.x- -(C.x+G.projectionMatrix.n11)/(C.w+G.projectionMatrix.n14));u.scale.y=y.scale.y*Math.abs(u.y-(C.y+G.projectionMatrix.n22)/(C.w+G.projectionMatrix.n24));u.materials=y.materials;T.push(u);q++}}}}Y&&T.sort(a);return T};this.unprojectVector=function(L,G){var Y=THREE.Matrix4.makeInvert(G.matrix);Y.multiplySelf(THREE.Matrix4.makeInvert(G.projectionMatrix));Y.multiplyVector3(L);return L}}; -THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,u,q,x,z;a=b.projectScene(h,k);j=0;for(m=a.length;j0){X.r+=ya.r*la;X.g+=ya.g*la;X.b+=ya.b*la}}else if(la instanceof THREE.PointLight){I.sub(la.position,ka);I.normalize(); -la=ia.dot(I)*Fa;if(la>0){X.r+=ya.r*la;X.g+=ya.g*la;X.b+=ya.b*la}}}}function Ia(S,ka,ia){if(ia.opacity!=0){a(ia.opacity);b(ia.blending);var X,ha,la,ya,Fa,Ha;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map&&ia.map.image.loaded){ya=ia.map.image;Fa=ya.width>>1;Ha=ya.height>>1;ha=ka.scale.x*k;la=ka.scale.y*j;ia=ha*Fa;X=la*Ha;A.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(J.instersects(A)){m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ha,-la);m.translate(-Fa,-Ha);m.drawImage(ya,0,0);m.restore()}}}else if(ia instanceof -THREE.ParticleCircleMaterial){if(R){O.r=ga.r+ma.r+E.r;O.g=ga.g+ma.g+E.g;O.b=ga.b+ma.b+E.b;T.r=ia.color.r*O.r;T.g=ia.color.g*O.g;T.b=ia.color.b*O.b;T.updateStyleString()}else T.__styleString=ia.color.__styleString;ia=ka.scale.x*k;X=ka.scale.y*j;A.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(J.instersects(A)){ha=T.__styleString;if(z!=ha)m.fillStyle=z=ha;m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ia,X);m.beginPath();m.arc(0,0,1,0,P,!0);m.closePath();m.fill();m.restore()}}}}function wa(S,ka,ia, -X){if(X.opacity!=0){a(X.opacity);b(X.blending);m.beginPath();m.moveTo(S.positionScreen.x,S.positionScreen.y);m.lineTo(ka.positionScreen.x,ka.positionScreen.y);m.closePath();if(X instanceof THREE.LineBasicMaterial){T.__styleString=X.color.__styleString;S=X.linewidth;if(C!=S)m.lineWidth=C=S;S=T.__styleString;if(x!=S)m.strokeStyle=x=S;m.stroke();A.inflate(X.linewidth*2)}}}function K(S,ka,ia,X,ha,la){if(ha.opacity!=0){a(ha.opacity);b(ha.blending);N=S.positionScreen.x;Q=S.positionScreen.y;ea=ka.positionScreen.x; -L=ka.positionScreen.y;G=ia.positionScreen.x;Y=ia.positionScreen.y;m.beginPath();m.moveTo(N,Q);m.lineTo(ea,L);m.lineTo(G,Y);m.lineTo(N,Q);m.closePath();if(ha instanceof THREE.MeshBasicMaterial)if(ha.map)ha.map.image.loaded&&ha.map.mapping instanceof THREE.UVMapping&&Na(N,Q,ea,L,G,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);else if(ha.env_map){if(ha.env_map.image.loaded&&ha.env_map.mapping instanceof THREE.SphericalReflectionMapping){S=$.matrix;I.copy(X.vertexNormalsWorld[0]); -B=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;y=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;I.copy(X.vertexNormalsWorld[1]);v=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;p=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;I.copy(X.vertexNormalsWorld[2]);D=(I.x*S.n11+I.y*S.n12+I.z*S.n13)*0.5+0.5;F=-(I.x*S.n21+I.y*S.n22+I.z*S.n23)*0.5+0.5;Na(N,Q,ea,L,G,Y,ha.env_map.image,B,y,v,p,D,F)}}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString);else if(ha instanceof THREE.MeshLambertMaterial){if(ha.map&& -!ha.wireframe){ha.map.mapping instanceof THREE.UVMapping&&Na(N,Q,ea,L,G,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);b(THREE.SubtractiveBlending)}if(R)if(!ha.wireframe&&ha.shading==THREE.SmoothShading&&X.vertexNormalsWorld.length==3){da.r=Z.r=H.r=ga.r;da.g=Z.g=H.g=ga.g;da.b=Z.b=H.b=ga.b;oa(la,X.v1.positionWorld,X.vertexNormalsWorld[0],da);oa(la,X.v2.positionWorld,X.vertexNormalsWorld[1],Z);oa(la,X.v3.positionWorld,X.vertexNormalsWorld[2],H);aa.r=(Z.r+H.r)*0.5; -aa.g=(Z.g+H.g)*0.5;aa.b=(Z.b+H.b)*0.5;l=La(da,Z,H,aa);Na(N,Q,ea,L,G,Y,l,0,0,1,0,0,1)}else{O.r=ga.r;O.g=ga.g;O.b=ga.b;oa(la,X.centroidWorld,X.normalWorld,O);T.r=ha.color.r*O.r;T.g=ha.color.g*O.g;T.b=ha.color.b*O.b;T.updateStyleString();ha.wireframe?ua(T.__styleString,ha.wireframe_linewidth):Pa(T.__styleString)}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString)}else if(ha instanceof THREE.MeshDepthMaterial){na=$.near;ba=$.far;da.r=da.g=da.b=1-qa(S.positionScreen.z, -na,ba);Z.r=Z.g=Z.b=1-qa(ka.positionScreen.z,na,ba);H.r=H.g=H.b=1-qa(ia.positionScreen.z,na,ba);aa.r=(Z.r+H.r)*0.5;aa.g=(Z.g+H.g)*0.5;aa.b=(Z.b+H.b)*0.5;l=La(da,Z,H,aa);Na(N,Q,ea,L,G,Y,l,0,0,1,0,0,1)}else if(ha instanceof THREE.MeshNormalMaterial){T.r=va(X.normalWorld.x);T.g=va(X.normalWorld.y);T.b=va(X.normalWorld.z);T.updateStyleString();ha.wireframe?ua(T.__styleString,ha.wireframe_linewidth):Pa(T.__styleString)}}}function ua(S,ka){if(x!=S)m.strokeStyle=x=S;if(C!=ka)m.lineWidth=C=ka;m.stroke();A.inflate(ka* -2)}function Pa(S){if(z!=S)m.fillStyle=z=S;m.fill()}function Na(S,ka,ia,X,ha,la,ya,Fa,Ha,Oa,za,Ka,Ma){var Ja,Ga;Ja=ya.width-1;Ga=ya.height-1;Fa*=Ja;Ha*=Ga;Oa*=Ja;za*=Ga;Ka*=Ja;Ma*=Ga;ia-=S;X-=ka;ha-=S;la-=ka;Oa-=Fa;za-=Ha;Ka-=Fa;Ma-=Ha;Ja=Oa*Ma-Ka*za;if(Ja!=0){Ga=1/Ja;Ja=(Ma*ia-za*ha)*Ga;za=(Ma*X-za*la)*Ga;ia=(Oa*ha-Ka*ia)*Ga;X=(Oa*la-Ka*X)*Ga;S=S-Ja*Fa-ia*Ha;ka=ka-za*Fa-X*Ha;m.save();m.transform(Ja,za,ia,X,S,ka);m.clip();m.drawImage(ya,0,0);m.restore()}}function La(S,ka,ia,X){var ha=~~(S.r*255),la= -~~(S.g*255);S=~~(S.b*255);var ya=~~(ka.r*255),Fa=~~(ka.g*255);ka=~~(ka.b*255);var Ha=~~(ia.r*255),Oa=~~(ia.g*255);ia=~~(ia.b*255);var za=~~(X.r*255),Ka=~~(X.g*255);X=~~(X.b*255);M[0]=ha<0?0:ha>255?255:ha;M[1]=la<0?0:la>255?255:la;M[2]=S<0?0:S>255?255:S;M[4]=ya<0?0:ya>255?255:ya;M[5]=Fa<0?0:Fa>255?255:Fa;M[6]=ka<0?0:ka>255?255:ka;M[8]=Ha<0?0:Ha>255?255:Ha;M[9]=Oa<0?0:Oa>255?255:Oa;M[10]=ia<0?0:ia>255?255:ia;M[12]=za<0?0:za>255?255:za;M[13]=Ka<0?0:Ka>255?255:Ka;M[14]=X<0?0:X>255?255:X;ca.putImageData(ta, -0,0);xa.drawImage(V,0,0);return Ba}function qa(S,ka,ia){S=(S-ka)/(ia-ka);return S*S*(3-2*S)}function va(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function ra(S,ka){var ia=ka.x-S.x,X=ka.y-S.y,ha=1/Math.sqrt(ia*ia+X*X);ia*=ha;X*=ha;ka.x+=ia;ka.y+=X;S.x-=ia;S.y-=X}var pa,sa,ja,Ca,Aa,Ra,Da,Qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(W,$,this.sortElements);(R=W.lights.length>0)&&fa(W);pa=0;for(sa=c.length;pa0){v.r+=F.color.r*J;v.g+=F.color.g*J;v.b+=F.color.b*J}}else if(F instanceof THREE.PointLight){Y.sub(F.position,y.centroidWorld);Y.normalize();J=y.normalWorld.dot(Y)*F.intensity;if(J>0){v.r+=F.color.r*J;v.g+=F.color.g*J;v.b+=F.color.b*J}}}}function b(B,y,v,p,D,F){H=d(aa++);H.setAttribute("d","M "+B.positionScreen.x+ -" "+B.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+"z");if(D instanceof THREE.MeshBasicMaterial)t.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshLambertMaterial)if(e){N.r=Q.r;N.g=Q.g;N.b=Q.b;a(F,p,N);t.r=D.color.r*N.r;t.g=D.color.g*N.g;t.b=D.color.b*N.b;t.updateStyleString()}else t.__styleString=D.color.__styleString;else if(D instanceof THREE.MeshDepthMaterial){G=1-D.__2near/(D.__farPlusNear-p.z*D.__farMinusNear); -t.setRGB(G,G,G)}else D instanceof THREE.MeshNormalMaterial&&t.setRGB(f(p.normalWorld.x),f(p.normalWorld.y),f(p.normalWorld.z));D.wireframe?H.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+D.wireframe_linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+D.wireframe_linecap+"; stroke-linejoin: "+D.wireframe_linejoin):H.setAttribute("style","fill: "+t.__styleString+"; fill-opacity: "+D.opacity);k.appendChild(H)}function c(B,y,v,p,D,F,J){H=d(aa++);H.setAttribute("d", -"M "+B.positionScreen.x+" "+B.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+" L "+p.positionScreen.x+","+p.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)t.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(e){N.r=Q.r;N.g=Q.g;N.b=Q.b;a(J,D,N);t.r=F.color.r*N.r;t.g=F.color.g*N.g;t.b=F.color.b*N.b;t.updateStyleString()}else t.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){G= -1-F.__2near/(F.__farPlusNear-D.z*F.__farMinusNear);t.setRGB(G,G,G)}else F instanceof THREE.MeshNormalMaterial&&t.setRGB(f(D.normalWorld.x),f(D.normalWorld.y),f(D.normalWorld.z));F.wireframe?H.setAttribute("style","fill: none; stroke: "+t.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):H.setAttribute("style","fill: "+t.__styleString+"; fill-opacity: "+F.opacity);k.appendChild(H)} -function d(B){if(T[B]==null){T[B]=document.createElementNS("http://www.w3.org/2000/svg","path");l==0&&T[B].setAttribute("shape-rendering","crispEdges")}return T[B]}function f(B){return B<0?Math.min((1+B)*0.5,0.5):0.5+Math.min(B*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,u,q,x,z,C=new THREE.Rectangle,o=new THREE.Rectangle,e=!1,t=new THREE.Color(16777215),N=new THREE.Color(16777215),Q=new THREE.Color(0),ea=new THREE.Color(0),L=new THREE.Color(0), -G,Y=new THREE.Vector3,T=[],da=[],Z=[],H,aa,na,ba,l=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(B){switch(B){case "high":l=1;break;case "low":l=0}};this.setSize=function(B,y){j=B;m=y;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);C.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(B,y){var v,p,D,F,J,U,A,R; -this.autoClear&&this.clear();g=h.projectScene(B,y,this.sortElements);ba=na=aa=0;if(e=B.lights.length>0){A=B.lights;Q.setRGB(0,0,0);ea.setRGB(0,0,0);L.setRGB(0,0,0);v=0;for(p=A.length;v=0&&da>=0&&G>=0&&$>=0)return!0;else if(ca<0&&da<0||G<0&&$<0)return!1;else{if(ca<0)Y=Math.max(Y,ca/(ca-da));else da<0&&(V=Math.min(V,ca/(ca-da)));if(G<0)Y=Math.max(Y,G/(G-$));else $<0&&(V=Math.min(V,G/(G-$)));if(Vca&&aa.z0&&F.z<1){t=x[p]=x[p]||new THREE.RenderableParticle;t.x=F.x/F.w;t.y=F.y/F.w;t.z=F.z;t.rotation=y.rotation.z;t.scale.x=y.scale.x*Math.abs(t.x- +(F.x+I.projectionMatrix.n11)/(F.w+I.projectionMatrix.n14));t.scale.y=y.scale.y*Math.abs(t.y-(F.y+I.projectionMatrix.n22)/(F.w+I.projectionMatrix.n24));t.materials=y.materials;V.push(t);p++}}}Y&&V.sort(a);return V};this.unprojectVector=function(L,I){var Y=THREE.Matrix4.makeInvert(I.globalMatrix);Y.multiplySelf(THREE.Matrix4.makeInvert(I.projectionMatrix));Y.multiplyVector3(L);return L}}; +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,t,p,x,z;a=b.projectScene(h,k);j=0;for(m=a.length;j0){X.r+=ya.r*ma;X.g+=ya.g*ma;X.b+=ya.b*ma}}else if(ma instanceof THREE.PointLight){K.sub(ma.position,ka);K.normalize(); +ma=ia.dot(K)*Fa;if(ma>0){X.r+=ya.r*ma;X.g+=ya.g*ma;X.b+=ya.b*ma}}}}function Ia(S,ka,ia){if(ia.opacity!=0){a(ia.opacity);b(ia.blending);var X,ha,ma,ya,Fa,Ha;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map&&ia.map.image.loaded){ya=ia.map.image;Fa=ya.width>>1;Ha=ya.height>>1;ha=ka.scale.x*k;ma=ka.scale.y*j;ia=ha*Fa;X=ma*Ha;D.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(H.instersects(D)){m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ha,-ma);m.translate(-Fa,-Ha);m.drawImage(ya,0,0);m.restore()}}}else if(ia instanceof +THREE.ParticleCircleMaterial){if(J){P.r=ga.r+la.r+C.r;P.g=ga.g+la.g+C.g;P.b=ga.b+la.b+C.b;V.r=ia.color.r*P.r;V.g=ia.color.g*P.g;V.b=ia.color.b*P.b;V.updateStyleString()}else V.__styleString=ia.color.__styleString;ia=ka.scale.x*k;X=ka.scale.y*j;D.set(S.x-ia,S.y-X,S.x+ia,S.y+X);if(H.instersects(D)){ha=V.__styleString;if(z!=ha)m.fillStyle=z=ha;m.save();m.translate(S.x,S.y);m.rotate(-ka.rotation);m.scale(ia,X);m.beginPath();m.arc(0,0,1,0,Q,!0);m.closePath();m.fill();m.restore()}}}}function wa(S,ka,ia, +X){if(X.opacity!=0){a(X.opacity);b(X.blending);m.beginPath();m.moveTo(S.positionScreen.x,S.positionScreen.y);m.lineTo(ka.positionScreen.x,ka.positionScreen.y);m.closePath();if(X instanceof THREE.LineBasicMaterial){V.__styleString=X.color.__styleString;S=X.linewidth;if(F!=S)m.lineWidth=F=S;S=V.__styleString;if(x!=S)m.strokeStyle=x=S;m.stroke();D.inflate(X.linewidth*2)}}}function M(S,ka,ia,X,ha,ma){if(ha.opacity!=0){a(ha.opacity);b(ha.blending);O=S.positionScreen.x;R=S.positionScreen.y;ea=ka.positionScreen.x; +L=ka.positionScreen.y;I=ia.positionScreen.x;Y=ia.positionScreen.y;m.beginPath();m.moveTo(O,R);m.lineTo(ea,L);m.lineTo(I,Y);m.lineTo(O,R);m.closePath();if(ha instanceof THREE.MeshBasicMaterial)if(ha.map)ha.map.image.loaded&&ha.map.mapping instanceof THREE.UVMapping&&Na(O,R,ea,L,I,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);else if(ha.env_map){if(ha.env_map.image.loaded&&ha.env_map.mapping instanceof THREE.SphericalReflectionMapping){S=Z.globalMatrix;K.copy(X.vertexNormalsWorld[0]); +A=(K.x*S.n11+K.y*S.n12+K.z*S.n13)*0.5+0.5;y=-(K.x*S.n21+K.y*S.n22+K.z*S.n23)*0.5+0.5;K.copy(X.vertexNormalsWorld[1]);v=(K.x*S.n11+K.y*S.n12+K.z*S.n13)*0.5+0.5;o=-(K.x*S.n21+K.y*S.n22+K.z*S.n23)*0.5+0.5;K.copy(X.vertexNormalsWorld[2]);B=(K.x*S.n11+K.y*S.n12+K.z*S.n13)*0.5+0.5;E=-(K.x*S.n21+K.y*S.n22+K.z*S.n23)*0.5+0.5;Na(O,R,ea,L,I,Y,ha.env_map.image,A,y,v,o,B,E)}}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString);else if(ha instanceof THREE.MeshLambertMaterial){if(ha.map&& +!ha.wireframe){ha.map.mapping instanceof THREE.UVMapping&&Na(O,R,ea,L,I,Y,ha.map.image,X.uvs[0].u,X.uvs[0].v,X.uvs[1].u,X.uvs[1].v,X.uvs[2].u,X.uvs[2].v);b(THREE.SubtractiveBlending)}if(J)if(!ha.wireframe&&ha.shading==THREE.SmoothShading&&X.vertexNormalsWorld.length==3){ca.r=da.r=G.r=ga.r;ca.g=da.g=G.g=ga.g;ca.b=da.b=G.b=ga.b;oa(ma,X.v1.positionWorld,X.vertexNormalsWorld[0],ca);oa(ma,X.v2.positionWorld,X.vertexNormalsWorld[1],da);oa(ma,X.v3.positionWorld,X.vertexNormalsWorld[2],G);$.r=(da.r+G.r)* +0.5;$.g=(da.g+G.g)*0.5;$.b=(da.b+G.b)*0.5;l=La(ca,da,G,$);Na(O,R,ea,L,I,Y,l,0,0,1,0,0,1)}else{P.r=ga.r;P.g=ga.g;P.b=ga.b;oa(ma,X.centroidWorld,X.normalWorld,P);V.r=ha.color.r*P.r;V.g=ha.color.g*P.g;V.b=ha.color.b*P.b;V.updateStyleString();ha.wireframe?ua(V.__styleString,ha.wireframe_linewidth):Pa(V.__styleString)}else ha.wireframe?ua(ha.color.__styleString,ha.wireframe_linewidth):Pa(ha.color.__styleString)}else if(ha instanceof THREE.MeshDepthMaterial){na=Z.near;aa=Z.far;ca.r=ca.g=ca.b=1-qa(S.positionScreen.z, +na,aa);da.r=da.g=da.b=1-qa(ka.positionScreen.z,na,aa);G.r=G.g=G.b=1-qa(ia.positionScreen.z,na,aa);$.r=(da.r+G.r)*0.5;$.g=(da.g+G.g)*0.5;$.b=(da.b+G.b)*0.5;l=La(ca,da,G,$);Na(O,R,ea,L,I,Y,l,0,0,1,0,0,1)}else if(ha instanceof THREE.MeshNormalMaterial){V.r=va(X.normalWorld.x);V.g=va(X.normalWorld.y);V.b=va(X.normalWorld.z);V.updateStyleString();ha.wireframe?ua(V.__styleString,ha.wireframe_linewidth):Pa(V.__styleString)}}}function ua(S,ka){if(x!=S)m.strokeStyle=x=S;if(F!=ka)m.lineWidth=F=ka;m.stroke(); +D.inflate(ka*2)}function Pa(S){if(z!=S)m.fillStyle=z=S;m.fill()}function Na(S,ka,ia,X,ha,ma,ya,Fa,Ha,Oa,za,Ka,Ma){var Ja,Ga;Ja=ya.width-1;Ga=ya.height-1;Fa*=Ja;Ha*=Ga;Oa*=Ja;za*=Ga;Ka*=Ja;Ma*=Ga;ia-=S;X-=ka;ha-=S;ma-=ka;Oa-=Fa;za-=Ha;Ka-=Fa;Ma-=Ha;Ja=Oa*Ma-Ka*za;if(Ja!=0){Ga=1/Ja;Ja=(Ma*ia-za*ha)*Ga;za=(Ma*X-za*ma)*Ga;ia=(Oa*ha-Ka*ia)*Ga;X=(Oa*ma-Ka*X)*Ga;S=S-Ja*Fa-ia*Ha;ka=ka-za*Fa-X*Ha;m.save();m.transform(Ja,za,ia,X,S,ka);m.clip();m.drawImage(ya,0,0);m.restore()}}function La(S,ka,ia,X){var ha= +~~(S.r*255),ma=~~(S.g*255);S=~~(S.b*255);var ya=~~(ka.r*255),Fa=~~(ka.g*255);ka=~~(ka.b*255);var Ha=~~(ia.r*255),Oa=~~(ia.g*255);ia=~~(ia.b*255);var za=~~(X.r*255),Ka=~~(X.g*255);X=~~(X.b*255);N[0]=ha<0?0:ha>255?255:ha;N[1]=ma<0?0:ma>255?255:ma;N[2]=S<0?0:S>255?255:S;N[4]=ya<0?0:ya>255?255:ya;N[5]=Fa<0?0:Fa>255?255:Fa;N[6]=ka<0?0:ka>255?255:ka;N[8]=Ha<0?0:Ha>255?255:Ha;N[9]=Oa<0?0:Oa>255?255:Oa;N[10]=ia<0?0:ia>255?255:ia;N[12]=za<0?0:za>255?255:za;N[13]=Ka<0?0:Ka>255?255:Ka;N[14]=X<0?0:X>255?255: +X;ba.putImageData(ta,0,0);xa.drawImage(U,0,0);return Ba}function qa(S,ka,ia){S=(S-ka)/(ia-ka);return S*S*(3-2*S)}function va(S){S=(S+1)*0.5;return S<0?0:S>1?1:S}function ra(S,ka){var ia=ka.x-S.x,X=ka.y-S.y,ha=1/Math.sqrt(ia*ia+X*X);ia*=ha;X*=ha;ka.x+=ia;ka.y+=X;S.x-=ia;S.y-=X}var pa,sa,ja,Ca,Aa,Ra,Da,Qa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(W,Z,this.sortElements);(J=W.lights.length>0)&&fa(W);pa=0;for(sa=c.length;pa0){v.r+=E.color.r*H;v.g+=E.color.g*H;v.b+=E.color.b*H}}else if(E instanceof THREE.PointLight){Y.sub(E.position,y.centroidWorld);Y.normalize();H=y.normalWorld.dot(Y)*E.intensity;if(H>0){v.r+=E.color.r*H;v.g+=E.color.g*H;v.b+=E.color.b*H}}}}function b(A,y,v,o,B,E){G=d($++);G.setAttribute("d","M "+A.positionScreen.x+ +" "+A.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)q.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(e){O.r=R.r;O.g=R.g;O.b=R.b;a(E,o,O);q.r=B.color.r*O.r;q.g=B.color.g*O.g;q.b=B.color.b*O.b;q.updateStyleString()}else q.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){I=1-B.__2near/(B.__farPlusNear-o.z*B.__farMinusNear); +q.setRGB(I,I,I)}else B instanceof THREE.MeshNormalMaterial&&q.setRGB(f(o.normalWorld.x),f(o.normalWorld.y),f(o.normalWorld.z));B.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+B.opacity);k.appendChild(G)}function c(A,y,v,o,B,E,H){G=d($++);G.setAttribute("d", +"M "+A.positionScreen.x+" "+A.positionScreen.y+" L "+y.positionScreen.x+" "+y.positionScreen.y+" L "+v.positionScreen.x+","+v.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)q.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(e){O.r=R.r;O.g=R.g;O.b=R.b;a(H,B,O);q.r=E.color.r*O.r;q.g=E.color.g*O.g;q.b=E.color.b*O.b;q.updateStyleString()}else q.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){I= +1-E.__2near/(E.__farPlusNear-B.z*E.__farMinusNear);q.setRGB(I,I,I)}else E instanceof THREE.MeshNormalMaterial&&q.setRGB(f(B.normalWorld.x),f(B.normalWorld.y),f(B.normalWorld.z));E.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+E.opacity);k.appendChild(G)} +function d(A){if(V[A]==null){V[A]=document.createElementNS("http://www.w3.org/2000/svg","path");l==0&&V[A].setAttribute("shape-rendering","crispEdges")}return V[A]}function f(A){return A<0?Math.min((1+A)*0.5,0.5):0.5+Math.min(A*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,t,p,x,z,F=new THREE.Rectangle,u=new THREE.Rectangle,e=!1,q=new THREE.Color(16777215),O=new THREE.Color(16777215),R=new THREE.Color(0),ea=new THREE.Color(0),L=new THREE.Color(0), +I,Y=new THREE.Vector3,V=[],ca=[],da=[],G,$,na,aa,l=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(A){switch(A){case "high":l=1;break;case "low":l=0}};this.setSize=function(A,y){j=A;m=y;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};this.render=function(A,y){var v,o,B,E,H,T,D,J; +this.autoClear&&this.clear();g=h.projectScene(A,y,this.sortElements);aa=na=$=0;if(e=A.lights.length>0){D=A.lights;R.setRGB(0,0,0);ea.setRGB(0,0,0);L.setRGB(0,0,0);v=0;for(o=D.length;v0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,D.map?"#define USE_MAP":"",D.env_map?"#define USE_ENVMAP":"",D.light_map?"#define USE_LIGHTMAP": -"",D.vertex_colors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); -e.attachShader(y,z("fragment",p+U));e.attachShader(y,z("vertex",D+B));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(v in l.uniforms)y.push(v);v=l.program;U=0;for(B=y.length;U< -B;U++){p=y[U];v.uniforms[p]=e.getUniformLocation(v,p)}l=l.program;v=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];y=0;for(U=v.length;y=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.color)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.normal)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.tangent)}if(l.uv>= -0)if(p.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(D instanceof THREE.SkinnedMesh){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA, -4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexA);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexB);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinIndex);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinWeight)}if(D instanceof -THREE.Mesh)if(v.wireframe){e.lineWidth(v.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(D,0,p.__webGLLineCount)}else D instanceof THREE.ParticleSystem&&e.drawArrays(e.POINTS, -0,p.__webGLParticleCount)};this.render=function(l,B,y,v){var p,D,F,J,U,A,R,O=l.lights,ga=l.fog;B.autoUpdateMatrix&&B.update();B.globalMatrix.flattenToArray(Z);B.projectionMatrix.flattenToArray(T);B.inverseMatrix.flattenToArray(da);Y.multiply(B.projectionMatrix,B.globalMatrix);g(Y);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,!1,B,this);this.initWebGLObjects(l,B);x(y,v!==undefined?v:!0);this.autoClear&&this.clear();J=l.__webGLObjects.length;for(v=0;v0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,ma)}if(ka&&P>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Na,ma)}if(S){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,ma);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER, -Aa,ma)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ra,ma);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,pa,ma);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,sa,ma);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ja,ma)}}w(objlist,U,D,J,v)}F.__dirtyVertices=!1;F.__dirtyElements=!1;F.__dirtyUvs=!1;F.__dirtyNormals=!1;F.__dirtyTangents=!1;F.__dirtyColors= -!1}else if(v instanceof THREE.Line){if(!F.__webGLVertexBuffer){D=F;D.__webGLVertexBuffer=e.createBuffer();D.__webGLColorBuffer=e.createBuffer();D=F;J=D.vertices.length;D.__vertexArray=new Float32Array(J*3);D.__colorArray=new Float32Array(J*3);D.__webGLLineCount=J;F.__dirtyVertices=!0;F.__dirtyColors=!0}if(F.__dirtyVertices||F.__dirtyColors){D=F;J=e.DYNAMIC_DRAW;O=void 0;O=void 0;A=void 0;p=void 0;ga=D.vertices;ma=D.colors;P=ga.length;E=ma.length;I=D.__vertexArray;R=D.__colorArray;V=D.__dirtyColors; -if(D.__dirtyVertices){for(O=0;O=0;y--){v=l.__webGLObjects[y].object;B==v&&l.__webGLObjects.splice(y,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)};this.setFaceCulling=function(l,B){if(l){!B||B=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK); -e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}}; +case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var u=document.createElement("canvas"),e,q=null,O=null,R=null,ea=null,L=null,I=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4, +new THREE.Vector4],Y=new THREE.Matrix4,V=new Float32Array(16),ca=new Float32Array(16),da=new Float32Array(16),G=new THREE.Vector4,$=!0,na=new THREE.Color(0),aa=0;if(a){if(a.antialias!==undefined)$=a.antialias;a.clearColor!==undefined&&na.setHex(a.clearColor);if(a.clearAlpha!==undefined)aa=a.clearAlpha}this.domElement=u;this.autoClear=!0;this.sortObjects=!1;(function(l,A,y){try{e=u.getContext("experimental-webgl",{antialias:l})}catch(v){console.log(v)}if(!e){alert("WebGL not supported");throw"cannot create webgl context"; +}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(A.r,A.g,A.b,y);_cullEnabled=!0})($,na,aa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,A){u.width=l;u.height=A;e.viewport(0,0,u.width,u.height)};this.setClearColorHex=function(l, +A){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,A)};this.setClearColor=function(l,A){e.clearColor(l.r,l.g,l.b,A)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)};this.setupLights=function(l,A){var y,v,o,B=0,E=0,H=0,T,D,J,P=this.lights,ga=P.directional.colors,la=P.directional.positions,C=P.point.colors,Q=P.point.positions,K=0,U=0;y=o=o=0;for(v=A.length;y0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.map?"#define USE_MAP":"",B.env_map?"#define USE_ENVMAP":"",B.light_map?"#define USE_LIGHTMAP": +"",B.vertex_colors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n"); +e.attachShader(y,z("fragment",o+T));e.attachShader(y,z("vertex",B+A));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(v in l.uniforms)y.push(v);v=l.program;T=0;for(A=y.length;T< +A;T++){o=y[T];v.uniforms[o]=e.getUniformLocation(v,o)}l=l.program;v=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];y=0;for(T=v.length;y=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.color)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.normal)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.tangent)}if(l.uv>= +0)if(o.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(o.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);if(B instanceof THREE.SkinnedMesh){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA, +4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexA);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinVertexB);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinIndex);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,4,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.skinWeight)}if(B instanceof +THREE.Mesh)if(v.wireframe){e.lineWidth(v.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.drawElements(e.LINES,o.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,o.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(B,0,o.__webGLLineCount)}else B instanceof THREE.ParticleSystem&&e.drawArrays(e.POINTS, +0,o.__webGLParticleCount)};this.render=function(l,A,y,v){var o,B,E,H,T,D,J,P,ga=l.lights,la=l.fog;A.autoUpdateMatrix&&A.update();A.globalMatrix.flattenToArray(da);A.projectionMatrix.flattenToArray(V);A.inverseMatrix.flattenToArray(ca);Y.multiply(A.projectionMatrix,A.globalMatrix);g(Y);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,!1,A);this.initWebGLObjects(l,A);x(y,v!==undefined?v:!0);this.autoClear&&this.clear();T=l.__webGLObjects.length;for(v=0;v0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,la)}if(ka&&Q>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Na,la)}if(S){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ca,la);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Aa,la)}if(M>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ra,la); +e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,pa,la);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,sa,la);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ja,la)}}w(objlist,T,B,H,v)}E.__dirtyVertices=!1;E.__dirtyElements=!1;E.__dirtyUvs=!1;E.__dirtyNormals=!1;E.__dirtyTangents=!1;E.__dirtyColors=!1}else if(v instanceof THREE.Line){if(!E.__webGLVertexBuffer){B=E;B.__webGLVertexBuffer=e.createBuffer(); +B.__webGLColorBuffer=e.createBuffer();B=E;H=B.vertices.length;B.__vertexArray=new Float32Array(H*3);B.__colorArray=new Float32Array(H*3);B.__webGLLineCount=H;E.__dirtyVertices=!0;E.__dirtyColors=!0}if(E.__dirtyVertices||E.__dirtyColors){B=E;H=e.DYNAMIC_DRAW;P=void 0;P=void 0;D=void 0;o=void 0;ga=B.vertices;la=B.colors;Q=ga.length;C=la.length;K=B.__vertexArray;J=B.__colorArray;U=B.__dirtyColors;if(B.__dirtyVertices){for(P=0;P=0;y--){v= +l.__webGLObjects[y].object;A==v&&l.__webGLObjects.splice(y,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)};this.setFaceCulling=function(l,A){if(l){!A||A=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)> +0}}; THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif", envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif", map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif", @@ -280,17 +276,17 @@ THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=ne THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null}; THREE.Detector={canvas:!!document.createElement("canvas").getContext,webgl:window.Uint8Array!=undefined,workers:!!window.Worker,addGetWebGLMessage:function(a){var b=document.body,c="oldie";if(a){if(a.parent!==undefined)b=a.parent;if(a.id!==undefined)c=a.id}a=document.createElement("center");var d=document.createElement("div");d.innerHTML='Sorry, your browser doesn\'t support WebGL
\n
\nPlease try in\nChrome 9+ /\nFirefox 4+ /\nSafari OSX 10.6+';d.id= c;c=d.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.background="#eee";c.color="#000";c.padding="1em";c.width="475px";c.margin="5em auto 0";a.appendChild(d);b.appendChild(a);return d}}; -var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var n=0,w=h.length;n25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,u)))-1);m.push(n)}b.push(m)}var q,x,z;f=b.length;for(c=0;c0)for(d=0;d1){q=this.vertices[h].position.clone(); -x=this.vertices[j].position.clone();z=this.vertices[m].position.clone();q.normalize();x.normalize();z.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([n,w,C])}}}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,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,t)))-1);m.push(n)}b.push(m)}var p,x,z;f=b.length;for(c=0;c0)for(d=0;d1){p=this.vertices[h].position.clone(); +x=this.vertices[j].position.clone();z=this.vertices[m].position.clone();p.normalize();x.normalize();z.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(z.x,z.y,z.z)]));this.uvs.push([n,w,F])}}}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,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c= 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][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 b(w,u,q){var x=Math.sqrt(w*w+u*u+q*q);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,u/x,q/x)))-1}function c(w,u,q,x){x.faces.push(new THREE.Face3(w,u,q))}function d(w,u){var q=f.vertices[w].position,x=f.vertices[u].position;return b((q.x+x.x)/2,(q.y+x.y)/2,(q.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0, +var Icosahedron=function(a){function b(w,t,p){var x=Math.sqrt(w*w+t*t+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,t/x,p/x)))-1}function c(w,t,p,x){x.faces.push(new THREE.Face3(w,t,p))}function d(w,t){var p=f.vertices[w].position,x=f.vertices[t].position;return b((p.x+x.x)/2,(p.y+x.y)/2,(p.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0, 1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a=this.maxCount-3&&k(this)};this.begin= -function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;dthis.size-1&&(j=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(n-k);q<1&&(q=1);k=Math.floor(n+k); -k>this.size-1&&(k=this.size-1);for(var x,z,C,o,e,t;w0&&(this.field[C+x]+=o)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,n=this.yd,w=this.zd,u=this.field,q=m*Math.sqrt(c/d);q>m&&(q=m);for(f=0;f0)for(g=0;gn&&(x=n);for(g=0;g0){j=g*w;for(f=0;fsize&&(dist=size);for(h=0;h0){j=zd*h;for(g=0;gthis.size-1&&(j=this.size-1);var t=Math.floor(m-k);t<1&&(t=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k); +k>this.size-1&&(k=this.size-1);for(var x,z,F,u,e,q;w0&&(this.field[F+x]+=u)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,n=this.yd,w=this.zd,t=this.field,p=m*Math.sqrt(c/d);p>m&&(p=m);for(f=0;f0)for(g=0;gn&&(x=n);for(g=0;g0){j=g*w;for(f=0;fsize&&(dist=size);for(h=0;h0){j=zd*h;for(g=0;g>7)-127;I|=(ca&127)<<16|V<<8;if(I==0&&M==-127)return 0;return(1-2*(ta>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,M)}function k(E,P){var I=n(E,P),V=n(E,P+1),ca=n(E,P+2);return(n(E,P+3)<<24)+(ca<<16)+(V<<8)+I}function j(E,P){var I=n(E,P);return(n(E,P+1)<<8)+I}function m(E,P){var I=n(E,P);return I>127?I-256:I}function n(E,P){return E.charCodeAt(P)&255}function w(E){var P,I,V; -P=k(a,E);I=k(a,E+ea);V=k(a,E+L);E=j(a,E+G);THREE.Loader.prototype.f3(o,P,I,V,E)}function u(E){var P,I,V,ca,ta,M;P=k(a,E);I=k(a,E+ea);V=k(a,E+L);ca=j(a,E+G);ta=k(a,E+Y);M=k(a,E+T);E=k(a,E+da);THREE.Loader.prototype.f3n(o,N,P,I,V,ca,ta,M,E)}function q(E){var P,I,V,ca;P=k(a,E);I=k(a,E+Z);V=k(a,E+H);ca=k(a,E+aa);E=j(a,E+na);THREE.Loader.prototype.f4(o,P,I,V,ca,E)}function x(E){var P,I,V,ca,ta,M,Ba,xa;P=k(a,E);I=k(a,E+Z);V=k(a,E+H);ca=k(a,E+aa);ta=j(a,E+na);M=k(a,E+ba);Ba=k(a,E+l);xa=k(a,E+B);E=k(a,E+ -y);THREE.Loader.prototype.f4n(o,N,P,I,V,ca,ta,M,Ba,xa,E)}function z(E){var P,I;P=k(a,E);I=k(a,E+v);E=k(a,E+p);THREE.Loader.prototype.uv3(o.uvs,Q[P*2],Q[P*2+1],Q[I*2],Q[I*2+1],Q[E*2],Q[E*2+1])}function C(E){var P,I,V;P=k(a,E);I=k(a,E+D);V=k(a,E+F);E=k(a,E+J);THREE.Loader.prototype.uv4(o.uvs,Q[P*2],Q[P*2+1],Q[I*2],Q[I*2+1],Q[V*2],Q[V*2+1],Q[E*2],Q[E*2+1])}var o=this,e=0,t,N=[],Q=[],ea,L,G,Y,T,da,Z,H,aa,na,ba,l,B,y,v,p,D,F,J,U,A,R,O,ga,ma;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(o, -d,g);t={signature:a.substr(e,8),header_bytes:n(a,e+8),vertex_coordinate_bytes:n(a,e+9),normal_coordinate_bytes:n(a,e+10),uv_coordinate_bytes:n(a,e+11),vertex_index_bytes:n(a,e+12),normal_index_bytes:n(a,e+13),uv_index_bytes:n(a,e+14),material_index_bytes:n(a,e+15),nvertices:k(a,e+16),nnormals:k(a,e+16+4),nuvs:k(a,e+16+8),ntri_flat:k(a,e+16+12),ntri_smooth:k(a,e+16+16),ntri_flat_uv:k(a,e+16+20),ntri_smooth_uv:k(a,e+16+24),nquad_flat:k(a,e+16+28),nquad_smooth:k(a,e+16+32),nquad_flat_uv:k(a,e+16+36), -nquad_smooth_uv:k(a,e+16+40)};e+=t.header_bytes;ea=t.vertex_index_bytes;L=t.vertex_index_bytes*2;G=t.vertex_index_bytes*3;Y=t.vertex_index_bytes*3+t.material_index_bytes;T=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes;da=t.vertex_index_bytes*3+t.material_index_bytes+t.normal_index_bytes*2;Z=t.vertex_index_bytes;H=t.vertex_index_bytes*2;aa=t.vertex_index_bytes*3;na=t.vertex_index_bytes*4;ba=t.vertex_index_bytes*4+t.material_index_bytes;l=t.vertex_index_bytes*4+t.material_index_bytes+ -t.normal_index_bytes;B=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*2;y=t.vertex_index_bytes*4+t.material_index_bytes+t.normal_index_bytes*3;v=t.uv_index_bytes;p=t.uv_index_bytes*2;D=t.uv_index_bytes;F=t.uv_index_bytes*2;J=t.uv_index_bytes*3;g=t.vertex_index_bytes*3+t.material_index_bytes;ma=t.vertex_index_bytes*4+t.material_index_bytes;U=t.ntri_flat*g;A=t.ntri_smooth*(g+t.normal_index_bytes*3);R=t.ntri_flat_uv*(g+t.uv_index_bytes*3);O=t.ntri_smooth_uv*(g+t.normal_index_bytes* -3+t.uv_index_bytes*3);ga=t.nquad_flat*ma;g=t.nquad_smooth*(ma+t.normal_index_bytes*4);ma=t.nquad_flat_uv*(ma+t.uv_index_bytes*4);e+=function(E){for(var P,I,V,ca=t.vertex_coordinate_bytes*3,ta=E+t.nvertices*ca;E>7)-127;K|=(ba&127)<<16|U<<8;if(K==0&&N==-127)return 0;return(1-2*(ta>>7))*(1+K*Math.pow(2,-23))*Math.pow(2,N)}function k(C,Q){var K=n(C,Q),U=n(C,Q+1),ba=n(C,Q+2);return(n(C,Q+3)<<24)+(ba<<16)+(U<<8)+K}function j(C,Q){var K=n(C,Q);return(n(C,Q+1)<<8)+K}function m(C,Q){var K=n(C,Q);return K>127?K-256:K}function n(C,Q){return C.charCodeAt(Q)&255}function w(C){var Q,K,U; +Q=k(a,C);K=k(a,C+ea);U=k(a,C+L);C=j(a,C+I);THREE.Loader.prototype.f3(u,Q,K,U,C)}function t(C){var Q,K,U,ba,ta,N;Q=k(a,C);K=k(a,C+ea);U=k(a,C+L);ba=j(a,C+I);ta=k(a,C+Y);N=k(a,C+V);C=k(a,C+ca);THREE.Loader.prototype.f3n(u,O,Q,K,U,ba,ta,N,C)}function p(C){var Q,K,U,ba;Q=k(a,C);K=k(a,C+da);U=k(a,C+G);ba=k(a,C+$);C=j(a,C+na);THREE.Loader.prototype.f4(u,Q,K,U,ba,C)}function x(C){var Q,K,U,ba,ta,N,Ba,xa;Q=k(a,C);K=k(a,C+da);U=k(a,C+G);ba=k(a,C+$);ta=j(a,C+na);N=k(a,C+aa);Ba=k(a,C+l);xa=k(a,C+A);C=k(a,C+ +y);THREE.Loader.prototype.f4n(u,O,Q,K,U,ba,ta,N,Ba,xa,C)}function z(C){var Q,K;Q=k(a,C);K=k(a,C+v);C=k(a,C+o);THREE.Loader.prototype.uv3(u.uvs,R[Q*2],R[Q*2+1],R[K*2],R[K*2+1],R[C*2],R[C*2+1])}function F(C){var Q,K,U;Q=k(a,C);K=k(a,C+B);U=k(a,C+E);C=k(a,C+H);THREE.Loader.prototype.uv4(u.uvs,R[Q*2],R[Q*2+1],R[K*2],R[K*2+1],R[U*2],R[U*2+1],R[C*2],R[C*2+1])}var u=this,e=0,q,O=[],R=[],ea,L,I,Y,V,ca,da,G,$,na,aa,l,A,y,v,o,B,E,H,T,D,J,P,ga,la;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(u, +d,g);q={signature:a.substr(e,8),header_bytes:n(a,e+8),vertex_coordinate_bytes:n(a,e+9),normal_coordinate_bytes:n(a,e+10),uv_coordinate_bytes:n(a,e+11),vertex_index_bytes:n(a,e+12),normal_index_bytes:n(a,e+13),uv_index_bytes:n(a,e+14),material_index_bytes:n(a,e+15),nvertices:k(a,e+16),nnormals:k(a,e+16+4),nuvs:k(a,e+16+8),ntri_flat:k(a,e+16+12),ntri_smooth:k(a,e+16+16),ntri_flat_uv:k(a,e+16+20),ntri_smooth_uv:k(a,e+16+24),nquad_flat:k(a,e+16+28),nquad_smooth:k(a,e+16+32),nquad_flat_uv:k(a,e+16+36), +nquad_smooth_uv:k(a,e+16+40)};e+=q.header_bytes;ea=q.vertex_index_bytes;L=q.vertex_index_bytes*2;I=q.vertex_index_bytes*3;Y=q.vertex_index_bytes*3+q.material_index_bytes;V=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;ca=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;da=q.vertex_index_bytes;G=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;na=q.vertex_index_bytes*4;aa=q.vertex_index_bytes*4+q.material_index_bytes;l=q.vertex_index_bytes*4+q.material_index_bytes+ +q.normal_index_bytes;A=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;y=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;v=q.uv_index_bytes;o=q.uv_index_bytes*2;B=q.uv_index_bytes;E=q.uv_index_bytes*2;H=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;la=q.vertex_index_bytes*4+q.material_index_bytes;T=q.ntri_flat*g;D=q.ntri_smooth*(g+q.normal_index_bytes*3);J=q.ntri_flat_uv*(g+q.uv_index_bytes*3);P=q.ntri_smooth_uv*(g+q.normal_index_bytes* +3+q.uv_index_bytes*3);ga=q.nquad_flat*la;g=q.nquad_smooth*(la+q.normal_index_bytes*4);la=q.nquad_flat_uv*(la+q.uv_index_bytes*4);e+=function(C){for(var Q,K,U,ba=q.vertex_coordinate_bytes*3,ta=C+q.nvertices*ba;C + + + + + + + + + + - - - - @@ -52,6 +58,8 @@ + + @@ -61,6 +69,7 @@ + diff --git a/examples/lights_test.html b/examples/lights_test.html index d9e7b788..9b618f6c 100644 --- a/examples/lights_test.html +++ b/examples/lights_test.html @@ -38,11 +38,84 @@

 
-		
-
-		
-		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
 		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+
 
 		
 
diff --git a/examples/render_to_texture.html b/examples/render_to_texture.html
index 2e7bd6f0..dfc5376f 100644
--- a/examples/render_to_texture.html
+++ b/examples/render_to_texture.html
@@ -34,8 +34,8 @@
         
three.js render-to-texture webgl example
- + - + \ No newline at end of file diff --git a/examples/scene_test.html b/examples/scene_test.html index 7132d9cb..ff3cbad0 100644 --- a/examples/scene_test.html +++ b/examples/scene_test.html @@ -228,6 +228,13 @@ renderer.domElement.style.position = "relative"; container.appendChild( renderer.domElement ); + stats = new Stats(); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.top = '0px'; + stats.domElement.style.right = '0px'; + stats.domElement.style.zIndex = 100; + container.appendChild( stats.domElement ); + $( "start" ).addEventListener( 'click', onStartClick, false ); setInterval( loop, 1000/60 ); @@ -296,13 +303,6 @@ $( "progress" ).style.display = "block"; SceneUtils.loadScene( "scenes/test_scene.js", callback_sync, callback_async, callback_progress ); - - stats = new Stats(); - stats.domElement.style.position = 'absolute'; - stats.domElement.style.top = '0px'; - stats.domElement.style.right = '0px'; - stats.domElement.style.zIndex = 100; - container.appendChild( stats.domElement ); $( "plus_exp" ).addEventListener( 'click', createToggle( "exp" ), false ); diff --git a/examples/uqbiquity_test.html b/examples/uqbiquity_test.html index 465077ee..bf06438a 100644 --- a/examples/uqbiquity_test.html +++ b/examples/uqbiquity_test.html @@ -26,21 +26,26 @@ + - - - - - + + + + + + + + + diff --git a/src/cameras/Camera.js b/src/cameras/Camera.js index 5d6b6eb8..58049457 100644 --- a/src/cameras/Camera.js +++ b/src/cameras/Camera.js @@ -28,6 +28,35 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, renderer, target ) { this.inverseMatrix = new THREE.Matrix4(); this.projectionMatrix = null; + // movement + + this.tmpVec = new THREE.Vector3(); + + this.translateX = function ( amount ) { + + this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount ); + this.tmpVec.crossSelf( this.up ); + + this.position.addSelf( this.tmpVec ); + this.target.position.addSelf( this.tmpVec ); + + }; + + /* TODO + this.translateY = function ( amount ) { + + }; + */ + + this.translateZ = function ( amount ) { + + this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount ); + + this.position.subSelf( this.tmpVec ); + this.target.position.subSelf( this.tmpVec ); + + }; + this.updateProjectionMatrix(); } @@ -36,6 +65,7 @@ THREE.Camera.prototype = new THREE.Object3D(); THREE.Camera.prototype.constructor = THREE.Camera; THREE.Camera.prototype.supr = THREE.Object3D.prototype; + /* * Update projection matrix * @@ -53,7 +83,7 @@ THREE.Camera.prototype.updateProjectionMatrix = function() { * Update */ -THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, scene, camera ) { +THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) { if( this.useTarget ) { @@ -70,10 +100,7 @@ THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, scene this.globalMatrix.copy( this.localMatrix ); THREE.Matrix4.makeInvert( this.globalMatrix, this.inverseMatrix ); - //THREE.Matrix4.makeInvertTo( this.globalMatrix, this.inverseMatrix ); - - //console.log(this.inverseMatrix); forceUpdate = true; @@ -93,7 +120,6 @@ THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, scene forceUpdate = true; THREE.Matrix4.makeInvert( this.globalMatrix, this.inverseMatrix ); - //THREE.Matrix4.makeInvertTo( this.globalMatrix, this.inverseMatrix ); } @@ -103,9 +129,9 @@ THREE.Camera.prototype.update = function( parentGlobalMatrix, forceUpdate, scene // update children for( var i = 0; i < this.children.length; i++ ) - this.children[ i ].update( this.globalMatrix, forceUpdate, camera, renderer ); + this.children[ i ].update( this.globalMatrix, forceUpdate, camera ); -} +}; /* @@ -171,4 +197,4 @@ THREE.Camera.prototype.frustumContains = function( object3D ) { return true; -} +}; diff --git a/src/core/Geometry.js b/src/core/Geometry.js index 20f14cd0..cfe1a6d3 100644 --- a/src/core/Geometry.js +++ b/src/core/Geometry.js @@ -415,7 +415,7 @@ THREE.Geometry.prototype = { } else { - hash_array.push( material[ i ].toString() ); + hash_array.push( material[ i ].id ); } diff --git a/src/core/Matrix4.js b/src/core/Matrix4.js index 26057df3..6fca135a 100644 --- a/src/core/Matrix4.js +++ b/src/core/Matrix4.js @@ -17,38 +17,6 @@ THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33 this.flat = new Array( 16 ); this.m33 = new THREE.Matrix3(); - - // WebGL additions - NEEDS TO BE DISCUSSED! - - if( typeof Float32Array !== 'undefined' ) { - - var that = this; - this.float32Array = new Float32Array( 16 ); - this.float32Array3x3 = new Float32Array( 9 ); - - this.flatten32 = function() { - - var flat = that.float32Array; - - flat[ 0 ] = that.n11; flat[ 1 ] = that.n21; flat[ 2 ] = that.n31; flat[ 3 ] = that.n41; - flat[ 4 ] = that.n12; flat[ 5 ] = that.n22; flat[ 6 ] = that.n32; flat[ 7 ] = that.n42; - flat[ 8 ] = that.n13; flat[ 9 ] = that.n23; flat[ 10 ] = that.n33; flat[ 11 ] = that.n43; - flat[ 12 ] = that.n14; flat[ 13 ] = that.n24; flat[ 14 ] = that.n34; flat[ 15 ] = that.n44; - - return flat; - } - - this.flatten323x3 = function() { - - var flat = that.float32Array3x3; - - flat[ 0 ] = that.n11; flat[ 1 ] = that.n21; flat[ 2 ] = that.n31; - flat[ 3 ] = that.n12; flat[ 4 ] = that.n22; flat[ 5 ] = that.n32; - flat[ 6 ] = that.n13; flat[ 7 ] = that.n23; flat[ 8 ] = that.n33; - - return flat; - } - } }; @@ -613,6 +581,15 @@ THREE.Matrix4.prototype = { return this; }, + extractRotationMatrix: function( m ) { + + m.n11 = this.n11; m.n12 = this.n12; m.n13 = this.n13; m.n14 = 0; + m.n21 = this.n21; m.n22 = this.n22; m.n23 = this.n23; m.n24 = 0; + m.n31 = this.n31; m.n32 = this.n32; m.n33 = this.n33; m.n34 = 0; + m.n41 = 0; m.n42 = 0; m.n43 = 0; m.n44 = 1; + + }, + toString: function() { return "| " + this.n11 + " " + this.n12 + " " + this.n13 + " " + this.n14 + " |\n" + diff --git a/src/core/Ray.js b/src/core/Ray.js index ba519694..50ace454 100644 --- a/src/core/Ray.js +++ b/src/core/Ray.js @@ -42,6 +42,7 @@ THREE.Ray.prototype = { origin, direction, geometry = object.geometry, vertices = geometry.vertices, + objMatrix, intersect, intersects = [], intersectPoint; @@ -52,10 +53,13 @@ THREE.Ray.prototype = { origin = this.origin.clone(); direction = this.direction.clone(); - a = object.matrix.multiplyVector3( vertices[ face.a ].position.clone() ); - b = object.matrix.multiplyVector3( vertices[ face.b ].position.clone() ); - c = object.matrix.multiplyVector3( vertices[ face.c ].position.clone() ); - d = face instanceof THREE.Face4 ? object.matrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null; + objMatrix = object.globalMatrix; + objMatrix.extractRotationMatrix( object.rotationMatrix ); + + a = objMatrix.multiplyVector3( vertices[ face.a ].position.clone() ); + b = objMatrix.multiplyVector3( vertices[ face.b ].position.clone() ); + c = objMatrix.multiplyVector3( vertices[ face.c ].position.clone() ); + d = face instanceof THREE.Face4 ? objMatrix.multiplyVector3( vertices[ face.d ].position.clone() ) : null; normal = object.rotationMatrix.multiplyVector3( face.normal.clone() ); dot = direction.dot( normal ); diff --git a/src/core/Vector3.js b/src/core/Vector3.js index 05170fbb..7f1e5824 100644 --- a/src/core/Vector3.js +++ b/src/core/Vector3.js @@ -5,31 +5,12 @@ * @author mikael emtinger / http://gomo.se/ */ -THREE.Vector3 = function ( _x, _y, _z ) { +THREE.Vector3 = function ( x, y, z ) { - this.x = _x || 0; - this.y = _y || 0; - this.z = _z || 0; - - this.api = { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; - isDirty: false, - that: this, - - get x() { return this.that.x; }, - get y() { return this.that.y; }, - get z() { return this.that.z; }, - - set x( value ) { this.that.x = value; this.isDirty = true; }, - set y( value ) { this.that.y = value; this.isDirty = true; }, - set z( value ) { this.that.z = value; this.isDirty = true; } - - }; - - this.api.__proto__ = THREE.Vector3.prototype; - - return this.api; - }; @@ -37,24 +18,20 @@ THREE.Vector3.prototype = { set: function ( x, y, z ) { - var vec = this.that; - vec.x = x; - vec.y = y; - vec.z = z; + this.x = x; + this.y = y; + this.z = z; - this.isDirty = true; return this; }, copy: function ( v ) { - var vec = this.that; - vec.x = v.x; - vec.y = v.y; - vec.z = v.z; - - this.isDirty = true; + this.x = v.x; + this.y = v.y; + this.z = v.z; + return this; }, @@ -62,12 +39,10 @@ THREE.Vector3.prototype = { add: function ( a, b ) { - var vec = this.that; - vec.x = a.x + b.x; - vec.y = a.y + b.y; - vec.z = a.z + b.z; + this.x = a.x + b.x; + this.y = a.y + b.y; + this.z = a.z + b.z; - this.isDirty = true; return this; }, @@ -75,12 +50,10 @@ THREE.Vector3.prototype = { addSelf: function ( v ) { - var vec = this.that; - vec.x += v.x; - vec.y += v.y; - vec.z += v.z; + this.x += v.x; + this.y += v.y; + this.z += v.z; - this.isDirty = true; return this; }, @@ -88,12 +61,10 @@ THREE.Vector3.prototype = { addScalar: function ( s ) { - var vec = this.that; - vec.x += s; - vec.y += s; - vec.z += s; + this.x += s; + this.y += s; + this.z += s; - this.isDirty = true; return this; }, @@ -101,12 +72,10 @@ THREE.Vector3.prototype = { sub: function( a, b ) { - var vec = this.that; - vec.x = a.x - b.x; - vec.y = a.y - b.y; - vec.z = a.z - b.z; + this.x = a.x - b.x; + this.y = a.y - b.y; + this.z = a.z - b.z; - this.isDirty = true; return this; }, @@ -114,12 +83,10 @@ THREE.Vector3.prototype = { subSelf: function ( v ) { - var vec = this.that; - vec.x -= v.x; - vec.y -= v.y; - vec.z -= v.z; + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; - this.isDirty = true; return this; }, @@ -127,154 +94,131 @@ THREE.Vector3.prototype = { cross: function ( a, b ) { - var vec = this.that; - vec.x = a.y * b.z - a.z * b.y; - vec.y = a.z * b.x - a.x * b.z; - vec.z = a.x * b.y - a.y * b.x; + this.x = a.y * b.z - a.z * b.y; + this.y = a.z * b.x - a.x * b.z; + this.z = a.x * b.y - a.y * b.x; - this.isDirty = true; return this; }, crossSelf: function ( v ) { - var vec = this.that; - var tx = vec.x, ty = vec.y, tz = vec.z; + var tx = this.x, ty = this.y, tz = this.z; - vec.x = ty * v.z - tz * v.y; - vec.y = tz * v.x - tx * v.z; - vec.z = tx * v.y - ty * v.x; + this.x = ty * v.z - tz * v.y; + this.y = tz * v.x - tx * v.z; + this.z = tx * v.y - ty * v.x; - this.isDirty = true; return this; }, multiply: function ( a, b ) { - var vec = this.that; - vec.x = a.x * b.x; - vec.y = a.y * b.y; - vec.z = a.z * b.z; + this.x = a.x * b.x; + this.y = a.y * b.y; + this.z = a.z * b.z; - this.isDirty = true; return this; }, multiplySelf: function ( v ) { - var vec = this.that; - vec.x *= v.x; - vec.y *= v.y; - vec.z *= v.z; + this.x *= v.x; + this.y *= v.y; + this.z *= v.z; - this.isDirty = true; return this; }, multiplyScalar: function ( s ) { - var vec = this.that; - vec.x *= s; - vec.y *= s; - vec.z *= s; + this.x *= s; + this.y *= s; + this.z *= s; - this.isDirty = true; return this; }, divideSelf: function ( v ) { - var vec = this.that; - vec.x /= v.x; - vec.y /= v.y; - vec.z /= v.z; + this.x /= v.x; + this.y /= v.y; + this.z /= v.z; - this.isDirty = true; return this; }, divideScalar: function ( s ) { - var vec = this.that; - vec.x /= s; - vec.y /= s; - vec.z /= s; + this.x /= s; + this.y /= s; + this.z /= s; - this.isDirty = true; return this; + }, dot: function ( v ) { - var vec = this.that; - return vec.x * v.x + vec.y * v.y + vec.z * v.z; + return this.x * v.x + this.y * v.y + this.z * v.z; }, distanceTo: function ( v ) { - var vec = this.that; - var dx = vec.x - v.x, dy = vec.y - v.y, dz = vec.z - v.z; + var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; return Math.sqrt( dx * dx + dy * dy + dz * dz ); }, distanceToSquared: function ( v ) { - var vec = this.that; - var dx = vec.x - v.x, dy = vec.y - v.y, dz = vec.z - v.z; + var dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; return dx * dx + dy * dy + dz * dz; }, length: function () { - var vec = this.that; - return Math.sqrt( vec.x * vec.x + vec.y * vec.y + vec.z * vec.z ); + return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); }, lengthSq: function () { - var vec = this.that; - return vec.x * vec.x + vec.y * vec.y + vec.z * vec.z; + return this.x * this.x + this.y * this.y + this.z * this.z; }, lengthManhattan: function () { - var vec = this.that; - return vec.x + vec.y + vec.z; + return this.x + this.y + this.z; }, negate: function () { - var vec = this.that; - vec.x = - this.x; - vec.y = - this.y; - vec.z = - this.z; + this.x = - this.x; + this.y = - this.y; + this.z = - this.z; - this.isDirty = true; return this; }, normalize: function () { - var vec = this.that; - var length = Math.sqrt( vec.x * vec.x + vec.y * vec.y + vec.z * vec.z ); + var length = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); length > 0 ? this.multiplyScalar( 1 / length ) : this.set( 0, 0, 0 ); - this.isDirty = true; return this; }, @@ -288,16 +232,14 @@ THREE.Vector3.prototype = { isZero: function () { var almostZero = 0.0001; - var vec = this.that; - return ( Math.abs( vec.x ) < almostZero ) && ( Math.abs( vec.y ) < almostZero ) && ( Math.abs( vec.z ) < almostZero ); + return ( Math.abs( this.x ) < almostZero ) && ( Math.abs( this.y ) < almostZero ) && ( Math.abs( this.z ) < almostZero ); }, clone: function () { - var vec = this.that; - return new THREE.Vector3( vec.x, vec.y, vec.z ); + return new THREE.Vector3( this.x, this.y, this.z ); }, diff --git a/src/core/Vector4.js b/src/core/Vector4.js index 7eaf0e3d..08ae6d77 100644 --- a/src/core/Vector4.js +++ b/src/core/Vector4.js @@ -9,7 +9,8 @@ THREE.Vector4 = function ( x, y, z, w ) { this.x = x || 0; this.y = y || 0; this.z = z || 0; - this.w = w !== undefined ? w : 1; + //this.w = w !== undefined ? w : 1; + this.w = w || 1; }; diff --git a/src/extras/GeometryUtils.js b/src/extras/GeometryUtils.js index 704d7712..4638c187 100644 --- a/src/extras/GeometryUtils.js +++ b/src/extras/GeometryUtils.js @@ -22,7 +22,7 @@ var GeometryUtils = { var vertexCopy = new THREE.Vertex( vertex.position.clone() ); - isMesh && object2.matrix.multiplyVector3( vertexCopy.position ); + isMesh && object2.localMatrix.multiplyVector3( vertexCopy.position ); vertices1.push( vertexCopy ); diff --git a/src/materials/LineBasicMaterial.js b/src/materials/LineBasicMaterial.js index 2c7c849a..0feadec4 100644 --- a/src/materials/LineBasicMaterial.js +++ b/src/materials/LineBasicMaterial.js @@ -19,7 +19,7 @@ THREE.LineBasicMaterial = function ( parameters ) { - this.id = THREE.LineBasicMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.color = new THREE.Color( 0xffffff ); this.opacity = 1.0; @@ -75,4 +75,3 @@ THREE.LineBasicMaterial.prototype = { }; -THREE.LineBasicMaterialCounter = { value: 0 }; diff --git a/src/materials/Material.js b/src/materials/Material.js index 73231518..0152a233 100644 --- a/src/materials/Material.js +++ b/src/materials/Material.js @@ -9,3 +9,5 @@ THREE.NormalBlending = 0; THREE.AdditiveBlending = 1; THREE.SubtractiveBlending = 2; THREE.BillboardBlending = 3; + +THREE.MaterialCounter = { value: 0 }; diff --git a/src/materials/MeshBasicMaterial.js b/src/materials/MeshBasicMaterial.js index bda71b32..6c2b6888 100644 --- a/src/materials/MeshBasicMaterial.js +++ b/src/materials/MeshBasicMaterial.js @@ -28,7 +28,7 @@ THREE.MeshBasicMaterial = function ( parameters ) { - this.id = THREE.MeshBasicMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.color = new THREE.Color( 0xffffff ); this.opacity = 1.0; @@ -119,5 +119,3 @@ THREE.MeshBasicMaterial.prototype = { } }; - -THREE.MeshBasicMaterialCounter = { value: 0 }; diff --git a/src/materials/MeshDepthMaterial.js b/src/materials/MeshDepthMaterial.js index ac5e432a..1cd4446a 100644 --- a/src/materials/MeshDepthMaterial.js +++ b/src/materials/MeshDepthMaterial.js @@ -15,7 +15,7 @@ THREE.MeshDepthMaterial = function ( parameters ) { - this.id = THREE.MeshDepthMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.opacity = 1.0; @@ -59,5 +59,3 @@ THREE.MeshDepthMaterial.prototype = { } }; - -THREE.MeshDepthMaterialCounter = { value: 0 }; \ No newline at end of file diff --git a/src/materials/MeshLambertMaterial.js b/src/materials/MeshLambertMaterial.js index 735988be..f35ea67e 100644 --- a/src/materials/MeshLambertMaterial.js +++ b/src/materials/MeshLambertMaterial.js @@ -28,7 +28,7 @@ THREE.MeshLambertMaterial = function ( parameters ) { - this.id = THREE.MeshLambertMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.color = new THREE.Color( 0xffffff ); this.opacity = 1.0; @@ -121,4 +121,3 @@ THREE.MeshLambertMaterial.prototype = { }; -THREE.MeshLambertMaterialCounter = { value: 0 }; diff --git a/src/materials/MeshNormalMaterial.js b/src/materials/MeshNormalMaterial.js index 90826224..05b493a4 100644 --- a/src/materials/MeshNormalMaterial.js +++ b/src/materials/MeshNormalMaterial.js @@ -15,7 +15,7 @@ THREE.MeshNormalMaterial = function ( parameters ) { - this.id = THREE.MeshNormalMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.opacity = 1.0; @@ -60,4 +60,3 @@ THREE.MeshNormalMaterial.prototype = { }; -THREE.MeshNormalMaterialCounter = { value: 0 }; diff --git a/src/materials/MeshPhongMaterial.js b/src/materials/MeshPhongMaterial.js index fc4c6cb2..d9bb2460 100644 --- a/src/materials/MeshPhongMaterial.js +++ b/src/materials/MeshPhongMaterial.js @@ -32,7 +32,7 @@ THREE.MeshPhongMaterial = function ( parameters ) { - this.id = THREE.MeshPhongMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.color = new THREE.Color( 0xffffff ); this.ambient = new THREE.Color( 0x050505 ); @@ -135,4 +135,3 @@ THREE.MeshPhongMaterial.prototype = { }; -THREE.MeshPhongMaterialCounter = { value: 0 }; diff --git a/src/materials/MeshShaderMaterial.js b/src/materials/MeshShaderMaterial.js index 8ae856d7..c0e2a6f5 100644 --- a/src/materials/MeshShaderMaterial.js +++ b/src/materials/MeshShaderMaterial.js @@ -21,7 +21,7 @@ THREE.MeshShaderMaterial = function ( parameters ) { - this.id = THREE.MeshShaderMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.fragment_shader = "void main() {}"; this.vertex_shader = "void main() {}"; @@ -89,4 +89,3 @@ THREE.MeshShaderMaterial.prototype = { }; -THREE.MeshShaderMaterialCounter = { value: 0 }; diff --git a/src/materials/ParticleBasicMaterial.js b/src/materials/ParticleBasicMaterial.js index cda26c99..a500f879 100644 --- a/src/materials/ParticleBasicMaterial.js +++ b/src/materials/ParticleBasicMaterial.js @@ -18,7 +18,7 @@ THREE.ParticleBasicMaterial = function ( parameters ) { - this.id = THREE.ParticleBasicMaterialCounter.value ++; + this.id = THREE.MaterialCounter.value ++; this.color = new THREE.Color( 0xffffff ); this.opacity = 1.0; @@ -73,4 +73,3 @@ THREE.ParticleBasicMaterial.prototype = { }; -THREE.ParticleBasicMaterialCounter = { value: 0 }; diff --git a/src/materials/ParticleCircleMaterial.js b/src/materials/ParticleCircleMaterial.js index eb8d4784..491326d8 100644 --- a/src/materials/ParticleCircleMaterial.js +++ b/src/materials/ParticleCircleMaterial.js @@ -10,6 +10,8 @@ THREE.ParticleCircleMaterial = function ( parameters ) { + this.id = THREE.MaterialCounter.value ++; + this.color = new THREE.Color( 0xffffff ); this.opacity = 1; this.blending = THREE.NormalBlending; diff --git a/src/materials/ParticleDOMMaterial.js b/src/materials/ParticleDOMMaterial.js index 187fbb66..b77b1cea 100644 --- a/src/materials/ParticleDOMMaterial.js +++ b/src/materials/ParticleDOMMaterial.js @@ -4,6 +4,8 @@ THREE.ParticleDOMMaterial = function ( domElement ) { + this.id = THREE.MaterialCounter.value ++; + this.domElement = domElement; }; diff --git a/src/objects/Bone.js b/src/objects/Bone.js index 1c4b9dfb..e61ec2ef 100644 --- a/src/objects/Bone.js +++ b/src/objects/Bone.js @@ -21,7 +21,7 @@ THREE.Bone.prototype.supr = THREE.Object3D.prototype; * Update */ -THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera, renderer ) { +THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera ) { // update local @@ -45,21 +45,28 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera, r // update children + + var child, i, l = this.children.length; if( this.hasNoneBoneChildren ) { this.globalMatrix.multiply( this.skin.globalMatrix, this.skinMatrix ); - for( var i = 0; i < this.children.length; i++ ) - if( !( this.children[ i ] instanceof THREE.Bone )) - this.children[ i ].update( this.globalMatrix, true, camera, renderer ); - else - this.children[ i ].update( this.skinMatrix, forceUpdate, camera, renderer ); + for( i = 0; i < l; i++ ) { + + child = this.children[ i ]; + + if( ! ( child instanceof THREE.Bone ) ) + child.update( this.globalMatrix, true, camera ); + else + child.update( this.skinMatrix, forceUpdate, camera ); + } + } else { - for( var i = 0; i < this.children.length; i++ ) - this.children[ i ].update( this.skinMatrix, forceUpdate, camera, renderer ); + for( i = 0; i < l; i++ ) + this.children[ i ].update( this.skinMatrix, forceUpdate, camera ); } @@ -80,8 +87,9 @@ THREE.Bone.prototype.addChild = function( child ) { child.parent = this; this.children.push( child ); - if( !( child instanceof THREE.Bone )) - this.hasNoneBoneChildren = true; + if( ! ( child instanceof THREE.Bone ) ) + this.hasNoneBoneChildren = true; + } }; diff --git a/src/objects/LOD.js b/src/objects/LOD.js index 040828f6..32ad47ab 100644 --- a/src/objects/LOD.js +++ b/src/objects/LOD.js @@ -39,7 +39,7 @@ THREE.LOD.prototype.add = function( object3D, visibleAtDistance ) { * Update */ -THREE.LOD.prototype.update = function( parentGlobalMatrix, forceUpdate, camera, renderer ) { +THREE.LOD.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) { // update local @@ -91,7 +91,8 @@ THREE.LOD.prototype.update = function( parentGlobalMatrix, forceUpdate, camera, // update children for( var c = 0; c < this.children.length; c++ ) - this.children[ c ].update( this.globalMatrix, forceUpdate, camera, renderer ); + this.children[ c ].update( this.globalMatrix, forceUpdate, camera ); + }; diff --git a/src/objects/Mesh.js b/src/objects/Mesh.js index 7c4f9491..4590ac14 100644 --- a/src/objects/Mesh.js +++ b/src/objects/Mesh.js @@ -38,7 +38,7 @@ THREE.Mesh.prototype.supr = THREE.Object3D.prototype; * Update */ -THREE.Mesh.prototype.update = function( parentGlobalMatrix, forceUpdate, camera, renderer ) { +THREE.Mesh.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) { // visible? @@ -73,23 +73,7 @@ THREE.Mesh.prototype.update = function( parentGlobalMatrix, forceUpdate, camera, // update children for( var i = 0; i < this.children.length; i++ ) - this.children[ i ].update( this.globalMatrix, forceUpdate, camera, renderer ); - - - // check camera frustum and add to render list - - if( renderer && camera ) { - - if( camera.frustumContains( this )) - renderer.addToRenderList( this ); - else - renderer.removeFromRenderList( this ); - - } - - } else { - - renderer.removeFromRenderList( this ); + this.children[ i ].update( this.globalMatrix, forceUpdate, camera ); } diff --git a/src/objects/Object3D.js b/src/objects/Object3D.js index 03cc15d7..4e645678 100644 --- a/src/objects/Object3D.js +++ b/src/objects/Object3D.js @@ -26,6 +26,8 @@ THREE.Object3D = function() { this.boundRadius = 0.0; this.boundRadiusScale = 1.0; + + this.rotationMatrix = new THREE.Matrix4(); // this is just to cache it when somewhere it's computed somewhere else (stripped down globalMatrix) }; @@ -34,7 +36,7 @@ THREE.Object3D = function() { * Update */ -THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, camera, renderer ) { +THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) { // visible and auto update? @@ -43,7 +45,7 @@ THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, cam // update local if( this.autoUpdateMatrix ) - forceUpdate |= this.updateMatrix(); + forceUpdate |= this.updateMatrix(); // update global @@ -63,9 +65,11 @@ THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, cam // update children - for( var i = 0; i < this.children.length; i++ ) { + var i, l = this.children.length; + + for( i = 0; i < l; i++ ) { - this.children[ i ].update( this.globalMatrix, forceUpdate, camera, renderer ); + this.children[ i ].update( this.globalMatrix, forceUpdate, camera ); } @@ -81,84 +85,38 @@ THREE.Object3D.prototype.update = function( parentGlobalMatrix, forceUpdate, cam THREE.Object3D.prototype.updateMatrix = function() { // update position - - var isDirty = false; - - if( this.position.isDirty ) { - this.localMatrix.setPosition( this.position ); - this.position.isDirty = false; - isDirty = true; - - } - - + this.localMatrix.setPosition( this.position ); + // update quaternion - if( this.useQuaternion ) { + if( this.useQuaternion ) { if( this.quaternion.isDirty ) { this.localMatrix.setRotationFromQuaternion( this.quaternion ); this.quaternion.isDirty = false; - this.rotation .isDirty = false; - - if( this.scale.isDirty || this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) { - - this.localMatrix.scale( this.scale ); - this.scale.isDirty = false; - - this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z ) ); - - } - - isDirty = true; } - - } - + // update rotation - - else if( this.rotation.isDirty ) { + } else { + this.localMatrix.setRotationFromEuler( this.rotation ); - this.rotation.isDirty = false; - - if( this.scale.isDirty || this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) { - - this.localMatrix.scale( this.scale ); - this.scale.isDirty = false; - - this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z ) ); - - } - - isDirty = true; - + } - // update scale - if( this.scale.isDirty ) { + if( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) { - if( this.useQuaternion ) - this.localMatrix.setRotationFromQuaternion( this.quaternion ); - else - this.localMatrix.setRotationFromEuler( this.rotation ); - this.localMatrix.scale( this.scale ); - this.scale.isDirty = false; - - this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z )); - - isDirty = true; - - } - + this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z ) ); - return isDirty; + } + + return true; }; @@ -186,7 +144,7 @@ THREE.Object3D.prototype.addChild = function( child ) { * RemoveChild */ -THREE.Object3D.prototype.removeChild = function() { +THREE.Object3D.prototype.removeChild = function( child ) { var childIndex = this.children.indexOf( child ); diff --git a/src/objects/SkinnedMesh.js b/src/objects/SkinnedMesh.js index fd47d144..6b0da146 100644 --- a/src/objects/SkinnedMesh.js +++ b/src/objects/SkinnedMesh.js @@ -22,32 +22,41 @@ THREE.SkinnedMesh = function( geometry, materials ) { this.bones = []; this.boneMatrices = []; + var b, bone, gbone, p, q, s; + if( this.geometry.bones !== undefined ) { - for( var b = 0; b < this.geometry.bones.length; b++ ) { + for( b = 0; b < this.geometry.bones.length; b++ ) { - var bone = this.addBone(); + gbone = this.geometry.bones[ b ]; - bone.name = this.geometry.bones[ b ].name; - bone.position.x = this.geometry.bones[ b ].pos [ 0 ]; - bone.position.y = this.geometry.bones[ b ].pos [ 1 ]; - bone.position.z = this.geometry.bones[ b ].pos [ 2 ]; - bone.quaternion.x = this.geometry.bones[ b ].rotq[ 0 ]; - bone.quaternion.y = this.geometry.bones[ b ].rotq[ 1 ]; - bone.quaternion.z = this.geometry.bones[ b ].rotq[ 2 ]; - bone.quaternion.w = this.geometry.bones[ b ].rotq[ 3 ]; - bone.scale.x = this.geometry.bones[ b ].scl !== undefined ? this.geometry.bones[ b ].scl[ 0 ] : 1; - bone.scale.y = this.geometry.bones[ b ].scl !== undefined ? this.geometry.bones[ b ].scl[ 1 ] : 1; - bone.scale.z = this.geometry.bones[ b ].scl !== undefined ? this.geometry.bones[ b ].scl[ 2 ] : 1; + p = gbone.pos; + q = gbone.rotq; + s = gbone.scl; + + bone = this.addBone(); + + bone.name = gbone.name; + bone.position.set( p[0], p[1], p[2] ); + bone.quaternion.set( q[0], q[1], q[2], q[3] ); + + if ( s !== undefined ) + bone.scale.set( s[0], s[1], s[2] ); + else + bone.scale.set( 1, 1, 1 ); } - for( var b = 0; b < this.bones.length; b++ ) { + for( b = 0; b < this.bones.length; b++ ) { - if( this.geometry.bones[ b ].parent === -1 ) - this.addChild( this.bones[ b ] ); + gbone = this.geometry.bones[ b ]; + bone = this.bones[ b ]; + + if( gbone.parent === -1 ) + this.addChild( bone ); else - this.bones[ this.geometry.bones[ b ].parent ].addChild( this.bones[ b ] ); + this.bones[ gbone.parent ].addChild( bone ); + } this.boneMatrices = new Float32Array( 16 * this.bones.length ); @@ -66,7 +75,7 @@ THREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh; * Update */ -THREE.SkinnedMesh.prototype.update = function( parentGlobalMatrix, forceUpdate, camera, renderer ) { +THREE.SkinnedMesh.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) { // visible? @@ -100,29 +109,19 @@ THREE.SkinnedMesh.prototype.update = function( parentGlobalMatrix, forceUpdate, // update children - for( var i = 0; i < this.children.length; i++ ) - if( this.children[ i ] instanceof THREE.Bone ) - this.children[ i ].update( this.identityMatrix, false, camera, renderer ); - else - this.children[ i ].update( this.globalMatrix, forceUpdate, camera, renderer ); - - - - // check camera frustum and add to render list + var child, i, l = this.children.length; - if( renderer && camera ) { + for( i = 0; i < l; i++ ) { - if( camera.frustumContains( this ) ) - renderer.addToRenderList( this ); + child = this.children[ i ]; + + if( child instanceof THREE.Bone ) + child.update( this.identityMatrix, false, camera ); else - renderer.removeFromRenderList( this ); - + child.update( this.globalMatrix, forceUpdate, camera ); + } - } else { - - renderer.removeFromRenderList( this ); - } }; @@ -154,15 +153,11 @@ THREE.SkinnedMesh.prototype.pose = function() { var bim, bone, boneInverses = []; - for( var b = 0; b < this.bones.length; b++ ) { + for( var b = 0; b < this.bones.length; b++ ) { bone = this.bones[ b ]; boneInverses.push( THREE.Matrix4.makeInvert( bone.skinMatrix ) ); - - //bim = new Float32Array( 16 ); - //bone.skinMatrix.flattenToArray( bim ); - //this.boneMatrices.push( bim ); bone.skinMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 ); diff --git a/src/renderers/CanvasRenderer.js b/src/renderers/CanvasRenderer.js index 8399b3dd..3e322bd1 100644 --- a/src/renderers/CanvasRenderer.js +++ b/src/renderers/CanvasRenderer.js @@ -153,7 +153,7 @@ THREE.CanvasRenderer = function () { var e, el, element, m, ml, fm, fml, material; this.autoClear ? this.clear() : _context.setTransform( 1, 0, 0, - 1, _canvasWidthHalf, _canvasHeightHalf ); - + _renderList = _projector.projectScene( scene, camera, this.sortElements ); /* DEBUG @@ -528,7 +528,7 @@ THREE.CanvasRenderer = function () { if ( material.env_map.mapping instanceof THREE.SphericalReflectionMapping ) { - var cameraMatrix = camera.matrix; + var cameraMatrix = camera.globalMatrix; _vector3.copy( element.vertexNormalsWorld[ 0 ] ); _uv1x = ( _vector3.x * cameraMatrix.n11 + _vector3.y * cameraMatrix.n12 + _vector3.z * cameraMatrix.n13 ) * 0.5 + 0.5; diff --git a/src/renderers/Projector.js b/src/renderers/Projector.js index 673cbe28..4be585a1 100644 --- a/src/renderers/Projector.js +++ b/src/renderers/Projector.js @@ -25,12 +25,9 @@ THREE.Projector = function() { this.projectObjects = function ( scene, camera, sort ) { var renderList = [], - o, ol, objects, object; + o, ol, objects, object, matrix; _objectCount = 0; - _projScreenMatrix.multiply( camera.projectionMatrix, camera.matrix ); - - computeFrustum( _projScreenMatrix ); objects = scene.objects; @@ -43,6 +40,8 @@ THREE.Projector = function() { _object = _objectPool[ _objectCount ] = _objectPool[ _objectCount ] || new THREE.RenderableObject(); _vector3.copy( object.position ); + //matrix = object.globalMatrix; + //_vector3.set( matrix.n14, matrix.n24, matrix.n34 ); _projScreenMatrix.multiplyVector3( _vector3 ); _object.object = object; @@ -53,7 +52,7 @@ THREE.Projector = function() { _objectCount ++; } - + sort && renderList.sort( painterSort ); return renderList; @@ -66,15 +65,19 @@ THREE.Projector = function() { var renderList = [], near = camera.near, far = camera.far, o, ol, v, vl, f, fl, n, nl, objects, object, - objectMatrix, objectRotationMatrix, objectMaterials, objectOverdraw, + objectMatrix, objectMaterials, objectOverdraw, + objectRotationMatrix, geometry, vertices, vertex, vertexPositionScreen, faces, face, faceVertexNormals, normal, v1, v2, v3, v4; _face3Count = _lineCount = _particleCount = 0; - camera.autoUpdateMatrix && camera.updateMatrix(); - - _projScreenMatrix.multiply( camera.projectionMatrix, camera.matrix ); + camera.autoUpdateMatrix && camera.update(); + + _projScreenMatrix.multiply( camera.projectionMatrix, camera.globalMatrix ); + computeFrustum( _projScreenMatrix ); + + scene.update( undefined, false, camera ); objects = this.projectObjects( scene, camera, true ); // scene.objects; @@ -86,8 +89,10 @@ THREE.Projector = function() { object.autoUpdateMatrix && object.updateMatrix(); - objectMatrix = object.matrix; + objectMatrix = object.globalMatrix; + objectMatrix.extractRotationMatrix( object.rotationMatrix ); objectRotationMatrix = object.rotationMatrix; + objectMaterials = object.materials; objectOverdraw = object.overdraw; @@ -321,6 +326,7 @@ THREE.Projector = function() { renderList.push( _line ); _lineCount ++; + } } @@ -364,7 +370,7 @@ THREE.Projector = function() { this.unprojectVector = function ( vector, camera ) { - var matrix = THREE.Matrix4.makeInvert( camera.matrix ); + var matrix = THREE.Matrix4.makeInvert( camera.globalMatrix ); matrix.multiplySelf( THREE.Matrix4.makeInvert( camera.projectionMatrix ) ); @@ -400,20 +406,20 @@ THREE.Projector = function() { function isInFrustum( object ) { - var d, position = object.position, + var distance, matrix = object.globalMatrix, radius = - object.geometry.boundingSphere.radius * Math.max( object.scale.x, Math.max( object.scale.y, object.scale.z ) ); for ( var i = 0; i < 6; i ++ ) { - d = _frustum[ i ].x * position.x + _frustum[ i ].y * position.y + _frustum[ i ].z * position.z + _frustum[ i ].w; - if ( d <= radius ) return false; + distance = _frustum[ i ].x * matrix.n14 + _frustum[ i ].y * matrix.n24 + _frustum[ i ].z * matrix.n34 + _frustum[ i ].w; + if ( distance <= radius ) return false; } return true; - } - + }; + function clipLine( s1, s2 ) { var alpha1 = 0, alpha2 = 1, diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index a349f1b2..4107374d 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -1735,7 +1735,7 @@ THREE.WebGLRenderer = function ( parameters ) { this.render = function( scene, camera, renderTarget, clear ) { - var i, program, opaque, transparent, + var i, program, opaque, transparent, material, o, ol, oil, webGLObject, object, buffer, lights = scene.lights, fog = scene.fog, @@ -1753,7 +1753,7 @@ THREE.WebGLRenderer = function ( parameters ) { if( THREE.AnimationHandler ) THREE.AnimationHandler.update(); - scene.update( undefined, false, camera, this ); + scene.update( undefined, false, camera ); this.initWebGLObjects( scene, camera ); diff --git a/src/scenes/Scene.js b/src/scenes/Scene.js index 29e4bfad..874cc873 100644 --- a/src/scenes/Scene.js +++ b/src/scenes/Scene.js @@ -32,23 +32,23 @@ THREE.Scene.prototype.addChild = function( child ) { } -THREE.Scene.prototype.addChildRecurse = function( object ) { +THREE.Scene.prototype.addChildRecurse = function( child ) { - if( object instanceof THREE.Light ) { + if( child instanceof THREE.Light ) { - if( this.lights.indexOf( object ) === -1 ) - this.lights.push( object ); + if( this.lights.indexOf( child ) === -1 ) + this.lights.push( child ); - } else if( !( object instanceof THREE.Camera ) ) { + } else if( !( child instanceof THREE.Camera ) ) { - if( this.objects.indexOf( object ) === -1 ) - this.objects.push( object ); + if( this.objects.indexOf( child ) === -1 ) + this.objects.push( child ); } - for( var c = 0; c < object.children.length; c++ ) - this.addChildRecurse( object.children[ c ] ); + for( var c = 0; c < child.children.length; c++ ) + this.addChildRecurse( child.children[ c ] ); } @@ -66,24 +66,24 @@ THREE.Scene.prototype.removeChild = function( child ) { THREE.Scene.prototype.removeChildRecurse = function( child ) { - if( object instanceof THREE.Light ) { + if( child instanceof THREE.Light ) { - var i = this.lights.indexOf( object ); + var i = this.lights.indexOf( child ); - if( i === -1 ) + if( i !== -1 ) this.lights.splice( i, 1 ); - } else if( !( object instanceof THREE.Camera ) ) { + } else if( !( child instanceof THREE.Camera ) ) { - var i = this.objects.indexOf( object ); + var i = this.objects.indexOf( child ); - if( i === -1 ) + if( i !== -1 ) this.objects.splice( i, 1 ); } - for( var c = 0; c < object.children.length; c++ ) - this.removeChildRecurse( object.children[ c ] ); + for( var c = 0; c < child.children.length; c++ ) + this.removeChildRecurse( child.children[ c ] ); }