提交 78fb8ac6 编写于 作者: M Mr.doob

Applied @alteredq's sprite removal bugfix.

上级 1c26dd25
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -24,18 +24,18 @@ THREE.Matrix3.prototype={transpose:function(){var b,e=this.m;b=e[1];e[1]=e[3];e[ ...@@ -24,18 +24,18 @@ THREE.Matrix3.prototype={transpose:function(){var b,e=this.m;b=e[1];e[1]=e[3];e[
THREE.Matrix4.prototype={set:function(b,e,d,f,h,i,g,j,k,o,p,n,q,w,y,D){this.n11=b;this.n12=e;this.n13=d;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=k;this.n32=o;this.n33=p;this.n34=n;this.n41=q;this.n42=w;this.n43=y;this.n44=D;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,e,d){var f=THREE.Matrix4.__v1, THREE.Matrix4.prototype={set:function(b,e,d,f,h,i,g,j,k,o,p,n,q,w,y,D){this.n11=b;this.n12=e;this.n13=d;this.n14=f;this.n21=h;this.n22=i;this.n23=g;this.n24=j;this.n31=k;this.n32=o;this.n33=p;this.n34=n;this.n41=q;this.n42=w;this.n43=y;this.n44=D;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,e,d){var f=THREE.Matrix4.__v1,
h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,e).normalize();if(i.length()===0)i.z=1;f.cross(d,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(d,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var e=b.x,d=b.y,f=b.z,h=1/(this.n41*e+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*e+this.n12*d+this.n13*f+this.n14)*h;b.y=(this.n21*e+this.n22*d+this.n23* h=THREE.Matrix4.__v2,i=THREE.Matrix4.__v3;i.sub(b,e).normalize();if(i.length()===0)i.z=1;f.cross(d,i).normalize();f.length()===0&&(i.x+=1.0E-4,f.cross(d,i).normalize());h.cross(i,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=i.x;this.n21=f.y;this.n22=h.y;this.n23=i.y;this.n31=f.z;this.n32=h.z;this.n33=i.z;return this},multiplyVector3:function(b){var e=b.x,d=b.y,f=b.z,h=1/(this.n41*e+this.n42*d+this.n43*f+this.n44);b.x=(this.n11*e+this.n12*d+this.n13*f+this.n14)*h;b.y=(this.n21*e+this.n22*d+this.n23*
f+this.n24)*h;b.z=(this.n31*e+this.n32*d+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var e=b.x,d=b.y,f=b.z,h=b.w;b.x=this.n11*e+this.n12*d+this.n13*f+this.n14*h;b.y=this.n21*e+this.n22*d+this.n23*f+this.n24*h;b.z=this.n31*e+this.n32*d+this.n33*f+this.n34*h;b.w=this.n41*e+this.n42*d+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var e=b.x,d=b.y,f=b.z;b.x=e*this.n11+d*this.n12+f*this.n13;b.y=e*this.n21+d*this.n22+f*this.n23;b.z=e*this.n31+d*this.n32+f*this.n33;b.normalize(); f+this.n24)*h;b.z=(this.n31*e+this.n32*d+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var e=b.x,d=b.y,f=b.z,h=b.w;b.x=this.n11*e+this.n12*d+this.n13*f+this.n14*h;b.y=this.n21*e+this.n22*d+this.n23*f+this.n24*h;b.z=this.n31*e+this.n32*d+this.n33*f+this.n34*h;b.w=this.n41*e+this.n42*d+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var e=b.x,d=b.y,f=b.z;b.x=e*this.n11+d*this.n12+f*this.n13;b.y=e*this.n21+d*this.n22+f*this.n23;b.z=e*this.n31+d*this.n32+f*this.n33;b.normalize();
return b},crossVector:function(b){var e=new THREE.Vector4;e.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;e.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;e.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;e.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return e},multiply:function(b,e){var d=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,o=b.n24,p=b.n31,n=b.n32,q=b.n33,w=b.n34,y=b.n41,D=b.n42,z=b.n43,C=b.n44,ga=e.n11,M=e.n12,O=e.n13,F=e.n14,v=e.n21,$=e.n22, return b},crossVector:function(b){var e=new THREE.Vector4;e.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;e.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;e.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;e.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return e},multiply:function(b,e){var d=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,o=b.n24,p=b.n31,n=b.n32,q=b.n33,w=b.n34,y=b.n41,D=b.n42,z=b.n43,C=b.n44,ga=e.n11,aa=e.n12,O=e.n13,F=e.n14,v=e.n21,M=e.n22,
B=e.n23,aa=e.n24,K=e.n31,na=e.n32,U=e.n33,R=e.n34,c=e.n41,ha=e.n42,S=e.n43,ka=e.n44;this.n11=d*ga+f*v+h*K+i*c;this.n12=d*M+f*$+h*na+i*ha;this.n13=d*O+f*B+h*U+i*S;this.n14=d*F+f*aa+h*R+i*ka;this.n21=g*ga+j*v+k*K+o*c;this.n22=g*M+j*$+k*na+o*ha;this.n23=g*O+j*B+k*U+o*S;this.n24=g*F+j*aa+k*R+o*ka;this.n31=p*ga+n*v+q*K+w*c;this.n32=p*M+n*$+q*na+w*ha;this.n33=p*O+n*B+q*U+w*S;this.n34=p*F+n*aa+q*R+w*ka;this.n41=y*ga+D*v+z*K+C*c;this.n42=y*M+D*$+z*na+C*ha;this.n43=y*O+D*B+z*U+C*S;this.n44=y*F+D*aa+z*R+C* B=e.n23,$=e.n24,K=e.n31,na=e.n32,U=e.n33,R=e.n34,c=e.n41,ha=e.n42,S=e.n43,ka=e.n44;this.n11=d*ga+f*v+h*K+i*c;this.n12=d*aa+f*M+h*na+i*ha;this.n13=d*O+f*B+h*U+i*S;this.n14=d*F+f*$+h*R+i*ka;this.n21=g*ga+j*v+k*K+o*c;this.n22=g*aa+j*M+k*na+o*ha;this.n23=g*O+j*B+k*U+o*S;this.n24=g*F+j*$+k*R+o*ka;this.n31=p*ga+n*v+q*K+w*c;this.n32=p*aa+n*M+q*na+w*ha;this.n33=p*O+n*B+q*U+w*S;this.n34=p*F+n*$+q*R+w*ka;this.n41=y*ga+D*v+z*K+C*c;this.n42=y*aa+D*M+z*na+C*ha;this.n43=y*O+D*B+z*U+C*S;this.n44=y*F+D*$+z*R+C*ka;
ka;return this},multiplyToArray:function(b,e,d){this.multiply(b,e);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*= return this},multiplyToArray:function(b,e,d){this.multiply(b,e);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;
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,e=this.n12,d=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,k=this.n31,o=this.n32,p=this.n33,n=this.n34,q=this.n41,w=this.n42,y=this.n43,D=this.n44;return f*g*o*q-d*j*o*q-f*i*p*q+e*j*p*q+d*i*n*q-e*g*n*q-f*g*k*w+d*j*k*w+f*h*p*w-b*j*p*w-d*h*n*w+b*g*n*w+f*i*k*y-e*j*k*y-f*h*o*y+b*j*o*y+e*h*n*y-b*i*n*y-d*i*k*D+e*g*k*D+d*h*o*D-b*g*o*D-e*h*p*D+b*i*p*D}, 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,e=this.n12,d=this.n13,f=this.n14,h=this.n21,i=this.n22,g=this.n23,j=this.n24,k=this.n31,o=this.n32,p=this.n33,n=this.n34,q=this.n41,w=this.n42,y=this.n43,D=this.n44;return f*g*o*q-d*j*o*q-f*i*p*q+e*j*p*q+d*i*n*q-e*g*n*q-f*g*k*w+d*j*k*w+f*h*p*w-b*j*p*w-d*h*n*w+b*g*n*w+f*i*k*y-e*j*k*y-f*h*o*y+b*j*o*y+e*h*n*y-b*i*n*y-d*i*k*D+e*g*k*D+d*h*o*D-b*g*o*D-e*h*p*D+b*i*p*D},transpose:function(){var b;
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=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.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.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[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,e){b[e]=this.n11;b[e+1]=this.n21;b[e+2]=this.n31;b[e+3]=this.n41;b[e+4]=this.n12;b[e+5]=this.n22;b[e+6]=this.n32;b[e+7]=this.n42;b[e+8]=this.n13;b[e+9]=this.n23;b[e+10]=this.n33;b[e+11]=this.n43;b[e+12]=this.n14;b[e+13]=this.n24;b[e+14]=this.n34; 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,e){b[e]=this.n11;b[e+1]=this.n21;b[e+2]=this.n31;b[e+3]=this.n41;b[e+4]=this.n12;b[e+5]=this.n22;b[e+6]=this.n32;b[e+7]=this.n42;b[e+8]=this.n13;b[e+9]=this.n23;b[e+10]=this.n33;b[e+11]=this.n43;b[e+12]=this.n14;b[e+13]=this.n24;b[e+14]=this.n34;b[e+15]=this.n44;return b},
b[e+15]=this.n44;return b},setTranslation:function(b,e,d){this.set(1,0,0,b,0,1,0,e,0,0,1,d,0,0,0,1);return this},setScale:function(b,e,d){this.set(b,0,0,0,0,e,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},setRotationY:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},setRotationZ:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,-b,0,0,b,e,0,0, setTranslation:function(b,e,d){this.set(1,0,0,b,0,1,0,e,0,0,1,d,0,0,0,1);return this},setScale:function(b,e,d){this.set(b,0,0,0,0,e,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,e,-b,0,0,b,e,0,0,0,0,1);return this},setRotationY:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,0,b,0,0,1,0,0,-b,0,e,0,0,0,0,1);return this},setRotationZ:function(b){var e=Math.cos(b),b=Math.sin(b);this.set(e,-b,0,0,b,e,0,0,0,0,1,0,0,0,0,1);return this},
0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,e){var d=Math.cos(e),f=Math.sin(e),h=1-d,i=b.x,g=b.y,j=b.z,k=h*i,o=h*g;this.set(k*i+d,k*g-f*j,k*j+f*g,0,k*g+f*j,o*g+d,o*j-f*i,0,k*j-f*g,o*j+f*i,h*j*j+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX= setRotationAxis:function(b,e){var d=Math.cos(e),f=Math.sin(e),h=1-d,i=b.x,g=b.y,j=b.z,k=h*i,o=h*g;this.set(k*i+d,k*g-f*j,k*j+f*g,0,k*g+f*j,o*g+d,o*j-f*i,0,k*j-f*g,o*j+f*i,h*j*j+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,
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,e){var d=b.x,f=b.y,h=b.z,i=Math.cos(d),d=Math.sin(d),g=Math.cos(f),f=Math.sin(f),j=Math.cos(h),h=Math.sin(h);switch(e){case "YXZ":var k= 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,e){var d=b.x,f=b.y,h=b.z,i=Math.cos(d),d=Math.sin(d),g=Math.cos(f),f=Math.sin(f),j=Math.cos(h),h=Math.sin(h);switch(e){case "YXZ":var k=g*j,o=g*h,p=f*j,n=f*h;
g*j,o=g*h,p=f*j,n=f*h;this.n11=k+n*d;this.n12=p*d-o;this.n13=i*f;this.n21=i*h;this.n22=i*j;this.n23=-d;this.n31=o*d-p;this.n32=n+k*d;this.n33=i*g;break;case "ZXY":k=g*j;o=g*h;p=f*j;n=f*h;this.n11=k-n*d;this.n12=-i*h;this.n13=p+o*d;this.n21=o+p*d;this.n22=i*j;this.n23=n-k*d;this.n31=-i*f;this.n32=d;this.n33=i*g;break;case "ZYX":k=i*j;o=i*h;p=d*j;n=d*h;this.n11=g*j;this.n12=p*f-o;this.n13=k*f+n;this.n21=g*h;this.n22=n*f+k;this.n23=o*f-p;this.n31=-f;this.n32=d*g;this.n33=i*g;break;case "YZX":k=i*g;o= this.n11=k+n*d;this.n12=p*d-o;this.n13=i*f;this.n21=i*h;this.n22=i*j;this.n23=-d;this.n31=o*d-p;this.n32=n+k*d;this.n33=i*g;break;case "ZXY":k=g*j;o=g*h;p=f*j;n=f*h;this.n11=k-n*d;this.n12=-i*h;this.n13=p+o*d;this.n21=o+p*d;this.n22=i*j;this.n23=n-k*d;this.n31=-i*f;this.n32=d;this.n33=i*g;break;case "ZYX":k=i*j;o=i*h;p=d*j;n=d*h;this.n11=g*j;this.n12=p*f-o;this.n13=k*f+n;this.n21=g*h;this.n22=n*f+k;this.n23=o*f-p;this.n31=-f;this.n32=d*g;this.n33=i*g;break;case "YZX":k=i*g;o=i*f;p=d*g;n=d*f;this.n11=
i*f;p=d*g;n=d*f;this.n11=g*j;this.n12=n-k*h;this.n13=p*h+o;this.n21=h;this.n22=i*j;this.n23=-d*j;this.n31=-f*j;this.n32=o*h+p;this.n33=k-n*h;break;case "XZY":k=i*g;o=i*f;p=d*g;n=d*f;this.n11=g*j;this.n12=-h;this.n13=f*j;this.n21=k*h+n;this.n22=i*j;this.n23=o*h-p;this.n31=p*h-o;this.n32=d*j;this.n33=n*h+k;break;default:k=i*j,o=i*h,p=d*j,n=d*h,this.n11=g*j,this.n12=-g*h,this.n13=f,this.n21=o+p*f,this.n22=k-n*f,this.n23=-d*g,this.n31=n-k*f,this.n32=p+o*f,this.n33=i*g}return this},setRotationFromQuaternion:function(b){var e= g*j;this.n12=n-k*h;this.n13=p*h+o;this.n21=h;this.n22=i*j;this.n23=-d*j;this.n31=-f*j;this.n32=o*h+p;this.n33=k-n*h;break;case "XZY":k=i*g;o=i*f;p=d*g;n=d*f;this.n11=g*j;this.n12=-h;this.n13=f*j;this.n21=k*h+n;this.n22=i*j;this.n23=o*h-p;this.n31=p*h-o;this.n32=d*j;this.n33=n*h+k;break;default:k=i*j,o=i*h,p=d*j,n=d*h,this.n11=g*j,this.n12=-g*h,this.n13=f,this.n21=o+p*f,this.n22=k-n*f,this.n23=-d*g,this.n31=n-k*f,this.n32=p+o*f,this.n33=i*g}return this},setRotationFromQuaternion:function(b){var e=
b.x,d=b.y,f=b.z,h=b.w,i=e+e,g=d+d,j=f+f,b=e*i,k=e*g;e*=j;var o=d*g;d*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(o+f);this.n12=k-h;this.n13=e+g;this.n21=k+h;this.n22=1-(b+f);this.n23=d-i;this.n31=e-g;this.n32=d+i;this.n33=1-(b+o);return this},scale:function(b){var e=b.x,d=b.y,b=b.z;this.n11*=e;this.n12*=d;this.n13*=b;this.n21*=e;this.n22*=d;this.n23*=b;this.n31*=e;this.n32*=d;this.n33*=b;this.n41*=e;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34}, b.x,d=b.y,f=b.z,h=b.w,i=e+e,g=d+d,j=f+f,b=e*i,k=e*g;e*=j;var o=d*g;d*=j;f*=j;i*=h;g*=h;h*=j;this.n11=1-(o+f);this.n12=k-h;this.n13=e+g;this.n21=k+h;this.n22=1-(b+f);this.n23=d-i;this.n31=e-g;this.n32=d+i;this.n33=1-(b+o);return this},scale:function(b){var e=b.x,d=b.y,b=b.z;this.n11*=e;this.n12*=d;this.n13*=b;this.n21*=e;this.n22*=d;this.n23*=b;this.n31*=e;this.n32*=d;this.n33*=b;this.n41*=e;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
extractRotation:function(b,e){var d=1/e.x,f=1/e.y,h=1/e.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}}; extractRotation:function(b,e){var d=1/e.x,f=1/e.y,h=1/e.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=b.n23*h;this.n33=b.n33*h}};
THREE.Matrix4.makeInvert=function(b,e){var d=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,o=b.n24,p=b.n31,n=b.n32,q=b.n33,w=b.n34,y=b.n41,D=b.n42,z=b.n43,C=b.n44;e===void 0&&(e=new THREE.Matrix4);e.n11=k*w*D-o*q*D+o*n*z-j*w*z-k*n*C+j*q*C;e.n12=i*q*D-h*w*D-i*n*z+f*w*z+h*n*C-f*q*C;e.n13=h*o*D-i*k*D+i*j*z-f*o*z-h*j*C+f*k*C;e.n14=i*k*n-h*o*n-i*j*q+f*o*q+h*j*w-f*k*w;e.n21=o*q*y-k*w*y-o*p*z+g*w*z+k*p*C-g*q*C;e.n22=h*w*y-i*q*y+i*p*z-d*w*z-h*p*C+d*q*C;e.n23=i*k*y-h*o*y-i*g*z+d*o*z+h*g*C-d*k*C;e.n24= THREE.Matrix4.makeInvert=function(b,e){var d=b.n11,f=b.n12,h=b.n13,i=b.n14,g=b.n21,j=b.n22,k=b.n23,o=b.n24,p=b.n31,n=b.n32,q=b.n33,w=b.n34,y=b.n41,D=b.n42,z=b.n43,C=b.n44;e===void 0&&(e=new THREE.Matrix4);e.n11=k*w*D-o*q*D+o*n*z-j*w*z-k*n*C+j*q*C;e.n12=i*q*D-h*w*D-i*n*z+f*w*z+h*n*C-f*q*C;e.n13=h*o*D-i*k*D+i*j*z-f*o*z-h*j*C+f*k*C;e.n14=i*k*n-h*o*n-i*j*q+f*o*q+h*j*w-f*k*w;e.n21=o*q*y-k*w*y-o*p*z+g*w*z+k*p*C-g*q*C;e.n22=h*w*y-i*q*y+i*p*z-d*w*z-h*p*C+d*q*C;e.n23=i*k*y-h*o*y-i*g*z+d*o*z+h*g*C-d*k*C;e.n24=
...@@ -61,9 +61,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,e,d;b=0;for(e=this.f ...@@ -61,9 +61,9 @@ THREE.Geometry.prototype={computeCentroids:function(){var b,e,d;b=0;for(e=this.f
d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var e,d,f,h,i,g,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);e=0;for(d=i.vertexNormals.length;e<d;e++)j.addSelf(i.vertexNormals[e]);j.divideScalar(3)}else e=this.vertices[i.a],d=this.vertices[i.b],g=this.vertices[i.c],j.sub(g.position,d.position),k.sub(e.position,d.position),j.crossSelf(k);j.isZero()|| d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var e,d,f,h,i,g,j=new THREE.Vector3,k=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(b&&i.vertexNormals.length){j.set(0,0,0);e=0;for(d=i.vertexNormals.length;e<d;e++)j.addSelf(i.vertexNormals[e]);j.divideScalar(3)}else e=this.vertices[i.a],d=this.vertices[i.b],g=this.vertices[i.c],j.sub(g.position,d.position),k.sub(e.position,d.position),j.crossSelf(k);j.isZero()||
j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,e,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(e=this.vertices.length;b<e;b++)f[b]=new THREE.Vector3;b=0;for(e=this.faces.length;b<e;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f= j.normalize();i.normal.copy(j)}},computeVertexNormals:function(){var b,e,d,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(e=this.vertices.length;b<e;b++)f[b]=new THREE.Vector3;b=0;for(e=this.faces.length;b<e;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
this.__tmpVertices;b=0;for(e=this.vertices.length;b<e;b++)f[b].set(0,0,0)}b=0;for(e=this.faces.length;b<e;b++)d=this.faces[b],d instanceof THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(e=this.vertices.length;b<e;b++)f[b].normalize();b=0;for(e=this.faces.length;b<e;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]), this.__tmpVertices;b=0;for(e=this.vertices.length;b<e;b++)f[b].set(0,0,0)}b=0;for(e=this.faces.length;b<e;b++)d=this.faces[b],d instanceof THREE.Face3?(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(f[d.a].addSelf(d.normal),f[d.b].addSelf(d.normal),f[d.c].addSelf(d.normal),f[d.d].addSelf(d.normal));b=0;for(e=this.vertices.length;b<e;b++)f[b].normalize();b=0;for(e=this.faces.length;b<e;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(f[d.a]),
d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,c,e,d,f,h,i){j=b.vertices[c].position;k=b.vertices[e].position;o=b.vertices[d].position;p=g[f];n=g[h];q=g[i];w=k.x-j.x;y=o.x-j.x;D=k.y-j.y;z=o.y-j.y;C=k.z-j.z;ga=o.z-j.z;M=n.u-p.u;O=q.u-p.u;F=n.v-p.v;v=q.v-p.v;$=1/(M*v-O*F);na.set((v*w-F*y)* d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(f[d.a]),d.vertexNormals[1].copy(f[d.b]),d.vertexNormals[2].copy(f[d.c]),d.vertexNormals[3].copy(f[d.d]))},computeTangents:function(){function b(b,c,e,d,f,h,i){j=b.vertices[c].position;k=b.vertices[e].position;o=b.vertices[d].position;p=g[f];n=g[h];q=g[i];w=k.x-j.x;y=o.x-j.x;D=k.y-j.y;z=o.y-j.y;C=k.z-j.z;ga=o.z-j.z;aa=n.u-p.u;O=q.u-p.u;F=n.v-p.v;v=q.v-p.v;M=1/(aa*v-O*F);na.set((v*w-F*
$,(v*D-F*z)*$,(v*C-F*ga)*$);U.set((M*y-O*w)*$,(M*z-O*D)*$,(M*ga-O*C)*$);aa[c].addSelf(na);aa[e].addSelf(na);aa[d].addSelf(na);K[c].addSelf(U);K[e].addSelf(U);K[d].addSelf(U)}var e,d,f,h,i,g,j,k,o,p,n,q,w,y,D,z,C,ga,M,O,F,v,$,B,aa=[],K=[],na=new THREE.Vector3,U=new THREE.Vector3,R=new THREE.Vector3,c=new THREE.Vector3,ha=new THREE.Vector3;e=0;for(d=this.vertices.length;e<d;e++)aa[e]=new THREE.Vector3,K[e]=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++)i=this.faces[e],g=this.faceVertexUvs[0][e], y)*M,(v*D-F*z)*M,(v*C-F*ga)*M);U.set((aa*y-O*w)*M,(aa*z-O*D)*M,(aa*ga-O*C)*M);$[c].addSelf(na);$[e].addSelf(na);$[d].addSelf(na);K[c].addSelf(U);K[e].addSelf(U);K[d].addSelf(U)}var e,d,f,h,i,g,j,k,o,p,n,q,w,y,D,z,C,ga,aa,O,F,v,M,B,$=[],K=[],na=new THREE.Vector3,U=new THREE.Vector3,R=new THREE.Vector3,c=new THREE.Vector3,ha=new THREE.Vector3;e=0;for(d=this.vertices.length;e<d;e++)$[e]=new THREE.Vector3,K[e]=new THREE.Vector3;e=0;for(d=this.faces.length;e<d;e++)i=this.faces[e],g=this.faceVertexUvs[0][e],
i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var S=["a","b","c","d"];e=0;for(d=this.faces.length;e<d;e++){i=this.faces[e];for(f=0;f<i.vertexNormals.length;f++)ha.copy(i.vertexNormals[f]),h=i[S[f]],B=aa[h],R.copy(B),R.subSelf(ha.multiplyScalar(ha.dot(B))).normalize(),c.cross(i.vertexNormals[f],B),h=c.dot(K[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b; i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,i.b,i.d,0,1,3));var S=["a","b","c","d"];e=0;for(d=this.faces.length;e<d;e++){i=this.faces[e];for(f=0;f<i.vertexNormals.length;f++)ha.copy(i.vertexNormals[f]),h=i[S[f]],B=$[h],R.copy(B),R.subSelf(ha.multiplyScalar(ha.dot(B))).normalize(),c.cross(i.vertexNormals[f],B),h=c.dot(K[h]),h=h<0?-1:1,i.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
if(this.vertices.length>0){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 e=1,d=this.vertices.length;e<d;e++){b=this.vertices[e];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y; if(this.vertices.length>0){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 e=1,d=this.vertices.length;e<d;e++){b=this.vertices[e];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,e=0,d=this.vertices.length;e<d;e++)b=Math.max(b,this.vertices[e].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function e(b,e,d){b[e]=== else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,e=0,d=this.vertices.length;e<d;e++)b=Math.max(b,this.vertices[e].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function e(b,e,d){b[e]===
void 0?(b[e]={set:{},array:[]},b[e].set[d]=1,b[e].array.push(d)):b[e].set[d]===void 0&&(b[e].set[d]=1,b[e].array.push(d))}var d,f,h,i,g,j={};d=0;for(f=this.faces.length;d<f;d++)g=this.faces[d],g instanceof THREE.Face3?(h=b(g.a,g.b),e(j,h,d),h=b(g.b,g.c),e(j,h,d),h=b(g.a,g.c),e(j,h,d)):g instanceof THREE.Face4&&(h=b(g.b,g.d),e(j,h,d),h=b(g.a,g.b),e(j,h,d),h=b(g.a,g.d),e(j,h,d),h=b(g.b,g.c),e(j,h,d),h=b(g.c,g.d),e(j,h,d));d=0;for(f=this.edges.length;d<f;d++){g=this.edges[d];h=g.vertexIndices[0];i=g.vertexIndices[1]; void 0?(b[e]={set:{},array:[]},b[e].set[d]=1,b[e].array.push(d)):b[e].set[d]===void 0&&(b[e].set[d]=1,b[e].array.push(d))}var d,f,h,i,g,j={};d=0;for(f=this.faces.length;d<f;d++)g=this.faces[d],g instanceof THREE.Face3?(h=b(g.a,g.b),e(j,h,d),h=b(g.b,g.c),e(j,h,d),h=b(g.a,g.c),e(j,h,d)):g instanceof THREE.Face4&&(h=b(g.b,g.d),e(j,h,d),h=b(g.a,g.b),e(j,h,d),h=b(g.a,g.d),e(j,h,d),h=b(g.b,g.c),e(j,h,d),h=b(g.c,g.d),e(j,h,d));d=0;for(f=this.edges.length;d<f;d++){g=this.edges[d];h=g.vertexIndices[0];i=g.vertexIndices[1];
...@@ -143,17 +143,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c ...@@ -143,17 +143,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var e=0;e<b.children.length;e++)this.addChildRecurse(b.children[e])}; THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var e=0;e<b.children.length;e++)this.addChildRecurse(b.children[e])};
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var e=this.lights.indexOf(b);e!==-1&&this.lights.splice(e,1)}else b instanceof THREE.Sound?(e=this.sounds.indexOf(b),e!==-1&&this.sounds.splice(e,1)):b instanceof THREE.Camera||(e=this.objects.indexOf(b),e!==-1&&(this.objects.splice(e,1),this.__objectsRemoved.push(b)));for(e=0;e<b.children.length;e++)this.removeChildRecurse(b.children[e])}; THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var e=this.lights.indexOf(b);e!==-1&&this.lights.splice(e,1)}else b instanceof THREE.Sound?(e=this.sounds.indexOf(b),e!==-1&&this.sounds.splice(e,1)):b instanceof THREE.Camera||(e=this.objects.indexOf(b),e!==-1&&(this.objects.splice(e,1),this.__objectsRemoved.push(b)));for(e=0;e<b.children.length;e++)this.removeChildRecurse(b.children[e])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,e,d){this.color=new THREE.Color(b);this.near=e||1;this.far=d||1E3};THREE.FogExp2=function(b,e){this.color=new THREE.Color(b);this.density=e!==void 0?e:2.5E-4}; THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,e,d){this.color=new THREE.Color(b);this.near=e||1;this.far=d||1E3};THREE.FogExp2=function(b,e){this.color=new THREE.Color(b);this.density=e!==void 0?e:2.5E-4};
THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function e(b,e){return e.z-b.z}function d(b,e){var d=0,c=1,f=b.z+b.w,h=e.z+e.w,g=-b.z+b.w,i=-e.z+e.w;return f>=0&&h>=0&&g>=0&&i>=0?!0:f<0&&h<0||g<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(c=Math.min(c,f/(f-h))),g<0?d=Math.max(d,g/(g-i)):i<0&&(c=Math.min(c,g/(g-i))),c<d?!1:(b.lerpSelf(e,d),e.lerpSelf(b,1-c),!0))}var f,h,i=[],g,j,k=[],o,p,n=[],q,w=[],y,D,z=[],C,ga,M=[],O=new THREE.Vector4,F=new THREE.Vector4, THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function e(b,e){return e.z-b.z}function d(b,e){var d=0,c=1,f=b.z+b.w,h=e.z+e.w,g=-b.z+b.w,i=-e.z+e.w;return f>=0&&h>=0&&g>=0&&i>=0?!0:f<0&&h<0||g<0&&i<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(c=Math.min(c,f/(f-h))),g<0?d=Math.max(d,g/(g-i)):i<0&&(c=Math.min(c,g/(g-i))),c<d?!1:(b.lerpSelf(e,d),e.lerpSelf(b,1-c),!0))}var f,h,i=[],g,j,k=[],o,p,n=[],q,w=[],y,D,z=[],C,ga,aa=[],O=new THREE.Vector4,F=new THREE.Vector4,
v=new THREE.Matrix4,$=new THREE.Matrix4,B=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],aa=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(b,e){v.multiply(e.projectionMatrix,e.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,e){v.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,d,g){var d=[],c,j,o;h=0; v=new THREE.Matrix4,M=new THREE.Matrix4,B=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],$=new THREE.Vector4,K=new THREE.Vector4;this.projectVector=function(b,e){v.multiply(e.projectionMatrix,e.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,e){v.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,d,g){var d=[],c,j,o;h=0;j=
j=b.objects;b=0;for(c=j.length;b<c;b++){o=j[b];var k;if(!(k=!o.visible))if(k=o instanceof THREE.Mesh){a:{k=void 0;for(var p=o.matrixWorld,n=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),q=0;q<6;q++)if(k=B[q].x*p.n14+B[q].y*p.n24+B[q].z*p.n34+B[q].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=i[h]=i[h]||new THREE.RenderableObject,h++,f=k,O.copy(o.position),v.multiplyVector3(O),f.object=o,f.z=O.z,d.push(f)}g&&d.sort(e);return d};this.projectScene=function(f,h,i){var c= b.objects;b=0;for(c=j.length;b<c;b++){o=j[b];var k;if(!(k=!o.visible))if(k=o instanceof THREE.Mesh){a:{k=void 0;for(var p=o.matrixWorld,n=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),q=0;q<6;q++)if(k=B[q].x*p.n14+B[q].y*p.n24+B[q].z*p.n34+B[q].w,k<=n){k=!1;break a}k=!0}k=!k}if(!k)k=i[h]=i[h]||new THREE.RenderableObject,h++,f=k,O.copy(o.position),v.multiplyVector3(O),f.object=o,f.z=O.z,d.push(f)}g&&d.sort(e);return d};this.projectScene=function(f,h,i){var c=[],
[],O=h.near,S=h.far,ka,Q,J,la,E,L,G,N,ma,u,t,pa,ra,Ca,ua,Aa,za;ga=D=q=p=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);v.multiply(h.projectionMatrix,h.matrixWorldInverse);B[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);B[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);B[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);B[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);B[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);B[5].set(v.n41+v.n31,v.n42+ O=h.near,S=h.far,ka,Q,J,la,E,L,G,N,ma,u,t,pa,ra,Ca,ua,Aa,za;ga=D=q=p=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);v.multiply(h.projectionMatrix,h.matrixWorldInverse);B[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);B[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);B[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);B[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);B[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);B[5].set(v.n41+v.n31,v.n42+
v.n32,v.n43+v.n33,v.n44+v.n34);for(ka=0;ka<6;ka++)ma=B[ka],ma.divideScalar(Math.sqrt(ma.x*ma.x+ma.y*ma.y+ma.z*ma.z));ma=this.projectObjects(f,h,!0);f=0;for(ka=ma.length;f<ka;f++)if(u=ma[f].object,u.visible)if(t=u.matrixWorld,pa=u.matrixRotationWorld,ra=u.materials,Ca=u.overdraw,j=0,u instanceof THREE.Mesh){ua=u.geometry;la=ua.vertices;Aa=ua.faces;ua=ua.faceVertexUvs;Q=0;for(J=la.length;Q<J;Q++)g=b(),g.positionWorld.copy(la[Q].position),t.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld), v.n32,v.n43+v.n33,v.n44+v.n34);for(ka=0;ka<6;ka++)ma=B[ka],ma.divideScalar(Math.sqrt(ma.x*ma.x+ma.y*ma.y+ma.z*ma.z));ma=this.projectObjects(f,h,!0);f=0;for(ka=ma.length;f<ka;f++)if(u=ma[f].object,u.visible)if(t=u.matrixWorld,pa=u.matrixRotationWorld,ra=u.materials,Ca=u.overdraw,j=0,u instanceof THREE.Mesh){ua=u.geometry;la=ua.vertices;Aa=ua.faces;ua=ua.faceVertexUvs;Q=0;for(J=la.length;Q<J;Q++)g=b(),g.positionWorld.copy(la[Q].position),t.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),
v.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>O&&g.positionScreen.z<S;la=0;for(Q=Aa.length;la<Q;la++){J=Aa[la];if(J instanceof THREE.Face3)if(E=k[J.a],L=k[J.b],G=k[J.c],E.visible&&L.visible&&G.visible&&(u.doubleSided||u.flipSided!=(G.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(G.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0))N=n[p]=n[p]|| v.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>O&&g.positionScreen.z<S;la=0;for(Q=Aa.length;la<Q;la++){J=Aa[la];if(J instanceof THREE.Face3)if(E=k[J.a],L=k[J.b],G=k[J.c],E.visible&&L.visible&&G.visible&&(u.doubleSided||u.flipSided!=(G.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(G.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0))N=n[p]=n[p]||
new THREE.RenderableFace3,p++,o=N,o.v1.copy(E),o.v2.copy(L),o.v3.copy(G);else continue;else if(J instanceof THREE.Face4)if(E=k[J.a],L=k[J.b],G=k[J.c],N=k[J.d],E.visible&&L.visible&&G.visible&&N.visible&&(u.doubleSided||u.flipSided!=((N.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(N.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(N.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)* new THREE.RenderableFace3,p++,o=N,o.v1.copy(E),o.v2.copy(L),o.v3.copy(G);else continue;else if(J instanceof THREE.Face4)if(E=k[J.a],L=k[J.b],G=k[J.c],N=k[J.d],E.visible&&L.visible&&G.visible&&N.visible&&(u.doubleSided||u.flipSided!=((N.positionScreen.x-E.positionScreen.x)*(L.positionScreen.y-E.positionScreen.y)-(N.positionScreen.y-E.positionScreen.y)*(L.positionScreen.x-E.positionScreen.x)<0||(L.positionScreen.x-G.positionScreen.x)*(N.positionScreen.y-G.positionScreen.y)-(L.positionScreen.y-G.positionScreen.y)*
(N.positionScreen.x-G.positionScreen.x)<0)))za=w[q]=w[q]||new THREE.RenderableFace4,q++,o=za,o.v1.copy(E),o.v2.copy(L),o.v3.copy(G),o.v4.copy(N);else continue;o.normalWorld.copy(J.normal);pa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(J.centroid);t.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);v.multiplyVector3(o.centroidScreen);G=J.vertexNormals;E=0;for(L=G.length;E<L;E++)N=o.vertexNormalsWorld[E],N.copy(G[E]),pa.multiplyVector3(N);E=0;for(L=ua.length;E<L;E++)if(za= (N.positionScreen.x-G.positionScreen.x)<0)))za=w[q]=w[q]||new THREE.RenderableFace4,q++,o=za,o.v1.copy(E),o.v2.copy(L),o.v3.copy(G),o.v4.copy(N);else continue;o.normalWorld.copy(J.normal);pa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(J.centroid);t.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);v.multiplyVector3(o.centroidScreen);G=J.vertexNormals;E=0;for(L=G.length;E<L;E++)N=o.vertexNormalsWorld[E],N.copy(G[E]),pa.multiplyVector3(N);E=0;for(L=ua.length;E<L;E++)if(za=
ua[E][la]){G=0;for(N=za.length;G<N;G++)o.uvs[E][G]=za[G]}o.meshMaterials=ra;o.faceMaterials=J.materials;o.overdraw=Ca;o.z=o.centroidScreen.z;c.push(o)}}else if(u instanceof THREE.Line){$.multiply(v,t);la=u.geometry.vertices;E=b();E.positionScreen.copy(la[0].position);$.multiplyVector4(E.positionScreen);Q=1;for(J=la.length;Q<J;Q++)if(E=b(),E.positionScreen.copy(la[Q].position),$.multiplyVector4(E.positionScreen),L=k[j-2],aa.copy(E.positionScreen),K.copy(L.positionScreen),d(aa,K))aa.multiplyScalar(1/ ua[E][la]){G=0;for(N=za.length;G<N;G++)o.uvs[E][G]=za[G]}o.meshMaterials=ra;o.faceMaterials=J.materials;o.overdraw=Ca;o.z=o.centroidScreen.z;c.push(o)}}else if(u instanceof THREE.Line){M.multiply(v,t);la=u.geometry.vertices;E=b();E.positionScreen.copy(la[0].position);M.multiplyVector4(E.positionScreen);Q=1;for(J=la.length;Q<J;Q++)if(E=b(),E.positionScreen.copy(la[Q].position),M.multiplyVector4(E.positionScreen),L=k[j-2],$.copy(E.positionScreen),K.copy(L.positionScreen),d($,K))$.multiplyScalar(1/$.w),
aa.w),K.multiplyScalar(1/K.w),t=z[D]=z[D]||new THREE.RenderableLine,D++,y=t,y.v1.positionScreen.copy(aa),y.v2.positionScreen.copy(K),y.z=Math.max(aa.z,K.z),y.materials=u.materials,c.push(y)}else if(u instanceof THREE.Particle&&(F.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),v.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))t=M[ga]=M[ga]||new THREE.RenderableParticle,ga++,C=t,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=u.rotation.z,C.scale.x=u.scale.x*Math.abs(C.x-(F.x+h.projectionMatrix.n11)/ K.multiplyScalar(1/K.w),t=z[D]=z[D]||new THREE.RenderableLine,D++,y=t,y.v1.positionScreen.copy($),y.v2.positionScreen.copy(K),y.z=Math.max($.z,K.z),y.materials=u.materials,c.push(y)}else if(u instanceof THREE.Particle&&(F.set(u.matrixWorld.n14,u.matrixWorld.n24,u.matrixWorld.n34,1),v.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))t=aa[ga]=aa[ga]||new THREE.RenderableParticle,ga++,C=t,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=u.rotation.z,C.scale.x=u.scale.x*Math.abs(C.x-(F.x+h.projectionMatrix.n11)/(F.w+
(F.w+h.projectionMatrix.n14)),C.scale.y=u.scale.y*Math.abs(C.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),C.materials=u.materials,c.push(C);i&&c.sort(e);return c}}; h.projectionMatrix.n14)),C.scale.y=u.scale.y*Math.abs(C.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),C.materials=u.materials,c.push(C);i&&c.sort(e);return c}};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,e,d){d&&b.update(void 0,!1,e);var d=b.sounds,f,h=d.length;for(f=0;f<h;f++)b=d[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(e.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}}; THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,e,d){d&&b.update(void 0,!1,e);var d=b.sounds,f,h=d.length;for(f=0;f<h;f++)b=d[f],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(e.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif", THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif", envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
...@@ -195,7 +195,7 @@ j.pointLightPosition.value=d.point.positions;j.pointLightDistance.value=d.point. ...@@ -195,7 +195,7 @@ j.pointLightPosition.value=d.point.positions;j.pointLightDistance.value=d.point.
j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=_canvas.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof j.combine.value=f.combine,j.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)j.diffuse.value=f.color,j.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)j.psColor.value=f.color,j.opacity.value=f.opacity,j.size.value=f.size,j.scale.value=_canvas.height/2,j.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)j.ambient.value=f.ambient,j.specular.value=f.specular,j.shininess.value=f.shininess;else if(f instanceof
THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var A in j)if(P=g.uniforms[A])if(k=j[A],r=k.type,d=k.value,r=="i")c.uniform1i(P,d);else if(r=="f")c.uniform1f(P,d);else if(r=="fv1")c.uniform1fv(P,d);else if(r=="fv")c.uniform3fv(P,d);else if(r=="v2")c.uniform2f(P,d.x,d.y);else if(r=="v3")c.uniform3f(P,d.x,d.y,d.z);else if(r=="v4")c.uniform4f(P,d.x,d.y,d.z,d.w);else if(r=="c")c.uniform3f(P, THREE.MeshDepthMaterial)j.mNear.value=b.near,j.mFar.value=b.far,j.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)j.opacity.value=f.opacity;for(var A in j)if(P=g.uniforms[A])if(k=j[A],r=k.type,d=k.value,r=="i")c.uniform1i(P,d);else if(r=="f")c.uniform1f(P,d);else if(r=="fv1")c.uniform1fv(P,d);else if(r=="fv")c.uniform3fv(P,d);else if(r=="v2")c.uniform2f(P,d.x,d.y);else if(r=="v3")c.uniform3f(P,d.x,d.y,d.z);else if(r=="v4")c.uniform4f(P,d.x,d.y,d.z,d.w);else if(r=="c")c.uniform3f(P,
d.r,d.g,d.b);else if(r=="t"&&(c.uniform1i(P,d),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(r=0;r<6;++r)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[r])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(r=0;r<6;++r)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+ d.r,d.g,d.b);else if(r=="t"&&(c.uniform1i(P,d),k=k.texture))if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(r=0;r<6;++r)c.texSubImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,c.RGBA,c.UNSIGNED_BYTE,k.image[r])}else{k.image.__webglTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(r=0;r<6;++r)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+
r,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[r]);k.__webglInit=!0}$(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else B(k,d);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition, r,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,k.image[r]);k.__webglInit=!0}M(c.TEXTURE_CUBE_MAP,k,k.image[0]);c.bindTexture(c.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else B(k,d);c.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);c.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&i.cameraPosition!==null&&c.uniform3f(i.cameraPosition,
b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,_viewMatrixArray);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]= b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&i.objectMatrix!==null&&c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&i.viewMatrix!==null&&c.uniformMatrix4fv(i.viewMatrix,!1,_viewMatrixArray);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=j.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=
-e[1].position.y,b[2]=-e[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,_viewMatrixArray);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,_viewMatrixArray),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,e,f,h,g,i){if(h.opacity!=0){var j,b=d(b,e,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position, -e[1].position.y,b[2]=-e[1].position.z,c.uniform3fv(i.directionalLightDirection,b),c.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray),c.uniformMatrix4fv(i.viewMatrix,!1,_viewMatrixArray);f.skinning&&(c.uniformMatrix4fv(i.cameraInverseMatrix,!1,_viewMatrixArray),c.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,e,f,h,g,i){if(h.opacity!=0){var j,b=d(b,e,f,h,i).attributes;if(!h.morphTargets&&b.position>=0)c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(b.position,
3,c.FLOAT,!1,0,0);else{e=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0)):e.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]), 3,c.FLOAT,!1,0,0);else{e=h.program.attributes;i.morphTargetBase!==-1?(c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[i.morphTargetBase]),c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0)):e.position>=0&&(c.bindBuffer(c.ARRAY_BUFFER,g.__webglVertexBuffer),c.vertexAttribPointer(e.position,3,c.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length)for(var f=0,k=i.morphTargetForcedOrder,o=i.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<k.length;)c.bindBuffer(c.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[k[f]]),
...@@ -247,12 +247,12 @@ W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRA ...@@ -247,12 +247,12 @@ W,j),c.bindBuffer(c.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),c.bufferData(c.ARRA
delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ja;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(d=h[f],d.attributes)for(ja in d.attributes)d.attributes[ja].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ja=f;b=c.DYNAMIC_DRAW;o=ja.vertices;h=ja.colors;u=o.length;g= delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;var ja;h=h.__materials;f=0;for(b=h.length;f<b;f++)if(d=h[f],d.attributes)for(ja in d.attributes)d.attributes[ja].needsUpdate=!1}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){ja=f;b=c.DYNAMIC_DRAW;o=ja.vertices;h=ja.colors;u=o.length;g=
h.length;v=ja.__vertexArray;i=ja.__colorArray;y=ja.__dirtyColors;if(ja.__dirtyVertices){for(j=0;j<u;j++)k=o[j].position,d=j*3,v[d]=k.x,v[d+1]=k.y,v[d+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<g;j++)color=h[j],d=j*3,i[d]=color.r,i[d+1]=color.g,i[d+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices|| h.length;v=ja.__vertexArray;i=ja.__colorArray;y=ja.__dirtyColors;if(ja.__dirtyVertices){for(j=0;j<u;j++)k=o[j].position,d=j*3,v[d]=k.x,v[d+1]=k.y,v[d+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<g;j++)color=h[j],d=j*3,i[d]=color.r,i[d+1]=color.g,i[d+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||
f.__dirtyColors){ja=f;b=c.DYNAMIC_DRAW;o=ja.vertices;h=ja.colors;u=o.length;g=h.length;v=ja.__vertexArray;i=ja.__colorArray;y=ja.__dirtyColors;if(ja.__dirtyVertices){for(j=0;j<u;j++)k=o[j].position,d=j*3,v[d]=k.x,v[d+1]=k.y,v[d+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<g;j++)color=h[j],d=j*3,i[d]=color.r,i[d+1]=color.g,i[d+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices= f.__dirtyColors){ja=f;b=c.DYNAMIC_DRAW;o=ja.vertices;h=ja.colors;u=o.length;g=h.length;v=ja.__vertexArray;i=ja.__colorArray;y=ja.__dirtyColors;if(ja.__dirtyVertices){for(j=0;j<u;j++)k=o[j].position,d=j*3,v[d]=k.x,v[d+1]=k.y,v[d+2]=k.z;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglVertexBuffer);c.bufferData(c.ARRAY_BUFFER,v,b)}if(y){for(j=0;j<g;j++)color=h[j],d=j*3,i[d]=color.r,i[d+1]=color.g,i[d+2]=color.b;c.bindBuffer(c.ARRAY_BUFFER,ja.__webglColorBuffer);c.bufferData(c.ARRAY_BUFFER,i,b)}}f.__dirtyVertices=
!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&e(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function M(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function O(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,r={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f= !1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=b.geometry,(f.__dirtyVertices||f.__dirtyColors||b.sortParticles)&&e(f,c.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1}function aa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function O(b){function c(b){var f=[];d=0;for(e=b.length;d<e;d++)b[d]==void 0?f.push("undefined"):f.push(b[d].id);return f.join("_")}var d,e,f,g,h,i,j,k,r={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};f=
0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),r[j]==void 0&&(r[j]={hash:j,counter:0}),k=r[j].hash+"_"+r[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(r[j].counter+=1,k=r[j].hash+"_"+r[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+= 0;for(g=b.faces.length;f<g;f++)h=b.faces[f],i=h.materials,j=c(i),r[j]==void 0&&(r[j]={hash:j,counter:0}),k=r[j].hash+"_"+r[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[k].vertices+h>65535&&(r[j].counter+=1,k=r[j].hash+"_"+r[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:i,vertices:0,numMorphTargets:o})),b.geometryGroups[k].faces.push(f),b.geometryGroups[k].vertices+=
h}function F(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(b){if(b!=E){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA, h}function F(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function v(b){if(b!=E){switch(b){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE);break;case THREE.SubtractiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ZERO,c.SRC_COLOR);break;default:c.blendEquationSeparate(c.FUNC_ADD,c.FUNC_ADD),c.blendFuncSeparate(c.SRC_ALPHA,
c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}E=b}}function $(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,U(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,U(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,U(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,U(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,na(d.magFilter)), c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA)}E=b}}function M(b,d,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(c.texParameteri(b,c.TEXTURE_WRAP_S,U(d.wrapS)),c.texParameteri(b,c.TEXTURE_WRAP_T,U(d.wrapT)),c.texParameteri(b,c.TEXTURE_MAG_FILTER,U(d.magFilter)),c.texParameteri(b,c.TEXTURE_MIN_FILTER,U(d.minFilter)),c.generateMipmap(b)):(c.texParameteri(b,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(b,c.TEXTURE_MAG_FILTER,na(d.magFilter)),
c.texParameteri(b,c.TEXTURE_MIN_FILTER,na(d.minFilter)))}function B(b,d){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),$(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D, c.texParameteri(b,c.TEXTURE_MIN_FILTER,na(d.minFilter)))}function B(b,d){if(b.needsUpdate)b.__webglInit?(c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,b.image)):(b.__webglTexture=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b.__webglTexture),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.image),b.__webglInit=!0),M(c.TEXTURE_2D,b,b.image),c.bindTexture(c.TEXTURE_2D,null),b.needsUpdate=!1;c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,
b.__webglTexture)}function aa(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,U(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,U(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,U(b.magFilter)); b.__webglTexture)}function $(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=c.createFramebuffer();b.__webglRenderbuffer=c.createRenderbuffer();b.__webglTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,b.__webglTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,U(b.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,U(b.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,U(b.magFilter));
c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,U(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER, c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,U(b.minFilter));c.texImage2D(c.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null);c.bindRenderbuffer(c.RENDERBUFFER,b.__webglRenderbuffer);c.bindFramebuffer(c.FRAMEBUFFER,b.__webglFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,
c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null, c.DEPTH_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_STENCIL,b.width,b.height),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_STENCIL_ATTACHMENT,c.RENDERBUFFER,b.__webglRenderbuffer)):c.renderbufferStorage(c.RENDERBUFFER,c.RGBA4,b.width,b.height);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var d,e;b?(d=b.__webglFramebuffer,e=b.width,b=b.height):(d=null,
e=_viewportWidth,b=_viewportHeight);d!=ka&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(_viewportX,_viewportY,e,b),ka=d)}function K(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function na(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST; e=_viewportWidth,b=_viewportHeight);d!=ka&&(c.bindFramebuffer(c.FRAMEBUFFER,d),c.viewport(_viewportX,_viewportY,e,b),ka=d)}function K(b,d){var e;b=="fragment"?e=c.createShader(c.FRAGMENT_SHADER):b=="vertex"&&(e=c.createShader(c.VERTEX_SHADER));c.shaderSource(e,d);c.compileShader(e);if(!c.getShaderParameter(e,c.COMPILE_STATUS))return console.error(c.getShaderInfoLog(e)),console.error(d),null;return e}function na(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return c.NEAREST;
...@@ -285,7 +285,7 @@ q.length;j<k;j++)o=q[j],p.uniforms[o]=c.getUniformLocation(p,o);k=["position","n ...@@ -285,7 +285,7 @@ q.length;j<k;j++)o=q[j],p.uniforms[o]=c.getUniformLocation(p,o);k=["position","n
0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0), 0&&c.enableVertexAttribArray(n.normal);n.tangent>=0&&c.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(c.enableVertexAttribArray(n.skinVertexA),c.enableVertexAttribArray(n.skinVertexB),c.enableVertexAttribArray(n.skinIndex),c.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(g in b.attributes)n[g]!==void 0&&n[g]>=0&&c.enableVertexAttribArray(n[g]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(c.enableVertexAttribArray(n.morphTarget0),
b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>= b.numSupportedMorphTargets++);n.morphTarget1>=0&&(c.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(c.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(c.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(c.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(c.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=
0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,e,p,t){var u,E,oa,B,F,G,r,P,J=b.lights,K=b.fog;R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;e.matrixAutoUpdate&&e.update(void 0,!0);b.update(void 0,!1,e);e.matrixWorldInverse.flattenToArray(_viewMatrixArray); 0&&(c.enableVertexAttribArray(n.morphTarget6),b.numSupportedMorphTargets++);n.morphTarget7>=0&&(c.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(g=this.maxMorphTargets;b<g;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,e,p,t){var u,E,oa,B,F,G,r,P,J=b.lights,K=b.fog;R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;e.matrixAutoUpdate&&e.update(void 0,!0);b.update(void 0,!1,e);e.matrixWorldInverse.flattenToArray(_viewMatrixArray);
e.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(e.projectionMatrix,e.matrixWorldInverse);k(_projScreenMatrix);this.initWebGLObjects(b);aa(p);(this.autoClear||t)&&this.clear();F=b.__webglObjects.length;for(t=0;t<F;t++)if(u=b.__webglObjects[t],r=u.object,r.visible)if(!(r instanceof THREE.Mesh)||o(r)){if(r.matrixWorld.flattenToArray(r._objectMatrixArray),C(r,e),q(u),u.render=!0,this.sortObjects)u.object.renderDepth?u.z=u.object.renderDepth:(_vector3.copy(r.position), e.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(e.projectionMatrix,e.matrixWorldInverse);k(_projScreenMatrix);this.initWebGLObjects(b);$(p);(this.autoClear||t)&&this.clear();F=b.__webglObjects.length;for(t=0;t<F;t++)if(u=b.__webglObjects[t],r=u.object,r.visible)if(!(r instanceof THREE.Mesh)||o(r)){if(r.matrixWorld.flattenToArray(r._objectMatrixArray),C(r,e),q(u),u.render=!0,this.sortObjects)u.object.renderDepth?u.z=u.object.renderDepth:(_vector3.copy(r.position),
_projScreenMatrix.multiplyVector3(_vector3),u.z=_vector3.z)}else u.render=!1;else u.render=!1;this.sortObjects&&b.__webglObjects.sort(w);G=b.__webglObjectsImmediate.length;for(t=0;t<G;t++)u=b.__webglObjectsImmediate[t],r=u.object,r.visible&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),C(r,e),n(u));v(THREE.NormalBlending);for(t=0;t<F;t++)if(u=b.__webglObjects[t],u.render){r=u.object;P=u.buffer;oa=u.opaque;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],g(B.depthTest),j(B.polygonOffset, _projScreenMatrix.multiplyVector3(_vector3),u.z=_vector3.z)}else u.render=!1;else u.render=!1;this.sortObjects&&b.__webglObjects.sort(w);G=b.__webglObjectsImmediate.length;for(t=0;t<G;t++)u=b.__webglObjectsImmediate[t],r=u.object,r.visible&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),C(r,e),n(u));v(THREE.NormalBlending);for(t=0;t<F;t++)if(u=b.__webglObjects[t],u.render){r=u.object;P=u.buffer;oa=u.opaque;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],g(B.depthTest),j(B.polygonOffset,
B.polygonOffsetFactor,B.polygonOffsetUnits),f(e,J,K,B,P,r)}for(t=0;t<G;t++)if(u=b.__webglObjectsImmediate[t],r=u.object,r.visible){oa=u.opaque;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],g(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),E=d(e,J,K,B,r),r.render(function(b){h(b,E,B.shading)})}for(t=0;t<F;t++)if(u=b.__webglObjects[t],u.render){r=u.object;P=u.buffer;oa=u.transparent;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],v(B.blending),g(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor, B.polygonOffsetFactor,B.polygonOffsetUnits),f(e,J,K,B,P,r)}for(t=0;t<G;t++)if(u=b.__webglObjectsImmediate[t],r=u.object,r.visible){oa=u.opaque;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],g(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),E=d(e,J,K,B,r),r.render(function(b){h(b,E,B.shading)})}for(t=0;t<F;t++)if(u=b.__webglObjects[t],u.render){r=u.object;P=u.buffer;oa=u.transparent;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],v(B.blending),g(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,
B.polygonOffsetUnits),f(e,J,K,B,P,r)}for(t=0;t<G;t++)if(u=b.__webglObjectsImmediate[t],r=u.object,r.visible){oa=u.transparent;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],v(B.blending),g(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),E=d(e,J,K,B,r),r.render(function(b){h(b,E,B.shading)})}b.__webglSprites.length&&D(b,e);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&y(b);b.__webglLensFlares.length&&z(b,e);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&& B.polygonOffsetUnits),f(e,J,K,B,P,r)}for(t=0;t<G;t++)if(u=b.__webglObjectsImmediate[t],r=u.object,r.visible){oa=u.transparent;i(r);for(u=0;u<oa.count;u++)B=oa.list[u],v(B.blending),g(B.depthTest),j(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),E=d(e,J,K,B,r),r.render(function(b){h(b,E,B.shading)})}b.__webglSprites.length&&D(b,e);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&y(b);b.__webglLensFlares.length&&z(b,e);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&
...@@ -299,8 +299,8 @@ new Float32Array(k*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)i.__ ...@@ -299,8 +299,8 @@ new Float32Array(k*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)i.__
p[z];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,u=1,v.type==="v2"?u=2:v.type==="v3"?u=3:v.type==="v4"?u=4:v.type==="c"&&(u=3),v.size=u,v.array=new Float32Array(k*u),v.buffer=c.createBuffer(),v.buffer.belongsToAttribute=a,p.needsUpdate=!0,v.__original=p;i.__webglCustomAttributes[a]=v}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume? p[z];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,u=1,v.type==="v2"?u=2:v.type==="v3"?u=3:v.type==="v4"?u=4:v.type==="c"&&(u=3),v.size=u,v.array=new Float32Array(k*u),v.buffer=c.createBuffer(),v.buffer.belongsToAttribute=a,p.needsUpdate=!0,v.__original=p;i.__webglCustomAttributes[a]=v}i.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}d instanceof THREE.ShadowVolume?
F(e.__webglShadowVolumes,h,d):F(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)F(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry; F(e.__webglShadowVolumes,h,d):F(e.__webglObjects,h,d)}else if(d instanceof THREE.LensFlare)F(e.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else if(d instanceof THREE.Line){g=d.geometry;
if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h* if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else if(d instanceof THREE.ParticleSystem){g=d.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=c.createBuffer(),f.__webglColorBuffer=c.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*
3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)d=b.__objectsRemoved[0],e=b,d instanceof THREE.ShadowVolume?M(e.__webglShadowVolumes, 3),f.__colorArray=new Float32Array(h*3),f.__sortArray=[],f.__webglParticleCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;F(e.__webglObjects,g,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.ShadowVolume)aa(d.__webglShadowVolumes,
d):d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line?M(e.__webglObjects,d):d instanceof THREE.Sprite?M(e.__webglSprites,d):d instanceof THREE.LensFlare?M(e.__webglLensFlares,d):d instanceof THREE.MarchingCubes&&M(e.__webglObjectsImmediate,d),b.__objectsRemoved.splice(0,1);d=0;for(e=b.__webglObjects.length;d<e;d++)ga(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<e;d++)ga(b.__webglShadowVolumes[d].object,b);d=0;for(e= e);else if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)aa(d.__webglObjects,e);else if(e instanceof THREE.Sprite){d=d.__webglSprites;g=void 0;for(g=d.length-1;g>=0;g--)d[g]==e&&d.splice(g,1)}else e instanceof THREE.LensFlare?aa(d.__webglLensFlares,e):e instanceof THREE.MarchingCubes&&aa(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)ga(b.__webglObjects[d].object,b);d=0;for(e=b.__webglShadowVolumes.length;d<
b.__webglLensFlares.length;d<e;d++)ga(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return ma}}; e;d++)ga(b.__webglShadowVolumes[d].object,b);d=0;for(e=b.__webglLensFlares.length;d<e;d++)ga(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW),b=="back"?c.cullFace(c.BACK):b=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK),c.enable(c.CULL_FACE)):c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return ma}};
THREE.WebGLRenderTarget=function(b,e,d){this.width=b;this.height=e;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type: THREE.WebGLRenderTarget=function(b,e,d){this.width=b;this.height=e;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0}; THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var scene, camera, renderer, info, mouse2d, sun, loader, sphere, debugNormal; var camera, scene, renderer, info, mouse2d, sun, loader, sphere, debugNormal;
var range = 400; var range = 400;
var speed = 1; var speed = 1;
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
scene = new THREE.Scene(); scene = new THREE.Scene();
// create sprites // create sprites
var amount = 200; var amount = 200;
...@@ -99,7 +98,6 @@ ...@@ -99,7 +98,6 @@
renderer = new THREE.WebGLRenderer(); renderer = new THREE.WebGLRenderer();
renderer.setClearColorHex( 0x000000, 1 ); renderer.setClearColorHex( 0x000000, 1 );
renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setSize( window.innerWidth, window.innerHeight );
renderer.sortObjects = true;
container.appendChild( renderer.domElement ); container.appendChild( renderer.domElement );
......
...@@ -4232,6 +4232,22 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -4232,6 +4232,22 @@ THREE.WebGLRenderer = function ( parameters ) {
}; };
function removeInstancesDirect( objlist, object ) {
var o, ol;
for ( o = objlist.length - 1; o >= 0; o -- ) {
if ( objlist[ o ] == object ) {
objlist.splice( o, 1 );
}
}
};
function removeObject( object, scene ) { function removeObject( object, scene ) {
// must check as shadow volume before mesh (as they are also meshes) // must check as shadow volume before mesh (as they are also meshes)
...@@ -4249,7 +4265,7 @@ THREE.WebGLRenderer = function ( parameters ) { ...@@ -4249,7 +4265,7 @@ THREE.WebGLRenderer = function ( parameters ) {
} else if ( object instanceof THREE.Sprite ) { } else if ( object instanceof THREE.Sprite ) {
removeInstances( scene.__webglSprites, object ); removeInstancesDirect( scene.__webglSprites, object );
} else if ( object instanceof THREE.LensFlare ) { } else if ( object instanceof THREE.LensFlare ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册