diff --git a/README.md b/README.md index 508b01cc7855197ce9b697b868e480d0866d6686..1a4692c459345231621f0252249063efe4591645 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ This code creates a camera, then creates a scene, adds a cube on it, creates a & ### Change Log ### -2011 10 06 - **r45** (340.607 KB, gzip: 86.462 KB) +2011 10 06 - **r45** (340.863 KB, gzip: 86.568 KB) * `Object/Scene.add*()` and `Object/Scene.remove*()` are now `Object/Scene.add()` and `Object/Scene.remove()`. ([mrdoob](http://github.com/mrdoob)) * `LOD.add()` is now `LOD.addLevel()`. ([mrdoob](http://github.com/mrdoob)) diff --git a/build/Three.js b/build/Three.js index 9a0cf3d6c23495ce2bd12ac81ffd5f7592f68bdb..c274a8d85f2acbef0910f1dfef83021c126cf12c 100644 --- a/build/Three.js +++ b/build/Three.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,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,k,m,n,t,u,w,p,x,v,A=b.geometry,z=A.vertices,y=[],f=0;for(h=A.faces.length;f0:p<0)))if(p=w.dot((new THREE.Vector3).sub(m,x))/p,x=x.addSelf(v.multiplyScalar(p)),k instanceof THREE.Face3)e(x,m,n,t)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,u)||e(x,n,t,u)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k);y.sort(function(b,c){return b.distance-c.distance});return y}else return[]}}; -THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};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,p){n=!1;c=k;e=m;f=w;h=p;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,p,x,v){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,h=m>p?m>v?m:v:p>v?p:v):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>p?m>v?m>h?m:h:v>h?v:h:p>v?p>h?p:h:v>h?v: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,k,m,n,t,u,v,p,x,w,A=b.geometry,z=A.vertices,y=[],f=0;for(h=A.faces.length;f0:p<0)))if(p=v.dot((new THREE.Vector3).sub(m,x))/p,x=x.addSelf(w.multiplyScalar(p)),k instanceof THREE.Face3)e(x,m,n,t)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,u)||e(x,n,t,u)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k);y.sort(function(b,c){return b.distance-c.distance});return y}else return[]}}; +THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};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,v,p){n=!1;c=k;e=m;f=v;h=p;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,v,p,x,w){n?(n=!1,c=kv?k>x?k:x:v>x?v:x,h=m>p?m>w?m:w:p>w?p:w):(c=kv?k>x?k>f?k:f:x>f?x:f:v>x?v>f?v:f:x>f?x:f,h=m>p?m>w?m>h?m:h:w>h?w:h:p>w?p>h?p:h:w>h?w: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,k,m,n,t,u,w,p,x,v,A,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,t||0,u||0,w!==void 0?w:1,p||0,x||0,v||0,A||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,k,m,n,t,u,w,p,x,v,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=t;this.n32=u;this.n33=w;this.n34=p;this.n41=x;this.n42=v;this.n43=A;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,k,m,n,t,u,v,p,x,w,A,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,t||0,u||0,v!==void 0?v:1,p||0,x||0,w||0,A||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,k,m,n,t,u,v,p,x,w,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=t;this.n32=u;this.n33=v;this.n34=p;this.n41=x;this.n42=w;this.n43=A;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,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.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,k=b.n14,m=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,p=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,C=b.n44,E=c.n11,D=c.n12, -F=c.n13,M=c.n14,N=c.n21,G=c.n22,H=c.n23,K=c.n24,Z=c.n31,L=c.n32,P=c.n33,U=c.n34,Y=c.n41,X=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*N+h*Z+k*Y;this.n12=e*D+f*G+h*L+k*X;this.n13=e*F+f*H+h*P+k*o;this.n14=e*M+f*K+h*U+k*ea;this.n21=m*E+n*N+t*Z+u*Y;this.n22=m*D+n*G+t*L+u*X;this.n23=m*F+n*H+t*P+u*o;this.n24=m*M+n*K+t*U+u*ea;this.n31=w*E+p*N+x*Z+v*Y;this.n32=w*D+p*G+x*L+v*X;this.n33=w*F+p*H+x*P+v*o;this.n34=w*M+p*K+x*U+v*ea;this.n41=A*E+z*N+y*Z+C*Y;this.n42=A*D+z*G+y*L+C*X;this.n43=A*F+z*H+y*P+C*o;this.n44=A* +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,k=b.n14,m=b.n21,n=b.n22,t=b.n23,u=b.n24,v=b.n31,p=b.n32,x=b.n33,w=b.n34,A=b.n41,z=b.n42,y=b.n43,C=b.n44,E=c.n11,D=c.n12, +F=c.n13,M=c.n14,N=c.n21,G=c.n22,H=c.n23,K=c.n24,Z=c.n31,L=c.n32,P=c.n33,U=c.n34,Y=c.n41,X=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*N+h*Z+k*Y;this.n12=e*D+f*G+h*L+k*X;this.n13=e*F+f*H+h*P+k*o;this.n14=e*M+f*K+h*U+k*ea;this.n21=m*E+n*N+t*Z+u*Y;this.n22=m*D+n*G+t*L+u*X;this.n23=m*F+n*H+t*P+u*o;this.n24=m*M+n*K+t*U+u*ea;this.n31=v*E+p*N+x*Z+w*Y;this.n32=v*D+p*G+x*L+w*X;this.n33=v*F+p*H+x*P+w*o;this.n34=v*M+p*K+x*U+w*ea;this.n41=A*E+z*N+y*Z+C*Y;this.n42=A*D+z*G+y*L+C*X;this.n43=A*F+z*H+y*P+C*o;this.n44=A* M+z*K+y*U+C*ea;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,k=this.n22,m=this.n23,n=this.n24,t=this.n31,u=this.n32,w=this.n33,p=this.n34,x=this.n41,v=this.n42,A=this.n43,z=this.n44;return f*m*u*x-e*n*u*x-f*k*w*x+c*n*w*x+e*k*p*x-c*m*p*x-f*m*t*v+e*n*t*v+f*h*w*v-b*n*w*v-e*h*p*v+b*m*p*v+f*k*t*A-c*n*t*A-f*h*u*A+b*n*u*A+c*h*p*A-b*k*p*A-e*k*t*z+c*m*t*z+e*h*u*z-b*m*u*z-c*h* -w*z+b*k*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= +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,k=this.n22,m=this.n23,n=this.n24,t=this.n31,u=this.n32,v=this.n33,p=this.n34,x=this.n41,w=this.n42,A=this.n43,z=this.n44;return f*m*u*x-e*n*u*x-f*k*v*x+c*n*v*x+e*k*p*x-c*m*p*x-f*m*t*w+e*n*t*w+f*h*v*w-b*n*v*w-e*h*p*w+b*m*p*w+f*k*t*A-c*n*t*A-f*h*u*A+b*n*u*A+c*h*p*A-b*k*p*A-e*k*t*z+c*m*t*z+e*h*u*z-b*m*u*z-c*h* +v*z+b*k*v*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,k=b.x,m=b.y,n=b.z,t=h*k,u=h*m;this.set(t*k+e,t*m-f*n,t*n+f*m,0,t*m+f*n,u*m+e,u*n-f*k,0,t*n-f*m,u*n+f*k,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,k=Math.cos(e),e=Math.sin(e),m=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var t= -m*n,u=m*h,w=f*n,p=f*h;this.n11=t+p*e;this.n12=w*e-u;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=u*e-w;this.n32=p+t*e;this.n33=k*m;break;case "ZXY":t=m*n;u=m*h;w=f*n;p=f*h;this.n11=t-p*e;this.n12=-k*h;this.n13=w+u*e;this.n21=u+w*e;this.n22=k*n;this.n23=p-t*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":t=k*n;u=k*h;w=e*n;p=e*h;this.n11=m*n;this.n12=w*f-u;this.n13=t*f+p;this.n21=m*h;this.n22=p*f+t;this.n23=u*f-w;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":t=k*m;u= -k*f;w=e*m;p=e*f;this.n11=m*n;this.n12=p-t*h;this.n13=w*h+u;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*h+w;this.n33=t-p*h;break;case "XZY":t=k*m;u=k*f;w=e*m;p=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=t*h+p;this.n22=k*n;this.n23=u*h-w;this.n31=w*h-u;this.n32=e*n;this.n33=p*h+t;break;default:t=k*n,u=k*h,w=e*n,p=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=u+w*f,this.n22=t-p*f,this.n23=-e*m,this.n31=p-t*f,this.n32=w+u*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c= +m*n,u=m*h,v=f*n,p=f*h;this.n11=t+p*e;this.n12=v*e-u;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=u*e-v;this.n32=p+t*e;this.n33=k*m;break;case "ZXY":t=m*n;u=m*h;v=f*n;p=f*h;this.n11=t-p*e;this.n12=-k*h;this.n13=v+u*e;this.n21=u+v*e;this.n22=k*n;this.n23=p-t*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":t=k*n;u=k*h;v=e*n;p=e*h;this.n11=m*n;this.n12=v*f-u;this.n13=t*f+p;this.n21=m*h;this.n22=p*f+t;this.n23=u*f-v;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":t=k*m;u= +k*f;v=e*m;p=e*f;this.n11=m*n;this.n12=p-t*h;this.n13=v*h+u;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*h+v;this.n33=t-p*h;break;case "XZY":t=k*m;u=k*f;v=e*m;p=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=t*h+p;this.n22=k*n;this.n23=u*h-v;this.n31=v*h-u;this.n32=e*n;this.n33=p*h+t;break;default:t=k*n,u=k*h,v=e*n,p=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=u+v*f,this.n22=t-p*f,this.n23=-e*m,this.n31=p-t*f,this.n32=v+u*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c= b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,t=c*m;c*=n;var u=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(u+f);this.n12=t-h;this.n13=c+m;this.n21=t+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-m;this.n32=e+k;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; 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,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.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=k.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,k=b.n14,m=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,p=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*v*z-u*x*z+u*p*y-n*v*y-t*p*C+n*x*C;c.n12=k*x*z-h*v*z-k*p*y+f*v*y+h*p*C-f*x*C;c.n13=h*u*z-k*t*z+k*n*y-f*u*y-h*n*C+f*t*C;c.n14=k*t*p-h*u*p-k*n*x+f*u*x+h*n*v-f*t*v;c.n21=u*x*A-t*v*A-u*w*y+m*v*y+t*w*C-m*x*C;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*C+e*x*C;c.n23=k*t*A-h*u*A-k*m*y+e*u*y+h*m*C-e*t*C;c.n24= -h*u*w-k*t*w+k*m*x-e*u*x-h*m*v+e*t*v;c.n31=n*v*A-u*p*A+u*w*z-m*v*z-n*w*C+m*p*C;c.n32=k*p*A-f*v*A-k*w*z+e*v*z+f*w*C-e*p*C;c.n33=h*u*A-k*n*A+k*m*z-e*u*z-f*m*C+e*n*C;c.n34=k*n*w-f*u*w-k*m*p+e*u*p+f*m*v-e*n*v;c.n41=t*p*A-n*x*A-t*w*z+m*x*z+n*w*y-m*p*y;c.n42=f*x*A-h*p*A+h*w*z-e*x*z-f*w*y+e*p*y;c.n43=h*n*A-f*t*A-h*m*z+e*t*z+f*m*y-e*n*y;c.n44=f*t*w-h*n*w+h*m*p-e*t*p-f*m*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,k=b.n32*b.n21-b.n31*b.n22,m=-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,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+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*k;e[3]=b*m;e[4]=b*n;e[5]=b*t;e[6]=b*u;e[7]=b*w;e[8]=b*p;return c}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,t=b.n23,u=b.n24,v=b.n31,p=b.n32,x=b.n33,w=b.n34,A=b.n41,z=b.n42,y=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*w*z-u*x*z+u*p*y-n*w*y-t*p*C+n*x*C;c.n12=k*x*z-h*w*z-k*p*y+f*w*y+h*p*C-f*x*C;c.n13=h*u*z-k*t*z+k*n*y-f*u*y-h*n*C+f*t*C;c.n14=k*t*p-h*u*p-k*n*x+f*u*x+h*n*w-f*t*w;c.n21=u*x*A-t*w*A-u*v*y+m*w*y+t*v*C-m*x*C;c.n22=h*w*A-k*x*A+k*v*y-e*w*y-h*v*C+e*x*C;c.n23=k*t*A-h*u*A-k*m*y+e*u*y+h*m*C-e*t*C;c.n24= +h*u*v-k*t*v+k*m*x-e*u*x-h*m*w+e*t*w;c.n31=n*w*A-u*p*A+u*v*z-m*w*z-n*v*C+m*p*C;c.n32=k*p*A-f*w*A-k*v*z+e*w*z+f*v*C-e*p*C;c.n33=h*u*A-k*n*A+k*m*z-e*u*z-f*m*C+e*n*C;c.n34=k*n*v-f*u*v-k*m*p+e*u*p+f*m*w-e*n*w;c.n41=t*p*A-n*x*A-t*v*z+m*x*z+n*v*y-m*p*y;c.n42=f*x*A-h*p*A+h*v*z-e*x*z-f*v*y+e*p*y;c.n43=h*n*A-f*t*A-h*m*z+e*t*z+f*m*y-e*n*y;c.n44=f*t*v-h*n*v+h*m*p-e*t*p-f*m*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,k=b.n32*b.n21-b.n31*b.n22,m=-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,v=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+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*k;e[3]=b*m;e[4]=b*n;e[5]=b*t;e[6]=b*u;e[7]=b*v;e[8]=b*p;return c}; THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};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,k){var m,n,t,u;m=new THREE.Matrix4;n=c-b;t=e-f;u=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/t;m.n23=0;m.n24=-((e+f)/t);m.n31=0;m.n32=0;m.n33=-2/u;m.n34=-((k+h)/u);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};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.name="";this.id=THREE.Object3DCount++;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,14 +54,14 @@ 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?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fo&&m.positionScreen.z0&&G.z<1))ha=D[E]=D[E]||new THREE.RenderableParticle,E++,C=ha,C.x=G.x/G.w,C.y=G.y/G.w,C.z=G.z,C.rotation=aa.rotation.z,C.scale.x=aa.scale.x*Math.abs(C.x-(G.x+k.projectionMatrix.n11)/(G.w+k.projectionMatrix.n14)),C.scale.y=aa.scale.y*Math.abs(C.y-(G.y+k.projectionMatrix.n22)/(G.w+k.projectionMatrix.n24)),C.materials=aa.materials,M.push(C);h&&M.sort(c);return M}}; @@ -69,8 +69,8 @@ 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=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),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-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,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-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,k=this.x,m=this.y,n=this.z,t=this.w,u=t*e+m*h-n*f,w=t*f+n*e-k*h,p=t*h+k*f-m*e,e=-k* -e-m*f-n*h;c.x=u*t+e*-k+w*-n-p*-m;c.y=w*t+e*-m+p*-k-u*-n;c.z=p*t+e*-n+u*-m-w*-k;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 k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.001)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)*k)/m;f=Math.sin(f*k)/m;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,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-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,k=this.x,m=this.y,n=this.z,t=this.w,u=t*e+m*h-n*f,v=t*f+n*e-k*h,p=t*h+k*f-m*e,e=-k* +e-m*f-n*h;c.x=u*t+e*-k+v*-n-p*-m;c.y=v*t+e*-m+p*-k-u*-n;c.z=p*t+e*-n+u*-m-v*-k;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 k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<0.001)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)*k)/m;f=Math.sin(f*k)/m;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,k){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=k instanceof Array?k:[k];this.centroid=new THREE.Vector3}; THREE.Face4=function(b,c,e,f,h,k,m){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=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];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)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1}; @@ -79,14 +79,14 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid e,f,h,k,m,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, 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?k:k+1;e[3]=k>this.points.length-3?k:k+2;u=this.points[e[0]];w=this.points[e[1]]; -p=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(u.x,w.x,p.x,x.x,m,n,t);f.y=c(u.y,w.y,p.y,x.y,m,n,t);f.z=c(u.z,w.z,p.z,x.z,m,n,t);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;bthis.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;u=this.points[e[0]];v=this.points[e[1]]; +p=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(u.x,v.x,p.x,x.x,m,n,t);f.y=c(u.y,v.y,p.y,x.y,m,n,t);f.z=c(u.z,v.z,p.z,x.z,m,n,t);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b* -255)+","+z+")"),v.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,t){function u(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b>1,xa=u.height>>1,m=k.scale.x*p,t=k.scale.y*x,o=m*w,n=t*xa,O.set(b.x-o,b.y-n,b.x+o,b.y+n),V.intersects(O)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-t),v.translate(-w,-xa),v.drawImage(u,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*p,n=k.scale.y*x,O.set(b.x-o,b.y-n,b.x+o,b.y+n),V.intersects(O)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v), -v.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(F!=b)v.lineWidth=F=b;b=m.linecap;if(M!=b)v.lineCap=M=b;b=m.linejoin;if(N!=b)v.lineJoin=N=b;f(m.color.getContextStyle());v.stroke();O.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,p,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending); -U=b.positionScreen.x;Y=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;R=h.positionScreen.y;E(U,Y,X,o,ea,R);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(U,Y,X,o,ea,R,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[u].u,ra[u].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=t.matrixWorldInverse,oa.copy(p.vertexNormalsWorld[0]),va=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5, -ua=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(p.vertexNormalsWorld[1]),Ea=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ba=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(p.vertexNormalsWorld[2]),Da=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Fa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,ab(U,Y,X,o,ea,R,va,ua,Ea,Ba,Da,Fa,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&& -(v.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(U,Y,X,o,ea,R,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[u].u,ra[u].v,v.map)),e(THREE.SubtractiveBlending)),qa?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(ca.r=aa.r=ha.r=ja.r,ca.g=aa.g=ha.g=ja.g,ca.b=aa.b=ha.b=ja.b,w(x,p.v1.positionWorld,p.vertexNormalsWorld[0],ca),w(x,p.v2.positionWorld,p.vertexNormalsWorld[1],aa),w(x,p.v3.positionWorld,p.vertexNormalsWorld[2],ha),ca.r=Math.max(0,Math.min(v.color.r*ca.r,1)),ca.g= -Math.max(0,Math.min(v.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(v.color.b*ca.b,1)),aa.r=Math.max(0,Math.min(v.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(v.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(v.color.b*aa.b,1)),ha.r=Math.max(0,Math.min(v.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(v.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(v.color.b*ha.b,1)),ka.r=(aa.r+ha.r)*0.5,ka.g=(aa.g+ha.g)*0.5,ka.b=(aa.b+ha.b)*0.5,na=Ya(ca,aa,ha,ka),Va(U,Y,X,o,ea,R,0,0,1,0,0,1,na)):(ia.r=ja.r,ia.g=ja.g,ia.b=ja.b,w(x,p.centroidWorld, -p.normalWorld,ia),$.r=Math.max(0,Math.min(v.color.r*ia.r,1)),$.g=Math.max(0,Math.min(v.color.g*ia.g,1)),$.b=Math.max(0,Math.min(v.color.b*ia.b,1)),v.wireframe?Na($,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa($)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)J=t.near,Q=t.far,ca.r=ca.g=ca.b=1-Ra(b.positionScreen.z,J,Q),aa.r=aa.g=aa.b=1-Ra(f.positionScreen.z,J,Q),ha.r=ha.g=ha.b=1-Ra(h.positionScreen.z, -J,Q),ka.r=(aa.r+ha.r)*0.5,ka.g=(aa.g+ha.g)*0.5,ka.b=(aa.b+ha.b)*0.5,na=Ya(ca,aa,ha,ka),Va(U,Y,X,o,ea,R,0,0,1,0,0,1,na);else if(v instanceof THREE.MeshNormalMaterial)$.r=Wa(p.normalWorld.x),$.g=Wa(p.normalWorld.y),$.b=Wa(p.normalWorld.z),v.wireframe?Na($,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa($)}function C(b,f,h,m,n,u,v,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,v,p,x),A(n,h,u,1,2,3,v,p,x);else if(U=b.positionScreen.x, -Y=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,R=h.positionScreen.y,pa=m.positionScreen.x,fa=m.positionScreen.y,ma=n.positionScreen.x,da=n.positionScreen.y,la=u.positionScreen.x,ga=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(U,Y,X,o,ea,R,pa,fa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)qa?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length== -4?(ca.r=aa.r=ha.r=ka.r=ja.r,ca.g=aa.g=ha.g=ka.g=ja.g,ca.b=aa.b=ha.b=ka.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],ca),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],aa),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ha),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ka),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.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)),ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),ka.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(p.color.b*ka.b,1)),na=Ya(ca,aa,ha,ka),E(U,Y,X,o,pa,fa),Va(U,Y,X,o,pa,fa,0,0,1,0,0,1,na),E(ma,da,ea,R,la,ga),Va(ma,da,ea,R,la,ga,1,0,1,1,0,1,na)):(ia.r=ja.r,ia.g=ja.g,ia.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ia), -$.r=Math.max(0,Math.min(p.color.r*ia.r,1)),$.g=Math.max(0,Math.min(p.color.g*ia.g,1)),$.b=Math.max(0,Math.min(p.color.b*ia.b,1)),D(U,Y,X,o,ea,R,pa,fa),p.wireframe?Na($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa($)):(D(U,Y,X,o,ea,R,pa,fa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)$.r=Wa(v.normalWorld.x),$.g=Wa(v.normalWorld.y),$.b=Wa(v.normalWorld.z),D(U,Y,X,o,ea,R,pa,fa),p.wireframe? -Na($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa($);else if(p instanceof THREE.MeshDepthMaterial)J=t.near,Q=t.far,ca.r=ca.g=ca.b=1-Ra(b.positionScreen.z,J,Q),aa.r=aa.g=aa.b=1-Ra(f.positionScreen.z,J,Q),ha.r=ha.g=ha.b=1-Ra(m.positionScreen.z,J,Q),ka.r=ka.g=ka.b=1-Ra(h.positionScreen.z,J,Q),na=Ya(ca,aa,ha,ka),E(U,Y,X,o,pa,fa),Va(U,Y,X,o,pa,fa,0,0,1,0,0,1,na),E(ma,da,ea,R,la,ga),Va(ma,da,ea,R,la,ga,1,0,1,1,0,1,na)}function E(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f); -v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function D(b,c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(F!=c)v.lineWidth=F=c;if(M!=e)v.lineCap=M=e;if(N!=k)v.lineJoin=N=k;f(b.getContextStyle());v.stroke();O.inflate(c*2)}function Oa(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,o,n,t,p,u,x,w){if(w.image.width!=0){if(w.needsUpdate==!0||sa[w.id]==void 0){var xa=w.wrapS==THREE.RepeatWrapping,z=w.wrapT== -THREE.RepeatWrapping;sa[w.id]=v.createPattern(w.image,xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var xa=w.offset.x/w.repeat.x,z=w.offset.y/w.repeat.y,V=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+xa)*V,n=(n+z)*w,t=(t+xa)*V,p=(p+z)*w,u=(u+xa)*V,x=(x+z)*w;e-=b;f-=c;k-=b;m-=c;t-=o;p-=n;u-=o;x-=n;xa=1/(t*x-u*p);w=(x*e-p*k)*xa;p=(x*f-p*m)*xa;e=(t*k-u*e)*xa;f=(t*m-u*f)*xa;b=b-w*o-e*n;c=c-p*o-f*n;v.save();v.transform(w,p,e,f,b,c);v.fill(); -v.restore()}}function Va(b,c,e,f,k,h,m,o,n,t,p,u,w){var x,xa;x=w.width-1;xa=w.height-1;m*=x;o*=xa;n*=x;t*=xa;p*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;t-=o;p-=m;u-=o;xa=1/(n*u-p*t);x=(u*e-t*k)*xa;t=(u*f-t*h)*xa;e=(n*k-p*e)*xa;f=(n*h-p*f)*xa;b=b-x*m-e*o;c=c-t*m-f*o;v.save();v.transform(x,t,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255),p=~~(f.r*255),u=~~(f.g* +THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var t,u,v,p,x,w,A,z;b=c.projectScene(e,f);t=0;for(u=b.length;t0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b* +255)+","+z+")"),w.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,t){function u(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);wa.setRGB(0,0,0);b=0;for(c=k.length;b>1,xa=u.height>>1,m=k.scale.x*p,t=k.scale.y*x,o=m*v,n=t*xa,O.set(b.x-o,b.y-n,b.x+o,b.y+n),V.intersects(O)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-t),w.translate(-v,-xa),w.drawImage(u,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*p,n=k.scale.y*x,O.set(b.x-o,b.y-n,b.x+o,b.y+n),V.intersects(O)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w), +w.restore()))}function y(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(F!=b)w.lineWidth=F=b;b=m.linecap;if(M!=b)w.lineCap=M=b;b=m.linejoin;if(N!=b)w.lineJoin=N=b;f(m.color.getContextStyle());w.stroke();O.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,p,w,x){k.info.render.vertices+=3;k.info.render.faces++;c(w.opacity);e(w.blending); +U=b.positionScreen.x;Y=b.positionScreen.y;X=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;R=h.positionScreen.y;E(U,Y,X,o,ea,R);if(w instanceof THREE.MeshBasicMaterial)if(w.map)w.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(U,Y,X,o,ea,R,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[u].u,ra[u].v,w.map));else if(w.envMap){if(w.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=t.matrixWorldInverse,oa.copy(p.vertexNormalsWorld[0]),va=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5, +ua=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(p.vertexNormalsWorld[1]),Ea=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ba=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(p.vertexNormalsWorld[2]),Da=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Fa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,ab(U,Y,X,o,ea,R,va,ua,Ea,Ba,Da,Fa,w.envMap)}else w.wireframe?Na(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshLambertMaterial)w.map&&!w.wireframe&& +(w.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(U,Y,X,o,ea,R,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[u].u,ra[u].v,w.map)),e(THREE.SubtractiveBlending)),qa?!w.wireframe&&w.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(ca.r=aa.r=ha.r=ja.r,ca.g=aa.g=ha.g=ja.g,ca.b=aa.b=ha.b=ja.b,v(x,p.v1.positionWorld,p.vertexNormalsWorld[0],ca),v(x,p.v2.positionWorld,p.vertexNormalsWorld[1],aa),v(x,p.v3.positionWorld,p.vertexNormalsWorld[2],ha),ca.r=Math.max(0,Math.min(w.color.r*ca.r,1)),ca.g= +Math.max(0,Math.min(w.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(w.color.b*ca.b,1)),aa.r=Math.max(0,Math.min(w.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(w.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(w.color.b*aa.b,1)),ha.r=Math.max(0,Math.min(w.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(w.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(w.color.b*ha.b,1)),ka.r=(aa.r+ha.r)*0.5,ka.g=(aa.g+ha.g)*0.5,ka.b=(aa.b+ha.b)*0.5,na=Ya(ca,aa,ha,ka),Va(U,Y,X,o,ea,R,0,0,1,0,0,1,na)):(ia.r=ja.r,ia.g=ja.g,ia.b=ja.b,v(x,p.centroidWorld, +p.normalWorld,ia),$.r=Math.max(0,Math.min(w.color.r*ia.r,1)),$.g=Math.max(0,Math.min(w.color.g*ia.g,1)),$.b=Math.max(0,Math.min(w.color.b*ia.b,1)),w.wireframe?Na($,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa($)):w.wireframe?Na(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshDepthMaterial)J=t.near,Q=t.far,ca.r=ca.g=ca.b=1-Ra(b.positionScreen.z,J,Q),aa.r=aa.g=aa.b=1-Ra(f.positionScreen.z,J,Q),ha.r=ha.g=ha.b=1-Ra(h.positionScreen.z, +J,Q),ka.r=(aa.r+ha.r)*0.5,ka.g=(aa.g+ha.g)*0.5,ka.b=(aa.b+ha.b)*0.5,na=Ya(ca,aa,ha,ka),Va(U,Y,X,o,ea,R,0,0,1,0,0,1,na);else if(w instanceof THREE.MeshNormalMaterial)$.r=Wa(p.normalWorld.x),$.g=Wa(p.normalWorld.y),$.b=Wa(p.normalWorld.z),w.wireframe?Na($,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa($)}function C(b,f,h,m,n,u,w,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,w,p,x),A(n,h,u,1,2,3,w,p,x);else if(U=b.positionScreen.x, +Y=b.positionScreen.y,X=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,R=h.positionScreen.y,pa=m.positionScreen.x,fa=m.positionScreen.y,ma=n.positionScreen.x,da=n.positionScreen.y,la=u.positionScreen.x,ga=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(U,Y,X,o,ea,R,pa,fa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)qa?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length== +4?(ca.r=aa.r=ha.r=ka.r=ja.r,ca.g=aa.g=ha.g=ka.g=ja.g,ca.b=aa.b=ha.b=ka.b=ja.b,v(x,w.v1.positionWorld,w.vertexNormalsWorld[0],ca),v(x,w.v2.positionWorld,w.vertexNormalsWorld[1],aa),v(x,w.v4.positionWorld,w.vertexNormalsWorld[3],ha),v(x,w.v3.positionWorld,w.vertexNormalsWorld[2],ka),ca.r=Math.max(0,Math.min(p.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.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)),ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),ka.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(p.color.b*ka.b,1)),na=Ya(ca,aa,ha,ka),E(U,Y,X,o,pa,fa),Va(U,Y,X,o,pa,fa,0,0,1,0,0,1,na),E(ma,da,ea,R,la,ga),Va(ma,da,ea,R,la,ga,1,0,1,1,0,1,na)):(ia.r=ja.r,ia.g=ja.g,ia.b=ja.b,v(x,w.centroidWorld,w.normalWorld,ia), +$.r=Math.max(0,Math.min(p.color.r*ia.r,1)),$.g=Math.max(0,Math.min(p.color.g*ia.g,1)),$.b=Math.max(0,Math.min(p.color.b*ia.b,1)),D(U,Y,X,o,ea,R,pa,fa),p.wireframe?Na($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa($)):(D(U,Y,X,o,ea,R,pa,fa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)$.r=Wa(w.normalWorld.x),$.g=Wa(w.normalWorld.y),$.b=Wa(w.normalWorld.z),D(U,Y,X,o,ea,R,pa,fa),p.wireframe? +Na($,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa($);else if(p instanceof THREE.MeshDepthMaterial)J=t.near,Q=t.far,ca.r=ca.g=ca.b=1-Ra(b.positionScreen.z,J,Q),aa.r=aa.g=aa.b=1-Ra(f.positionScreen.z,J,Q),ha.r=ha.g=ha.b=1-Ra(m.positionScreen.z,J,Q),ka.r=ka.g=ka.b=1-Ra(h.positionScreen.z,J,Q),na=Ya(ca,aa,ha,ka),E(U,Y,X,o,pa,fa),Va(U,Y,X,o,pa,fa,0,0,1,0,0,1,na),E(ma,da,ea,R,la,ga),Va(ma,da,ea,R,la,ga,1,0,1,1,0,1,na)}function E(b,c,e,f,k,h){w.beginPath();w.moveTo(b,c);w.lineTo(e,f); +w.lineTo(k,h);w.lineTo(b,c);w.closePath()}function D(b,c,e,f,k,h,m,o){w.beginPath();w.moveTo(b,c);w.lineTo(e,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,c);w.closePath()}function Na(b,c,e,k){if(F!=c)w.lineWidth=F=c;if(M!=e)w.lineCap=M=e;if(N!=k)w.lineJoin=N=k;f(b.getContextStyle());w.stroke();O.inflate(c*2)}function Oa(b){h(b.getContextStyle());w.fill()}function ab(b,c,e,f,k,m,o,n,t,p,u,x,v){if(v.image.width!=0){if(v.needsUpdate==!0||sa[v.id]==void 0){var xa=v.wrapS==THREE.RepeatWrapping,z=v.wrapT== +THREE.RepeatWrapping;sa[v.id]=w.createPattern(v.image,xa&&z?"repeat":xa&&!z?"repeat-x":!xa&&z?"repeat-y":"no-repeat");v.needsUpdate=!1}h(sa[v.id]);var xa=v.offset.x/v.repeat.x,z=v.offset.y/v.repeat.y,V=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,o=(o+xa)*V,n=(n+z)*v,t=(t+xa)*V,p=(p+z)*v,u=(u+xa)*V,x=(x+z)*v;e-=b;f-=c;k-=b;m-=c;t-=o;p-=n;u-=o;x-=n;xa=1/(t*x-u*p);v=(x*e-p*k)*xa;p=(x*f-p*m)*xa;e=(t*k-u*e)*xa;f=(t*m-u*f)*xa;b=b-v*o-e*n;c=c-p*o-f*n;w.save();w.transform(v,p,e,f,b,c);w.fill(); +w.restore()}}function Va(b,c,e,f,k,h,m,o,n,t,p,u,v){var x,xa;x=v.width-1;xa=v.height-1;m*=x;o*=xa;n*=x;t*=xa;p*=x;u*=xa;e-=b;f-=c;k-=b;h-=c;n-=m;t-=o;p-=m;u-=o;xa=1/(n*u-p*t);x=(u*e-t*k)*xa;t=(u*f-t*h)*xa;e=(n*k-p*e)*xa;f=(n*h-p*f)*xa;b=b-x*m-e*o;c=c-t*m-f*o;w.save();w.transform(x,t,e,f,b,c);w.clip();w.drawImage(v,0,0);w.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255),p=~~(f.r*255),u=~~(f.g* 255),f=~~(f.b*255);Ca[0]=k<0?0:k>255?255:k;Ca[1]=h<0?0:h>255?255:h;Ca[2]=b<0?0:b>255?255:b;Ca[4]=m<0?0:m>255?255:m;Ca[5]=o<0?0:o>255?255:o;Ca[6]=c<0?0:c>255?255:c;Ca[8]=n<0?0:n>255?255:n;Ca[9]=t<0?0:t>255?255:t;Ca[10]=e<0?0:e>255?255:e;Ca[12]=p<0?0:p>255?255:p;Ca[13]=u<0?0:u>255?255:u;Ca[14]=f<0?0:f>255?255:f;za.putImageData(Ka,0,0);W.drawImage(Ia,0,0);return Ga}function Ra(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,c){var e=c.x-b.x,f=c.y- -b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=k,f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,ta,Ha,Qa,Xa,$a,Aa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,p,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,t,this.sortElements);(qa=b.lights.length>0)&&u(b);Za=0;for(bb=m.length;Za0)&&u(b);Za=0;for(bb=m.length;Za0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Z.sub(h.position,c.centroidWorld),Z.normalize(),m=c.normalWorld.dot(Z)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,p){k.info.render.vertices+=3;k.info.render.faces++;U=f(Y++); U.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?F.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(M.r=N.r,M.g=N.g,M.b=N.b,b(p,o,M),F.r=Math.max(0,Math.min(n.color.r*M.r,1)),F.g=Math.max(0,Math.min(n.color.g*M.g,1)),F.b=Math.max(0,Math.min(n.color.b*M.b,1))):F.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear- o.z*n.__farMinusNear),F.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&F.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+F.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+F.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(U)}function e(c,e,m,o,n,p,u){k.info.render.vertices+= 4;k.info.render.faces++;U=f(Y++);U.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?F.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(M.r=N.r,M.g=N.g,M.b=N.b,b(u,n,M),F.r=Math.max(0,Math.min(p.color.r*M.r,1)),F.g=Math.max(0,Math.min(p.color.g*M.g,1)),F.b=Math.max(0,Math.min(p.color.b*M.b,1))): F.copy(p.color):p instanceof THREE.MeshDepthMaterial?(K=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),F.setRGB(K,K,K)):p instanceof THREE.MeshNormalMaterial&&F.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?U.setAttribute("style","fill: none; stroke: "+F.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):U.setAttribute("style","fill: "+F.getContextStyle()+ -"; fill-opacity: "+p.opacity);t.appendChild(U)}function f(b){L[b]==null&&(L[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&L[b].setAttribute("shape-rendering","crispEdges"));return L[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,p,x,v,A,z,y,C=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,F=new THREE.Color(16777215),M=new THREE.Color(16777215),N=new THREE.Color(0), -G=new THREE.Color(0),H=new THREE.Color(0),K,Z=new THREE.Vector3,L=[],P=[],U,Y,X,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,c){u=b;w=c;p=u/2;x=w/2;t.setAttribute("viewBox",-p+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);C.set(-p,-x,p,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}; -this.render=function(b,f){var h,u,w,F,L,M,K,ca;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);X=Y=0;if(D=b.lights.length>0){K=b.lights;N.setRGB(0,0,0);G.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(u=K.length;h1?1:b}var k=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,v,p,x,w,A,z,y,C=new THREE.Rectangle,E=new THREE.Rectangle,D=!1,F=new THREE.Color(16777215),M=new THREE.Color(16777215),N=new THREE.Color(0), +G=new THREE.Color(0),H=new THREE.Color(0),K,Z=new THREE.Vector3,L=[],P=[],U,Y,X,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,c){u=b;v=c;p=u/2;x=v/2;t.setAttribute("viewBox",-p+" "+-x+" "+u+" "+v);t.setAttribute("width",u);t.setAttribute("height",v);C.set(-p,-x,p,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])}; +this.render=function(b,f){var h,u,v,F,L,M,K,ca;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);X=Y=0;if(D=b.lights.length>0){K=b.lights;N.setRGB(0,0,0);G.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(u=K.length;h=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]), -o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;pv&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=v;t[w]=1;v=-1;p++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>= +o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;pw&&(v=x,w=u[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=w;t[v]=1;w=-1;p++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>= 0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.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),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount, o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),X.info.render.calls++,X.info.render.vertices+=h.__webglFaceCount,X.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),X.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),X.info.render.calls++): m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),X.info.render.calls++)}}function h(b,c,e){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(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER, -b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,p,t,u,v,w,x=b.count*3;for(w=0;w=0;e--)b[e].object==c&&b.splice(e,1)}function M(b){function c(b){var h=[];e=0;for(f=b.length;e65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[], -materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=da++,b.geometryGroupsList.push(b.geometryGroups[v])}function N(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=$){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); +materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var w in b.geometryGroups)b.geometryGroups[w].id=da++,b.geometryGroupsList.push(b.geometryGroups[w])}function N(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(b){if(b!=$){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)}$=b}}function H(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(c.magFilter)), o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(c.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,U(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(c.minFilter)))}function K(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),X.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(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+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Z(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; @@ -283,9 +283,9 @@ function(b,c){ia.setHex(b);ja=c;o.clearColor(ia.r,ia.g,ia.b,ja)};this.setClearCo 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];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer); o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA), o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){Z(b); this.clear(c,e,f)};this.render=function(b,c,p,V){var O,T,E,D,F,H,J,qa,K=b.lights,ja=b.fog;fa=-1;this.shadowMapEnabled&&z(b,c);X.info.render.calls=0;X.info.render.vertices=0;X.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ba);c.projectionMatrix.flattenToArray(Ea);ua.multiply(c.projectionMatrix,c.matrixWorldInverse);u(ua);this.initWebGLObjects(b);Z(p);(this.autoClear||V)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil); -F=b.__webglObjects.length;for(V=0;V=0;V--)if(O=b.__webglObjects[V],O.render){J=O.object;qa=O.buffer;E=O.opaque;k(J);for(O=0;O0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray= -new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(V*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(z=m.numMorphTargets;w0||v.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray= +new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(V*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];v=0;for(z=m.numMorphTargets;v=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&F(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0, -1)}e=0;for(f=b.__webglObjects.length;e0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer), -o.bufferData(o.ARRAY_BUFFER,fa,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ma,y));Ka&&ua.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y));Ba&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&Z>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,y));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER, +o.bufferData(o.ARRAY_BUFFER,fa,y));Ka&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ma,y));Ga&&ua.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y));Ba&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&Z>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,va,y));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER, za,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,sa,y));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ka,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,$,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));V&&(delete t.__inittedArrays, delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices|| -h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=V=V=void 0;u=k.vertices;p=k.colors;v=u.length;t=p.length;z=k.__vertexArray;y=k.__colorArray;O=k.__dirtyColors;if(k.__dirtyVertices){for(V=0;V1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=m;c.v=k;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,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,t=b.faces,u=k.faces,w=b.faceVertexUvs[0],k=k.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 p=0,x=n.length;p1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position, m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m) -b?e(c,h-1):u[h]0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,v,p,n),z=THREE.Shape.Utils.b2(z,A,x, -t),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];t=k[5];p=k[0];x=k[1];u=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,v,p,u,n),z=THREE.Shape.Utils.b3(z,A,x,w,t),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m); -for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];t=k[1];u=k[2];p=k[3];z=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);A=z-p;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=p+z*A,k=w+n+u*Math.cos(z),z=v+t+u*Math.sin(z),e.push(new THREE.Vector2(k,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,k){var m=this.getPoints(),n,t,u,w,p;n=0;for(t=m.length;n0?(m=e[e.length-1],w=m.x,A=m.y):(m=this.actions[f-1].args,w=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,w,p,n),z=THREE.Shape.Utils.b2(z,A,x, +t),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];t=k[5];p=k[0];x=k[1];u=k[2];v=k[3];e.length>0?(m=e[e.length-1],w=m.x,A=m.y):(m=this.actions[f-1].args,w=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,w,p,u,n),z=THREE.Shape.Utils.b3(z,A,x,v,t),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m); +for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];t=k[1];u=k[2];p=k[3];z=k[4];x=!!k[5];v=m[m.length-2];w=m[m.length-1];m.length==0&&(v=w=0);A=z-p;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=p+z*A,k=v+n+u*Math.cos(z),z=w+t+u*Math.sin(z),e.push(new THREE.Vector2(k,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,k){var m=this.getPoints(),n,t,u,v,p;n=0;for(t=m.length;n=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;var z=[u[m],e[n],e[h]];p=THREE.FontUtils.Triangulate.area(z);var y=[u[m],u[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);v=n;w=m;n+=1;m+=-1;n< -0&&(n+=e.length);n%=e.length;m<0&&(m+=u.length);m%=u.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;z=[u[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[u[m],u[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);p+x>z+y&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=u.length),m%=u.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:u.length-1);p=e.slice(0,n);x=e.slice(n);v=u.slice(m);w=u.slice(0,m);k=[u[m],u[k],e[n]];A.push([u[m],e[n],e[h]]);A.push(k);e=p.concat(v).concat(w).concat(x)}return{shape:e, +THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,t,u,v,p,x,w,A=[];for(t=0;t=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;var z=[u[m],e[n],e[h]];p=THREE.FontUtils.Triangulate.area(z);var y=[u[m],u[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);w=n;v=m;n+=1;m+=-1;n< +0&&(n+=e.length);n%=e.length;m<0&&(m+=u.length);m%=u.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;z=[u[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[u[m],u[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);p+x>z+y&&(n=w,m=v,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=u.length),m%=u.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:u.length-1);p=e.slice(0,n);x=e.slice(n);w=u.slice(m);v=u.slice(0,m);k=[u[m],u[k],e[n]];A.push([u[m],e[n],e[h]]);A.push(k);e=p.concat(w).concat(v).concat(x)}return{shape:e, isolatedPts:A,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),k,m,n,t,u={};k=0;for(m=f.length;k1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= -this.getPrevKeyWith("pos",v,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&w[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= +this.getPrevKeyWith("pos",w,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",w,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&v[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;wb.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];t=b[e[2]];u=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],t[0],u[0],h,e,m);f[1]=this.interpolate(k[1],n[1],t[1],u[1],h,e,m);f[2]=this.interpolate(k[2],n[2],t[2],u[2],h,e,m);return f}; THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*k+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]}; @@ -465,44 +465,44 @@ THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,argu 1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back}; this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0, 0]}};this.domElement.addEventListener("mousemove",e(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",e(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",e(this,this.mouseup),!1);this.domElement.addEventListener("keydown",e(this,this.keydown),!1);this.domElement.addEventListener("keyup",e(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()}; -THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,t=0,u=0,w=0,p=0,x=0,v=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*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(t>0||this.autoForward&&!(t<0)?1:t));this.object.translateX(b*u);this.object.translateY(b*w);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); +THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,t=0,u=0,v=0,p=0,x=0,w=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*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(t>0||this.autoForward&&!(t<0)?1:t));this.object.translateX(b*u);this.object.translateY(b*v);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); else if(this.forward.y1?c.normalize():c.z=Math.sqrt(1-f*f);k.copy(this.object.position).subSelf(this.target);f=this.object.up.clone().setLength(c.y);f.addSelf(this.object.up.clone().crossSelf(k).setLength(c.x));f.addSelf(k.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(m.dot(n)/m.length()/n.length());if(b){var e=(new THREE.Vector3).cross(m,n).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e, --b);c.multiplyVector3(k);c.multiplyVector3(this.object.up);c.multiplyVector3(n);this.staticMoving?m=n:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(u.y-t.y)*this.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),this.staticMoving?t=u:t.y+=(u.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=p.clone().subSelf(w);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var e=k.clone().crossSelf(this.object.up).setLength(b.x); -e.addSelf(this.object.up.clone().setLength(b.y));this.object.position.addSelf(e);this.target.addSelf(e);this.staticMoving?w=p:w.addSelf(b.sub(p,w).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),k.lengthSq()0&&(k.multiplyScalar(b),this.staticMoving?t=u:t.y+=(u.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=p.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var e=k.clone().crossSelf(this.object.up).setLength(b.x); +e.addSelf(this.object.up.clone().setLength(b.y));this.object.position.addSelf(e);this.target.addSelf(e);this.staticMoving?v=p:v.addSelf(b.sub(p,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),k.lengthSq()0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(L=b.length;--L>=0;){la=L;ga=L-1;ga<0&&(ga=b.length- -1);for(var e=0,c=v+w*2,e=0;e=0;U--){Y=U/w;X=t*(1-Y);Y=u*Math.sin(Y*Math.PI/2);L=0;for(P=E.length;L=0;U--){Y=U/v;X=t*(1-Y);Y=u*Math.sin(Y*Math.PI/2);L=0;for(P=E.length;L0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,n,x)))-1);u.push(w)}c.push(u)}for(var v,A,z,h=c.length,e=0;e0)for(f=0;f1&&(v= -this.vertices[m].position.clone(),A=this.vertices[t].position.clone(),z=this.vertices[u].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,t,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,p,y]))}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,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,n,x)))-1);u.push(v)}c.push(u)}for(var w,A,z,h=c.length,e=0;e0)for(f=0;f1&&(w= +this.vertices[m].position.clone(),A=this.vertices[t].position.clone(),z=this.vertices[u].position.clone(),w.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,t,u,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([v,p,y]))}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(""),k=h.length,m=[],b=0;b0)for(u=0;u2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}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 v=t,A=u,z=w,y=h,C=m,E=void 0,D=void 0,F=void 0, -M=void 0,N=void 0,G=void 0,H=void 0,K=void 0,Z=void 0,D=x[C[v]].x,F=x[C[v]].y,M=x[C[A]].x,N=x[C[A]].y,G=x[C[z]].x,H=x[C[z]].y;if(1.0E-10>(M-D)*(H-F)-(N-F)*(G-D))x=!1;else{for(E=0;E=0&&U>=0&&X>=0){x=!1; -break a}}x=!0}}if(x){k.push([b[m[t]],b[m[u]],b[m[w]]]);n.push([m[t],m[u],m[w]]);t=u;for(w=u+1;w0)for(u=0;u2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);v=u+1;h<=v&&(v=0);var x;a:{x=b;var w=t,A=u,z=v,y=h,C=m,E=void 0,D=void 0,F=void 0, +M=void 0,N=void 0,G=void 0,H=void 0,K=void 0,Z=void 0,D=x[C[w]].x,F=x[C[w]].y,M=x[C[A]].x,N=x[C[A]].y,G=x[C[z]].x,H=x[C[z]].y;if(1.0E-10>(M-D)*(H-F)-(N-F)*(G-D))x=!1;else{for(E=0;E=0&&U>=0&&X>=0){x=!1; +break a}}x=!0}}if(x){k.push([b[m[t]],b[m[u]],b[m[v]]]);n.push([m[t],m[u],m[v]]);t=u;for(v=u+1;v0;)this.smooth(b)}; -THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n,t){var v=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){v.vertexColors=[];for(var o,u,w,x=0;x<4;x++){w=t[x];o=new THREE.Color;o.setRGB(0,0,0);for(var y=0;y>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,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function u(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function p(e){var c, -f,k;c=h(b,e);f=h(b,e+N);k=h(b,e+G);e=t(b,e+H);C.faces.push(new THREE.Face3(c,f,k,null,null,C.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+N);k=h(b,e+G);m=t(b,e+H);o=h(b,e+K);p=h(b,e+Z);e=h(b,e+L);m=C.materials[m];var v=F[p*3],u=F[p*3+1];p=F[p*3+2];var w=F[e*3],x=F[e*3+1],e=F[e*3+2];C.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(F[o*3],F[o*3+1],F[o*3+2]),new THREE.Vector3(v,u,p),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+U);m=h(b, -e+Y);e=t(b,e+X);C.faces.push(new THREE.Face4(c,f,k,m,null,null,C.materials[e]))}function A(e){var c,f,k,m,p,v,u,w;c=h(b,e);f=h(b,e+P);k=h(b,e+U);m=h(b,e+Y);p=t(b,e+X);v=h(b,e+o);u=h(b,e+ea);w=h(b,e+R);e=h(b,e+pa);p=C.materials[p];var x=F[u*3],V=F[u*3+1];u=F[u*3+2];var y=F[w*3],O=F[w*3+1];w=F[w*3+2];var z=F[e*3],A=F[e*3+1],e=F[e*3+2];C.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(F[v*3],F[v*3+1],F[v*3+2]),new THREE.Vector3(x,V,u),new THREE.Vector3(y,O,w),new THREE.Vector3(z,A,e)],null,p))} -function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+fa);k=h(b,e+ma);e=M[c*2];m=M[c*2+1];c=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(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function y(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+da);k=h(b,e+la);m=h(b,e+ga);e=M[c*2];o=M[c*2+1];c=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(e,o));u.push(new THREE.UV(c,p));u.push(new THREE.UV(f, -k));u.push(new THREE.UV(v,m));t.push(u)}var C=this,E=0,D,F=[],M=[],N,G,H,K,Z,L,P,U,Y,X,o,ea,R,pa,fa,ma,da,la,ga,$,ca,aa,ha,ka,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,e);D={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), +THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=v(b,e),h=v(b,e+1),k=v(b,e+2),m=v(b,e+3),n=(m<<1&255|k>>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,e){var c=v(b,e),f=v(b,e+1),k=v(b,e+2);return(v(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=v(b,e);return(v(b,e+1)<<8)+c}function u(b,e){var c=v(b,e);return c>127?c-256:c}function v(b,e){return b.charCodeAt(e)&255}function p(e){var c, +f,k;c=h(b,e);f=h(b,e+N);k=h(b,e+G);e=t(b,e+H);C.faces.push(new THREE.Face3(c,f,k,null,null,C.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+N);k=h(b,e+G);m=t(b,e+H);o=h(b,e+K);p=h(b,e+Z);e=h(b,e+L);m=C.materials[m];var w=F[p*3],u=F[p*3+1];p=F[p*3+2];var v=F[e*3],x=F[e*3+1],e=F[e*3+2];C.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(F[o*3],F[o*3+1],F[o*3+2]),new THREE.Vector3(w,u,p),new THREE.Vector3(v,x,e)],null,m))}function w(e){var c,f,k,m;c=h(b,e);f=h(b,e+P);k=h(b,e+U);m=h(b, +e+Y);e=t(b,e+X);C.faces.push(new THREE.Face4(c,f,k,m,null,null,C.materials[e]))}function A(e){var c,f,k,m,p,w,u,v;c=h(b,e);f=h(b,e+P);k=h(b,e+U);m=h(b,e+Y);p=t(b,e+X);w=h(b,e+o);u=h(b,e+ea);v=h(b,e+R);e=h(b,e+pa);p=C.materials[p];var x=F[u*3],V=F[u*3+1];u=F[u*3+2];var y=F[v*3],O=F[v*3+1];v=F[v*3+2];var z=F[e*3],A=F[e*3+1],e=F[e*3+2];C.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(F[w*3],F[w*3+1],F[w*3+2]),new THREE.Vector3(x,V,u),new THREE.Vector3(y,O,v),new THREE.Vector3(z,A,e)],null,p))} +function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+fa);k=h(b,e+ma);e=M[c*2];m=M[c*2+1];c=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(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function y(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+da);k=h(b,e+la);m=h(b,e+ga);e=M[c*2];o=M[c*2+1];c=M[f*2];p=M[f*2+1];f=M[k*2];var t=C.faceVertexUvs[0];k=M[k*2+1];var w=M[m*2];m=M[m*2+1];var u=[];u.push(new THREE.UV(e,o));u.push(new THREE.UV(c,p));u.push(new THREE.UV(f, +k));u.push(new THREE.UV(w,m));t.push(u)}var C=this,E=0,D,F=[],M=[],N,G,H,K,Z,L,P,U,Y,X,o,ea,R,pa,fa,ma,da,la,ga,$,ca,aa,ha,ka,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,e);D={signature:b.substr(E,8),header_bytes:v(b,E+8),vertex_coordinate_bytes:v(b,E+9),normal_coordinate_bytes:v(b,E+10),uv_coordinate_bytes:v(b,E+11),vertex_index_bytes:v(b,E+12),normal_index_bytes:v(b,E+13),uv_index_bytes:v(b,E+14),material_index_bytes:v(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+=D.header_bytes;N=D.vertex_index_bytes;G=D.vertex_index_bytes*2;H=D.vertex_index_bytes*3;K=D.vertex_index_bytes*3+D.material_index_bytes;Z=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;L=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes* 2;P=D.vertex_index_bytes;U=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;X=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;R=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;pa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;fa=D.uv_index_bytes;ma=D.uv_index_bytes*2;da=D.uv_index_bytes;la=D.uv_index_bytes*2;ga=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes; sa=D.vertex_index_bytes*4+D.material_index_bytes;$=D.ntri_flat*e;ca=D.ntri_smooth*(e+D.normal_index_bytes*3);aa=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ha=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ka=D.nquad_flat*sa;e=D.nquad_smooth*(sa+D.normal_index_bytes*4);sa=D.nquad_flat_uv*(sa+D.uv_index_bytes*4);E+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e=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?c[1].substr(0,e):"0";c[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;fe){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14, -e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b= -{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=sa[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color= -f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};Z.prototype.parse=function(b){for(var e=0;e=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e=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?c[1].substr(0,e):"0";c[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;fe){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};K.prototype.create=function(){var b={},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof H)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source== +this.effect.surface.sid&&(f=sa[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};Z.prototype.parse=function(b){for(var e= +0;e=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(N,Z);object.name=v;object.position.set(D[0],D[1],D[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;R.scene.add(object);R.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b)); -if(E.castsShadow)b=new THREE.ShadowVolume(N),R.scene.add(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},R.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[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,R.scene.add(object),R.objects[v]=object,R.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},R.triggers[object.name]=b)}function t(b){return function(c){R.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function u(b){return function(e){R.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-X},R);e.onLoadProgress();Y==0&&X==0&&c(R)}var p, -x,v,A,z,y,C,E,D,F,M,N,G,H,K,Z,L,P,U,Y,X,o,ea,R;P=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;X=Y=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in P.objects)if(E=P.objects[v],E.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;F=P.transform.rotation;var pa=P.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);F&&R.scene.rotation.set(F[0], -F[1],F[2]);pa&&R.scene.scale.set(pa[0],pa[1],pa[2]);(b||F||pa)&&R.scene.updateMatrix()}b=function(){X-=1;w();e.onLoadComplete()};for(z in P.cameras)F=P.cameras[z],F.type=="perspective"?G=new THREE.PerspectiveCamera(F.fov,F.aspect,F.near,F.far):F.type=="ortho"&&(G=new THREE.OrthographicCamera(F.left,F.right,F.top,F.bottom,F.near,F.far)),D=F.position,F=F.target,G.position.set(D[0],D[1],D[2]),G.target=new THREE.Vector3(F[0],F[1],F[2]),R.cameras[z]=G;for(A in P.lights)z=P.lights[A],G=z.color!==void 0? +THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(w in P.objects)if(!R.objects[w])if(E=P.objects[w],E.geometry!==void 0){if(N=R.geometries[E.geometry]){var b=!1;Z=[];for(fa=0;fa1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(N,Z);object.name=w;object.position.set(D[0],D[1],D[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;R.scene.add(object);R.objects[w]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b)); +if(E.castsShadow)b=new THREE.ShadowVolume(N),R.scene.add(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},R.triggers[object.name]=b)}}else D=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(D[0],D[1],D[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,R.scene.add(object),R.objects[w]=object,R.empties[w]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},R.triggers[object.name]=b)}function t(b){return function(c){R.geometries[b]=c;n();Y-=1;e.onLoadComplete();v()}}function u(b){return function(e){R.geometries[b]=e}}function v(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-X},R);e.onLoadProgress();Y==0&&X==0&&c(R)}var p, +x,w,A,z,y,C,E,D,F,M,N,G,H,K,Z,L,P,U,Y,X,o,ea,R;P=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;X=Y=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in P.objects)if(E=P.objects[w],E.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(P.transform){b=P.transform.position;F=P.transform.rotation;var pa=P.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);F&&R.scene.rotation.set(F[0], +F[1],F[2]);pa&&R.scene.scale.set(pa[0],pa[1],pa[2]);(b||F||pa)&&R.scene.updateMatrix()}b=function(){X-=1;v();e.onLoadComplete()};for(z in P.cameras)F=P.cameras[z],F.type=="perspective"?G=new THREE.PerspectiveCamera(F.fov,F.aspect,F.near,F.far):F.type=="ortho"&&(G=new THREE.OrthographicCamera(F.left,F.right,F.top,F.bottom,F.near,F.far)),D=F.position,F=F.target,G.position.set(D[0],D[1],D[2]),G.target=new THREE.Vector3(F[0],F[1],F[2]),R.cameras[z]=G;for(A in P.lights)z=P.lights[A],G=z.color!==void 0? z.color:16777215,F=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,L=new THREE.DirectionalLight(G,F),L.position.set(D[0],D[1],D[2]),L.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,L=new THREE.PointLight(G,F,d),L.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(L=new THREE.AmbientLight(G)),R.scene.add(L),R.lights[A]=L;for(y in P.fogs)A=P.fogs[y],A.type=="linear"?H=new THREE.Fog(0,A.near,A.far):A.type=="exp2"&&(H=new THREE.FogExp2(0,A.density)),F=A.color, H.color.setRGB(F[0],F[1],F[2]),R.fogs[y]=H;if(R.cameras&&P.defaults.camera)R.currentCamera=R.cameras[P.defaults.camera];if(R.fogs&&P.defaults.fog)R.scene.fog=R.fogs[P.defaults.fog];F=P.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(F[0],F[1],F[2]);R.bgColorAlpha=P.defaults.bgalpha;for(p in P.geometries)if(y=P.geometries[p],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(p in P.geometries)y=P.geometries[p],y.type=="cube"?(N=new THREE.CubeGeometry(y.width,y.height, y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),R.geometries[p]=N):y.type=="plane"?(N=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),R.geometries[p]=N):y.type=="sphere"?(N=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),R.geometries[p]=N):y.type=="cylinder"?(N=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),R.geometries[p]=N):y.type=="torus"?(N=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR, @@ -642,24 +643,24 @@ R.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.v THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader; THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,m=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,m,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)}; THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,m=0;m>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=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 v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- -1);for(var A,z,y,C,E,D;p0&&(this.field[y+A]+=C)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,u=this.size,w=this.yd,p=this.zd,x=this.field,v=u*Math.sqrt(b/c);v>u&&(v=u);for(h=0;h0)for(k=0;kw&&(A=w);for(k=0;k0){t=k*p;for(h=0;hsize&&(dist=size);for(m=0;m0){t=zd*m;for(k=0;kthis.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 w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size- +1);for(var A,z,y,C,E,D;p0&&(this.field[y+A]+=C)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,u=this.size,v=this.yd,p=this.zd,x=this.field,w=u*Math.sqrt(b/c);w>u&&(w=u);for(h=0;h0)for(k=0;kv&&(A=v);for(k=0;k0){t=k*p;for(h=0;hsize&&(dist=size);for(m=0;m0){t=zd*m;for(k=0;kk?this.hits.push(h):this.hits.unshift(h),k=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,k=0;k=n*h))return Number.MAX_VALUE;m/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(m);n.addSelf(b.origin);Math.abs(k.x)> Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=n.y-c.y,k=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,k=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(k.y)>Math.abs(k.z)?(b=n.x-c.x,k=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,k=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=k*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*=k*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return m}; 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}; @@ -699,9 +700,9 @@ f;if(ec.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 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.PerspectiveCamera,k=new THREE.PerspectiveCamera,m=new THREE.Matrix4,n=new THREE.Matrix4,t,u,w;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.PerspectiveCamera(53,1,1,1E4);v.position.z= +if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.PerspectiveCamera,k=new THREE.PerspectiveCamera,m=new THREE.Matrix4,n=new THREE.Matrix4,t,u,v;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.PerspectiveCamera(53,1,1,1E4);w.position.z= 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},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 A=new THREE.Scene;A.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.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,D=E*u/125,F=u*Math.tan(w*Math.PI/360),M;m.n14=E;n.n14=-E;E=-F*t+D;M=F*t+D;C.n11=2*u/(M-E);C.n13=(M+E)/(M-E);h.projectionMatrix=C.clone();E=-F*t-D;M=F*t-D;C.n11=2*u/(M-E);C.n13= -(M+E)/(M-E);k.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,p,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,v)}}; +var A=new THREE.Scene;A.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||u!==e.near||v!==e.fov){t=e.aspect;u=e.near;v=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,D=E*u/125,F=u*Math.tan(v*Math.PI/360),M;m.n14=E;n.n14=-E;E=-F*t+D;M=F*t+D;C.n11=2*u/(M-E);C.n13=(M+E)/(M-E);h.projectionMatrix=C.clone();E=-F*t-D;M=F*t-D;C.n11=2*u/(M-E);C.n13= +(M+E)/(M-E);k.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,p,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,w)}}; 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,k,m=new THREE.PerspectiveCamera;m.target=new THREE.Vector3(0,0,0);var n=new THREE.PerspectiveCamera;n.target=new THREE.Vector3(0,0,0);c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far= e.far;m.updateProjectionMatrix();m.position.copy(e.position);m.target.copy(e.target);m.translateX(c.separation);m.lookAt(m.target);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.copy(e.target);n.translateX(-c.separation);n.lookAt(n.target);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}}; diff --git a/build/custom/ThreeExtras.js b/build/custom/ThreeExtras.js index 51d0e57e9aed5f323d199aa0398e5b79d9e8a8cd..2dbb7fad1aad51145263a607b7b5680806fc68c1 100644 --- a/build/custom/ThreeExtras.js +++ b/build/custom/ThreeExtras.js @@ -193,7 +193,7 @@ b(w,n[x],p.b,n[B],p,["123","12","2","23"]),b(w,n[B],p.c,n[D],p,["123","23","3"," c){I[a]===void 0&&(I[a]={});I[a][c]=null};for(t in y)p=y[t],B=t.split("_"),u=B[0],B=B[1],l(u,[u,B]),l(B,[u,B]),w=p[0],x=p[1],n(u,w),x?n(u,x):n(u,w),n(B,w),x?n(B,x):n(B,w);l=new THREE.Vector3;n=new THREE.Vector3;t=0;for(u=k.length;t=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4;m.skinningMatrix.multiply(m.world,v);m.weights=[]; -for(v=0;v1){l=new THREE.MeshFaceMaterial;for(j=0;j1?b[1].substr(0,c):"0";b[1].length=0,g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;ec){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14, -c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a= -{},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color= -e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var c=0;c=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c=0){v=l.invBindMatrices[p];m.invBindMatrix=v;m.skinningMatrix=new THREE.Matrix4; +m.skinningMatrix.multiply(m.world,v);m.weights=[];for(v=0;v1){l=new THREE.MeshFaceMaterial;for(j=0;j1?b[1].substr(0,c):"0";b[1].length=0, +g=f.indexOf("(")>=0,k;if(h)e=f.split("."),f=e.shift(),e.shift();else if(g){k=f.split("(");f=k.shift();for(e=0;ec){p=m.output[l];break}g=p!==void 0?p instanceof THREE.Matrix4?g.multiply(g,p):g.multiply(g,k.matrix):g.multiply(g,k.matrix)}else g=g.multiply(g,k.matrix);c=g;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};H.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof I)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source== +this.effect.surface.sid&&(e=Y[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(ja+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=ka;return this.material=new THREE.MeshLambertMaterial(a)};J.prototype.parse=function(a){for(var c= +0;c=0,e=a.indexOf("(")>=0,f,h;if(b)c=a.split("."),a=c.shift(),h=c.shift();else if(e){f=a.split("(");a=f.shift();for(c=0;c