From 0033a9754235d5c1fad4d3057b97708736f8fa28 Mon Sep 17 00:00:00 2001 From: alteredq Date: Mon, 19 Sep 2011 22:49:52 +0200 Subject: [PATCH] Fixed bug preventing re-adding of objects removed from the scene. Problem was that objects could be added to WebGLRenderer's internal render list only once (because of `webglInit` flag). Now there are two separate internal states (`webglInit` and `webglActive`) so that object can be initialized just once (expensive operation) but added / removed from the scene many times (cheap operation). --- build/Three.js | 713 +++++++++++++++++---------------- build/custom/ThreeWebGL.js | 287 ++++++------- src/core/Object3D.js | 3 +- src/renderers/WebGLRenderer.js | 41 +- 4 files changed, 531 insertions(+), 513 deletions(-) diff --git a/build/Three.js b/build/Three.js index d67cdb35c2..4645749e18 100644 --- a/build/Three.js +++ b/build/Three.js @@ -16,37 +16,37 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&k+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,t,u,w,v,x,p,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f0:v<0)))if(v=w.dot((new THREE.Vector3).sub(k,x))/v,x=x.addSelf(p.multiplyScalar(v)),m instanceof THREE.Face3)e(x,k,n,t)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,u)||e(x,n,t,u)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}}; -THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,v){n=!1;c=k;e=m;f=w;h=v;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= -function(k,m,w,v,x,p){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,h=m>v?m>p?m:p:v>p?v:p):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>v?m>p?m>h?m:h:p>h?p:h:v>p?v>h?v:h:p>h?p:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=ck.getRight()?f:k.getRight(),h=h> +Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,t,v,w,u,x,p,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f0:u<0)))if(u=w.dot((new THREE.Vector3).sub(k,x))/u,x=x.addSelf(p.multiplyScalar(u)),m instanceof THREE.Face3)e(x,k,n,t)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,v)||e(x,n,t,v)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}}; +THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,u){n=!1;c=k;e=m;f=w;h=u;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= +function(k,m,w,u,x,p){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,h=m>u?m>p?m:p:u>p?u:p):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>u?m>p?m>h?m:h:p>h?p:h:u>p?u>h?u:h:p>h?p:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=ck.getRight()?f:k.getRight(),h=h> k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}}; -THREE.Matrix4=function(b,c,e,f,h,m,k,n,t,u,w,v,x,p,y,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,m!==void 0?m:1,k||0,n||0,t||0,u||0,w!==void 0?w:1,v||0,x||0,p||0,y||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,t,u,w,v,x,p,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=t;this.n32=u;this.n33=w;this.n34=v;this.n41=x;this.n42=p;this.n43=y;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +THREE.Matrix4=function(b,c,e,f,h,m,k,n,t,v,w,u,x,p,y,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,m!==void 0?m:1,k||0,n||0,t||0,v||0,w!==void 0?w:1,u||0,x||0,p||0,y||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,t,v,w,u,x,p,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=t;this.n32=v;this.n33=w;this.n34=u;this.n41=x;this.n42=p;this.n43=y;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ -e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,v=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12, -H=c.n13,M=c.n14,Q=c.n21,J=c.n22,I=c.n23,K=c.n24,X=c.n31,D=c.n32,R=c.n33,T=c.n34,V=c.n41,W=c.n42,o=c.n43,ha=c.n44;this.n11=e*E+f*Q+h*X+m*V;this.n12=e*G+f*J+h*D+m*W;this.n13=e*H+f*I+h*R+m*o;this.n14=e*M+f*K+h*T+m*ha;this.n21=k*E+n*Q+t*X+u*V;this.n22=k*G+n*J+t*D+u*W;this.n23=k*H+n*I+t*R+u*o;this.n24=k*M+n*K+t*T+u*ha;this.n31=w*E+v*Q+x*X+p*V;this.n32=w*G+v*J+x*D+p*W;this.n33=w*H+v*I+x*R+p*o;this.n34=w*M+v*K+x*T+p*ha;this.n41=y*E+z*Q+A*X+C*V;this.n42=y*G+z*J+A*D+C*W;this.n43=y*H+z*I+A*R+C*o;this.n44=y* -M+z*K+A*T+C*ha;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= -b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,t=this.n31,u=this.n32,w=this.n33,v=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*u*x-e*n*u*x-f*m*w*x+c*n*w*x+e*m*v*x-c*k*v*x-f*k*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*v*p+b*k*v*p+f*m*t*y-c*n*t*y-f*h*u*y+b*n*u*y+c*h*v*y-b*m*v*y-e*m*t*z+c*k*t*z+e*h*u*z-b*k*u*z-c*h* +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,E=b.n44,D=c.n11,G=c.n12, +I=c.n13,O=c.n14,P=c.n21,K=c.n22,H=c.n23,J=c.n24,X=c.n31,C=c.n32,R=c.n33,T=c.n34,V=c.n41,W=c.n42,o=c.n43,ga=c.n44;this.n11=e*D+f*P+h*X+m*V;this.n12=e*G+f*K+h*C+m*W;this.n13=e*I+f*H+h*R+m*o;this.n14=e*O+f*J+h*T+m*ga;this.n21=k*D+n*P+t*X+v*V;this.n22=k*G+n*K+t*C+v*W;this.n23=k*I+n*H+t*R+v*o;this.n24=k*O+n*J+t*T+v*ga;this.n31=w*D+u*P+x*X+p*V;this.n32=w*G+u*K+x*C+p*W;this.n33=w*I+u*H+x*R+p*o;this.n34=w*O+u*J+x*T+p*ga;this.n41=y*D+z*P+A*X+E*V;this.n42=y*G+z*K+A*C+E*W;this.n43=y*I+z*H+A*R+E*o;this.n44=y* +O+z*J+A*T+E*ga;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*= +b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,m=this.n22,k=this.n23,n=this.n24,t=this.n31,v=this.n32,w=this.n33,u=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*v*x-e*n*v*x-f*m*w*x+c*n*w*x+e*m*u*x-c*k*u*x-f*k*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*u*p+b*k*u*p+f*m*t*y-c*n*t*y-f*h*v*y+b*n*v*y+c*h*u*y-b*m*u*y-e*m*t*z+c*k*t*z+e*h*v*z-b*k*v*z-c*h* w*z+b*m*w*z},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34= this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]= this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]= this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0, -0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,m=b.x,k=b.y,n=b.z,t=h*m,u=h*k;this.set(t*m+e,t*k-f*n,t*n+f*k,0,t*k+f*n,u*k+e,u*n-f*m,0,t*n-f*k,u*n+f*m,h*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,m=b.x,k=b.y,n=b.z,t=h*m,v=h*k;this.set(t*m+e,t*k-f*n,t*n+f*k,0,t*k+f*n,v*k+e,v*n-f*m,0,t*n-f*k,v*n+f*m,h*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,m=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var t= -k*n,u=k*h,w=f*n,v=f*h;this.n11=t+v*e;this.n12=w*e-u;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=u*e-w;this.n32=v+t*e;this.n33=m*k;break;case "ZXY":t=k*n;u=k*h;w=f*n;v=f*h;this.n11=t-v*e;this.n12=-m*h;this.n13=w+u*e;this.n21=u+w*e;this.n22=m*n;this.n23=v-t*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":t=m*n;u=m*h;w=e*n;v=e*h;this.n11=k*n;this.n12=w*f-u;this.n13=t*f+v;this.n21=k*h;this.n22=v*f+t;this.n23=u*f-w;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":t=m*k;u= -m*f;w=e*k;v=e*f;this.n11=k*n;this.n12=v-t*h;this.n13=w*h+u;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*h+w;this.n33=t-v*h;break;case "XZY":t=m*k;u=m*f;w=e*k;v=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=t*h+v;this.n22=m*n;this.n23=u*h-w;this.n31=w*h-u;this.n32=e*n;this.n33=v*h+t;break;default:t=m*n,u=m*h,w=e*n,v=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=u+w*f,this.n22=t-v*f,this.n23=-e*k,this.n31=v-t*f,this.n32=w+u*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c= -b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,t=c*k;c*=n;var u=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(u+f);this.n12=t-h;this.n13=c+k;this.n21=t+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+u);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; +k*n,v=k*h,w=f*n,u=f*h;this.n11=t+u*e;this.n12=w*e-v;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=v*e-w;this.n32=u+t*e;this.n33=m*k;break;case "ZXY":t=k*n;v=k*h;w=f*n;u=f*h;this.n11=t-u*e;this.n12=-m*h;this.n13=w+v*e;this.n21=v+w*e;this.n22=m*n;this.n23=u-t*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":t=m*n;v=m*h;w=e*n;u=e*h;this.n11=k*n;this.n12=w*f-v;this.n13=t*f+u;this.n21=k*h;this.n22=u*f+t;this.n23=v*f-w;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":t=m*k;v= +m*f;w=e*k;u=e*f;this.n11=k*n;this.n12=u-t*h;this.n13=w*h+v;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=v*h+w;this.n33=t-u*h;break;case "XZY":t=m*k;v=m*f;w=e*k;u=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=t*h+u;this.n22=m*n;this.n23=v*h-w;this.n31=w*h-v;this.n32=e*n;this.n33=u*h+t;break;default:t=m*n,v=m*h,w=e*n,u=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=v+w*f,this.n22=t-u*f,this.n23=-e*k,this.n31=u-t*f,this.n32=w+v*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c= +b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,t=c*k;c*=n;var v=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(v+f);this.n12=t-h;this.n13=c+k;this.n21=t+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+v);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2; f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);m.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); e.y=h.length();e.z=m.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,v=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*p*z-u*x*z+u*v*A-n*p*A-t*v*C+n*x*C;c.n12=m*x*z-h*p*z-m*v*A+f*p*A+h*v*C-f*x*C;c.n13=h*u*z-m*t*z+m*n*A-f*u*A-h*n*C+f*t*C;c.n14=m*t*v-h*u*v-m*n*x+f*u*x+h*n*p-f*t*p;c.n21=u*x*y-t*p*y-u*w*A+k*p*A+t*w*C-k*x*C;c.n22=h*p*y-m*x*y+m*w*A-e*p*A-h*w*C+e*x*C;c.n23=m*t*y-h*u*y-m*k*A+e*u*A+h*k*C-e*t*C;c.n24= -h*u*w-m*t*w+m*k*x-e*u*x-h*k*p+e*t*p;c.n31=n*p*y-u*v*y+u*w*z-k*p*z-n*w*C+k*v*C;c.n32=m*v*y-f*p*y-m*w*z+e*p*z+f*w*C-e*v*C;c.n33=h*u*y-m*n*y+m*k*z-e*u*z-f*k*C+e*n*C;c.n34=m*n*w-f*u*w-m*k*v+e*u*v+f*k*p-e*n*p;c.n41=t*v*y-n*x*y-t*w*z+k*x*z+n*w*A-k*v*A;c.n42=f*x*y-h*v*y+h*w*z-e*x*z-f*w*A+e*v*A;c.n43=h*n*y-f*t*y-h*k*z+e*t*z+f*k*A-e*n*A;c.n44=f*t*w-h*n*w+h*k*v-e*t*v-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,t=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*u;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*t;e[6]=b*u;e[7]=b*w;e[8]=b*v;return c}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*p*z-v*x*z+v*u*A-n*p*A-t*u*E+n*x*E;c.n12=m*x*z-h*p*z-m*u*A+f*p*A+h*u*E-f*x*E;c.n13=h*v*z-m*t*z+m*n*A-f*v*A-h*n*E+f*t*E;c.n14=m*t*u-h*v*u-m*n*x+f*v*x+h*n*p-f*t*p;c.n21=v*x*y-t*p*y-v*w*A+k*p*A+t*w*E-k*x*E;c.n22=h*p*y-m*x*y+m*w*A-e*p*A-h*w*E+e*x*E;c.n23=m*t*y-h*v*y-m*k*A+e*v*A+h*k*E-e*t*E;c.n24= +h*v*w-m*t*w+m*k*x-e*v*x-h*k*p+e*t*p;c.n31=n*p*y-v*u*y+v*w*z-k*p*z-n*w*E+k*u*E;c.n32=m*u*y-f*p*y-m*w*z+e*p*z+f*w*E-e*u*E;c.n33=h*v*y-m*n*y+m*k*z-e*v*z-f*k*E+e*n*E;c.n34=m*n*w-f*v*w-m*k*u+e*v*u+f*k*p-e*n*p;c.n41=t*u*y-n*x*y-t*w*z+k*x*z+n*w*A-k*u*A;c.n42=f*x*y-h*u*y+h*w*z-e*x*z-f*w*A+e*u*A;c.n43=h*n*y-f*t*y-h*k*z+e*t*z+f*k*A-e*n*A;c.n44=f*t*w-h*n*w+h*k*u-e*t*u-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,t=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*v;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*t;e[6]=b*v;e[7]=b*w;e[8]=b*u;return c}; THREE.Matrix4.makeFrustum=function(b,c,e,f,h,m){var k;k=new THREE.Matrix4;k.n11=2*h/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*h/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+h)/(m-h);k.n34=-2*m*h/(m-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; -THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,t,u;k=new THREE.Matrix4;n=c-b;t=e-f;u=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/t;k.n23=0;k.n24=-((e+f)/t);k.n31=0;k.n32=0;k.n33=-2/u;k.n34=-((m+h)/u);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; +THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,t,v;k=new THREE.Matrix4;n=c-b;t=e-f;v=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/t;k.n23=0;k.n24=-((e+f)/t);k.n31=0;k.n32=0;k.n33=-2/v;k.n34=-((m+h)/v);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3}; THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)=== @@ -54,22 +54,22 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&& this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fo&&k.positionScreen.z0&&J.z<1))da=G[E]=G[E]||new THREE.RenderableParticle,E++,C=da,C.x=J.x/J.w,C.y=J.y/J.w,C.z= -J.z,C.rotation=$.rotation.z,C.scale.x=$.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=$.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=$.materials,M.push(C);m&&M.sort(c);return M}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; +THREE.Projector=function(){function b(){var b=t[n]=t[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fo&&k.positionScreen.z0&&K.z<1))da=G[D]=G[D]||new THREE.RenderableParticle, +D++,E=da,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=aa.rotation.z,E.scale.x=aa.scale.x*Math.abs(E.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),E.scale.y=aa.scale.y*Math.abs(E.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),E.materials=aa.materials,O.push(E);m&&O.sort(c);return O}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,t=this.w,u=t*e+k*h-n*f,w=t*f+n*e-m*h,v=t*h+m*f-k*e,e=-m* -e-k*f-n*h;c.x=u*t+e*-m+w*-n-v*-k;c.y=w*t+e*-k+v*-m-u*-n;c.z=v*t+e*-n+u*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; +this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,m=this.x,k=this.y,n=this.z,t=this.w,v=t*e+k*h-n*f,w=t*f+n*e-m*h,u=t*h+m*f-k*e,e=-m* +e-k*f-n*h;c.x=v*t+e*-m+w*-n-u*-k;c.y=w*t+e*-k+u*-m-v*-n;c.z=u*t+e*-n+v*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -79,17 +79,17 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid e,f,h,m,k,n=new THREE.Vector3,t=new THREE.Vector3;f=0;for(h=this.faces.length;f0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, +e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,m,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=k[h];u=k[m];x=k[o];p=t.x-n.x;y=v.x-n.x;z=t.y-n.y;A=v.y-n.y;E=t.z-n.z;D=v.z-n.z;G=u.u-w.u;I=x.u-w.u;O=u.v-w.v;P=x.v-w.v;K=1/(G*P-I*O);C.set((P*p-O*y)*K,(P*z-O*A)*K,(P*E-O*D)*K);R.set((G*y-I*p)*K,(G*A-I*z)*K,(G*D-I*E)*K);J[e].addSelf(C);J[c].addSelf(C);J[f].addSelf(C);X[e].addSelf(R); +X[c].addSelf(R);X[f].addSelf(R)}var c,e,f,h,m,k,n,t,v,w,u,x,p,y,z,A,E,D,G,I,O,P,K,H,J=[],X=[],C=new THREE.Vector3,R=new THREE.Vector3,T=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;cthis.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;u=this.points[e[0]];w=this.points[e[1]]; -v=this.points[e[2]];x=this.points[e[3]];n=k*k;t=k*n;f.x=c(u.x,w.x,v.x,x.x,k,n,t);f.y=c(u.y,w.y,v.y,x.y,k,n,t);f.z=c(u.z,w.z,v.z,x.z,k,n,t);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;bthis.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;v=this.points[e[0]];w=this.points[e[1]]; +u=this.points[e[2]];x=this.points[e[3]];n=k*k;t=k*n;f.x=c(v.x,w.x,u.x,x.x,k,n,t);f.y=c(v.y,w.y,u.y,x.y,k,n,t);f.z=c(v.z,w.z,u.z,x.z,k,n,t);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* -255)+","+z+")"),p.fillRect(Math.floor(O.getX()),Math.floor(O.getY()),Math.floor(O.getWidth()),Math.floor(O.getHeight()))),O.empty())};this.render=function(b,u){function t(b){var e,c,f,k=b.lights;oa.setRGB(0,0,0);za.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,w=Y.height>>1,m=k.scale.x*v,u=k.scale.y*x,o=m*t,n=u*w,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-u),p.translate(-t,-w),p.drawImage(Y,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*v,n=k.scale.y*x,ga.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ga)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p), -p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(M!=b)p.lineCap=M=b;b=m.linejoin;if(Q!=b)p.lineJoin=Q=b;f(m.color.getContextStyle());p.stroke();ga.inflate(m.linewidth*2)}}function A(b,f,k,h,n,v,Y,p,t){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending); -T=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ha=k.positionScreen.x;S=k.positionScreen.y;E(T,V,W,o,ha,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,W,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,na.copy(Y.vertexNormalsWorld[0]),ta=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5, -Ba=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[1]),Ca=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(Y.vertexNormalsWorld[2]),Aa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(T,V,W,o,ha,S,ta,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&& -(p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,W,o,ha,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[v].u,ua[v].v,p.map)),e(THREE.SubtractiveBlending)),aa?!p.wireframe&&p.shading==THREE.SmoothShading&&Y.vertexNormalsWorld.length==3?(U.r=$.r=da.r=oa.r,U.g=$.g=da.g=oa.g,U.b=$.b=da.b=oa.b,w(t,Y.v1.positionWorld,Y.vertexNormalsWorld[0],U),w(t,Y.v2.positionWorld,Y.vertexNormalsWorld[1],$),w(t,Y.v3.positionWorld,Y.vertexNormalsWorld[2],da),U.r=Math.max(0,Math.min(p.color.r*U.r,1)),U.g=Math.max(0, -Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,W,o,ha,S,0,0,1,0,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,Y.centroidWorld,Y.normalWorld, -ka),ia.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ka.b,1)),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(k.positionScreen.z, -N,ea),ja.r=($.r+da.r)*0.5,ja.g=($.g+da.g)*0.5,ja.b=($.b+da.b)*0.5,qa=Xa(U,$,da,ja),Sa(T,V,W,o,ha,S,0,0,1,0,0,1,qa);else if(p instanceof THREE.MeshNormalMaterial)ia.r=Ta(Y.normalWorld.x),ia.g=Ta(Y.normalWorld.y),ia.b=Ta(Y.normalWorld.z),p.wireframe?Ia(ia,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ia)}function C(b,f,k,h,n,p,v,Y,t){m.info.render.vertices+=4;m.info.render.faces++;c(Y.opacity);e(Y.blending);if(Y.map||Y.envMap)A(b,f,h,0,1,3,v,Y,t),A(n,k,p,1,2,3,v,Y,t);else if(T=b.positionScreen.x, -V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ha=k.positionScreen.x,S=k.positionScreen.y,ma=h.positionScreen.x,ca=h.positionScreen.y,ra=n.positionScreen.x,la=n.positionScreen.y,pa=p.positionScreen.x,fa=p.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)aa?!Y.wireframe&&Y.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length== -4?(U.r=$.r=da.r=ja.r=oa.r,U.g=$.g=da.g=ja.g=oa.g,U.b=$.b=da.b=ja.b=oa.b,w(t,v.v1.positionWorld,v.vertexNormalsWorld[0],U),w(t,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(t,v.v4.positionWorld,v.vertexNormalsWorld[3],da),w(t,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),$.r=Math.max(0,Math.min(Y.color.r*$.r,1)),$.g=Math.max(0,Math.min(Y.color.g*$.g,1)),$.b=Math.max(0,Math.min(Y.color.b* -$.b,1)),da.r=Math.max(0,Math.min(Y.color.r*da.r,1)),da.g=Math.max(0,Math.min(Y.color.g*da.g,1)),da.b=Math.max(0,Math.min(Y.color.b*da.b,1)),ja.r=Math.max(0,Math.min(Y.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(Y.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(Y.color.b*ja.b,1)),qa=Xa(U,$,da,ja),E(T,V,W,o,ma,ca),Sa(T,V,W,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)):(ka.r=oa.r,ka.g=oa.g,ka.b=oa.b,w(t,v.centroidWorld,v.normalWorld,ka),ia.r=Math.max(0,Math.min(Y.color.r*ka.r, -1)),ia.g=Math.max(0,Math.min(Y.color.g*ka.g,1)),ia.b=Math.max(0,Math.min(Y.color.b*ka.b,1)),G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia)):(G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)ia.r=Ta(v.normalWorld.x),ia.g=Ta(v.normalWorld.y),ia.b=Ta(v.normalWorld.z),G(T,V,W,o,ha,S,ma,ca),Y.wireframe?Ia(ia,Y.wireframeLinewidth, -Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ia);else if(Y instanceof THREE.MeshDepthMaterial)N=u.near,ea=u.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,N,ea),$.r=$.g=$.b=1-Na(f.positionScreen.z,N,ea),da.r=da.g=da.b=1-Na(h.positionScreen.z,N,ea),ja.r=ja.g=ja.b=1-Na(k.positionScreen.z,N,ea),qa=Xa(U,$,da,ja),E(T,V,W,o,ma,ca),Sa(T,V,W,o,ma,ca,0,0,1,0,0,1,qa),E(ra,la,ha,S,pa,fa),Sa(ra,la,ha,S,pa,fa,1,0,1,1,0,1,qa)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e); -p.closePath()}function G(b,e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(M!=c)p.lineCap=M=c;if(Q!=k)p.lineJoin=Q=k;f(b.getContextStyle());p.stroke();ga.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,Y,v,u,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||sa[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;sa[w.id]= -p.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,Y=(Y+x)*L,v=(v+Ma)*w,u=(u+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;Y-=o;v-=n;u-=o;t-=n;x=1/(Y*t-u*v);w=(t*c-v*k)*x;v=(t*f-v*m)*x;c=(Y*k-u*c)*x;f=(Y*m-u*f)*x;b=b-w*o-c*n;e=e-v*o-f*n;p.save();p.transform(w,v,c,f,b,e);p.fill();p.restore()}}function Sa(b,e, -c,f,k,h,m,o,n,Y,v,u,t){var w,x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;Y*=x;v*=w;u*=x;c-=b;f-=e;k-=b;h-=e;n-=m;Y-=o;v-=m;u-=o;x=1/(n*u-v*Y);w=(u*c-Y*k)*x;Y=(u*f-Y*h)*x;c=(n*k-v*c)*x;f=(n*h-v*f)*x;b=b-w*m-c*o;e=e-Y*m-f*o;p.save();p.transform(w,Y,c,f,b,e);p.clip();p.drawImage(t,0,0);p.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),v=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);Y[0]=k<0?0:k>255? -255:k;Y[1]=h<0?0:h>255?255:h;Y[2]=b<0?0:b>255?255:b;Y[4]=m<0?0:m>255?255:m;Y[5]=o<0?0:o>255?255:o;Y[6]=e<0?0:e>255?255:e;Y[8]=n<0?0:n>255?255:n;Y[9]=v<0?0:v>255?255:v;Y[10]=c<0?0:c>255?255:c;Y[12]=p<0?0:p>255?255:p;Y[13]=u<0?0:u>255?255:u;Y[14]=f<0?0:f>255?255:f;Z.putImageData(Fa,0,0);Wa.drawImage(ya,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k, -e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():p.setTransform(1,0,0,-1,v,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(aa=b.lights.length>0)&&t(b);Ya=0;for(db=k.length;Ya0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(X.sub(h.position,e.centroidWorld),X.normalize(),m=e.normalWorld.dot(X)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,v){m.info.render.vertices+=3;m.info.render.faces++;T=f(V++); -T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(v,o,M),H.r=Math.max(0,Math.min(n.color.r*M.r,1)),H.g=Math.max(0,Math.min(n.color.g*M.g,1)),H.b=Math.max(0,Math.min(n.color.b*M.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear- -o.z*n.__farMinusNear),H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(T)}function e(e,c,k,o,n,v,p){m.info.render.vertices+= -4;m.info.render.faces++;T=f(V++);T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");v instanceof THREE.MeshBasicMaterial?H.copy(v.color):v instanceof THREE.MeshLambertMaterial?G?(M.r=Q.r,M.g=Q.g,M.b=Q.b,b(p,n,M),H.r=Math.max(0,Math.min(v.color.r*M.r,1)),H.g=Math.max(0,Math.min(v.color.g*M.g,1)),H.b=Math.max(0,Math.min(v.color.b*M.b,1))): -H.copy(v.color):v instanceof THREE.MeshDepthMaterial?(K=1-v.__2near/(v.__farPlusNear-n.z*v.__farMinusNear),H.setRGB(K,K,K)):v instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));v.wireframe?T.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+v.wireframeLinewidth+"; stroke-opacity: "+v.opacity+"; stroke-linecap: "+v.wireframeLinecap+"; stroke-linejoin: "+v.wireframeLinejoin):T.setAttribute("style","fill: "+H.getContextStyle()+ -"; fill-opacity: "+v.opacity);t.appendChild(T)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,v,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),M=new THREE.Color(16777215),Q=new THREE.Color(0), -J=new THREE.Color(0),I=new THREE.Color(0),K,X=new THREE.Vector3,D=[],R=[],T,V,W,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){u=b;w=e;v=u/2;x=w/2;t.setAttribute("viewBox",-v+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-v,-x,v,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}; -this.render=function(b,f){var h,u,w,H,M,D,K,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(G=b.lights.length>0){K=b.lights;Q.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(u=K.length;h 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 ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif", +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var t,v,w,u,x,p,y,z;b=c.projectScene(e,f);t=0;for(v=b.length;t0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b* +255)+","+z+")"),p.fillRect(Math.floor(N.getX()),Math.floor(N.getY()),Math.floor(N.getWidth()),Math.floor(N.getHeight()))),N.empty())};this.render=function(b,v){function t(b){var e,c,f,k=b.lights;ta.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b>1,w=Y.height>>1,m=k.scale.x*u,v=k.scale.y*x,o=m*t,n=v*w,Z.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(Z)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-v),p.translate(-t,-w),p.drawImage(Y,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,Z.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(Z)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),m.program(p), +p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(I!=b)p.lineWidth=I=b;b=m.linecap;if(O!=b)p.lineCap=O=b;b=m.linejoin;if(P!=b)p.lineJoin=P=b;f(m.color.getContextStyle());p.stroke();Z.inflate(m.linewidth*2)}}function A(b,f,k,h,n,u,Y,p,t){m.info.render.vertices+=3;m.info.render.faces++;c(p.opacity);e(p.blending); +T=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ga=k.positionScreen.x;S=k.positionScreen.y;D(T,V,W,o,ga,S);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,W,o,ga,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[u].u,ua[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,ma.copy(Y.vertexNormalsWorld[0]),sa=(ma.x*b.n11+ma.y*b.n12+ma.z*b.n13)*0.5+0.5, +Ba=-(ma.x*b.n21+ma.y*b.n22+ma.z*b.n23)*0.5+0.5,ma.copy(Y.vertexNormalsWorld[1]),Ca=(ma.x*b.n11+ma.y*b.n12+ma.z*b.n13)*0.5+0.5,va=-(ma.x*b.n21+ma.y*b.n22+ma.z*b.n23)*0.5+0.5,ma.copy(Y.vertexNormalsWorld[2]),Aa=(ma.x*b.n11+ma.y*b.n12+ma.z*b.n13)*0.5+0.5,Ea=-(ma.x*b.n21+ma.y*b.n22+ma.z*b.n23)*0.5+0.5,$a(T,V,W,o,ga,S,sa,Ba,Ca,va,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&& +(p.map.mapping instanceof THREE.UVMapping&&(ua=Y.uvs[0],$a(T,V,W,o,ga,S,ua[h].u,ua[h].v,ua[n].u,ua[n].v,ua[u].u,ua[u].v,p.map)),e(THREE.SubtractiveBlending)),M?!p.wireframe&&p.shading==THREE.SmoothShading&&Y.vertexNormalsWorld.length==3?(U.r=aa.r=da.r=ta.r,U.g=aa.g=da.g=ta.g,U.b=aa.b=da.b=ta.b,w(t,Y.v1.positionWorld,Y.vertexNormalsWorld[0],U),w(t,Y.v2.positionWorld,Y.vertexNormalsWorld[1],aa),w(t,Y.v3.positionWorld,Y.vertexNormalsWorld[2],da),U.r=Math.max(0,Math.min(p.color.r*U.r,1)),U.g=Math.max(0, +Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),aa.r=Math.max(0,Math.min(p.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(p.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(p.color.b*aa.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),ia.r=(aa.r+da.r)*0.5,ia.g=(aa.g+da.g)*0.5,ia.b=(aa.b+da.b)*0.5,pa=Xa(U,aa,da,ia),Sa(T,V,W,o,ga,S,0,0,1,0,0,1,pa)):(ja.r=ta.r,ja.g=ta.g,ja.b=ta.b,w(t,Y.centroidWorld,Y.normalWorld, +ja),ha.r=Math.max(0,Math.min(p.color.r*ja.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ja.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ja.b,1)),p.wireframe?Ia(ha,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ha)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)la=v.near,ea=v.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ea),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,la,ea),da.r=da.g=da.b=1-Na(k.positionScreen.z, +la,ea),ia.r=(aa.r+da.r)*0.5,ia.g=(aa.g+da.g)*0.5,ia.b=(aa.b+da.b)*0.5,pa=Xa(U,aa,da,ia),Sa(T,V,W,o,ga,S,0,0,1,0,0,1,pa);else if(p instanceof THREE.MeshNormalMaterial)ha.r=Ta(Y.normalWorld.x),ha.g=Ta(Y.normalWorld.y),ha.b=Ta(Y.normalWorld.z),p.wireframe?Ia(ha,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ha)}function E(b,f,k,h,n,p,u,Y,t){m.info.render.vertices+=4;m.info.render.faces++;c(Y.opacity);e(Y.blending);if(Y.map||Y.envMap)A(b,f,h,0,1,3,u,Y,t),A(n,k,p,1,2,3,u,Y,t);else if(T= +b.positionScreen.x,V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ga=k.positionScreen.x,S=k.positionScreen.y,oa=h.positionScreen.x,ca=h.positionScreen.y,qa=n.positionScreen.x,ka=n.positionScreen.y,na=p.positionScreen.x,fa=p.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)G(T,V,W,o,ga,S,oa,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)M?!Y.wireframe&&Y.shading==THREE.SmoothShading&& +u.vertexNormalsWorld.length==4?(U.r=aa.r=da.r=ia.r=ta.r,U.g=aa.g=da.g=ia.g=ta.g,U.b=aa.b=da.b=ia.b=ta.b,w(t,u.v1.positionWorld,u.vertexNormalsWorld[0],U),w(t,u.v2.positionWorld,u.vertexNormalsWorld[1],aa),w(t,u.v4.positionWorld,u.vertexNormalsWorld[3],da),w(t,u.v3.positionWorld,u.vertexNormalsWorld[2],ia),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),aa.r=Math.max(0,Math.min(Y.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(Y.color.g* +aa.g,1)),aa.b=Math.max(0,Math.min(Y.color.b*aa.b,1)),da.r=Math.max(0,Math.min(Y.color.r*da.r,1)),da.g=Math.max(0,Math.min(Y.color.g*da.g,1)),da.b=Math.max(0,Math.min(Y.color.b*da.b,1)),ia.r=Math.max(0,Math.min(Y.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(Y.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(Y.color.b*ia.b,1)),pa=Xa(U,aa,da,ia),D(T,V,W,o,oa,ca),Sa(T,V,W,o,oa,ca,0,0,1,0,0,1,pa),D(qa,ka,ga,S,na,fa),Sa(qa,ka,ga,S,na,fa,1,0,1,1,0,1,pa)):(ja.r=ta.r,ja.g=ta.g,ja.b=ta.b,w(t,u.centroidWorld,u.normalWorld, +ja),ha.r=Math.max(0,Math.min(Y.color.r*ja.r,1)),ha.g=Math.max(0,Math.min(Y.color.g*ja.g,1)),ha.b=Math.max(0,Math.min(Y.color.b*ja.b,1)),G(T,V,W,o,ga,S,oa,ca),Y.wireframe?Ia(ha,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ha)):(G(T,V,W,o,ga,S,oa,ca),Y.wireframe?Ia(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)ha.r=Ta(u.normalWorld.x),ha.g=Ta(u.normalWorld.y),ha.b=Ta(u.normalWorld.z),G(T,V,W,o,ga,S, +oa,ca),Y.wireframe?Ia(ha,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):Ja(ha);else if(Y instanceof THREE.MeshDepthMaterial)la=v.near,ea=v.far,U.r=U.g=U.b=1-Na(b.positionScreen.z,la,ea),aa.r=aa.g=aa.b=1-Na(f.positionScreen.z,la,ea),da.r=da.g=da.b=1-Na(h.positionScreen.z,la,ea),ia.r=ia.g=ia.b=1-Na(k.positionScreen.z,la,ea),pa=Xa(U,aa,da,ia),D(T,V,W,o,oa,ca),Sa(T,V,W,o,oa,ca,0,0,1,0,0,1,pa),D(qa,ka,ga,S,na,fa),Sa(qa,ka,ga,S,na,fa,1,0,1,1,0,1,pa)}function D(b,e,c,f,k,h){p.beginPath();p.moveTo(b, +e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function G(b,e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(I!=e)p.lineWidth=I=e;if(O!=c)p.lineCap=O=c;if(P!=k)p.lineJoin=P=k;f(b.getContextStyle());p.stroke();Z.inflate(e*2)}function Ja(b){h(b.getContextStyle());p.fill()}function $a(b,e,c,f,k,m,o,n,Y,u,v,t,w){if(w.image.width!=0){if(w.needsUpdate==!0||ra[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping, +Ma=w.wrapT==THREE.RepeatWrapping;ra[w.id]=p.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ra[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,Y=(Y+x)*L,u=(u+Ma)*w,v=(v+x)*L,t=(t+Ma)*w;c-=b;f-=e;k-=b;m-=e;Y-=o;u-=n;v-=o;t-=n;x=1/(Y*t-v*u);w=(t*c-u*k)*x;u=(t*f-u*m)*x;c=(Y*k-v*c)*x;f=(Y*m-v*f)*x;b=b-w*o-c*n;e=e-u*o-f*n;p.save();p.transform(w,u,c,f, +b,e);p.fill();p.restore()}}function Sa(b,e,c,f,k,h,m,o,n,Y,u,v,t){var w,x;w=t.width-1;x=t.height-1;m*=w;o*=x;n*=w;Y*=x;u*=w;v*=x;c-=b;f-=e;k-=b;h-=e;n-=m;Y-=o;u-=m;v-=o;x=1/(n*v-u*Y);w=(v*c-Y*k)*x;Y=(v*f-Y*h)*x;c=(n*k-u*c)*x;f=(n*h-u*f)*x;b=b-w*m-c*o;e=e-Y*m-f*o;p.save();p.transform(w,Y,c,f,b,e);p.clip();p.drawImage(t,0,0);p.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),u=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255), +v=~~(f.g*255),f=~~(f.b*255);Y[0]=k<0?0:k>255?255:k;Y[1]=h<0?0:h>255?255:h;Y[2]=b<0?0:b>255?255:b;Y[4]=m<0?0:m>255?255:m;Y[5]=o<0?0:o>255?255:o;Y[6]=e<0?0:e>255?255:e;Y[8]=n<0?0:n>255?255:n;Y[9]=u<0?0:u>255?255:u;Y[10]=c<0?0:c>255?255:c;Y[12]=p<0?0:p>255?255:p;Y[13]=v<0?0:v>255?255:v;Y[14]=f<0?0:f>255?255:f;$.putImageData(Fa,0,0);Wa.drawImage(za,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y, +k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,db,wa,Da,La,Ua,Za,F;this.autoClear?this.clear():p.setTransform(1,0,0,-1,u,x);m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,v,this.sortElements);(M=b.lights.length>0)&&t(b);Ya=0;for(db=k.length;Ya0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(X.sub(h.position,e.centroidWorld),X.normalize(),m=e.normalWorld.dot(X)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,u){m.info.render.vertices+=3;m.info.render.faces++;T=f(V++); +T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(O.r=P.r,O.g=P.g,O.b=P.b,b(u,o,O),I.r=Math.max(0,Math.min(n.color.r*O.r,1)),I.g=Math.max(0,Math.min(n.color.g*O.g,1)),I.b=Math.max(0,Math.min(n.color.b*O.b,1))):I.copy(n.color):n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear- +o.z*n.__farMinusNear),I.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?T.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):T.setAttribute("style","fill: "+I.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(T)}function e(e,c,k,o,n,u,p){m.info.render.vertices+= +4;m.info.render.faces++;T=f(V++);T.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?I.copy(u.color):u instanceof THREE.MeshLambertMaterial?G?(O.r=P.r,O.g=P.g,O.b=P.b,b(p,n,O),I.r=Math.max(0,Math.min(u.color.r*O.r,1)),I.g=Math.max(0,Math.min(u.color.g*O.g,1)),I.b=Math.max(0,Math.min(u.color.b*O.b,1))): +I.copy(u.color):u instanceof THREE.MeshDepthMaterial?(J=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),I.setRGB(J,J,J)):u instanceof THREE.MeshNormalMaterial&&I.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));u.wireframe?T.setAttribute("style","fill: none; stroke: "+I.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):T.setAttribute("style","fill: "+I.getContextStyle()+ +"; fill-opacity: "+u.opacity);t.appendChild(T)}function f(b){C[b]==null&&(C[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&C[b].setAttribute("shape-rendering","crispEdges"));return C[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,z,A,E=new THREE.Rectangle,D=new THREE.Rectangle,G=!1,I=new THREE.Color(16777215),O=new THREE.Color(16777215),P=new THREE.Color(0), +K=new THREE.Color(0),H=new THREE.Color(0),J,X=new THREE.Vector3,C=[],R=[],T,V,W,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;w=e;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);E.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}; +this.render=function(b,f){var h,v,w,I,O,C,J,U;this.autoClear&&this.clear();m.info.render.vertices=0;m.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(G=b.lights.length>0){J=b.lights;P.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(v=J.length;h 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 ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ 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 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\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 vec4 vPointLight[ 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( vec3( 0.0 ), 1.0 );\nvec4 pointSpecular = vec4( vec3( 0.0 ), 1.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\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 * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( vec3( 0.0 ), 1.0 );\nvec4 dirSpecular = vec4( vec3( 0.0 ), 1.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 + viewPosition );\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 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif", @@ -225,120 +226,120 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh "void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;", THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex, "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}}; -THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,v=b.colors,p=v.length,u=b.__vertexArray,t=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,y=b.__webglCustomAttributes,ga,O;if(y)for(ga in y)y[ga].offset=0;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(f=0;f=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&& -(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,v=m.morphTargetInfluences;ft&&(u=w,t=v[u]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=t;p[u]=1;t=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n], -o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer), -o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER, -h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, -h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP, -0,h.__webglVertexCount),W.info.render.calls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c== -THREE.FlatShading){var f,h,k,m,n,p,v,t,u,w,x=b.count*3;for(w=0;w=0;c--)b[c].object==e&&b.splice(c,1)}function M(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(v[o].counter+=1,p=v[o].hash+"_"+v[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])} -function Q(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=la){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA, -o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}la=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,T(e.magFilter)), -o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate= -!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function X(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);I(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(), -o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),I(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+ +n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var p,u,v,t=0,w=0,x=0,L,y,Z,N=Ca,z=N.directional.colors,A=N.directional.positions,E=N.point.colors,D=N.point.positions,G=N.point.distances,I=0,M=0,c=u=Z=0;for(p=e.length;c=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer), +o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;ft&&(v=w,t=u[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=t;p[v]=1;t=-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n], +c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)): +o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB, +4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES, +h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}} +function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,u,t,v,w,x=b.count* +3;for(w=0;w=0;c--)b[c].object==e&&b.splice(c,1)}function O(b){function e(b){var h=[];c=0;for(f=b.length;c65535&&(u[o].counter+=1,p=u[o].hash+"_"+u[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[v])} +function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ka){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA, +o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ka=b}}function H(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,T(e.magFilter)), +o.texParameteri(b,o.TEXTURE_MIN_FILTER,T(e.minFilter)))}function J(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);H(o.TEXTURE_2D,b,b.image);b.needsUpdate= +!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function X(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);H(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(), +o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),H(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+ c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER, -o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=sa,b=N,f=da,h=ja);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function D(b){b instanceof +o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=ra,b=la,f=da,h=ia);e!=oa&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),oa=e)}function C(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function R(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)), console.error(e),null;return c}function T(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR; case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA; -case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,ha=[],S=null,ma=null,ca=null,ra=null,la=null,pa=null,fa=null,ia=null,U=null,$=null,da=0,ja=0,sa=0,N=0,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,ua=new Float32Array(16),ta=new Float32Array(16),Ba=new THREE.Vector4,Ca= -{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},va=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,O=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ga=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0, -geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=va;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var aa,ka=[],b=THREE.ShaderLib.depthRGBA,oa=THREE.UniformsUtils.clone(b.uniforms),za=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader, -vertexShader:b.vertexShader,uniforms:oa}),xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:oa,morphTargets:!0});za._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=va.getContext("experimental-webgl",{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(na){console.error(na)}o.clearColor(0, -0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(O.r,O.g,O.b,ga);this.context=o;var ya=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Z={};Z.vertices=new Float32Array(16);Z.faces=new Uint16Array(6);i=0;Z.vertices[i++]=-1;Z.vertices[i++]=-1;Z.vertices[i++]=0;Z.vertices[i++]=1;Z.vertices[i++]=1; -Z.vertices[i++]=-1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=1;Z.vertices[i++]=0;Z.vertices[i++]=-1;Z.vertices[i++]=1;Z.vertices[i++]=0;i=Z.vertices[i++]=0;Z.faces[i++]=0;Z.faces[i++]=1;Z.faces[i++]=2;Z.faces[i++]=0;Z.faces[i++]=2;Z.faces[i++]=3;Z.vertexBuffer=o.createBuffer();Z.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Z.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Z.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Z.elementBuffer); -o.bufferData(o.ELEMENT_ARRAY_BUFFER,Z.faces,o.STATIC_DRAW);Z.program=o.createProgram();o.attachShader(Z.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(Z.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Z.program);Z.attributes={};Z.uniforms={};Z.attributes.position=o.getAttribLocation(Z.program,"position");Z.attributes.uv=o.getAttribLocation(Z.program,"uv");Z.uniforms.uvOffset=o.getUniformLocation(Z.program,"uvOffset");Z.uniforms.uvScale=o.getUniformLocation(Z.program, -"uvScale");Z.uniforms.rotation=o.getUniformLocation(Z.program,"rotation");Z.uniforms.scale=o.getUniformLocation(Z.program,"scale");Z.uniforms.alignment=o.getUniformLocation(Z.program,"alignment");Z.uniforms.color=o.getUniformLocation(Z.program,"color");Z.uniforms.map=o.getUniformLocation(Z.program,"map");Z.uniforms.opacity=o.getUniformLocation(Z.program,"opacity");Z.uniforms.useScreenCoordinates=o.getUniformLocation(Z.program,"useScreenCoordinates");Z.uniforms.affectedByDistance=o.getUniformLocation(Z.program, -"affectedByDistance");Z.uniforms.screenPosition=o.getUniformLocation(Z.program,"screenPosition");Z.uniforms.modelViewMatrix=o.getUniformLocation(Z.program,"modelViewMatrix");Z.uniforms.projectionMatrix=o.getUniformLocation(Z.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){da=b;ja=e;sa=c;N=f;o.viewport(da,ja,sa,N)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest= -function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){O.setHex(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.setClearColor=function(b,e){O.copy(b);ga=e;o.clearColor(O.r,O.g,O.b,ga)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ga};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit= -!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer); -o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c0,$={};$.vertices=new Float32Array(16);$.faces=new Uint16Array(6);i=0;$.vertices[i++]=-1;$.vertices[i++]=-1;$.vertices[i++]=0;$.vertices[i++]=1;$.vertices[i++]=1;$.vertices[i++]= +-1;$.vertices[i++]=1;$.vertices[i++]=1;$.vertices[i++]=1;$.vertices[i++]=1;$.vertices[i++]=1;$.vertices[i++]=0;$.vertices[i++]=-1;$.vertices[i++]=1;$.vertices[i++]=0;i=$.vertices[i++]=0;$.faces[i++]=0;$.faces[i++]=1;$.faces[i++]=2;$.faces[i++]=0;$.faces[i++]=2;$.faces[i++]=3;$.vertexBuffer=o.createBuffer();$.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,$.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,$.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,$.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER, +$.faces,o.STATIC_DRAW);$.program=o.createProgram();o.attachShader($.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader($.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram($.program);$.attributes={};$.uniforms={};$.attributes.position=o.getAttribLocation($.program,"position");$.attributes.uv=o.getAttribLocation($.program,"uv");$.uniforms.uvOffset=o.getUniformLocation($.program,"uvOffset");$.uniforms.uvScale=o.getUniformLocation($.program,"uvScale");$.uniforms.rotation= +o.getUniformLocation($.program,"rotation");$.uniforms.scale=o.getUniformLocation($.program,"scale");$.uniforms.alignment=o.getUniformLocation($.program,"alignment");$.uniforms.color=o.getUniformLocation($.program,"color");$.uniforms.map=o.getUniformLocation($.program,"map");$.uniforms.opacity=o.getUniformLocation($.program,"opacity");$.uniforms.useScreenCoordinates=o.getUniformLocation($.program,"useScreenCoordinates");$.uniforms.affectedByDistance=o.getUniformLocation($.program,"affectedByDistance"); +$.uniforms.screenPosition=o.getUniformLocation($.program,"screenPosition");$.uniforms.modelViewMatrix=o.getUniformLocation($.program,"modelViewMatrix");$.uniforms.projectionMatrix=o.getUniformLocation($.program,"projectionMatrix");var Fa=!1;this.setSize=function(b,e){va.width=b;va.height=e;this.setViewport(0,0,va.width,va.height)};this.setViewport=function(b,e,c,f){da=b;ia=e;ra=c;la=f;o.viewport(da,ia,ra,la)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b? +o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){N.setHex(b);Z=e;o.clearColor(N.r,N.g,N.b,Z)};this.setClearColor=function(b,e){N.copy(b);Z=e;o.clearColor(N.r,N.g,N.b,Z)};this.getClearColor=function(){return N};this.getClearAlpha=function(){return Z};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix, +delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer); +o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA), +w=f;L=0;for(e=w.length;L=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA), o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){X(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT); -o.clear(b)};this.render=function(b,c,o,v){var L,ga,O,E,G,H,aa,N,I=b.lights,oa=b.fog;this.shadowMapEnabled&&z(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ta);c.projectionMatrix.flattenToArray(ua);qa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(qa);this.initWebGLObjects(b);X(o);(this.autoClear||v)&&this.clear();G=b.__webglObjects.length;for(v=0;v=0;v--)if(L=b.__webglObjects[v],L.render){aa=L.object;N=L.buffer;O=L.opaque; -m(aa);for(L=0;L0||x.faceVertexUvs.length> -0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(v.geometry.edgeFaces?v.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ga*2);if(n.numMorphTargets){n.__morphTargetsArrays= -[];x=0;for(L=n.numMorphTargets;x=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e= -0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,la,z));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ra,z));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER, -p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,z));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ta,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,fa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER, -ha,z));y&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k= -h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ga=y=y=void 0;x=h.vertices;v=h.colors;t=x.length;p=v.length;u=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y=0;u--)if(L=b.__webglObjects[u],L.render){M=L.object;la=L.buffer;N=L.opaque;m(M); +for(L=0;L0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(u* +2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(u*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(u*4),m.__skinVertexBArray=new Float32Array(u*4),m.__skinIndexArray=new Float32Array(u*4),m.__skinWeightArray=new Float32Array(u*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(Z*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(L= +m.numMorphTargets;x=0;k--)f[k]==h&&f.splice(k,1)}else e instanceof THREE.MarchingCubes&&I(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,y));Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ha,y));ab&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER, +ka,y));Aa&&ua>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,qa,y));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,oa,y));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,sa,y),o.bindBuffer(o.ARRAY_BUFFER, +p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));Z&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets= +!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;G(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=x=Z=Z=void 0;t=k.vertices;u=k.colors;v=t.length;p=u.length;L=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(Z=0;Z1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=m;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,m=c instanceof THREE.Mesh?c.geometry:c,k=b.vertices,n=m.vertices,t=b.faces,u=m.faces,w=b.faceVertexUvs[0],m=m.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var v=0,x=n.length;v1&&(f=1-f,h=1-h);m=1-f-h;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);k.addSelf(n);n.copy(e);n.multiplyScalar(m);k.addSelf(n);return k},randomPointInFace:function(b,c,e){var f,h,m;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,m=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,m);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;m=c.vertices[b.c].position;var c=c.vertices[b.d].position, -k;e?b._area1&&b._area2?(e=b._area1,k=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c),b._area1=e,b._area2=k):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c));return THREE.GeometryUtils.random()*(e+k) -b?e(c,h-1):u[h] +b?e(c,h-1):v[h]0?(k=e[e.length-1],p=k.x,y=k.y):(k=this.actions[f-1].args,p=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,p,v,n),z=THREE.Shape.Utils.b2(z,y,x, -t),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];t=m[5];v=m[0];x=m[1];u=m[2];w=m[3];e.length>0?(k=e[e.length-1],p=k.x,y=k.y):(k=this.actions[f-1].args,p=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,p,v,u,n),z=THREE.Shape.Utils.b3(z,y,x,w,t),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k); -for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];t=m[1];u=m[2];v=m[3];z=m[4];x=!!m[5];w=k[k.length-2];p=k[k.length-1];k.length==0&&(w=p=0);y=z-v;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=v+z*y,m=w+n+u*Math.cos(z),z=p+t+u*Math.sin(z),e.push(new THREE.Vector2(m,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; -THREE.Path.prototype.nltransform=function(b,c,e,f,h,m){var k=this.getPoints(),n,t,u,w,v;n=0;for(t=k.length;n0?(k=e[e.length-1],p=k.x,y=k.y):(k=this.actions[f-1].args,p=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,p,u,n),z=THREE.Shape.Utils.b2(z,y,x, +t),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];t=m[5];u=m[0];x=m[1];v=m[2];w=m[3];e.length>0?(k=e[e.length-1],p=k.x,y=k.y):(k=this.actions[f-1].args,p=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,p,u,v,n),z=THREE.Shape.Utils.b3(z,y,x,w,t),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k); +for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];t=m[1];v=m[2];u=m[3];z=m[4];x=!!m[5];w=k[k.length-2];p=k[k.length-1];k.length==0&&(w=p=0);y=z-u;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=u+z*y,m=w+n+v*Math.cos(z),z=p+t+v*Math.sin(z),e.push(new THREE.Vector2(m,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.nltransform=function(b,c,e,f,h,m){var k=this.getPoints(),n,t,v,w,u;n=0;for(t=k.length;n=0?n-1:e.length-1;m=k-1>=0?k-1:u.length-1;var z=[u[k],e[n],e[h]];v=THREE.FontUtils.Triangulate.area(z);var A=[u[k],u[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);p=n;w=k;n+=1;k+=-1;n<0&&(n+=e.length);n%= -e.length;k<0&&(k+=u.length);k%=u.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:u.length-1;z=[u[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[u[k],u[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);v+x>z+A&&(n=p,k=w,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=u.length),k%=u.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:u.length-1);v=e.slice(0,n);x=e.slice(n);p=u.slice(k);w=u.slice(0,k);m=[u[k],u[m],e[n]];y.push([u[k],e[n],e[h]]);y.push(m);e=v.concat(p).concat(w).concat(x)}return{shape:e,isolatedPts:y, -allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,k,n,t,u={};m=0;for(k=f.length;m=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;var z=[v[k],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(z);var A=[v[k],v[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);p=n;w=k;n+=1;k+=-1;n<0&&(n+=e.length);n%= +e.length;k<0&&(k+=v.length);k%=v.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;z=[v[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[v[k],v[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);u+x>z+A&&(n=p,k=w,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=v.length),k%=v.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:v.length-1);u=e.slice(0,n);x=e.slice(n);p=v.slice(k);w=v.slice(0,k);m=[v[k],v[m],e[n]];y.push([v[k],e[n],e[h]]);y.push(m);e=u.concat(p).concat(w).concat(x)}return{shape:e,isolatedPts:y, +allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,k,n,t,v={};m=0;for(k=f.length;m1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+p),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,m,k,n,t,v,w=this.data.JIT.hierarchy,u,x;this.currentTime+=b*this.timeScale;x=this.currentTime;u=this.currentTime%=this.data.length;v=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,y=this.hierarchy.length;p1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+p),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= this.getPrevKeyWith("pos",p,k.index-1).pos,this.points[1]=h,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",p,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== -"rot")THREE.Quaternion.slerp(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&w[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;pb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];t=b[e[2]];u=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],t[0],u[0],h,e,k);f[1]=this.interpolate(m[1],n[1],t[1],u[1],h,e,k);f[2]=this.interpolate(m[2],n[2],t[2],u[2],h,e,k);return f}; +"rot")THREE.Quaternion.slerp(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&w[0][v]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;pb.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];t=b[e[2]];v=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],t[0],v[0],h,e,k);f[1]=this.interpolate(m[1],n[1],t[1],v[1],h,e,k);f[2]=this.interpolate(m[2],n[2],t[2],v[2],h,e,k);return f}; THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]}; THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed= @@ -438,7 +439,7 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown 1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;h=this.position;b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)* Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)}; THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))}; -THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),t=m.length,E=0;k=t-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k0||this.autoForward&&!(w<0)?1:w));this.translateX(b*v);this.translateY(b*x);t&&(this.roll+=this.rollSpeed*this.delta*u);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,t=!1,v=1,w=0,u=0,x=0,p=0,y=0,z=window.innerWidth/2,A=window.innerHeight/2;this.update= +function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*p),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(w>0||this.autoForward&&!(w<0)?1:w));this.translateX(b*u);this.translateY(b*x);t&&(this.roll+=this.rollSpeed*this.delta*v);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); else if(this.forward.y1?e.normalize():e.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f}; this.rotateCamera=function(){var b=Math.acos(m.dot(k)/m.length()/k.length());if(b){var c=(new THREE.Vector3).cross(m,k).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(h);e.multiplyVector3(this.up);e.multiplyVector3(k);this.staticMoving?m=k:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(t.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),this.staticMoving?n=t:n.y+=(t.y-n.y)*this.dynamicDampingFactor)}; -this.panCamera=function(){var b=w.clone().subSelf(u);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?u=w:u.addSelf(b.sub(w,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), +this.panCamera=function(){var b=w.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?v=w:v.addSelf(b.sub(w,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance), h.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){pa=D;fa=D-1;fa<0&&(fa=b.length- -1);for(var c=0,e=p+w*2,c=0;c=0;T--){V=T/w;W=t*(1-V);V=u*Math.sin(V*Math.PI/2);D=0;for(R=E.length;Db&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(C=b.length;--C>=0;){na=C;fa=C-1;fa<0&&(fa=b.length- +1);for(var c=0,e=p+w*2,c=0;c=0;T--){V=T/w;W=t*(1-V);V=v*Math.sin(V*Math.PI/2);C=0;for(R=D.length;C0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,n,x)))-1);u.push(w)}c.push(u)}for(var p,y,z,h=c.length,e=0;e0)for(f=0;f1&&(p= -this.vertices[k].position.clone(),y=this.vertices[t].position.clone(),z=this.vertices[u].position.clone(),p.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,t,u,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,v,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,m=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);v.push(w)}c.push(v)}for(var p,y,z,h=c.length,e=0;e0)for(f=0;f1&&(p= +this.vertices[k].position.clone(),y=this.vertices[t].position.clone(),z=this.vertices[v].position.clone(),p.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,t,v,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,u,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b0)for(u=0;u2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=u,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0, -M=void 0,Q=void 0,J=void 0,I=void 0,K=void 0,X=void 0,G=x[C[p]].x,H=x[C[p]].y,M=x[C[y]].x,Q=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(M-G)*(I-H)-(Q-H)*(J-G))x=!1;else{for(E=0;E=0&&T>=0&&W>=0){x=!1; -break a}}x=!0}}if(x){m.push([b[k[t]],b[k[u]],b[k[w]]]);n.push([k[t],k[u],k[w]]);t=u;for(w=u+1;w0)for(v=0;v2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}t=v;h<=t&&(t=0);v=t+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=v,z=w,A=h,E=k,D=void 0,G=void 0,I=void 0, +O=void 0,P=void 0,K=void 0,H=void 0,J=void 0,X=void 0,G=x[E[p]].x,I=x[E[p]].y,O=x[E[y]].x,P=x[E[y]].y,K=x[E[z]].x,H=x[E[z]].y;if(1.0E-10>(O-G)*(H-I)-(P-I)*(K-G))x=!1;else{for(D=0;D=0&&T>=0&&W>=0){x=!1; +break a}}x=!0}}if(x){m.push([b[k[t]],b[k[v]],b[k[w]]]);n.push([k[t],k[v],k[w]]);t=v;for(w=v+1;w>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function u(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function v(c){var e, -f,k;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);c=t(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+Q);k=h(b,c+J);m=t(b,c+I);o=h(b,c+K);p=h(b,c+X);c=h(b,c+D);m=C.materials[m];var v=H[p*3],u=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b, -c+V);c=t(b,c+W);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,v,u,w;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,c+V);p=t(b,c+W);v=h(b,c+o);u=h(b,c+ha);w=h(b,c+S);c=h(b,c+ma);p=C.materials[p];var x=H[u*3],L=H[u*3+1];u=H[u*3+2];var O=H[w*3],ga=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[v*3],H[v*3+1],H[v*3+2]),new THREE.Vector3(x,L,u),new THREE.Vector3(O,ga,w),new THREE.Vector3(y,z,c)],null,p))} -function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ca);k=h(b,c+ra);c=M[e*2];m=M[e*2+1];e=M[f*2];var o=C.faceVertexUvs[0];f=M[f*2+1];var p=M[k*2];k=M[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+la);k=h(b,c+pa);m=h(b,c+fa);c=M[e*2];o=M[e*2+1];e=M[f*2];p=M[f*2+1];f=M[k*2];var t=C.faceVertexUvs[0];k=M[k*2+1];var v=M[m*2];m=M[m*2+1];var u=[];u.push(new THREE.UV(c,o));u.push(new THREE.UV(e,p));u.push(new THREE.UV(f, -k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,G,H=[],M=[],Q,J,I,K,X,D,R,T,V,W,o,ha,S,ma,ca,ra,la,pa,fa,ia,U,$,da,ja,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b, -E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=G.header_bytes;Q=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;X=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;R=G.vertex_index_bytes; -T=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;W=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ha=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;ma=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;ra=G.uv_index_bytes*2;la=G.uv_index_bytes;pa=G.uv_index_bytes*2;fa=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes* -4+G.material_index_bytes;ia=G.ntri_flat*c;U=G.ntri_smooth*(c+G.normal_index_bytes*3);$=G.ntri_flat_uv*(c+G.uv_index_bytes*3);da=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ja=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c=0){y=o.invBindMatrices[u];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; -for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j1?e[1].substr(0,c):"0";e[1].length>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function t(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function v(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function u(c){var e, +f,k;e=h(b,c);f=h(b,c+P);k=h(b,c+K);c=t(b,c+H);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+P);k=h(b,c+K);m=t(b,c+H);o=h(b,c+J);p=h(b,c+X);c=h(b,c+C);m=E.materials[m];var u=I[p*3],v=I[p*3+1];p=I[p*3+2];var w=I[c*3],L=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(I[o*3],I[o*3+1],I[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b, +c+V);c=t(b,c+W);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function y(c){var e,f,k,m,p,u,v,w;e=h(b,c);f=h(b,c+R);k=h(b,c+T);m=h(b,c+V);p=t(b,c+W);u=h(b,c+o);v=h(b,c+ga);w=h(b,c+S);c=h(b,c+oa);p=E.materials[p];var x=I[v*3],L=I[v*3+1];v=I[v*3+2];var N=I[w*3],Z=I[w*3+1];w=I[w*3+2];var y=I[c*3],z=I[c*3+1],c=I[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(I[u*3],I[u*3+1],I[u*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(N,Z,w),new THREE.Vector3(y,z,c)],null,p))} +function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ca);k=h(b,c+qa);c=O[e*2];m=O[e*2+1];e=O[f*2];var o=E.faceVertexUvs[0];f=O[f*2+1];var p=O[k*2];k=O[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ka);k=h(b,c+na);m=h(b,c+fa);c=O[e*2];o=O[e*2+1];e=O[f*2];p=O[f*2+1];f=O[k*2];var t=E.faceVertexUvs[0];k=O[k*2+1];var u=O[m*2];m=O[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f, +k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,D=0,G,I=[],O=[],P,K,H,J,X,C,R,T,V,W,o,ga,S,oa,ca,qa,ka,na,fa,ha,U,aa,da,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);G={signature:b.substr(D,8),header_bytes:w(b,D+8),vertex_coordinate_bytes:w(b,D+9),normal_coordinate_bytes:w(b,D+10),uv_coordinate_bytes:w(b,D+11),vertex_index_bytes:w(b,D+12),normal_index_bytes:w(b,D+13),uv_index_bytes:w(b,D+14),material_index_bytes:w(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4), +nuvs:h(b,D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=G.header_bytes;P=G.vertex_index_bytes;K=G.vertex_index_bytes*2;H=G.vertex_index_bytes*3;J=G.vertex_index_bytes*3+G.material_index_bytes;X=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;C=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes* +2;R=G.vertex_index_bytes;T=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;W=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;ga=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;S=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;oa=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;ca=G.uv_index_bytes;qa=G.uv_index_bytes*2;ka=G.uv_index_bytes;na=G.uv_index_bytes*2;fa=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes; +ra=G.vertex_index_bytes*4+G.material_index_bytes;ha=G.ntri_flat*c;U=G.ntri_smooth*(c+G.normal_index_bytes*3);aa=G.ntri_flat_uv*(c+G.uv_index_bytes*3);da=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ia=G.nquad_flat*ra;c=G.nquad_smooth*(ra+G.normal_index_bytes*4);ra=G.nquad_flat_uv*(ra+G.uv_index_bytes*4);D+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[]; +for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j1?e[1].substr(0,c):"0";e[1].length=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;fc){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14, -c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b3)for(h=2;h0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},c=this.transparency!==void 0&& -this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof I)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ja[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex()); -break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};X.prototype.parse=function(b){for(var c=0;c3)for(h=2;h0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};J.prototype.create=function(){var b={},c=this.transparency!==void 0&& +this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ia[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ca+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=f.color.getHex():c||(b[e]=f.color.getHex()); +break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ea;return this.material=new THREE.MeshLambertMaterial(b)};X.prototype.parse=function(b){for(var c=0;c=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c1&&(X=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,X);object.name=p;object.position.set(G[0],G[1],G[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=E.visible;S.scene.addObject(object);S.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b)); -if(E.castsShadow)b=new THREE.ShadowVolume(Q),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(G[0],G[1],G[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], -s[1],s[2]),object.visible=E.visible!==void 0?E.visible:!1,S.scene.addObject(object),S.objects[p]=object,S.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},S.triggers[object.name]=b)}function t(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){S.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ha,loadedModels:o-V,loadedTextures:ha-W},S);e.onLoadProgress();V==0&&W==0&&c(S)} -var v,x,p,y,z,A,C,E,G,H,M,Q,J,I,K,X,D,R,T,V,W,o,ha,S;R=b.data;K=new THREE.BinaryLoader;T=new THREE.JSONLoader;W=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(E=R.objects[p],E.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);H&&S.scene.rotation.set(H[0], -H[1],H[2]);ma&&S.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&S.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in R.cameras){H=R.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);S.cameras[z]=J}for(y in R.lights)z=R.lights[y], -J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),S.scene.addLight(D),S.lights[y]=D;for(A in R.fogs)y=R.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0, -y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),S.fogs[A]=I;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];H=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(H[0],H[1],H[2]);S.bgColorAlpha=R.defaults.bgalpha;for(v in R.geometries)if(A=R.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(v in R.geometries)A=R.geometries[v],A.type=="cube"?(Q=new THREE.CubeGeometry(A.width, -A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[v]=Q):A.type=="plane"?(Q=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="sphere"?(Q=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[v]=Q):A.type=="cylinder"?(Q=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[v]=Q):A.type=="torus"?(Q=new THREE.TorusGeometry(A.radius,A.tube, -A.segmentsR,A.segmentsT),S.geometries[v]=Q):A.type=="icosahedron"?(Q=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[v]=Q):A.type=="bin_mesh"?K.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="ascii_mesh"?T.load({model:f(A.url,R.urlBaseType),callback:t(v)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&T.createModel(A,u(v),"");for(C in R.textures)if(v=R.textures[C],v.url instanceof Array){W+=v.url.length;for(K=0;K1&&(X=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,X);object.name=p;object.position.set(G[0],G[1],G[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;S.scene.addObject(object);S.objects[p]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),S.scene.collisions.colliders.push(b)); +if(D.castsShadow)b=new THREE.ShadowVolume(P),S.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}}else G=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(G[0],G[1],G[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], +s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,S.scene.addObject(object),S.objects[p]=object,S.empties[p]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},S.triggers[object.name]=b)}function t(b){return function(c){S.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function v(b){return function(c){S.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ga,loadedModels:o-V,loadedTextures:ga-W},S);e.onLoadProgress();V==0&&W==0&&c(S)} +var u,x,p,y,z,A,E,D,G,I,O,P,K,H,J,X,C,R,T,V,W,o,ga,S;R=b.data;J=new THREE.BinaryLoader;T=new THREE.JSONLoader;W=V=0;S={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(D=R.objects[p],D.meshCollider){b=!0;break}if(b)S.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;I=R.transform.rotation;var oa=R.transform.scale;b&&S.scene.position.set(b[0],b[1],b[2]);I&&S.scene.rotation.set(I[0], +I[1],I[2]);oa&&S.scene.scale.set(oa[0],oa[1],oa[2]);(b||I||oa)&&S.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(z in R.cameras){I=R.cameras[z];if(I.type=="perspective")K=new THREE.Camera(I.fov,I.aspect,I.near,I.far);else if(I.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(I.left,I.right,I.top,I.bottom,I.near,I.far);G=I.position;I=I.target;K.position.set(G[0],G[1],G[2]);K.target.position.set(I[0],I[1],I[2]);S.cameras[z]=K}for(y in R.lights)z=R.lights[y], +K=z.color!==void 0?z.color:16777215,I=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,C=new THREE.DirectionalLight(K,I),C.position.set(G[0],G[1],G[2]),C.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,C=new THREE.PointLight(K,I,d),C.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(C=new THREE.AmbientLight(K)),S.scene.addLight(C),S.lights[y]=C;for(A in R.fogs)y=R.fogs[A],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(H=new THREE.FogExp2(0, +y.density)),I=y.color,H.color.setRGB(I[0],I[1],I[2]),S.fogs[A]=H;if(S.cameras&&R.defaults.camera)S.currentCamera=S.cameras[R.defaults.camera];if(S.fogs&&R.defaults.fog)S.scene.fog=S.fogs[R.defaults.fog];I=R.defaults.bgcolor;S.bgColor=new THREE.Color;S.bgColor.setRGB(I[0],I[1],I[2]);S.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(A=R.geometries[u],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(u in R.geometries)A=R.geometries[u],A.type=="cube"?(P=new THREE.CubeGeometry(A.width, +A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),S.geometries[u]=P):A.type=="plane"?(P=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),S.geometries[u]=P):A.type=="sphere"?(P=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),S.geometries[u]=P):A.type=="cylinder"?(P=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),S.geometries[u]=P):A.type=="torus"?(P=new THREE.TorusGeometry(A.radius,A.tube, +A.segmentsR,A.segmentsT),S.geometries[u]=P):A.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(A.subdivisions),S.geometries[u]=P):A.type=="bin_mesh"?J.load({model:f(A.url,R.urlBaseType),callback:t(u)}):A.type=="ascii_mesh"?T.load({model:f(A.url,R.urlBaseType),callback:t(u)}):A.type=="embedded_mesh"&&(A=R.embeds[A.id])&&T.createModel(A,v(u),"");for(E in R.textures)if(u=R.textures[E],u.url instanceof Array){W+=u.url.length;for(J=0;J=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h=this.maxCount-3&&n(this)};this.begin=function(){this.count=0; -this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(t=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- -1);for(var y,z,A,C,E,G;v0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,u=this.size,w=this.yd,v=this.zd,x=this.field,p=u*Math.sqrt(b/c);p>u&&(p=u);for(h=0;h0)for(m=0;mw&&(y=w);for(m=0;m0){t=m*v;for(h=0;hsize&&(dist=size);for(k=0;k0){t=zd*k;for(m=0;mthis.size-1&&(t=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- +1);for(var y,z,A,E,D,G;u0&&(this.field[A+y]+=E)}}};this.addPlaneX=function(b,c){var h,m,k,n,t,v=this.size,w=this.yd,u=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h0)for(m=0;mw&&(y=w);for(m=0;m0){t=m*u;for(h=0;hsize&&(dist=size);for(k=0;k0){t=zd*k;for(m=0;mm?this.hits.push(h):this.hits.unshift(h),m=f;return this.hits}; THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.distc.length)return null;return c[e]}; THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)}; -THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,m=0;m=n*h))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(m.x)> Math.abs(m.y)?Math.abs(m.x)>Math.abs(m.z)?(b=n.y-c.y,m=e.y-c.y,h=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(m.y)>Math.abs(m.z)?(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,m=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=m*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=m*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k}; THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f}; -THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,m=0,k=0,n=0,t=0,u=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,u=!1,k=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, -u=!1,n=1);e.origin.zc.max.z&&(m=c.max.z-e.origin.z,m/=e.direction.z,u=!1,t=1);if(u)return-1;u=0;h>f&&(u=1,f=h);m>f&&(u=2,f=m);switch(u){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* +THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,m=0,k=0,n=0,t=0,v=!0;e.origin.xc.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,v=!1,k=1);e.origin.yc.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y, +v=!1,n=1);e.origin.zc.max.z&&(m=c.max.z-e.origin.z,m/=e.direction.z,v=!1,t=1);if(v)return-1;v=0;h>f&&(v=1,f=h);m>f&&(v=2,f=m);switch(v){case 0:n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z* f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:k=e.origin.x+e.direction.x*f;if(kc.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(nc.max.y)return Number.MAX_VALUE;c.normal.set(0,0,t)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE}; THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4; THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c}; THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))}; -if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,t,u,w;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},v=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),p=new THREE.Camera(53,1,1,1E4);p.position.z= -2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:v},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); -var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);v.width=b;v.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||u!==e.near||w!==e.fov){t=e.aspect;u=e.near;w=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,G=E*u/125,H=u*Math.tan(w*Math.PI/360),M;k.n14=E;n.n14=-E;E=-H*t+G;M=H*t+G;C.n11=2*u/(M-E);C.n13=(M+E)/(M-E);h.projectionMatrix=C.clone();E=-H*t-G;M=H*t-G;C.n11=2*u/(M-E); -C.n13=(M+E)/(M-E);m.projectionMatrix=C.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=u;h.far=e.far;f.call(c,b,h,v,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=u;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,p)}}; +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,t,v,w;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),p=new THREE.Camera(53,1,1,1E4);p.position.z= +2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}); +var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||v!==e.near||w!==e.fov){t=e.aspect;v=e.near;w=e.fov;var E=e.projectionMatrix.clone(),D=125/30*0.5,G=D*v/125,I=v*Math.tan(w*Math.PI/360),O;k.n14=D;n.n14=-D;D=-I*t+G;O=I*t+G;E.n11=2*v/(O-D);E.n13=(O+D)/(O-D);h.projectionMatrix=E.clone();D=-I*t-G;O=I*t-G;E.n11=2*v/(O-D); +E.n13=(O+D)/(O-D);m.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;h.far=e.far;f.call(c,b,h,u,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=v;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,p)}}; if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far; k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}}; diff --git a/build/custom/ThreeWebGL.js b/build/custom/ThreeWebGL.js index 589606fa0f..a3111542b7 100644 --- a/build/custom/ThreeWebGL.js +++ b/build/custom/ThreeWebGL.js @@ -16,35 +16,35 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,f=[];c=0;for(d=b.length;c0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x, -Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,q,o,r,n,u,w,B=b.geometry,y=B.vertices,I=[],f=0;for(j=B.faces.length;f0:n<0)))if(n=r.dot((new THREE.Vector3).sub(k,u))/n,u=u.addSelf(w.multiplyScalar(n)),h instanceof THREE.Face3)d(u,k,m,q)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},I.push(h));else if(h instanceof THREE.Face4&&(d(u,k,m,o)||d(u,m,q,o)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},I.push(h);I.sort(function(b,c){return b.distance-c.distance});return I}else return[]}}; -THREE.Rectangle=function(){function b(){h=f-c;k=j-d}var c,d,f,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return j};this.set=function(h,k,r,n){m=!1;c=h;d=k;f=r;j=n;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,f=h,j=k):(c=ch?f:h,j=j>k?j:k);b()};this.add3Points= -function(h,k,r,n,u,w){m?(m=!1,c=hr?h>u?h:u:r>u?r:u,j=k>n?k>w?k:w:n>w?n:w):(c=hr?h>u?h>f?h:f:u>f?u:f:r>u?r>f?r:f:u>f?u:f,j=k>n?k>w?k>j?k:j:w>j?w:j:n>w?n>j?n:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),j=h.getBottom()):(c=ch.getRight()?f:h.getRight(),j=j> +Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,q,o,u,r,v,s,z=b.geometry,y=z.vertices,E=[],f=0;for(j=z.faces.length;f0:r<0)))if(r=u.dot((new THREE.Vector3).sub(k,v))/r,v=v.addSelf(s.multiplyScalar(r)),h instanceof THREE.Face3)d(v,k,m,q)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(v,k,m,o)||d(v,m,q,o)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}}; +THREE.Rectangle=function(){function b(){h=f-c;k=j-d}var c,d,f,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return j};this.set=function(h,k,u,r){m=!1;c=h;d=k;f=u;j=r;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,f=h,j=k):(c=ch?f:h,j=j>k?j:k);b()};this.add3Points= +function(h,k,u,r,v,s){m?(m=!1,c=hu?h>v?h:v:u>v?u:v,j=k>r?k>s?k:s:r>s?r:s):(c=hu?h>v?h>f?h:f:v>f?v:f:u>v?u>f?u:f:v>f?v:f,j=k>r?k>s?k>j?k:j:s>j?s:j:r>s?r>j?r:j:s>j?s:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),f=h.getRight(),j=h.getBottom()):(c=ch.getRight()?f:h.getRight(),j=j> h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;f+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();f=f=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=f=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}}; -THREE.Matrix4=function(b,c,d,f,j,h,k,m,q,o,r,n,u,w,B,y){this.set(b!==void 0?b:1,c||0,d||0,f||0,j||0,h!==void 0?h:1,k||0,m||0,q||0,o||0,r!==void 0?r:1,n||0,u||0,w||0,B||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,q,o,r,n,u,w,B,y){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=q;this.n32=o;this.n33=r;this.n34=n;this.n41=u;this.n42=w;this.n43=B;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +THREE.Matrix4=function(b,c,d,f,j,h,k,m,q,o,u,r,v,s,z,y){this.set(b!==void 0?b:1,c||0,d||0,f||0,j||0,h!==void 0?h:1,k||0,m||0,q||0,o||0,u!==void 0?u:1,r||0,v||0,s||0,z||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,f,j,h,k,m,q,o,u,r,v,s,z,y){this.n11=b;this.n12=c;this.n13=d;this.n14=f;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=q;this.n32=o;this.n33=u;this.n34=r;this.n41=v;this.n42=s;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(d,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(d,h).normalize());j.cross(h,f).normalize();this.n11=f.x;this.n12=j.x;this.n13=h.x;this.n21=f.y;this.n22=j.y;this.n23=h.y;this.n31=f.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,f=b.z,j=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*j; b.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,f=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*f+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*f+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*f+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*f+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,f=b.z;b.x=c*this.n11+d*this.n12+f*this.n13;b.y=c*this.n21+d*this.n22+f*this.n23;b.z=c*this.n31+ -d*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,r=b.n31,n=b.n32,u=b.n33,w=b.n34,B=b.n41,y=b.n42,I=b.n43,C=b.n44,xa=c.n11,ya= -c.n12,pa=c.n13,ra=c.n14,fa=c.n21,L=c.n22,v=c.n23,ia=c.n24,M=c.n31,ja=c.n32,Y=c.n33,ua=c.n34,R=c.n41,O=c.n42,e=c.n43,Ca=c.n44;this.n11=d*xa+f*fa+j*M+h*R;this.n12=d*ya+f*L+j*ja+h*O;this.n13=d*pa+f*v+j*Y+h*e;this.n14=d*ra+f*ia+j*ua+h*Ca;this.n21=k*xa+m*fa+q*M+o*R;this.n22=k*ya+m*L+q*ja+o*O;this.n23=k*pa+m*v+q*Y+o*e;this.n24=k*ra+m*ia+q*ua+o*Ca;this.n31=r*xa+n*fa+u*M+w*R;this.n32=r*ya+n*L+u*ja+w*O;this.n33=r*pa+n*v+u*Y+w*e;this.n34=r*ra+n*ia+u*ua+w*Ca;this.n41=B*xa+y*fa+I*M+C*R;this.n42=B*ya+y*L+I*ja+ -C*O;this.n43=B*pa+y*v+I*Y+C*e;this.n44=B*ra+y*ia+I*ua+C*Ca;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b; -this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,q=this.n31,o=this.n32,r=this.n33,n=this.n34,u=this.n41,w=this.n42,B=this.n43,y=this.n44;return f*k*o*u-d*m*o*u-f*h*r*u+c*m*r*u+d*h*n*u-c*k*n*u-f*k*q*w+d*m*q*w+f*j*r*w-b*m*r*w-d*j*n*w+b*k*n*w+f*h*q*B-c*m*q*B-f*j*o*B+b*m*o*B+c*j*n* -B-b*h*n*B-d*h*q*y+c*k*q*y+d*j*o*y-b*k*o*y-c*j*r*y+b*h*r*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31= -this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44; -return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]= -this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c= -Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,q=j*h,o=j*k;this.set(q*h+d,q*k-f*m,q*m+f*k,0,q*k+f*m,o*k+d,o*m-f*h,0,q*m-f*k,o*m+f*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position}, -getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(f), -f=Math.sin(f),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var q=k*m,o=k*j,r=f*m,n=f*j;this.n11=q+n*d;this.n12=r*d-o;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=o*d-r;this.n32=n+q*d;this.n33=h*k;break;case "ZXY":q=k*m;o=k*j;r=f*m;n=f*j;this.n11=q-n*d;this.n12=-h*j;this.n13=r+o*d;this.n21=o+r*d;this.n22=h*m;this.n23=n-q*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":q=h*m;o=h*j;r=d*m;n=d*j;this.n11=k*m;this.n12=r*f-o;this.n13=q*f+n;this.n21=k*j;this.n22=n*f+q;this.n23= -o*f-r;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":q=h*k;o=h*f;r=d*k;n=d*f;this.n11=k*m;this.n12=n-q*j;this.n13=r*j+o;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=o*j+r;this.n33=q-n*j;break;case "XZY":q=h*k;o=h*f;r=d*k;n=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=q*j+n;this.n22=h*m;this.n23=o*j-r;this.n31=r*j-o;this.n32=d*m;this.n33=n*j+q;break;default:q=h*m,o=h*j,r=d*m,n=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=o+r*f,this.n22=q-n*f,this.n23=-d*k,this.n31= -n-q*f,this.n32=r+o*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,f=b.z,j=b.w,h=c+c,k=d+d,m=f+f,b=c*h,q=c*k;c*=m;var o=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(o+f);this.n12=q-j;this.n13=c+k;this.n21=q+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*= -b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(f,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c: -new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length();d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31= -b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*j;this.n23=b.n23*j;this.n33=b.n33*j}}; -THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,r=b.n31,n=b.n32,u=b.n33,w=b.n34,B=b.n41,y=b.n42,I=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*w*y-o*u*y+o*n*I-m*w*I-q*n*C+m*u*C;c.n12=h*u*y-j*w*y-h*n*I+f*w*I+j*n*C-f*u*C;c.n13=j*o*y-h*q*y+h*m*I-f*o*I-j*m*C+f*q*C;c.n14=h*q*n-j*o*n-h*m*u+f*o*u+j*m*w-f*q*w;c.n21=o*u*B-q*w*B-o*r*I+k*w*I+q*r*C-k*u*C;c.n22=j*w*B-h*u*B+h*r*I-d*w*I-j*r*C+d*u*C;c.n23=h*q*B-j*o*B-h*k*I+d*o*I+j*k*C-d*q*C;c.n24= -j*o*r-h*q*r+h*k*u-d*o*u-j*k*w+d*q*w;c.n31=m*w*B-o*n*B+o*r*y-k*w*y-m*r*C+k*n*C;c.n32=h*n*B-f*w*B-h*r*y+d*w*y+f*r*C-d*n*C;c.n33=j*o*B-h*m*B+h*k*y-d*o*y-f*k*C+d*m*C;c.n34=h*m*r-f*o*r-h*k*n+d*o*n+f*k*w-d*m*w;c.n41=q*n*B-m*u*B-q*r*y+k*u*y+m*r*I-k*n*I;c.n42=f*u*B-j*n*B+j*r*y-d*u*y-f*r*I+d*n*I;c.n43=j*m*B-f*q*B-j*k*y+d*q*y+f*k*I-d*m*I;c.n44=f*q*r-j*m*r+j*k*n-d*q*n-f*k*u+d*m*u;c.multiplyScalar(1/b.determinant());return c}; -THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,r=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*q;d[6]=b*o;d[7]=b*r;d[8]=b*n;return c}; +d*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,u=b.n31,r=b.n32,v=b.n33,s=b.n34,z=b.n41,y=b.n42,E=b.n43,G=b.n44,va=c.n11,wa= +c.n12,pa=c.n13,qa=c.n14,ha=c.n21,F=c.n22,w=c.n23,R=c.n24,O=c.n31,ia=c.n32,X=c.n33,xa=c.n34,S=c.n41,M=c.n42,e=c.n43,Ba=c.n44;this.n11=d*va+f*ha+j*O+h*S;this.n12=d*wa+f*F+j*ia+h*M;this.n13=d*pa+f*w+j*X+h*e;this.n14=d*qa+f*R+j*xa+h*Ba;this.n21=k*va+m*ha+q*O+o*S;this.n22=k*wa+m*F+q*ia+o*M;this.n23=k*pa+m*w+q*X+o*e;this.n24=k*qa+m*R+q*xa+o*Ba;this.n31=u*va+r*ha+v*O+s*S;this.n32=u*wa+r*F+v*ia+s*M;this.n33=u*pa+r*w+v*X+s*e;this.n34=u*qa+r*R+v*xa+s*Ba;this.n41=z*va+y*ha+E*O+G*S;this.n42=z*wa+y*F+E*ia+G*M; +this.n43=z*pa+y*w+E*X+G*e;this.n44=z*qa+y*R+E*xa+G*Ba;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*= +b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,q=this.n31,o=this.n32,u=this.n33,r=this.n34,v=this.n41,s=this.n42,z=this.n43,y=this.n44;return f*k*o*v-d*m*o*v-f*h*u*v+c*m*u*v+d*h*r*v-c*k*r*v-f*k*q*s+d*m*q*s+f*j*u*s-b*m*u*s-d*j*r*s+b*k*r*s+f*h*q*z-c*m*q*z-f*j*o*z+b*m*o*z+c*j*r*z-b*h*r*z- +d*h*q*y+c*k*q*y+d*j*o*y-b*k*o*y-c*j*u*y+b*h*u*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31; +b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat}, +flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]= +this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b), +b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),f=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,q=j*h,o=j*k;this.set(q*h+d,q*k-f*m,q*m+f*k,0,q*k+f*m,o*k+d,o*m-f*h,0,q*m-f*k,o*m+f*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= +new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,f=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(f),f=Math.sin(f),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var q= +k*m,o=k*j,u=f*m,r=f*j;this.n11=q+r*d;this.n12=u*d-o;this.n13=h*f;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=o*d-u;this.n32=r+q*d;this.n33=h*k;break;case "ZXY":q=k*m;o=k*j;u=f*m;r=f*j;this.n11=q-r*d;this.n12=-h*j;this.n13=u+o*d;this.n21=o+u*d;this.n22=h*m;this.n23=r-q*d;this.n31=-h*f;this.n32=d;this.n33=h*k;break;case "ZYX":q=h*m;o=h*j;u=d*m;r=d*j;this.n11=k*m;this.n12=u*f-o;this.n13=q*f+r;this.n21=k*j;this.n22=r*f+q;this.n23=o*f-u;this.n31=-f;this.n32=d*k;this.n33=h*k;break;case "YZX":q=h*k;o= +h*f;u=d*k;r=d*f;this.n11=k*m;this.n12=r-q*j;this.n13=u*j+o;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-f*m;this.n32=o*j+u;this.n33=q-r*j;break;case "XZY":q=h*k;o=h*f;u=d*k;r=d*f;this.n11=k*m;this.n12=-j;this.n13=f*m;this.n21=q*j+r;this.n22=h*m;this.n23=o*j-u;this.n31=u*j-o;this.n32=d*m;this.n33=r*j+q;break;default:q=h*m,o=h*j,u=d*m,r=d*j,this.n11=k*m,this.n12=-k*j,this.n13=f,this.n21=o+u*f,this.n22=q-r*f,this.n23=-d*k,this.n31=r-q*f,this.n32=u+o*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c= +b.x,d=b.y,f=b.z,j=b.w,h=c+c,k=d+d,m=f+f,b=c*h,q=c*k;c*=m;var o=d*k;d*=m;f*=m;h*=j;k*=j;j*=m;this.n11=1-(o+f);this.n12=q-j;this.n13=c+k;this.n21=q+j;this.n22=1-(b+f);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var f=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2; +f.identity();f.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(f,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var f=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=f.length(); +d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=d.x;f.n21/=d.x;f.n31/=d.x;f.n12/=d.y;f.n22/=d.y;f.n32/=d.y;f.n13/=d.z;f.n23/=d.z;f.n33/=d.z;c.setFromRotationMatrix(f);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,f=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*j;this.n23= +b.n23*j;this.n33=b.n33*j}}; +THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,f=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,q=b.n23,o=b.n24,u=b.n31,r=b.n32,v=b.n33,s=b.n34,z=b.n41,y=b.n42,E=b.n43,G=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=q*s*y-o*v*y+o*r*E-m*s*E-q*r*G+m*v*G;c.n12=h*v*y-j*s*y-h*r*E+f*s*E+j*r*G-f*v*G;c.n13=j*o*y-h*q*y+h*m*E-f*o*E-j*m*G+f*q*G;c.n14=h*q*r-j*o*r-h*m*v+f*o*v+j*m*s-f*q*s;c.n21=o*v*z-q*s*z-o*u*E+k*s*E+q*u*G-k*v*G;c.n22=j*s*z-h*v*z+h*u*E-d*s*E-j*u*G+d*v*G;c.n23=h*q*z-j*o*z-h*k*E+d*o*E+j*k*G-d*q*G;c.n24= +j*o*u-h*q*u+h*k*v-d*o*v-j*k*s+d*q*s;c.n31=m*s*z-o*r*z+o*u*y-k*s*y-m*u*G+k*r*G;c.n32=h*r*z-f*s*z-h*u*y+d*s*y+f*u*G-d*r*G;c.n33=j*o*z-h*m*z+h*k*y-d*o*y-f*k*G+d*m*G;c.n34=h*m*u-f*o*u-h*k*r+d*o*r+f*k*s-d*m*s;c.n41=q*r*z-m*v*z-q*u*y+k*v*y+m*u*E-k*r*E;c.n42=f*v*z-j*r*z+j*u*y-d*v*y-f*u*E+d*r*E;c.n43=j*m*z-f*q*z-j*k*y+d*q*y+f*k*E-d*m*E;c.n44=f*q*u-j*m*u+j*k*r-d*q*r-f*k*v+d*m*v;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,f=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,q=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,u=-b.n23*b.n11+b.n21*b.n13,r=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*f;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*q;d[6]=b*o;d[7]=b*u;d[8]=b*r;return c}; THREE.Matrix4.makeFrustum=function(b,c,d,f,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(f-d);k.n23=(f+d)/(f-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,f){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,f)}; THREE.Matrix4.makeOrtho=function(b,c,d,f,j,h){var k,m,q,o;k=new THREE.Matrix4;m=c-b;q=d-f;o=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/q;k.n23=0;k.n24=-((d+f)/q);k.n31=0;k.n32=0;k.n33=-2/o;k.n34=-((h+j)/o);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate= @@ -54,22 +54,22 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi b)return j;if(c&&(j=j.getChildByName(b,c),j!==void 0))return j}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&& this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),ee&&k.positionScreen.z0&&L.z<1))sa=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,C=sa,C.x=L.x/L.w,C.y=L.y/L.w,C.z=L.z,C.rotation=Q.rotation.z,C.scale.x=Q.scale.x*Math.abs(C.x- -(L.x+j.projectionMatrix.n11)/(L.w+j.projectionMatrix.n14)),C.scale.y=Q.scale.y*Math.abs(C.y-(L.y+j.projectionMatrix.n22)/(L.w+j.projectionMatrix.n24)),C.materials=Q.materials,ra.push(C);h&&ra.sort(c);return ra}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)}; +THREE.Projector=function(){function b(){var b=q[m]=q[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return f>=0&&j>=0&&h>=0&&k>=0?!0:f<0&&j<0||h<0&&k<0?!1:(f<0?d=Math.max(d,f/(f-j)):j<0&&(e=Math.min(e,f/(f-j))),h<0?d=Math.max(d,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),ee&&k.positionScreen.z0&&F.z<1))ya=wa[va]=wa[va]||new THREE.RenderableParticle,va++,G=ya,G.x=F.x/F.w,G.y=F.y/F.w,G.z=F.z,G.rotation=K.rotation.z,G.scale.x=K.scale.x*Math.abs(G.x- +(F.x+j.projectionMatrix.n11)/(F.w+j.projectionMatrix.n14)),G.scale.y=K.scale.y*Math.abs(G.y-(F.y+j.projectionMatrix.n22)/(F.w+j.projectionMatrix.n24)),G.materials=K.materials,qa.push(G);h&&qa.sort(c);return qa}};THREE.Quaternion=function(b,c,d,f){this.set(b||0,c||0,d||0,f!==void 0?f:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,f){this.x=b;this.y=c;this.z=d;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,f=b.y*c,j=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=f*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=f*c*h+b*j*d;this.z=b*j*h-f*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,f=Math.sin(d); this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z); this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c= -this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,r=q*f+m*d-h*j,n=q*j+h*f-k*d,d=-h* -d-k*f-m*j;c.x=o*q+d*-h+r*-m-n*-k;c.y=r*q+d*-k+n*-h-o*-m;c.z=n*q+d*-m+o*-k-r*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d}; +this.x,d=this.y,f=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-f*k;this.y=d*b+j*k+f*h-c*m;this.z=f*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,f=b.y,j=b.z,h=this.x,k=this.y,m=this.z,q=this.w,o=q*d+k*j-m*f,u=q*f+m*d-h*j,r=q*j+h*f-k*d,d=-h* +d-k*f-m*j;c.x=o*q+d*-h+u*-m-r*-k;c.y=u*q+d*-k+r*-h-o*-m;c.z=r*q+d*-m+o*-k-u*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,f){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;d.w=b.w*j+c.w*f;d.x=b.x*j+c.x*f;d.y=b.y*j+c.y*f;d.z=b.z*j+c.z*f;return d}; THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,f,j,h){this.a=b;this.b=c;this.c=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,d,f,j,h,k){this.a=b;this.b=c;this.c=d;this.d=f;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0}; THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}}; @@ -79,15 +79,15 @@ c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid d,f,j,h,k,m=new THREE.Vector3,q=new THREE.Vector3;f=0;for(j=this.faces.length;f0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], +d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,e,c,d,f,j,h){m=b.vertices[e].position;q=b.vertices[c].position;o=b.vertices[d].position;u=k[f];r=k[j];v=k[h];s=q.x-m.x;z=o.x-m.x;y=q.y-m.y;E=o.y-m.y;G=q.z-m.z;va=o.z-m.z;wa=r.u-u.u;pa=v.u-u.u;qa=r.v-u.v;ha=v.v-u.v;F=1/(wa*ha-pa*qa);ia.set((ha*s-qa*z)*F,(ha*y-qa*E)*F,(ha*G-qa*va)*F);X.set((wa*z-pa*s)*F,(wa*E-pa*y)*F,(wa*va-pa*G)*F);R[e].addSelf(ia);R[c].addSelf(ia); +R[d].addSelf(ia);O[e].addSelf(X);O[c].addSelf(X);O[d].addSelf(X)}var c,d,f,j,h,k,m,q,o,u,r,v,s,z,y,E,G,va,wa,pa,qa,ha,F,w,R=[],O=[],ia=new THREE.Vector3,X=new THREE.Vector3,xa=new THREE.Vector3,S=new THREE.Vector3,M=new THREE.Vector3;c=0;for(d=this.vertices.length;c0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x], y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z< this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;cthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;o=this.points[d[0]];r=this.points[d[1]]; -n=this.points[d[2]];u=this.points[d[3]];m=k*k;q=k*m;f.x=c(o.x,r.x,n.x,u.x,k,m,q);f.y=c(o.y,r.y,n.y,u.y,k,m,q);f.z=c(o.z,r.z,n.z,u.z,k,m,q);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;bthis.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;o=this.points[d[0]];u=this.points[d[1]]; +r=this.points[d[2]];v=this.points[d[3]];m=k*k;q=k*m;f.x=c(o.x,u.x,r.x,v.x,k,m,q);f.y=c(o.y,u.y,r.y,v.y,k,m,q);f.z=c(o.z,u.z,r.z,v.z,k,m,q);return f};this.getControlPointsArray=function(){var b,c,d=this.points.length,f=[];for(b=0;b=0)e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0)):c.position>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer), -e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,D=k.morphTargetInfluences;fq&&(F=n,q=D[F]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[F]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=q;o[F]=1;q=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[m], +e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,C=k.morphTargetInfluences;fq&&(D=r,q=C[D]);e.bindBuffer(e.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[D]);e.vertexAttribPointer(c["morphTarget"+f],3,e.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=q;o[D]=1;q=-1;f++}}j.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[m], c.size,e.FLOAT,!1,0,0));b.color>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));b.normal>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));b.tangent>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)): e.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,h.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB, 4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(e.lineWidth(j.wireframeLinewidth),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),e.drawElements(e.LINES,h.__webglLineCount,e.UNSIGNED_SHORT,0)):(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),e.drawElements(e.TRIANGLES, -h.__webglFaceCount,e.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=h.__webglFaceCount,O.info.render.faces+=h.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),O.info.render.calls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),O.info.render.calls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),O.info.render.calls++)}} -function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,j,k,m,o,q,n,r,u,t=b.count* -3;for(u=0;u=0;d--)b[d].object==c&&b.splice(d,1)}function ra(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(q[m].counter+=1,o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=j;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[u])} -function fa(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=G){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA, -e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}G=b}}function v(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,R(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,R(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,R(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,R(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,ua(c.magFilter)), -e.texParameteri(b,e.TEXTURE_MIN_FILTER,ua(c.minFilter)))}function ia(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),O.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,R(b.format),b.image.width,b.image.height,0,R(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);v(e.TEXTURE_2D,b,b.image);b.needsUpdate= -!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function M(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);v(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(), -e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,R(b.format),b.width,b.height,0,R(b.format),R(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),v(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,R(b.format),b.width,b.height,0,R(b.format),R(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ +h.__webglFaceCount,e.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=h.__webglFaceCount,M.info.render.faces+=h.__webglFaceCount/3):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?e.LINE_STRIP:e.LINES,e.lineWidth(j.linewidth),e.drawArrays(k,0,h.__webglLineCount),M.info.render.calls++):k instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,h.__webglParticleCount),M.info.render.calls++):k instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,h.__webglVertexCount),M.info.render.calls++)}} +function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=e.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=e.createBuffer();b.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,b.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,b.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(c.attributes.position),e.vertexAttribPointer(c.attributes.position,3,e.FLOAT,!1,0,0));if(b.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var f,h,j,k,m,o,q,r,u,s,n=b.count* +3;for(s=0;s=0;d--)b[d].object==c&&b.splice(d,1)}function qa(b){function c(b){var f=[];d=0;for(e=b.length;d65535&&(q[m].counter+=1,o=q[m].hash+"_"+q[m].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:k,vertices:0,numMorphTargets:r})),b.geometryGroups[o].faces.push(f),b.geometryGroups[o].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])} +function ha(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function F(b){if(b!=I){switch(b){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA, +e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}I=b}}function w(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(e.texParameteri(b,e.TEXTURE_WRAP_S,S(c.wrapS)),e.texParameteri(b,e.TEXTURE_WRAP_T,S(c.wrapT)),e.texParameteri(b,e.TEXTURE_MAG_FILTER,S(c.magFilter)),e.texParameteri(b,e.TEXTURE_MIN_FILTER,S(c.minFilter)),e.generateMipmap(b)):(e.texParameteri(b,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(b,e.TEXTURE_MAG_FILTER,xa(c.magFilter)), +e.texParameteri(b,e.TEXTURE_MIN_FILTER,xa(c.minFilter)))}function R(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=e.createTexture(),M.info.memory.textures++;e.activeTexture(e.TEXTURE0+c);e.bindTexture(e.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),e.UNSIGNED_BYTE,b.image.data):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,b.image);w(e.TEXTURE_2D,b,b.image);b.needsUpdate= +!1}else e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,b.__webglTexture)}function O(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=e.createRenderbuffer();b.__webglTexture=e.createTexture();if(c){e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture);w(e.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=e.createFramebuffer(), +e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=e.createFramebuffer(),e.bindTexture(e.TEXTURE_2D,b.__webglTexture),w(e.TEXTURE_2D,b,b),e.texImage2D(e.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);e.bindRenderbuffer(e.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer[d]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+ d,b.__webglTexture,0);else e.bindFramebuffer(e.FRAMEBUFFER,b.__webglFramebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER, -e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=za,b=Ea,f=sa,h=Ga);c!=va&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),va=c)}function ja(b){b instanceof -THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function Y(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)), -console.error(c),null;return d}function ua(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function R(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR; +e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,b.__webglRenderbuffer)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height);c?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=f=0):(c=null,d=Ea,b=Da,f=ya,h=za);c!=ua&&(e.bindFramebuffer(e.FRAMEBUFFER,c),e.viewport(f,h,d,b),ua=c)}function ia(b){b instanceof +THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,b.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,b.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null))}function X(b,c){var d;b=="fragment"?d=e.createShader(e.FRAGMENT_SHADER):b=="vertex"&&(d=e.createShader(e.VERTEX_SHADER));e.shaderSource(d,c);e.compileShader(d);if(!e.getShaderParameter(d,e.COMPILE_STATUS))return console.error(e.getShaderInfoLog(d)), +console.error(c),null;return d}function xa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR; case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;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 O=this,e,Ca=[],Va=null,va=null,U=null,Z=null,G=null,W=null,T=null,V=null,wa=null,Q=null,sa=0,Ga=0,za=0,Ea=0,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Da=new Float32Array(16),Ta=new Float32Array(16),Ja=new THREE.Vector4,Wa={ambient:[0, -0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ka=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,ga=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ha=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0, -geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ka;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var qa,Sa=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader, -vertexShader:b.vertexShader,uniforms:Za}),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass=!0;Xa._shadowPass=!0;try{if(!(e=Ka.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}e.clearColor(0, -0,0,1);e.clearDepth(1);e.clearStencil(0);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.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(ga.r,ga.g,ga.b,Ha);this.context=e;var $a=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);i=0;t.vertices[i++]=-1;t.vertices[i++]=-1;t.vertices[i++]=0;t.vertices[i++]=1;t.vertices[i++]= -1;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=1;t.vertices[i++]=0;t.vertices[i++]=-1;t.vertices[i++]=1;t.vertices[i++]=0;i=t.vertices[i++]=0;t.faces[i++]=0;t.faces[i++]=1;t.faces[i++]=2;t.faces[i++]=0;t.faces[i++]=2;t.faces[i++]=3;t.vertexBuffer=e.createBuffer();t.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,t.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.elementBuffer); -e.bufferData(e.ELEMENT_ARRAY_BUFFER,t.faces,e.STATIC_DRAW);t.program=e.createProgram();e.attachShader(t.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(t.program,Y("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=e.getAttribLocation(t.program,"position");t.attributes.uv=e.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=e.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=e.getUniformLocation(t.program, -"uvScale");t.uniforms.rotation=e.getUniformLocation(t.program,"rotation");t.uniforms.scale=e.getUniformLocation(t.program,"scale");t.uniforms.alignment=e.getUniformLocation(t.program,"alignment");t.uniforms.color=e.getUniformLocation(t.program,"color");t.uniforms.map=e.getUniformLocation(t.program,"map");t.uniforms.opacity=e.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=e.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=e.getUniformLocation(t.program, -"affectedByDistance");t.uniforms.screenPosition=e.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=e.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=e.getUniformLocation(t.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ka.width=b;Ka.height=c;this.setViewport(0,0,Ka.width,Ka.height)};this.setViewport=function(b,c,d,f){sa=b;Ga=c;za=d;Ea=f;e.viewport(sa,Ga,za,Ea)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest= -function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){ga.setHex(b);Ha=c;e.clearColor(ga.r,ga.g,ga.b,Ha)};this.setClearColor=function(b,c){ga.copy(b);Ha=c;e.clearColor(ga.r,ga.g,ga.b,Ha)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return Ha};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit= +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 M=this,e,Ba=[],Va=null,ua=null,Y=null,ra=null,I=null,T=null,P=null,ka=null,fa=null,K=null,ya=0,za=0,Ea=0,Da=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ca=new Float32Array(16),Ta=new Float32Array(16),Ia=new THREE.Vector4,Wa= +{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),ab=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,Z=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ja=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0, +geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var V,La=[],b=THREE.ShaderLib.depthRGBA,Za=THREE.UniformsUtils.clone(b.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader, +vertexShader:b.vertexShader,uniforms:Za}),Xa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Za,morphTargets:!0});Ua._shadowPass=!0;Xa._shadowPass=!0;try{if(!(e=Ga.getContext("experimental-webgl",{antialias:cb,stencil:ab,preserveDrawingBuffer:bb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION))}catch(db){console.error(db)}e.clearColor(0, +0,0,1);e.clearDepth(1);e.clearStencil(0);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.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(Z.r,Z.g,Z.b,Ja);this.context=e;var $a=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,n={};n.vertices=new Float32Array(16);n.faces=new Uint16Array(6);i=0;n.vertices[i++]=-1;n.vertices[i++]=-1;n.vertices[i++]=0;n.vertices[i++]=1;n.vertices[i++]=1; +n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=1;n.vertices[i++]=0;n.vertices[i++]=-1;n.vertices[i++]=1;n.vertices[i++]=0;i=n.vertices[i++]=0;n.faces[i++]=0;n.faces[i++]=1;n.faces[i++]=2;n.faces[i++]=0;n.faces[i++]=2;n.faces[i++]=3;n.vertexBuffer=e.createBuffer();n.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer); +e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW);n.program=e.createProgram();e.attachShader(n.program,X("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(n.program,X("vertex",THREE.ShaderLib.sprite.vertexShader));e.linkProgram(n.program);n.attributes={};n.uniforms={};n.attributes.position=e.getAttribLocation(n.program,"position");n.attributes.uv=e.getAttribLocation(n.program,"uv");n.uniforms.uvOffset=e.getUniformLocation(n.program,"uvOffset");n.uniforms.uvScale=e.getUniformLocation(n.program, +"uvScale");n.uniforms.rotation=e.getUniformLocation(n.program,"rotation");n.uniforms.scale=e.getUniformLocation(n.program,"scale");n.uniforms.alignment=e.getUniformLocation(n.program,"alignment");n.uniforms.color=e.getUniformLocation(n.program,"color");n.uniforms.map=e.getUniformLocation(n.program,"map");n.uniforms.opacity=e.getUniformLocation(n.program,"opacity");n.uniforms.useScreenCoordinates=e.getUniformLocation(n.program,"useScreenCoordinates");n.uniforms.affectedByDistance=e.getUniformLocation(n.program, +"affectedByDistance");n.uniforms.screenPosition=e.getUniformLocation(n.program,"screenPosition");n.uniforms.modelViewMatrix=e.getUniformLocation(n.program,"modelViewMatrix");n.uniforms.projectionMatrix=e.getUniformLocation(n.program,"projectionMatrix");var Ya=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,f){ya=b;za=c;Ea=d;Da=f;e.viewport(ya,za,Ea,Da)};this.setScissor=function(b,c,d,f){e.scissor(b,c,d,f)};this.enableScissorTest= +function(b){b?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(b,c){Z.setHex(b);Ja=c;e.clearColor(Z.r,Z.g,Z.b,Ja)};this.setClearColor=function(b,c){Z.copy(b);Ja=c;e.clearColor(Z.r,Z.g,Z.b,Ja)};this.getClearColor=function(){return Z};this.getClearAlpha=function(){return Ja};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.getContext=function(){return e};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit= !1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer); -e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,f=c.numMorphTargets;d=0&&e.enableVertexAttribArray(r.position);r.color>=0&&e.enableVertexAttribArray(r.color);r.normal>=0&&e.enableVertexAttribArray(r.normal);r.tangent>=0&&e.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(e.enableVertexAttribArray(r.skinVertexA), -e.enableVertexAttribArray(r.skinVertexB),e.enableVertexAttribArray(r.skinIndex),e.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(h in b.attributes)r[h]!==void 0&&r[h]>=0&&e.enableVertexAttribArray(r[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(e.enableVertexAttribArray(r[w]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){M(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT); -e.clear(b)};this.render=function(b,c,e,n){var J,t,Fa,v,D,G,F,Pa,Qa=b.lights,Ra=b.fog;this.shadowMapEnabled&&y(b,c);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Da);Aa.multiply(c.projectionMatrix,c.matrixWorldInverse);o(Aa);this.initWebGLObjects(b);M(e);(this.autoClear||n)&&this.clear();D=b.__webglObjects.length;for(n=0;n=0;n--)if(J=b.__webglObjects[n],J.render){F=J.object;Pa=J.buffer;Fa=J.opaque;h(F); -for(J=0;J0||u.faceVertexUvs.length> -0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(n*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays= -[];u=0;for(v=m.numMorphTargets;u=0;j--)d[j]==f&&d.splice(j,1)}else f instanceof THREE.MarchingCubes&&pa(d.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d< -f;d++)if(h=b.__webglObjects[d].object,n=k=j=void 0,h instanceof THREE.Mesh){j=h.geometry;m=0;for(o=j.geometryGroupsList.length;m0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,oa,E));Aa&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,E));Ca&&ta.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer), -e.bufferData(e.ARRAY_BUFFER,$,E));sa&&W>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ia,E));sa&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ja,E));va&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,ga,E),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ba,E));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER, -aa,E),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,E),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,E),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,ea,E));w&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray, -delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;ya(k)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=e.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;o=h.colors;q=u.length;n=o.length;r=h.__vertexArray;E=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w=0&&e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(e.enableVertexAttribArray(n.skinVertexA), +e.enableVertexAttribArray(n.skinVertexB),e.enableVertexAttribArray(n.skinIndex),e.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(h in b.attributes)n[h]!==void 0&&n[h]>=0&&e.enableVertexAttribArray(n[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(e.enableVertexAttribArray(n[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,f){O(b);b=0;c&&(b|=e.COLOR_BUFFER_BIT);d&&(b|=e.DEPTH_BUFFER_BIT);f&&(b|=e.STENCIL_BUFFER_BIT); +e.clear(b)};this.render=function(b,c,e,r){var n,w,Fa,U,C,I,D,Qa,Ra=b.lights,Sa=b.fog;this.shadowMapEnabled&&y(b,c);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ta);c.projectionMatrix.flattenToArray(Ca);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ta);this.initWebGLObjects(b);O(e);(this.autoClear||r)&&this.clear();C=b.__webglObjects.length;for(r=0;r=0;r--)if(n=b.__webglObjects[r],n.render){D=n.object;Qa=n.buffer;Fa=n.opaque;h(D); +for(n=0;n0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o* +2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(w*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(z*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v= +k.numMorphTargets;u=0;j--)f[j]==h&&f.splice(j,1)}else d instanceof THREE.MarchingCubes&&pa(f.__webglObjectsImmediate,d);d.__webglActive=!1;b.__objectsRemoved.splice(0,1)}d=0;for(f=b.__webglObjects.length;d0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,oa,w));Ba&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer),e.bufferData(e.ARRAY_BUFFER,V,w));Ca&&sa.hasTangents&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglTangentBuffer),e.bufferData(e.ARRAY_BUFFER,$,w));ta&&X>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,ia,w));ta&&Y>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,ka,w));ya&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, +n.__webglFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,w),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Aa,w));x>0&&(e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,aa,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,ca,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,da,w),e.bindBuffer(e.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER, +ea,w));z&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;wa(k)}else if(j instanceof THREE.Ribbon){h= +j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=e.DYNAMIC_DRAW;m=u=z=z=void 0;r=j.vertices;o=j.colors;q=r.length;n=o.length;v=j.__vertexArray;w=j.__colorArray;y=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z