|
@@ -89,15 +89,15 @@ a instanceof THREE.Euler&&console.error("ERROR: Matrix's .makeRotationFromEuler(
|
|
f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=m+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,k=d*g,m=d*e,b[0]=a-m*c,b[4]=-f*e,b[8]=k+i*c,b[1]=i+k*c,b[5]=f*g,b[9]=m-a*c,b[2]=-f*d,b[6]=c,b[10]=f*h):"ZYX"===a.order?(a=f*g,i=f*e,k=c*g,m=c*e,b[0]=h*g,b[4]=k*d-i,b[8]=a*d+m,b[1]=h*e,b[5]=m*d+a,b[9]=i*d-k,b[2]=-d,b[6]=c*h,b[10]=f*h):"YZX"===a.order?(a=f*h,i=f*d,k=c*h,m=c*d,b[0]=h*g,b[4]=m-a*e,b[8]=k*e+i,b[1]=e,b[5]=f*g,b[9]=-c*g,b[2]=-d*g,b[6]=i*e+k,b[10]=a-m*e):"XZY"===a.order&&(a=f*h,i=f*d,k=c*h,m=c*d,b[0]=
|
|
f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=m+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,k=d*g,m=d*e,b[0]=a-m*c,b[4]=-f*e,b[8]=k+i*c,b[1]=i+k*c,b[5]=f*g,b[9]=m-a*c,b[2]=-f*d,b[6]=c,b[10]=f*h):"ZYX"===a.order?(a=f*g,i=f*e,k=c*g,m=c*e,b[0]=h*g,b[4]=k*d-i,b[8]=a*d+m,b[1]=h*e,b[5]=m*d+a,b[9]=i*d-k,b[2]=-d,b[6]=c*h,b[10]=f*h):"YZX"===a.order?(a=f*h,i=f*d,k=c*h,m=c*d,b[0]=h*g,b[4]=m-a*e,b[8]=k*e+i,b[1]=e,b[5]=f*g,b[9]=-c*g,b[2]=-d*g,b[6]=i*e+k,b[10]=a-m*e):"XZY"===a.order&&(a=f*h,i=f*d,k=c*h,m=c*d,b[0]=
|
|
h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+m,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=m*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,a=c*h,k=c*g,c=
|
|
h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+m,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=m*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,a=c*h,k=c*g,c=
|
|
c*i,m=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(m+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+m);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);h[0]=a.x;
|
|
c*i,m=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(m+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+m);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);h[0]=a.x;
|
|
-h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],m=c[5],l=c[9],n=c[13],s=c[2],r=c[6],q=c[10],p=c[14],u=c[3],t=c[7],v=c[11],c=c[15],
|
|
|
|
-w=d[0],x=d[4],F=d[8],y=d[12],D=d[1],E=d[5],J=d[9],G=d[13],B=d[2],M=d[6],z=d[10],I=d[14],A=d[3],N=d[7],S=d[11],d=d[15];e[0]=f*w+h*D+g*B+i*A;e[4]=f*x+h*E+g*M+i*N;e[8]=f*F+h*J+g*z+i*S;e[12]=f*y+h*G+g*I+i*d;e[1]=k*w+m*D+l*B+n*A;e[5]=k*x+m*E+l*M+n*N;e[9]=k*F+m*J+l*z+n*S;e[13]=k*y+m*G+l*I+n*d;e[2]=s*w+r*D+q*B+p*A;e[6]=s*x+r*E+q*M+p*N;e[10]=s*F+r*J+q*z+p*S;e[14]=s*y+r*G+q*I+p*d;e[3]=u*w+t*D+v*B+c*A;e[7]=u*x+t*E+v*M+c*N;e[11]=u*F+t*J+v*z+c*S;e[15]=u*y+t*G+v*I+c*d;return this},multiplyToArray:function(a,b,
|
|
|
|
|
|
+h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],m=c[5],l=c[9],n=c[13],s=c[2],r=c[6],q=c[10],p=c[14],t=c[3],u=c[7],v=c[11],c=c[15],
|
|
|
|
+w=d[0],E=d[4],G=d[8],y=d[12],D=d[1],x=d[5],J=d[9],F=d[13],B=d[2],M=d[6],z=d[10],I=d[14],A=d[3],N=d[7],S=d[11],d=d[15];e[0]=f*w+h*D+g*B+i*A;e[4]=f*E+h*x+g*M+i*N;e[8]=f*G+h*J+g*z+i*S;e[12]=f*y+h*F+g*I+i*d;e[1]=k*w+m*D+l*B+n*A;e[5]=k*E+m*x+l*M+n*N;e[9]=k*G+m*J+l*z+n*S;e[13]=k*y+m*F+l*I+n*d;e[2]=s*w+r*D+q*B+p*A;e[6]=s*E+r*x+q*M+p*N;e[10]=s*G+r*J+q*z+p*S;e[14]=s*y+r*F+q*I+p*d;e[3]=t*w+u*D+v*B+c*A;e[7]=t*E+u*x+v*M+c*N;e[11]=t*G+u*J+v*z+c*S;e[15]=t*y+u*F+v*I+c*d;return this},multiplyToArray:function(a,b,
|
|
c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],m=a[6],l=a[10],n=a[14];return a[3]*(+e*g*m-d*i*m-e*h*l+c*i*l+d*h*n-c*g*n)+a[7]*(+b*g*n-b*i*l+e*f*l-d*f*n+d*i*k-e*g*k)+a[11]*(+b*i*m-b*h*n-e*f*m+c*f*n+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*m+b*h*l+d*f*m-c*f*
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],m=a[6],l=a[10],n=a[14];return a[3]*(+e*g*m-d*i*m-e*h*l+c*i*l+d*h*n-c*g*n)+a[7]*(+b*g*n-b*i*l+e*f*l-d*f*n+d*i*k-e*g*k)+a[11]*(+b*i*m-b*h*n-e*f*m+c*f*n+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*m+b*h*l+d*f*m-c*f*
|
|
l+c*g*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
l+c*g*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
|
|
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
|
|
-b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],m=d[9],l=d[13],n=d[2],s=d[6],r=d[10],q=d[14],p=d[3],u=d[7],t=d[11],d=d[15];c[0]=m*q*u-l*r*u+l*s*t-k*q*t-m*s*d+k*r*d;c[4]=g*r*u-h*q*u-g*s*t+f*q*t+h*s*d-f*r*d;c[8]=h*l*u-g*m*u+g*k*t-f*l*t-h*k*d+f*m*d;c[12]=g*m*s-h*l*s-g*k*r+f*l*r+h*k*q-f*m*q;c[1]=l*r*p-m*q*p-l*n*t+i*q*t+m*n*d-i*r*d;c[5]=h*q*p-g*r*p+g*n*t-e*q*t-h*n*d+e*r*d;c[9]=g*m*p-h*l*p-g*i*t+e*l*t+h*i*d-
|
|
|
|
-e*m*d;c[13]=h*l*n-g*m*n+g*i*r-e*l*r-h*i*q+e*m*q;c[2]=k*q*p-l*s*p+l*n*u-i*q*u-k*n*d+i*s*d;c[6]=g*s*p-f*q*p-g*n*u+e*q*u+f*n*d-e*s*d;c[10]=f*l*p-g*k*p+g*i*u-e*l*u-f*i*d+e*k*d;c[14]=g*k*n-f*l*n-g*i*s+e*l*s+f*i*q-e*k*q;c[3]=m*s*p-k*r*p-m*n*u+i*r*u+k*n*t-i*s*t;c[7]=f*r*p-h*s*p+h*n*u-e*r*u-f*n*t+e*s*t;c[11]=h*k*p-f*m*p-h*i*u+e*m*u+f*i*t-e*k*t;c[15]=f*m*n-h*k*n+h*i*s-e*m*s-f*i*r+e*k*r;c=e*c[0]+i*c[4]+n*c[8]+p*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
|
|
|
+b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],m=d[9],l=d[13],n=d[2],s=d[6],r=d[10],q=d[14],p=d[3],t=d[7],u=d[11],d=d[15];c[0]=m*q*t-l*r*t+l*s*u-k*q*u-m*s*d+k*r*d;c[4]=g*r*t-h*q*t-g*s*u+f*q*u+h*s*d-f*r*d;c[8]=h*l*t-g*m*t+g*k*u-f*l*u-h*k*d+f*m*d;c[12]=g*m*s-h*l*s-g*k*r+f*l*r+h*k*q-f*m*q;c[1]=l*r*p-m*q*p-l*n*u+i*q*u+m*n*d-i*r*d;c[5]=h*q*p-g*r*p+g*n*u-e*q*u-h*n*d+e*r*d;c[9]=g*m*p-h*l*p-g*i*u+e*l*u+h*i*d-
|
|
|
|
+e*m*d;c[13]=h*l*n-g*m*n+g*i*r-e*l*r-h*i*q+e*m*q;c[2]=k*q*p-l*s*p+l*n*t-i*q*t-k*n*d+i*s*d;c[6]=g*s*p-f*q*p-g*n*t+e*q*t+f*n*d-e*s*d;c[10]=f*l*p-g*k*p+g*i*t-e*l*t-f*i*d+e*k*d;c[14]=g*k*n-f*l*n-g*i*s+e*l*s+f*i*q-e*k*q;c[3]=m*s*p-k*r*p-m*n*t+i*r*t+k*n*u-i*s*u;c[7]=f*r*p-h*s*p+h*n*t-e*r*t-f*n*u+e*s*u;c[11]=h*k*p-f*m*p-h*i*t+e*m*t+f*i*u-e*k*u;c[15]=f*m*n-h*k*n+h*i*s-e*m*s-f*i*r+e*k*r;c=e*c[0]+i*c[4]+n*c[8]+p*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
|
|
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
|
|
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
|
|
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,g=a.z,i=e*f,k=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,k*h+c,k*g-d*f,0,i*g-d*h,k*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,g=a.z,i=e*f,k=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,k*h+c,k*g-d*f,0,i*g-d*h,k*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
@@ -140,11 +140,11 @@ a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.Ev
|
|
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
|
|
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
|
|
c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(){var a=[];return function(b){if(void 0!==this._listeners){var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=c.length,e=0;e<d;e++)a[e]=c[e];for(e=0;e<d;e++)a[e].call(this,b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,m,s){if(f instanceof a.Sprite){d.getPositionFromMatrix(f.matrixWorld);var r=m.ray.distanceToPoint(d);if(r>f.scale.x)return s;s.push({distance:r,point:f.position,face:null,object:f})}else if(f instanceof
|
|
c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(){var a=[];return function(b){if(void 0!==this._listeners){var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=c.length,e=0;e<d;e++)a[e]=c[e];for(e=0;e<d;e++)a[e].call(this,b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,m,s){if(f instanceof a.Sprite){d.getPositionFromMatrix(f.matrixWorld);var r=m.ray.distanceToPoint(d);if(r>f.scale.x)return s;s.push({distance:r,point:f.position,face:null,object:f})}else if(f instanceof
|
|
a.LOD)d.getPositionFromMatrix(f.matrixWorld),r=m.ray.origin.distanceTo(d),k(f.getObjectForDistance(r),m,s);else if(f instanceof a.Mesh){var q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(null!==q.boundingBox&&!1===c.isIntersectionBox(q.boundingBox))return s;if(q instanceof a.BufferGeometry){var p=f.material;if(void 0===
|
|
a.LOD)d.getPositionFromMatrix(f.matrixWorld),r=m.ray.origin.distanceTo(d),k(f.getObjectForDistance(r),m,s);else if(f instanceof a.Mesh){var q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(null!==q.boundingBox&&!1===c.isIntersectionBox(q.boundingBox))return s;if(q instanceof a.BufferGeometry){var p=f.material;if(void 0===
|
|
-p||!1===q.dynamic)return s;var u,t,v=m.precision;if(void 0!==q.attributes.index)for(var w=q.offsets,x=q.attributes.index.array,F=q.attributes.position.array,y=q.offsets.length,D=q.attributes.index.array.length/3,D=0;D<y;++D)for(var r=w[D].start,E=w[D].index,q=r,J=r+w[D].count;q<J;q+=3)r=E+x[q],u=E+x[q+1],t=E+x[q+2],h.set(F[3*r],F[3*r+1],F[3*r+2]),g.set(F[3*u],F[3*u+1],F[3*u+2]),i.set(F[3*t],F[3*t+1],F[3*t+2]),u=p.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,p.side!==a.DoubleSide),
|
|
|
|
-null!==u&&(u.applyMatrix4(f.matrixWorld),r=m.ray.origin.distanceTo(u),r<v||(r<m.near||r>m.far)||s.push({distance:r,point:u,face:null,faceIndex:null,object:f}));else{F=q.attributes.position.array;D=q.attributes.position.array.length;for(q=0;q<D;q+=3)r=q,u=q+1,t=q+2,h.set(F[3*r],F[3*r+1],F[3*r+2]),g.set(F[3*u],F[3*u+1],F[3*u+2]),i.set(F[3*t],F[3*t+1],F[3*t+2]),u=p.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,p.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
|
-r=m.ray.origin.distanceTo(u),r<v||(r<m.near||r>m.far)||s.push({distance:r,point:u,face:null,faceIndex:null,object:f}))}}else if(q instanceof a.Geometry){x=f.material instanceof a.MeshFaceMaterial;F=!0===x?f.material.materials:null;v=m.precision;w=q.vertices;y=0;for(D=q.faces.length;y<D;y++)E=q.faces[y],p=!0===x?F[E.materialIndex]:f.material,void 0!==p&&(r=w[E.a],u=w[E.b],t=w[E.c],u=p.side===a.BackSide?c.intersectTriangle(t,u,r,!0):c.intersectTriangle(r,u,t,p.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
|
-r=m.ray.origin.distanceTo(u),r<v||(r<m.near||r>m.far)||s.push({distance:r,point:u,face:E,faceIndex:y,object:f})))}}else if(f instanceof a.Line){v=m.linePrecision;p=v*v;q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(q instanceof a.Geometry){w=q.vertices;v=w.length;u=new a.Vector3;t=new a.Vector3;D=f.type===a.LineStrip?1:
|
|
|
|
-2;for(q=0;q<v-1;q+=D)c.distanceSqToSegment(w[q],w[q+1],t,u)>p||(r=c.origin.distanceTo(t),r<m.near||r>m.far||s.push({distance:r,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&m(a,
|
|
|
|
|
|
+p||!1===q.dynamic)return s;var t,u,v=m.precision;if(void 0!==q.attributes.index)for(var w=q.offsets,E=q.attributes.index.array,G=q.attributes.position.array,y=q.offsets.length,D=q.attributes.index.array.length/3,D=0;D<y;++D)for(var r=w[D].start,x=w[D].index,q=r,J=r+w[D].count;q<J;q+=3)r=x+E[q],t=x+E[q+1],u=x+E[q+2],h.set(G[3*r],G[3*r+1],G[3*r+2]),g.set(G[3*t],G[3*t+1],G[3*t+2]),i.set(G[3*u],G[3*u+1],G[3*u+2]),t=p.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,p.side!==a.DoubleSide),
|
|
|
|
+null!==t&&(t.applyMatrix4(f.matrixWorld),r=m.ray.origin.distanceTo(t),r<v||(r<m.near||r>m.far)||s.push({distance:r,point:t,face:null,faceIndex:null,object:f}));else{G=q.attributes.position.array;D=q.attributes.position.array.length;for(q=0;q<D;q+=3)r=q,t=q+1,u=q+2,h.set(G[3*r],G[3*r+1],G[3*r+2]),g.set(G[3*t],G[3*t+1],G[3*t+2]),i.set(G[3*u],G[3*u+1],G[3*u+2]),t=p.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,p.side!==a.DoubleSide),null!==t&&(t.applyMatrix4(f.matrixWorld),
|
|
|
|
+r=m.ray.origin.distanceTo(t),r<v||(r<m.near||r>m.far)||s.push({distance:r,point:t,face:null,faceIndex:null,object:f}))}}else if(q instanceof a.Geometry){E=f.material instanceof a.MeshFaceMaterial;G=!0===E?f.material.materials:null;v=m.precision;w=q.vertices;y=0;for(D=q.faces.length;y<D;y++)x=q.faces[y],p=!0===E?G[x.materialIndex]:f.material,void 0!==p&&(r=w[x.a],t=w[x.b],u=w[x.c],t=p.side===a.BackSide?c.intersectTriangle(u,t,r,!0):c.intersectTriangle(r,t,u,p.side!==a.DoubleSide),null!==t&&(t.applyMatrix4(f.matrixWorld),
|
|
|
|
+r=m.ray.origin.distanceTo(t),r<v||(r<m.near||r>m.far)||s.push({distance:r,point:t,face:x,faceIndex:y,object:f})))}}else if(f instanceof a.Line){v=m.linePrecision;p=v*v;q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(q instanceof a.Geometry){w=q.vertices;v=w.length;t=new a.Vector3;u=new a.Vector3;D=f.type===a.LineStrip?1:
|
|
|
|
+2;for(q=0;q<v-1;q+=D)c.distanceSqToSegment(w[q],w[q+1],u,t)>p||(r=c.origin.distanceTo(u),r<m.near||r>m.far||s.push({distance:r,point:t.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&m(a,
|
|
this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&m(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&m(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,get rotation(){return this._rotation},set rotation(a){this._rotation=a;this._rotation._quaternion=this._quaternion;this._quaternion._euler=this._rotation;this._rotation._updateQuaternion()},get quaternion(){return this._quaternion},set quaternion(a){this._quaternion=a;this._quaternion._euler=this._rotation;this._rotation._quaternion=this._quaternion;this._quaternion._updateEuler()},get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,get rotation(){return this._rotation},set rotation(a){this._rotation=a;this._rotation._quaternion=this._quaternion;this._quaternion._euler=this._rotation;this._rotation._updateQuaternion()},get quaternion(){return this._quaternion},set quaternion(a){this._quaternion=a;this._quaternion._euler=this._rotation;this._rotation._quaternion=this._quaternion;this._quaternion._updateEuler()},get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");
|
|
@@ -158,17 +158,17 @@ for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},getObje
|
|
return this.getObjectByName(a,b)},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):
|
|
return this.getObjectByName(a,b)},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):
|
|
this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);
|
|
this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);
|
|
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===m){var a=new THREE.RenderableVertex;k.push(a);m++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
|
|
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===m){var a=new THREE.RenderableVertex;k.push(a);m++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
|
|
-0,g,i,k=[],m=0,l,n,s=[],r=0,q,p,u=[],t=0,v,w,x=[],F=0,y={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,E=new THREE.Vector4,J=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),G=new THREE.Box3,B=Array(3),M=new THREE.Matrix4,z=new THREE.Matrix4,I,A=new THREE.Matrix4,N=new THREE.Matrix3,S=new THREE.Matrix3,ia=new THREE.Vector3,na=new THREE.Frustum,pa=new THREE.Vector4,C=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
|
|
|
+0,g,i,k=[],m=0,l,n,s=[],r=0,q,p,t=[],u=0,v,w,E=[],G=0,y={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,x=new THREE.Vector4,J=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),F=new THREE.Box3,B=Array(3),M=new THREE.Matrix4,z=new THREE.Matrix4,I,A=new THREE.Matrix4,N=new THREE.Matrix3,S=new THREE.Matrix3,ia=new THREE.Vector3,na=new THREE.Frustum,pa=new THREE.Vector4,C=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
z.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(z)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(z)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var Q=function(a){if(e===h){var b=new THREE.RenderableObject;
|
|
z.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(z)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);z.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(z)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var Q=function(a){if(e===h){var b=new THREE.RenderableObject;
|
|
f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(D.getPositionFromMatrix(a.matrixWorld),D.applyProjection(z),d.z=D.z);return d},R=function(a){if(!1!==a.visible){a instanceof THREE.Light?y.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===na.intersectsObject(a))&&y.objects.push(Q(a)):a instanceof THREE.Sprite&&y.sprites.push(Q(a));for(var b=0,c=a.children.length;b<c;b++)R(a.children[b])}};this.projectScene=function(d,
|
|
f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(D.getPositionFromMatrix(a.matrixWorld),D.applyProjection(z),d.z=D.z);return d},R=function(a){if(!1!==a.visible){a instanceof THREE.Light?y.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===na.intersectsObject(a))&&y.objects.push(Q(a)):a instanceof THREE.Sprite&&y.sprites.push(Q(a));for(var b=0,c=a.children.length;b<c;b++)R(a.children[b])}};this.projectScene=function(d,
|
|
f,h,m){var D=!1,Q,Z,da,O,ba,$,V,ja,sa,ga,Ka,Ga;w=p=n=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();M.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));z.multiplyMatrices(f.projectionMatrix,M);S.getNormalMatrix(M);na.setFromMatrix(z);e=0;y.objects.length=0;y.sprites.length=0;y.lights.length=0;R(d);!0===h&&y.objects.sort(b);d=0;for(h=y.objects.length;d<h;d++)if(V=y.objects[d].object,I=V.matrixWorld,i=0,V instanceof THREE.Mesh){ja=V.geometry;
|
|
f,h,m){var D=!1,Q,Z,da,O,ba,$,V,ja,sa,ga,Ka,Ga;w=p=n=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();M.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));z.multiplyMatrices(f.projectionMatrix,M);S.getNormalMatrix(M);na.setFromMatrix(z);e=0;y.objects.length=0;y.sprites.length=0;y.lights.length=0;R(d);!0===h&&y.objects.sort(b);d=0;for(h=y.objects.length;d<h;d++)if(V=y.objects[d].object,I=V.matrixWorld,i=0,V instanceof THREE.Mesh){ja=V.geometry;
|
|
da=ja.vertices;sa=ja.faces;ja=ja.faceVertexUvs;N.getNormalMatrix(I);Ka=V.material instanceof THREE.MeshFaceMaterial;Ga=!0===Ka?V.material:null;Q=0;for(Z=da.length;Q<Z;Q++){g=a();g.positionWorld.copy(da[Q]).applyMatrix4(I);g.positionScreen.copy(g.positionWorld).applyMatrix4(z);var ka=1/g.positionScreen.w;g.positionScreen.x*=ka;g.positionScreen.y*=ka;g.positionScreen.z*=ka;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||1<
|
|
da=ja.vertices;sa=ja.faces;ja=ja.faceVertexUvs;N.getNormalMatrix(I);Ka=V.material instanceof THREE.MeshFaceMaterial;Ga=!0===Ka?V.material:null;Q=0;for(Z=da.length;Q<Z;Q++){g=a();g.positionWorld.copy(da[Q]).applyMatrix4(I);g.positionScreen.copy(g.positionWorld).applyMatrix4(z);var ka=1/g.positionScreen.w;g.positionScreen.x*=ka;g.positionScreen.y*=ka;g.positionScreen.z*=ka;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||1<
|
|
-g.positionScreen.z)}da=0;for(Q=sa.length;da<Q;da++)if(Z=sa[da],ka=!0===Ka?Ga.materials[Z.materialIndex]:V.material,void 0!==ka&&($=ka.side,O=k[Z.a],ba=k[Z.b],ga=k[Z.c],B[0]=O.positionScreen,B[1]=ba.positionScreen,B[2]=ga.positionScreen,!0===O.visible||!0===ba.visible||!0===ga.visible||J.isIntersectionBox(G.setFromPoints(B))))if(D=0>(ga.positionScreen.x-O.positionScreen.x)*(ba.positionScreen.y-O.positionScreen.y)-(ga.positionScreen.y-O.positionScreen.y)*(ba.positionScreen.x-O.positionScreen.x),$===
|
|
|
|
|
|
+g.positionScreen.z)}da=0;for(Q=sa.length;da<Q;da++)if(Z=sa[da],ka=!0===Ka?Ga.materials[Z.materialIndex]:V.material,void 0!==ka&&($=ka.side,O=k[Z.a],ba=k[Z.b],ga=k[Z.c],B[0]=O.positionScreen,B[1]=ba.positionScreen,B[2]=ga.positionScreen,!0===O.visible||!0===ba.visible||!0===ga.visible||J.isIntersectionBox(F.setFromPoints(B))))if(D=0>(ga.positionScreen.x-O.positionScreen.x)*(ba.positionScreen.y-O.positionScreen.y)-(ga.positionScreen.y-O.positionScreen.y)*(ba.positionScreen.x-O.positionScreen.x),$===
|
|
THREE.DoubleSide||D===($===THREE.FrontSide)){if(n===r){var Da=new THREE.RenderableFace3;s.push(Da);r++;n++;l=Da}else l=s[n++];l.id=V.id;l.v1.copy(O);l.v2.copy(ba);l.v3.copy(ga);l.normalModel.copy(Z.normal);!1===D&&($===THREE.BackSide||$===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(N).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(S);l.centroidModel.copy(Z.centroid).applyMatrix4(I);ga=Z.vertexNormals;O=0;for(ba=Math.min(ga.length,3);O<ba;O++)Da=l.vertexNormalsModel[O],
|
|
THREE.DoubleSide||D===($===THREE.FrontSide)){if(n===r){var Da=new THREE.RenderableFace3;s.push(Da);r++;n++;l=Da}else l=s[n++];l.id=V.id;l.v1.copy(O);l.v2.copy(ba);l.v3.copy(ga);l.normalModel.copy(Z.normal);!1===D&&($===THREE.BackSide||$===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(N).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(S);l.centroidModel.copy(Z.centroid).applyMatrix4(I);ga=Z.vertexNormals;O=0;for(ba=Math.min(ga.length,3);O<ba;O++)Da=l.vertexNormalsModel[O],
|
|
Da.copy(ga[O]),!1===D&&($===THREE.BackSide||$===THREE.DoubleSide)&&Da.negate(),Da.applyMatrix3(N).normalize(),l.vertexNormalsModelView[O].copy(Da).applyMatrix3(S);l.vertexNormalsLength=ga.length;D=0;for(O=Math.min(ja.length,3);D<O;D++)if(ga=ja[D][da],void 0!==ga){ba=0;for($=ga.length;ba<$;ba++)l.uvs[D][ba]=ga[ba]}l.color=Z.color;l.material=ka;ia.copy(l.centroidModel).applyProjection(z);l.z=ia.z;y.elements.push(l)}}else if(V instanceof THREE.Line){A.multiplyMatrices(z,I);da=V.geometry.vertices;O=a();
|
|
Da.copy(ga[O]),!1===D&&($===THREE.BackSide||$===THREE.DoubleSide)&&Da.negate(),Da.applyMatrix3(N).normalize(),l.vertexNormalsModelView[O].copy(Da).applyMatrix3(S);l.vertexNormalsLength=ga.length;D=0;for(O=Math.min(ja.length,3);D<O;D++)if(ga=ja[D][da],void 0!==ga){ba=0;for($=ga.length;ba<$;ba++)l.uvs[D][ba]=ga[ba]}l.color=Z.color;l.material=ka;ia.copy(l.centroidModel).applyProjection(z);l.z=ia.z;y.elements.push(l)}}else if(V instanceof THREE.Line){A.multiplyMatrices(z,I);da=V.geometry.vertices;O=a();
|
|
-O.positionScreen.copy(da[0]).applyMatrix4(A);sa=V.type===THREE.LinePieces?2:1;Q=1;for(Z=da.length;Q<Z;Q++)O=a(),O.positionScreen.copy(da[Q]).applyMatrix4(A),0<(Q+1)%sa||(ba=k[i-2],pa.copy(O.positionScreen),C.copy(ba.positionScreen),!0===c(pa,C)&&(pa.multiplyScalar(1/pa.w),C.multiplyScalar(1/C.w),p===t?(ja=new THREE.RenderableLine,u.push(ja),t++,p++,q=ja):q=u[p++],q.id=V.id,q.v1.positionScreen.copy(pa),q.v2.positionScreen.copy(C),q.z=Math.max(pa.z,C.z),q.material=V.material,V.material.vertexColors===
|
|
|
|
-THREE.VertexColors&&(q.vertexColors[0].copy(V.geometry.colors[Q]),q.vertexColors[1].copy(V.geometry.colors[Q-1])),y.elements.push(q)))}d=0;for(h=y.sprites.length;d<h;d++)V=y.sprites[d].object,I=V.matrixWorld,V instanceof THREE.Sprite&&(E.set(I.elements[12],I.elements[13],I.elements[14],1),E.applyMatrix4(z),ka=1/E.w,E.z*=ka,-1<E.z&&1>E.z&&(w===F?(sa=new THREE.RenderableSprite,x.push(sa),F++,w++,v=sa):v=x[w++],v.id=V.id,v.x=E.x*ka,v.y=E.y*ka,v.z=E.z,v.object=V,v.rotation=V.rotation,v.scale.x=V.scale.x*
|
|
|
|
-Math.abs(v.x-(E.x+f.projectionMatrix.elements[0])/(E.w+f.projectionMatrix.elements[12])),v.scale.y=V.scale.y*Math.abs(v.y-(E.y+f.projectionMatrix.elements[5])/(E.w+f.projectionMatrix.elements[13])),v.material=V.material,y.elements.push(v)));!0===m&&y.elements.sort(b);return y}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
|
|
|
+O.positionScreen.copy(da[0]).applyMatrix4(A);sa=V.type===THREE.LinePieces?2:1;Q=1;for(Z=da.length;Q<Z;Q++)O=a(),O.positionScreen.copy(da[Q]).applyMatrix4(A),0<(Q+1)%sa||(ba=k[i-2],pa.copy(O.positionScreen),C.copy(ba.positionScreen),!0===c(pa,C)&&(pa.multiplyScalar(1/pa.w),C.multiplyScalar(1/C.w),p===u?(ja=new THREE.RenderableLine,t.push(ja),u++,p++,q=ja):q=t[p++],q.id=V.id,q.v1.positionScreen.copy(pa),q.v2.positionScreen.copy(C),q.z=Math.max(pa.z,C.z),q.material=V.material,V.material.vertexColors===
|
|
|
|
+THREE.VertexColors&&(q.vertexColors[0].copy(V.geometry.colors[Q]),q.vertexColors[1].copy(V.geometry.colors[Q-1])),y.elements.push(q)))}d=0;for(h=y.sprites.length;d<h;d++)V=y.sprites[d].object,I=V.matrixWorld,V instanceof THREE.Sprite&&(x.set(I.elements[12],I.elements[13],I.elements[14],1),x.applyMatrix4(z),ka=1/x.w,x.z*=ka,-1<x.z&&1>x.z&&(w===G?(sa=new THREE.RenderableSprite,E.push(sa),G++,w++,v=sa):v=E[w++],v.id=V.id,v.x=x.x*ka,v.y=x.y*ka,v.z=x.z,v.object=V,v.rotation=V.rotation,v.scale.x=V.scale.x*
|
|
|
|
+Math.abs(v.x-(x.x+f.projectionMatrix.elements[0])/(x.w+f.projectionMatrix.elements[12])),v.scale.y=V.scale.y*Math.abs(v.y-(x.y+f.projectionMatrix.elements[5])/(x.w+f.projectionMatrix.elements[13])),v.material=V.material,y.elements.push(v)));!0===m&&y.elements.sort(b);return y}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,h){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,h){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
@@ -178,21 +178,21 @@ h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
new THREE.Vector3;new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g.subVectors(h,f),i.subVectors(a,f),g.cross(i),e[d.a].add(g),e[d.b].add(g),e[d.c].add(g)}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
|
|
new THREE.Vector3;new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g.subVectors(h,f),i.subVectors(a,f),g.cross(i),e[d.a].add(g),e[d.b].add(g),e[d.c].add(g)}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
|
|
d.vertexNormals[2].copy(e[d.c])},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=
|
|
d.vertexNormals[2].copy(e[d.c])},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=
|
|
this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();
|
|
this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();
|
|
-c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,m,l,n,s,r,q,p,u=[],t=[];c=new THREE.Vector3;var v=new THREE.Vector3,w=new THREE.Vector3,x=new THREE.Vector3,F=new THREE.Vector3;
|
|
|
|
-a=0;for(b=this.vertices.length;a<b;a++)u[a]=new THREE.Vector3,t[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,p=e.b,e=e.c,h=this.vertices[d],g=this.vertices[p],i=this.vertices[e],k=f[0],m=f[1],l=f[2],f=g.x-h.x,n=i.x-h.x,s=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=m.x-k.x,q=l.x-k.x,m=m.y-k.y,k=l.y-k.y,l=1/(i*k-q*m),c.set((k*f-m*n)*l,(k*s-m*r)*l,(k*g-m*h)*l),v.set((i*n-q*f)*l,(i*r-q*s)*l,(i*h-q*g)*l),u[d].add(c),u[p].add(c),u[e].add(c),t[d].add(v),
|
|
|
|
-t[p].add(v),t[e].add(v);v=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)F.copy(e.vertexNormals[c]),d=e[v[c]],p=u[d],w.copy(p),w.sub(F.multiplyScalar(F.dot(p))).normalize(),x.crossVectors(e.vertexNormals[c],p),d=x.dot(t[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=
|
|
|
|
|
|
+c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,m,l,n,s,r,q,p,t=[],u=[];c=new THREE.Vector3;var v=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3,G=new THREE.Vector3;
|
|
|
|
+a=0;for(b=this.vertices.length;a<b;a++)t[a]=new THREE.Vector3,u[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,p=e.b,e=e.c,h=this.vertices[d],g=this.vertices[p],i=this.vertices[e],k=f[0],m=f[1],l=f[2],f=g.x-h.x,n=i.x-h.x,s=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=m.x-k.x,q=l.x-k.x,m=m.y-k.y,k=l.y-k.y,l=1/(i*k-q*m),c.set((k*f-m*n)*l,(k*s-m*r)*l,(k*g-m*h)*l),v.set((i*n-q*f)*l,(i*r-q*s)*l,(i*h-q*g)*l),t[d].add(c),t[p].add(c),t[e].add(c),u[d].add(v),
|
|
|
|
+u[p].add(v),u[e].add(v);v=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)G.copy(e.vertexNormals[c]),d=e[v[c]],p=t[d],w.copy(p),w.sub(G.multiplyScalar(G.dot(p))).normalize(),E.crossVectors(e.vertexNormals[c],p),d=E.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=
|
|
a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*
|
|
a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*
|
|
e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){e=a[f];this.faces.splice(e,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(e,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=
|
|
e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){e=a[f];this.faces.splice(e,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(e,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=
|
|
b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c,d){this.attributes[a]={itemSize:d,array:new b(c*d)}},applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c,d){this.attributes[a]={itemSize:d,array:new b(c*d)}},applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===
|
|
this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=
|
|
this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=
|
|
new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var h=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),h=Math.max(h,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(h)}}}(),computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;
|
|
new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var h=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),h=Math.max(h,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(h)}}}(),computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;
|
|
-if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,m,l,n=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,p=new THREE.Vector3;if(this.attributes.index){var u=this.attributes.index.array,t=this.offsets;c=0;for(d=t.length;c<d;++c){b=t[c].start;h=t[c].count;var v=
|
|
|
|
-t[c].index;a=b;for(b+=h;a<b;a+=3)h=v+u[a],g=v+u[a+1],i=v+u[a+2],k=e[3*h],m=e[3*h+1],l=e[3*h+2],n.set(k,m,l),k=e[3*g],m=e[3*g+1],l=e[3*g+2],s.set(k,m,l),k=e[3*i],m=e[3*i+1],l=e[3*i+2],r.set(k,m,l),q.subVectors(r,s),p.subVectors(n,s),q.cross(p),f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*i]+=q.x,f[3*i+1]+=q.y,f[3*i+2]+=q.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],l=e[a+2],n.set(k,m,l),k=e[a+3],m=e[a+4],l=e[a+5],s.set(k,m,l),k=e[a+6],m=e[a+7],l=e[a+8],
|
|
|
|
|
|
+if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,m,l,n=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,p=new THREE.Vector3;if(this.attributes.index){var t=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;h=u[c].count;var v=
|
|
|
|
+u[c].index;a=b;for(b+=h;a<b;a+=3)h=v+t[a],g=v+t[a+1],i=v+t[a+2],k=e[3*h],m=e[3*h+1],l=e[3*h+2],n.set(k,m,l),k=e[3*g],m=e[3*g+1],l=e[3*g+2],s.set(k,m,l),k=e[3*i],m=e[3*i+1],l=e[3*i+2],r.set(k,m,l),q.subVectors(r,s),p.subVectors(n,s),q.cross(p),f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*i]+=q.x,f[3*i+1]+=q.y,f[3*i+2]+=q.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],l=e[a+2],n.set(k,m,l),k=e[a+3],m=e[a+4],l=e[a+5],s.set(k,m,l),k=e[a+6],m=e[a+7],l=e[a+8],
|
|
r.set(k,m,l),q.subVectors(r,s),p.subVectors(n,s),q.cross(p),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){na.x=d[3*a];na.y=d[3*a+1];na.z=d[3*a+2];pa.copy(na);Q=g[a];S.copy(Q);S.sub(na.multiplyScalar(na.dot(Q))).normalize();
|
|
r.set(k,m,l),q.subVectors(r,s),p.subVectors(n,s),q.cross(p),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){na.x=d[3*a];na.y=d[3*a+1];na.z=d[3*a+2];pa.copy(na);Q=g[a];S.copy(Q);S.sub(na.multiplyScalar(na.dot(Q))).normalize();
|
|
ia.crossVectors(pa,Q);R=ia.dot(i[a]);C=0>R?-1:1;h[4*a]=S.x;h[4*a+1]=S.y;h[4*a+2]=S.z;h[4*a+3]=C}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&
|
|
ia.crossVectors(pa,Q);R=ia.dot(i[a]);C=0>R?-1:1;h[4*a]=S.x;h[4*a+1]=S.y;h[4*a+2]=S.z;h[4*a+3]=C}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&
|
|
-(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var m,l,n,s,r,q,p,u,t,v,w,x,F,y,D,f=new THREE.Vector3,k=new THREE.Vector3,E,J,G,B,M,z,I,A=this.offsets;G=0;for(B=A.length;G<B;++G){J=A[G].start;M=A[G].count;var N=A[G].index;E=J;for(J+=M;E<J;E+=3)M=N+b[E],z=N+b[E+1],I=N+b[E+2],m=c[3*M],l=c[3*M+1],n=c[3*M+2],s=c[3*z],r=c[3*z+1],q=c[3*z+2],p=c[3*I],u=c[3*I+1],t=c[3*I+2],v=e[2*
|
|
|
|
-M],w=e[2*M+1],x=e[2*z],F=e[2*z+1],y=e[2*I],D=e[2*I+1],s-=m,m=p-m,r-=l,l=u-l,q-=n,n=t-n,x-=v,v=y-v,F-=w,w=D-w,D=1/(x*w-v*F),f.set((w*s-F*m)*D,(w*r-F*l)*D,(w*q-F*n)*D),k.set((x*m-v*s)*D,(x*l-v*r)*D,(x*n-v*q)*D),g[M].add(f),g[z].add(f),g[I].add(f),i[M].add(k),i[z].add(k),i[I].add(k)}var S=new THREE.Vector3,ia=new THREE.Vector3,na=new THREE.Vector3,pa=new THREE.Vector3,C,Q,R;G=0;for(B=A.length;G<B;++G){J=A[G].start;M=A[G].count;N=A[G].index;E=J;for(J+=M;E<J;E+=3)M=N+b[E],z=N+b[E+1],I=N+b[E+2],a(M),a(z),
|
|
|
|
|
|
+(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var m,l,n,s,r,q,p,t,u,v,w,E,G,y,D,f=new THREE.Vector3,k=new THREE.Vector3,x,J,F,B,M,z,I,A=this.offsets;F=0;for(B=A.length;F<B;++F){J=A[F].start;M=A[F].count;var N=A[F].index;x=J;for(J+=M;x<J;x+=3)M=N+b[x],z=N+b[x+1],I=N+b[x+2],m=c[3*M],l=c[3*M+1],n=c[3*M+2],s=c[3*z],r=c[3*z+1],q=c[3*z+2],p=c[3*I],t=c[3*I+1],u=c[3*I+2],v=e[2*
|
|
|
|
+M],w=e[2*M+1],E=e[2*z],G=e[2*z+1],y=e[2*I],D=e[2*I+1],s-=m,m=p-m,r-=l,l=t-l,q-=n,n=u-n,E-=v,v=y-v,G-=w,w=D-w,D=1/(E*w-v*G),f.set((w*s-G*m)*D,(w*r-G*l)*D,(w*q-G*n)*D),k.set((E*m-v*s)*D,(E*l-v*r)*D,(E*n-v*q)*D),g[M].add(f),g[z].add(f),g[I].add(f),i[M].add(k),i[z].add(k),i[I].add(k)}var S=new THREE.Vector3,ia=new THREE.Vector3,na=new THREE.Vector3,pa=new THREE.Vector3,C,Q,R;F=0;for(B=A.length;F<B;++F){J=A[F].start;M=A[F].count;N=A[F].index;x=J;for(J+=M;x<J;x+=3)M=N+b[x],z=N+b[x+1],I=N+b[x+2],a(M),a(z),
|
|
a(I)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,
|
|
a(I)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,
|
|
index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);a.projectionMatrixInverse.copy(this.projectionMatrixInverse);return a};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);a.projectionMatrixInverse.copy(this.projectionMatrixInverse);return a};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
@@ -205,8 +205,8 @@ THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLig
|
|
this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,p){var u=/\.dds$/i.test(f),t=b+"/"+f;if(u){var v=THREE.ImageUtils.loadCompressedTexture(t);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
|
-f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));p&&(a[e].anisotropy=p);if(!u){var w=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);w.image.width=a;w.image.height=b;w.image.getContext("2d").drawImage(this,0,0,a,b)}else w.image=this;w.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=t}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,p){var t=/\.dds$/i.test(f),u=b+"/"+f;if(t){var v=THREE.ImageUtils.loadCompressedTexture(u);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
|
+f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));p&&(a[e].anisotropy=p);if(!t){var w=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);w.image.width=a;w.image.height=b;w.image.getContext("2d").drawImage(this,0,0,a,b)}else w.image=this;w.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
@@ -216,12 +216,12 @@ THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){va
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
|
|
(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,m,l,n,s,r,q,p,u,t=a.faces;n=a.vertices;var v=a.normals,w=a.colors,x=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&x++;for(e=0;e<x;e++)c.faceVertexUvs[e]=[]}g=0;for(i=n.length;g<i;)k=new THREE.Vector3,k.x=n[g++]*d,k.y=n[g++]*d,k.z=n[g++]*d,c.vertices.push(k);g=0;for(i=t.length;g<i;)if(n=t[g++],s=n&1,h=n&2,e=n&8,m=n&16,r=n&32,k=n&64,n&=128,s){s=new THREE.Face3;s.a=t[g];
|
|
|
|
-s.b=t[g+1];s.c=t[g+3];q=new THREE.Face3;q.a=t[g+1];q.b=t[g+2];q.c=t[g+3];g+=4;h&&(h=t[g++],s.materialIndex=h,q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<x;e++){p=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)l=t[g++],u=p[2*l],l=p[2*l+1],u=new THREE.Vector2(u,l),2!==f&&c.faceVertexUvs[e][h].push(u),0!==f&&c.faceVertexUvs[e][h+1].push(u)}m&&(m=3*t[g++],s.normal.set(v[m++],v[m++],v[m]),q.normal.copy(s.normal));if(r)for(e=0;4>e;e++)m=3*t[g++],r=new THREE.Vector3(v[m++],
|
|
|
|
-v[m++],v[m]),2!==e&&s.vertexNormals.push(r),0!==e&&q.vertexNormals.push(r);k&&(k=t[g++],k=w[k],s.color.setHex(k),q.color.setHex(k));if(n)for(e=0;4>e;e++)k=t[g++],k=w[k],2!==e&&s.vertexColors.push(new THREE.Color(k)),0!==e&&q.vertexColors.push(new THREE.Color(k));c.faces.push(s);c.faces.push(q)}else{s=new THREE.Face3;s.a=t[g++];s.b=t[g++];s.c=t[g++];h&&(h=t[g++],s.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<x;e++){p=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)l=t[g++],u=p[2*l],l=p[2*l+1],
|
|
|
|
-u=new THREE.Vector2(u,l),c.faceVertexUvs[e][h].push(u)}m&&(m=3*t[g++],s.normal.set(v[m++],v[m++],v[m]));if(r)for(e=0;3>e;e++)m=3*t[g++],r=new THREE.Vector3(v[m++],v[m++],v[m]),s.vertexNormals.push(r);k&&(k=t[g++],s.color.setHex(w[k]));if(n)for(e=0;3>e;e++)k=t[g++],s.vertexColors.push(new THREE.Color(w[k]));c.faces.push(s)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)t=a.skinWeights[g],v=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(t,v,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
|
|
|
|
-i;g+=2)t=a.skinIndices[g],v=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(t,v,0,0))}c.bones=a.bones;c.animation=a.animation;c.animations=a.animations;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];w=c.morphTargets[g].vertices;x=a.morphTargets[g].vertices;t=0;for(v=x.length;t<v;t+=3)n=new THREE.Vector3,n.x=x[t]*d,n.y=x[t+1]*d,n.z=x[t+2]*d,w.push(n)}}if(void 0!==a.morphColors){g=
|
|
|
|
-0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];v=c.morphColors[g].colors;w=a.morphColors[g].colors;d=0;for(t=w.length;d<t;d+=3)x=new THREE.Color(16755200),x.setRGB(w[d],w[d+1],w[d+2]),v.push(x)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,m,l,n,s,r,q,p,t,u=a.faces;n=a.vertices;var v=a.normals,w=a.colors,E=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&E++;for(e=0;e<E;e++)c.faceVertexUvs[e]=[]}g=0;for(i=n.length;g<i;)k=new THREE.Vector3,k.x=n[g++]*d,k.y=n[g++]*d,k.z=n[g++]*d,c.vertices.push(k);g=0;for(i=u.length;g<i;)if(n=u[g++],s=n&1,h=n&2,e=n&8,m=n&16,r=n&32,k=n&64,n&=128,s){s=new THREE.Face3;s.a=u[g];
|
|
|
|
+s.b=u[g+1];s.c=u[g+3];q=new THREE.Face3;q.a=u[g+1];q.b=u[g+2];q.c=u[g+3];g+=4;h&&(h=u[g++],s.materialIndex=h,q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<E;e++){p=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)l=u[g++],t=p[2*l],l=p[2*l+1],t=new THREE.Vector2(t,l),2!==f&&c.faceVertexUvs[e][h].push(t),0!==f&&c.faceVertexUvs[e][h+1].push(t)}m&&(m=3*u[g++],s.normal.set(v[m++],v[m++],v[m]),q.normal.copy(s.normal));if(r)for(e=0;4>e;e++)m=3*u[g++],r=new THREE.Vector3(v[m++],
|
|
|
|
+v[m++],v[m]),2!==e&&s.vertexNormals.push(r),0!==e&&q.vertexNormals.push(r);k&&(k=u[g++],k=w[k],s.color.setHex(k),q.color.setHex(k));if(n)for(e=0;4>e;e++)k=u[g++],k=w[k],2!==e&&s.vertexColors.push(new THREE.Color(k)),0!==e&&q.vertexColors.push(new THREE.Color(k));c.faces.push(s);c.faces.push(q)}else{s=new THREE.Face3;s.a=u[g++];s.b=u[g++];s.c=u[g++];h&&(h=u[g++],s.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<E;e++){p=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)l=u[g++],t=p[2*l],l=p[2*l+1],
|
|
|
|
+t=new THREE.Vector2(t,l),c.faceVertexUvs[e][h].push(t)}m&&(m=3*u[g++],s.normal.set(v[m++],v[m++],v[m]));if(r)for(e=0;3>e;e++)m=3*u[g++],r=new THREE.Vector3(v[m++],v[m++],v[m]),s.vertexNormals.push(r);k&&(k=u[g++],s.color.setHex(w[k]));if(n)for(e=0;3>e;e++)k=u[g++],s.vertexColors.push(new THREE.Color(w[k]));c.faces.push(s)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)u=a.skinWeights[g],v=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(u,v,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
|
|
|
|
+i;g+=2)u=a.skinIndices[g],v=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(u,v,0,0))}c.bones=a.bones;c.animation=a.animation;c.animations=a.animations;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];w=c.morphTargets[g].vertices;E=a.morphTargets[g].vertices;u=0;for(v=E.length;u<v;u+=3)n=new THREE.Vector3,n.x=E[u]*d,n.y=E[u+1]*d,n.z=E[u+2]*d,w.push(n)}}if(void 0!==a.morphColors){g=
|
|
|
|
+0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];v=c.morphColors[g].colors;w=a.morphColors[g].colors;d=0;for(u=w.length;d<u;d+=3)E=new THREE.Color(16755200),E.setRGB(w[d],w[d+1],w[d+2]),v.push(E)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets,a=a.boundingSphere,e;for(e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
|
|
THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets,a=a.boundingSphere,e;for(e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
|
|
void 0!==a&&(b.boundingSphere=new THREE.Sphere((new THREE.Vector3).fromArray(void 0!==a.center?a.center:[0,0,0]),a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
void 0!==a&&(b.boundingSphere=new THREE.Sphere((new THREE.Vector3).fromArray(void 0!==a.center?a.center:[0,0,0]),a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
|
|
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
|
|
@@ -234,27 +234,27 @@ b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.r
|
|
b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),
|
|
b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),
|
|
void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
|
|
void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
|
|
THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(y.scene,
|
|
THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(y.scene,
|
|
-E.objects)}function f(a,b){var c,e,h,i,k,m;for(m in b){var n=y.objects[m],p=b[m];if(void 0===n){if(p.type&&p.type in l.hierarchyHandlers){if(void 0===p.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var u={},v;for(v in p)v in c||(u[v]=p[v]);r=y.materials[p.material];p.loading=!0;c=l.hierarchyHandlers[p.type].loaderObject;c.options?c.load(d(p.url,E.urlBaseType),g(m,a,r,p)):c.load(d(p.url,E.urlBaseType),g(m,
|
|
|
|
-a,r,p),u)}}else if(void 0!==p.geometry){if(s=y.geometries[p.geometry]){n=!1;r=y.materials[p.material];n=r instanceof THREE.ShaderMaterial;e=p.position;h=p.rotation;i=p.scale;c=p.matrix;k=p.quaternion;p.material||(r=new THREE.MeshFaceMaterial(y.face_materials[p.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(y.face_materials[p.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(u=0;u<r.materials.length;u++)n=n||r.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
|
|
|
+x.objects)}function f(a,b){var c,e,h,i,k,m;for(m in b){var n=y.objects[m],p=b[m];if(void 0===n){if(p.type&&p.type in l.hierarchyHandlers){if(void 0===p.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var t={},v;for(v in p)v in c||(t[v]=p[v]);r=y.materials[p.material];p.loading=!0;c=l.hierarchyHandlers[p.type].loaderObject;c.options?c.load(d(p.url,x.urlBaseType),g(m,a,r,p)):c.load(d(p.url,x.urlBaseType),g(m,
|
|
|
|
+a,r,p),t)}}else if(void 0!==p.geometry){if(s=y.geometries[p.geometry]){n=!1;r=y.materials[p.material];n=r instanceof THREE.ShaderMaterial;e=p.position;h=p.rotation;i=p.scale;c=p.matrix;k=p.quaternion;p.material||(r=new THREE.MeshFaceMaterial(y.face_materials[p.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(y.face_materials[p.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(t=0;t<r.materials.length;t++)n=n||r.materials[t]instanceof THREE.ShaderMaterial;
|
|
n&&s.computeTangents();p.skin?n=new THREE.SkinnedMesh(s,r):p.morph?(n=new THREE.MorphAnimMesh(s,r),void 0!==p.duration&&(n.duration=p.duration),void 0!==p.time&&(n.time=p.time),void 0!==p.mirroredLoop&&(n.mirroredLoop=p.mirroredLoop),r.morphNormals&&s.computeMorphNormals()):n=new THREE.Mesh(s,r);n.name=m;c?(n.matrixAutoUpdate=!1,n.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(n.position.fromArray(e),k?n.quaternion.fromArray(k):n.rotation.fromArray(h),
|
|
n&&s.computeTangents();p.skin?n=new THREE.SkinnedMesh(s,r):p.morph?(n=new THREE.MorphAnimMesh(s,r),void 0!==p.duration&&(n.duration=p.duration),void 0!==p.time&&(n.time=p.time),void 0!==p.mirroredLoop&&(n.mirroredLoop=p.mirroredLoop),r.morphNormals&&s.computeMorphNormals()):n=new THREE.Mesh(s,r);n.name=m;c?(n.matrixAutoUpdate=!1,n.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(n.position.fromArray(e),k?n.quaternion.fromArray(k):n.rotation.fromArray(h),
|
|
-n.scale.fromArray(i));n.visible=p.visible;n.castShadow=p.castShadow;n.receiveShadow=p.receiveShadow;a.add(n);y.objects[m]=n}}else if("AmbientLight"===p.type||"PointLight"===p.type||"DirectionalLight"===p.type||"SpotLight"===p.type||"HemisphereLight"===p.type||"AreaLight"===p.type){u=p.color;c=p.intensity;e=p.distance;h=p.position;i=p.rotation;switch(p.type){case "AmbientLight":t=new THREE.AmbientLight(u);break;case "PointLight":t=new THREE.PointLight(u,c,e);t.position.fromArray(h);break;case "DirectionalLight":t=
|
|
|
|
-new THREE.DirectionalLight(u,c);t.position.fromArray(p.direction);break;case "SpotLight":t=new THREE.SpotLight(u,c,e,1);t.angle=p.angle;t.position.fromArray(h);t.target.set(h[0],h[1]-e,h[2]);t.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":t=new THREE.DirectionalLight(u,c,e);t.target.set(h[0],h[1]-e,h[2]);t.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":t=new THREE.AreaLight(u,c),t.position.fromArray(h),t.width=p.size,t.height=
|
|
|
|
-p.size_y}a.add(t);t.name=m;y.lights[m]=t;y.objects[m]=t}else"PerspectiveCamera"===p.type||"OrthographicCamera"===p.type?(e=p.position,h=p.rotation,k=p.quaternion,"PerspectiveCamera"===p.type?q=new THREE.PerspectiveCamera(p.fov,p.aspect,p.near,p.far):"OrthographicCamera"===p.type&&(q=new THREE.OrthographicCamera(p.left,p.right,p.top,p.bottom,p.near,p.far)),q.name=m,q.position.fromArray(e),void 0!==k?q.quaternion.fromArray(k):void 0!==h&&q.rotation.fromArray(h),a.add(q),y.cameras[m]=q,y.objects[m]=
|
|
|
|
-q):(e=p.position,h=p.rotation,i=p.scale,k=p.quaternion,n=new THREE.Object3D,n.name=m,n.position.fromArray(e),k?n.quaternion.fromArray(k):n.rotation.fromArray(h),n.scale.fromArray(i),n.visible=void 0!==p.visible?p.visible:!1,a.add(n),y.objects[m]=n,y.empties[m]=n);if(n){if(void 0!==p.userData)for(var w in p.userData)n.userData[w]=p.userData[w];if(void 0!==p.groups)for(u=0;u<p.groups.length;u++)c=p.groups[u],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(m)}}void 0!==n&&void 0!==p.children&&
|
|
|
|
|
|
+n.scale.fromArray(i));n.visible=p.visible;n.castShadow=p.castShadow;n.receiveShadow=p.receiveShadow;a.add(n);y.objects[m]=n}}else if("AmbientLight"===p.type||"PointLight"===p.type||"DirectionalLight"===p.type||"SpotLight"===p.type||"HemisphereLight"===p.type||"AreaLight"===p.type){t=p.color;c=p.intensity;e=p.distance;h=p.position;i=p.rotation;switch(p.type){case "AmbientLight":u=new THREE.AmbientLight(t);break;case "PointLight":u=new THREE.PointLight(t,c,e);u.position.fromArray(h);break;case "DirectionalLight":u=
|
|
|
|
+new THREE.DirectionalLight(t,c);u.position.fromArray(p.direction);break;case "SpotLight":u=new THREE.SpotLight(t,c,e,1);u.angle=p.angle;u.position.fromArray(h);u.target.set(h[0],h[1]-e,h[2]);u.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":u=new THREE.DirectionalLight(t,c,e);u.target.set(h[0],h[1]-e,h[2]);u.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":u=new THREE.AreaLight(t,c),u.position.fromArray(h),u.width=p.size,u.height=
|
|
|
|
+p.size_y}a.add(u);u.name=m;y.lights[m]=u;y.objects[m]=u}else"PerspectiveCamera"===p.type||"OrthographicCamera"===p.type?(e=p.position,h=p.rotation,k=p.quaternion,"PerspectiveCamera"===p.type?q=new THREE.PerspectiveCamera(p.fov,p.aspect,p.near,p.far):"OrthographicCamera"===p.type&&(q=new THREE.OrthographicCamera(p.left,p.right,p.top,p.bottom,p.near,p.far)),q.name=m,q.position.fromArray(e),void 0!==k?q.quaternion.fromArray(k):void 0!==h&&q.rotation.fromArray(h),a.add(q),y.cameras[m]=q,y.objects[m]=
|
|
|
|
+q):(e=p.position,h=p.rotation,i=p.scale,k=p.quaternion,n=new THREE.Object3D,n.name=m,n.position.fromArray(e),k?n.quaternion.fromArray(k):n.rotation.fromArray(h),n.scale.fromArray(i),n.visible=void 0!==p.visible?p.visible:!1,a.add(n),y.objects[m]=n,y.empties[m]=n);if(n){if(void 0!==p.userData)for(var w in p.userData)n.userData[w]=p.userData[w];if(void 0!==p.groups)for(t=0;t<p.groups.length;t++)c=p.groups[t],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(m)}}void 0!==n&&void 0!==p.children&&
|
|
f(n,p.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();v-=1;l.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var m=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=m});b.add(f);f.name=a;y.objects[a]=
|
|
f(n,p.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();v-=1;l.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var m=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=m});b.add(f);f.name=a;y.objects[a]=
|
|
-f;e();v-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:x,totalTextures:F,loadedModels:x-v,loadedTextures:F-w},y);l.onLoadProgress();if(0===v&&0===w){for(var a=0;a<D.length;a++){var c=D[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(y)}}function m(a,b){b(a);if(void 0!==a.children)for(var c in a.children)m(a.children[c],
|
|
|
|
-b)}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),s,r,q,p,u,t,v,w,x,F,y,D=[],E=a,J;for(J in this.geometryHandlers)a=this.geometryHandlers[J].loaderClass,this.geometryHandlers[J].loaderObject=new a;for(J in this.hierarchyHandlers)a=this.hierarchyHandlers[J].loaderClass,this.hierarchyHandlers[J].loaderObject=new a;w=v=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(E.transform&&(J=E.transform.position,
|
|
|
|
-a=E.transform.rotation,c=E.transform.scale,J&&y.scene.position.fromArray(J),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),J||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();J=function(a){return function(){w-=a;k();l.onLoadComplete()}};for(var G in E.fogs)a=E.fogs[G],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),y.fogs[G]=p;for(var B in E.geometries)p=E.geometries[B],p.type in
|
|
|
|
-this.geometryHandlers&&(v+=1,l.onLoadStart());for(var M in E.objects)m(E.objects[M],function(a){a.type&&a.type in l.hierarchyHandlers&&(v+=1,l.onLoadStart())});x=v;for(B in E.geometries)if(p=E.geometries[B],"cube"===p.type)s=new THREE.CubeGeometry(p.width,p.height,p.depth,p.widthSegments,p.heightSegments,p.depthSegments),s.name=B,y.geometries[B]=s;else if("plane"===p.type)s=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),s.name=B,y.geometries[B]=s;else if("sphere"===p.type)s=
|
|
|
|
|
|
+f;e();v-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:E,totalTextures:G,loadedModels:E-v,loadedTextures:G-w},y);l.onLoadProgress();if(0===v&&0===w){for(var a=0;a<D.length;a++){var c=D[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(y)}}function m(a,b){b(a);if(void 0!==a.children)for(var c in a.children)m(a.children[c],
|
|
|
|
+b)}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),s,r,q,p,t,u,v,w,E,G,y,D=[],x=a,J;for(J in this.geometryHandlers)a=this.geometryHandlers[J].loaderClass,this.geometryHandlers[J].loaderObject=new a;for(J in this.hierarchyHandlers)a=this.hierarchyHandlers[J].loaderClass,this.hierarchyHandlers[J].loaderObject=new a;w=v=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(x.transform&&(J=x.transform.position,
|
|
|
|
+a=x.transform.rotation,c=x.transform.scale,J&&y.scene.position.fromArray(J),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),J||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();J=function(a){return function(){w-=a;k();l.onLoadComplete()}};for(var F in x.fogs)a=x.fogs[F],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),y.fogs[F]=p;for(var B in x.geometries)p=x.geometries[B],p.type in
|
|
|
|
+this.geometryHandlers&&(v+=1,l.onLoadStart());for(var M in x.objects)m(x.objects[M],function(a){a.type&&a.type in l.hierarchyHandlers&&(v+=1,l.onLoadStart())});E=v;for(B in x.geometries)if(p=x.geometries[B],"cube"===p.type)s=new THREE.CubeGeometry(p.width,p.height,p.depth,p.widthSegments,p.heightSegments,p.depthSegments),s.name=B,y.geometries[B]=s;else if("plane"===p.type)s=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),s.name=B,y.geometries[B]=s;else if("sphere"===p.type)s=
|
|
new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),s.name=B,y.geometries[B]=s;else if("cylinder"===p.type)s=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),s.name=B,y.geometries[B]=s;else if("torus"===p.type)s=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),s.name=B,y.geometries[B]=s;else if("icosahedron"===p.type)s=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),s.name=B,y.geometries[B]=s;else if(p.type in this.geometryHandlers){M=
|
|
new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),s.name=B,y.geometries[B]=s;else if("cylinder"===p.type)s=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),s.name=B,y.geometries[B]=s;else if("torus"===p.type)s=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),s.name=B,y.geometries[B]=s;else if("icosahedron"===p.type)s=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),s.name=B,y.geometries[B]=s;else if(p.type in this.geometryHandlers){M=
|
|
-{};for(u in p)"type"!==u&&"url"!==u&&(M[u]=p[u]);this.geometryHandlers[p.type].loaderObject.load(d(p.url,E.urlBaseType),h(B),M)}else"embedded"===p.type&&(M=E.embeds[p.id],M.metadata=E.metadata,M&&(M=this.geometryHandlers.ascii.loaderObject.parse(M,""),i(B)(M.geometry,M.materials)));for(var z in E.textures)if(B=E.textures[z],B.url instanceof Array){w+=B.url.length;for(u=0;u<B.url.length;u++)l.onLoadStart()}else w+=1,l.onLoadStart();F=w;for(z in E.textures){B=E.textures[z];void 0!==B.mapping&&void 0!==
|
|
|
|
-THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){M=B.url.length;p=[];for(u=0;u<M;u++)p[u]=d(B.url[u],E.urlBaseType);u=(u=/\.dds$/i.test(p[0]))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,J(M)):THREE.ImageUtils.loadTextureCube(p,B.mapping,J(M))}else u=/\.dds$/i.test(B.url),M=d(B.url,E.urlBaseType),p=J(1),u=u?THREE.ImageUtils.loadCompressedTexture(M,B.mapping,p):THREE.ImageUtils.loadTexture(M,B.mapping,p),void 0!==THREE[B.minFilter]&&(u.minFilter=THREE[B.minFilter]),
|
|
|
|
-void 0!==THREE[B.magFilter]&&(u.magFilter=THREE[B.magFilter]),B.anisotropy&&(u.anisotropy=B.anisotropy),B.repeat&&(u.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(u.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(u.wrapT=THREE.RepeatWrapping)),B.offset&&u.offset.set(B.offset[0],B.offset[1]),B.wrap&&(M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==M[B.wrap[0]]&&(u.wrapS=M[B.wrap[0]]),void 0!==M[B.wrap[1]]&&(u.wrapT=M[B.wrap[1]]));y.textures[z]=u}var I,A;for(I in E.materials){z=
|
|
|
|
-E.materials[I];for(A in z.parameters)"envMap"===A||"map"===A||"lightMap"===A||"bumpMap"===A?z.parameters[A]=y.textures[z.parameters[A]]:"shading"===A?z.parameters[A]="flat"===z.parameters[A]?THREE.FlatShading:THREE.SmoothShading:"side"===A?z.parameters[A]="double"==z.parameters[A]?THREE.DoubleSide:"back"==z.parameters[A]?THREE.BackSide:THREE.FrontSide:"blending"===A?z.parameters[A]=z.parameters[A]in THREE?THREE[z.parameters[A]]:THREE.NormalBlending:"combine"===A?z.parameters[A]=z.parameters[A]in THREE?
|
|
|
|
-THREE[z.parameters[A]]:THREE.MultiplyOperation:"vertexColors"===A?"face"==z.parameters[A]?z.parameters[A]=THREE.FaceColors:z.parameters[A]&&(z.parameters[A]=THREE.VertexColors):"wrapRGB"===A&&(J=z.parameters[A],z.parameters[A]=new THREE.Vector3(J[0],J[1],J[2]));void 0!==z.parameters.opacity&&1>z.parameters.opacity&&(z.parameters.transparent=!0);z.parameters.normalMap?(J=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(J.uniforms),u=z.parameters.color,M=z.parameters.specular,p=z.parameters.ambient,
|
|
|
|
-G=z.parameters.shininess,B.tNormal.value=y.textures[z.parameters.normalMap],z.parameters.normalScale&&B.uNormalScale.value.set(z.parameters.normalScale[0],z.parameters.normalScale[1]),z.parameters.map&&(B.tDiffuse.value=z.parameters.map,B.enableDiffuse.value=!0),z.parameters.envMap&&(B.tCube.value=z.parameters.envMap,B.enableReflection.value=!0,B.uReflectivity.value=z.parameters.reflectivity),z.parameters.lightMap&&(B.tAO.value=z.parameters.lightMap,B.enableAO.value=!0),z.parameters.specularMap&&
|
|
|
|
-(B.tSpecular.value=y.textures[z.parameters.specularMap],B.enableSpecular.value=!0),z.parameters.displacementMap&&(B.tDisplacement.value=y.textures[z.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=z.parameters.displacementBias,B.uDisplacementScale.value=z.parameters.displacementScale),B.uDiffuseColor.value.setHex(u),B.uSpecularColor.value.setHex(M),B.uAmbientColor.value.setHex(p),B.uShininess.value=G,z.parameters.opacity&&(B.uOpacity.value=z.parameters.opacity),
|
|
|
|
-r=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:B,lights:!0,fog:!0})):r=new THREE[z.type](z.parameters);r.name=I;y.materials[I]=r}for(I in E.materials)if(z=E.materials[I],z.parameters.materials){A=[];for(u=0;u<z.parameters.materials.length;u++)A.push(y.materials[z.parameters.materials[u]]);y.materials[I].materials=A}e();y.cameras&&E.defaults.camera&&(y.currentCamera=y.cameras[E.defaults.camera]);y.fogs&&E.defaults.fog&&(y.scene.fog=y.fogs[E.defaults.fog]);
|
|
|
|
|
|
+{};for(t in p)"type"!==t&&"url"!==t&&(M[t]=p[t]);this.geometryHandlers[p.type].loaderObject.load(d(p.url,x.urlBaseType),h(B),M)}else"embedded"===p.type&&(M=x.embeds[p.id],M.metadata=x.metadata,M&&(M=this.geometryHandlers.ascii.loaderObject.parse(M,""),i(B)(M.geometry,M.materials)));for(var z in x.textures)if(B=x.textures[z],B.url instanceof Array){w+=B.url.length;for(t=0;t<B.url.length;t++)l.onLoadStart()}else w+=1,l.onLoadStart();G=w;for(z in x.textures){B=x.textures[z];void 0!==B.mapping&&void 0!==
|
|
|
|
+THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){M=B.url.length;p=[];for(t=0;t<M;t++)p[t]=d(B.url[t],x.urlBaseType);t=(t=/\.dds$/i.test(p[0]))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,J(M)):THREE.ImageUtils.loadTextureCube(p,B.mapping,J(M))}else t=/\.dds$/i.test(B.url),M=d(B.url,x.urlBaseType),p=J(1),t=t?THREE.ImageUtils.loadCompressedTexture(M,B.mapping,p):THREE.ImageUtils.loadTexture(M,B.mapping,p),void 0!==THREE[B.minFilter]&&(t.minFilter=THREE[B.minFilter]),
|
|
|
|
+void 0!==THREE[B.magFilter]&&(t.magFilter=THREE[B.magFilter]),B.anisotropy&&(t.anisotropy=B.anisotropy),B.repeat&&(t.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(t.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(t.wrapT=THREE.RepeatWrapping)),B.offset&&t.offset.set(B.offset[0],B.offset[1]),B.wrap&&(M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==M[B.wrap[0]]&&(t.wrapS=M[B.wrap[0]]),void 0!==M[B.wrap[1]]&&(t.wrapT=M[B.wrap[1]]));y.textures[z]=t}var I,A;for(I in x.materials){z=
|
|
|
|
+x.materials[I];for(A in z.parameters)"envMap"===A||"map"===A||"lightMap"===A||"bumpMap"===A?z.parameters[A]=y.textures[z.parameters[A]]:"shading"===A?z.parameters[A]="flat"===z.parameters[A]?THREE.FlatShading:THREE.SmoothShading:"side"===A?z.parameters[A]="double"==z.parameters[A]?THREE.DoubleSide:"back"==z.parameters[A]?THREE.BackSide:THREE.FrontSide:"blending"===A?z.parameters[A]=z.parameters[A]in THREE?THREE[z.parameters[A]]:THREE.NormalBlending:"combine"===A?z.parameters[A]=z.parameters[A]in THREE?
|
|
|
|
+THREE[z.parameters[A]]:THREE.MultiplyOperation:"vertexColors"===A?"face"==z.parameters[A]?z.parameters[A]=THREE.FaceColors:z.parameters[A]&&(z.parameters[A]=THREE.VertexColors):"wrapRGB"===A&&(J=z.parameters[A],z.parameters[A]=new THREE.Vector3(J[0],J[1],J[2]));void 0!==z.parameters.opacity&&1>z.parameters.opacity&&(z.parameters.transparent=!0);z.parameters.normalMap?(J=THREE.ShaderLib.normalmap,B=THREE.UniformsUtils.clone(J.uniforms),t=z.parameters.color,M=z.parameters.specular,p=z.parameters.ambient,
|
|
|
|
+F=z.parameters.shininess,B.tNormal.value=y.textures[z.parameters.normalMap],z.parameters.normalScale&&B.uNormalScale.value.set(z.parameters.normalScale[0],z.parameters.normalScale[1]),z.parameters.map&&(B.tDiffuse.value=z.parameters.map,B.enableDiffuse.value=!0),z.parameters.envMap&&(B.tCube.value=z.parameters.envMap,B.enableReflection.value=!0,B.uReflectivity.value=z.parameters.reflectivity),z.parameters.lightMap&&(B.tAO.value=z.parameters.lightMap,B.enableAO.value=!0),z.parameters.specularMap&&
|
|
|
|
+(B.tSpecular.value=y.textures[z.parameters.specularMap],B.enableSpecular.value=!0),z.parameters.displacementMap&&(B.tDisplacement.value=y.textures[z.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=z.parameters.displacementBias,B.uDisplacementScale.value=z.parameters.displacementScale),B.uDiffuseColor.value.setHex(t),B.uSpecularColor.value.setHex(M),B.uAmbientColor.value.setHex(p),B.uShininess.value=F,z.parameters.opacity&&(B.uOpacity.value=z.parameters.opacity),
|
|
|
|
+r=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:B,lights:!0,fog:!0})):r=new THREE[z.type](z.parameters);r.name=I;y.materials[I]=r}for(I in x.materials)if(z=x.materials[I],z.parameters.materials){A=[];for(t=0;t<z.parameters.materials.length;t++)A.push(y.materials[z.parameters.materials[t]]);y.materials[I].materials=A}e();y.cameras&&x.defaults.camera&&(y.currentCamera=y.cameras[x.defaults.camera]);y.fogs&&x.defaults.fog&&(y.scene.fog=y.fogs[x.defaults.fog]);
|
|
l.callbackSync(y);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
l.callbackSync(y);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
|
|
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
|
|
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
|
|
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
|
|
@@ -273,10 +273,8 @@ a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.ref
|
|
THREE.ParticleSystemMaterial.prototype.clone=function(){var a=new THREE.ParticleSystemMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleBasicMaterial=THREE.ParticleSystemMaterial;THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName="position";this.setValues(a)};
|
|
THREE.ParticleSystemMaterial.prototype.clone=function(){var a=new THREE.ParticleSystemMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleBasicMaterial=THREE.ParticleSystemMaterial;THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName="position";this.setValues(a)};
|
|
THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=
|
|
THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=
|
|
-this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=new THREE.Texture;this.useScreenCoordinates=!1;this.sizeAttenuation=this.depthTest=!0;this.alignment=THREE.SpriteAlignment.center.clone();this.rotation=0;this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a);a=a||{};void 0===a.depthTest&&(this.depthTest=!1===this.useScreenCoordinates);void 0===a.sizeAttenuation&&(this.sizeAttenuation=!1===this.useScreenCoordinates)};
|
|
|
|
-THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.useScreenCoordinates=this.useScreenCoordinates;a.sizeAttenuation=this.sizeAttenuation;a.alignment.copy(this.alignment);a.rotation=this.rotation;a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);a.fog=this.fog;return a};THREE.SpriteAlignment={};
|
|
|
|
-THREE.SpriteAlignment.topLeft=new THREE.Vector2(0.5,-0.5);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-0.5);THREE.SpriteAlignment.topRight=new THREE.Vector2(-0.5,-0.5);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(0.5,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-0.5,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(0.5,0.5);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,0.5);
|
|
|
|
-THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-0.5,0.5);THREE.SpriteCanvasMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.program=function(){};this.setValues(a)};THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteCanvasMaterial.prototype.clone=function(){var a=new THREE.SpriteCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};THREE.ParticleCanvasMaterial=THREE.SpriteCanvasMaterial;THREE.Texture=function(a,b,c,d,e,f,h,g,i){this.id=THREE.TextureIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==g?g:THREE.UnsignedByteType;
|
|
|
|
|
|
+this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=new THREE.Texture;this.sizeAttenuation=this.depthTest=!0;this.rotation=0;this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
|
|
+THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.rotation=this.rotation;a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);a.fog=this.fog;return a};THREE.SpriteCanvasMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.program=function(){};this.setValues(a)};THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteCanvasMaterial.prototype.clone=function(){var a=new THREE.SpriteCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};THREE.ParticleCanvasMaterial=THREE.SpriteCanvasMaterial;THREE.Texture=function(a,b,c,d,e,f,h,g,i){this.id=THREE.TextureIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==g?g:THREE.UnsignedByteType;
|
|
this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
|
|
this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=
|
|
this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype);THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,h,g,i,k,m){THREE.Texture.call(this,null,f,h,g,i,k,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,h,g,i,k,m){THREE.Texture.call(this,null,f,h,g,i,k,d,e,m);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.ParticleSystemMaterial({color:16777215*Math.random()});this.frustumCulled=this.sortParticles=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype);THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,h,g,i,k,m){THREE.Texture.call(this,null,f,h,g,i,k,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,h,g,i,k,m){THREE.Texture.call(this,null,f,h,g,i,k,d,e,m);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.ParticleSystemMaterial({color:16777215*Math.random()});this.frustumCulled=this.sortParticles=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -298,28 +296,28 @@ THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=w.length;d<e;d++){var f=w[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=ta.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ka.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=ta.getPositionFromMatrix(f.matrixWorld),g=b.dot(ta.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ka.multiplyScalar(g)))))}}
|
|
THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=w.length;d<e;d++){var f=w[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=ta.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ka.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=ta.getPositionFromMatrix(f.matrixWorld),g=b.dot(ta.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ka.multiplyScalar(g)))))}}
|
|
-function c(a,b,c,d){m(b);l(c);n(d);s(a.getStyle());G.stroke();Ea.expandByScalar(2*b)}function d(a){r(a.getStyle());G.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Ga[n.id]=G.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ga[n.id]?r("rgba(0,0,0,1)"):
|
|
|
|
|
|
+function c(a,b,c,d){m(b);l(c);n(d);s(a.getStyle());F.stroke();Ea.expandByScalar(2*b)}function d(a){r(a.getStyle());F.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Ga[n.id]=F.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ga[n.id]?r("rgba(0,0,0,1)"):
|
|
r(Ga[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y,g=(g+p)*s,j=(1-j+q)*t,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*s-g,k=(1-k+q)*t-j,m=(m+p)*s-g,l=(1-l+q)*t-j,p=i*l-m*k;0===p?(void 0===ka[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ka[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ka[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
|
|
r(Ga[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y,g=(g+p)*s,j=(1-j+q)*t,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*s-g,k=(1-k+q)*t-j,m=(m+p)*s-g,l=(1-l+q)*t-j,p=i*l-m*k;0===p?(void 0===ka[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ka[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ka[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
|
|
-O.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(O)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,G.save(),G.transform(n,k,c,e,a,g),G.fill(),G.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*n-h;i=i*p-g;k=k*n-h;m=m*p-g;p=1/(j*m-k*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;G.save();G.transform(n,i,c,d,a,b);G.clip();G.drawImage(l,0,0);G.restore()}function h(a,
|
|
|
|
-b,c,d){ua[0]=255*a.r|0;ua[1]=255*a.g|0;ua[2]=255*a.b|0;ua[4]=255*b.r|0;ua[5]=255*b.g|0;ua[6]=255*b.b|0;ua[8]=255*c.r|0;ua[9]=255*c.g|0;ua[10]=255*c.b|0;ua[12]=255*d.r|0;ua[13]=255*d.g|0;ua[14]=255*d.b|0;j.putImageData(Oa,0,0);Fa.drawImage(Pa,0,0);return La}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function i(a){z!==a&&(z=G.globalAlpha=a)}function k(a){I!==a&&(a===THREE.NormalBlending?G.globalCompositeOperation="source-over":
|
|
|
|
-a===THREE.AdditiveBlending?G.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(G.globalCompositeOperation="darker"),I=a)}function m(a){S!==a&&(S=G.lineWidth=a)}function l(a){ia!==a&&(ia=G.lineCap=a)}function n(a){na!==a&&(na=G.lineJoin=a)}function s(a){A!==a&&(A=G.strokeStyle=a)}function r(a){N!==a&&(N=G.fillStyle=a)}function q(a,b){if(pa!==a||C!==b)G.setLineDash([a,b]),pa=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var p=THREE.Math.smoothstep,a=a||{},u=this,t,v,w,x=
|
|
|
|
-new THREE.Projector,F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),y=F.width,D=F.height,E=Math.floor(y/2),J=Math.floor(D/2),G=F.getContext("2d"),B=new THREE.Color(0),M=0,z=1,I=0,A=null,N=null,S=null,ia=null,na=null,pa=null,C=0,Q,R,K,ca;new THREE.RenderableVertex;new THREE.RenderableVertex;var wa,Ba,P,Aa,Z,da,O=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,V=new THREE.Color,ja=new THREE.Color,sa=new THREE.Color,ga=new THREE.Color,Ka=new THREE.Color,Ga={},ka={},Da,Ua,Qa,xa,bb,
|
|
|
|
-cb,Ma,fb,sb,pb,va=new THREE.Box2,la=new THREE.Box2,Ea=new THREE.Box2,gb=new THREE.Color,ra=new THREE.Color,ea=new THREE.Color,ta=new THREE.Vector3,Pa,j,Oa,ua,La,Fa,Ra=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;j=Pa.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Oa=j.getImageData(0,0,2,2);ua=Oa.data;La=document.createElement("canvas");La.width=La.height=Ra;Fa=La.getContext("2d");Fa.translate(-Ra/2,-Ra/2);Fa.scale(Ra,Ra);Ra--;void 0===G.setLineDash&&(G.setLineDash=
|
|
|
|
-void 0!==G.mozDash?function(a){G.mozDash=null!==a[0]?a:null}:function(){});this.domElement=F;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){y=a*this.devicePixelRatio;D=b*this.devicePixelRatio;E=Math.floor(y/2);J=Math.floor(D/2);
|
|
|
|
-F.width=y;F.height=D;1!==this.devicePixelRatio&&!1!==c&&(F.style.width=a+"px",F.style.height=b+"px");va.set(new THREE.Vector2(-E,-J),new THREE.Vector2(E,J));la.set(new THREE.Vector2(-E,-J),new THREE.Vector2(E,J));z=1;I=0;na=ia=S=N=A=null};this.setClearColor=function(a,b){B.set(a);M=void 0!==b?b:1;la.set(new THREE.Vector2(-E,-J),new THREE.Vector2(E,J))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,
|
|
|
|
-b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){G.setTransform(1,0,0,-1,E,J);!1===la.empty()&&(la.intersect(va),la.expandByScalar(2),1>M&&G.clearRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0),0<M&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*B.r)+","+Math.floor(255*B.g)+","+Math.floor(255*B.b)+","+M+")"),G.fillRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0)),la.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
|
-else{!0===this.autoClear&&this.clear();G.setTransform(1,0,0,-1,E,J);u.info.render.vertices=0;u.info.render.faces=0;t=x.projectScene(a,j,this.sortObjects,this.sortElements);v=t.elements;w=t.lights;Q=j;gb.setRGB(0,0,0);ra.setRGB(0,0,0);ea.setRGB(0,0,0);for(var y=0,F=w.length;y<F;y++){var B=w[y],D=B.color;B instanceof THREE.AmbientLight?gb.add(D):B instanceof THREE.DirectionalLight?ra.add(D):B instanceof THREE.PointLight&&ea.add(D)}y=0;for(F=v.length;y<F;y++){var A=v[y],z=A.material;if(!(void 0===z||
|
|
|
|
-!1===z.visible)){Ea.makeEmpty();if(A instanceof THREE.RenderableSprite){R=A;R.x*=E;R.y*=J;var B=R,D=A,I=z;i(I.opacity);k(I.blending);A=D.scale.x*E;z=D.scale.y*J;Ea.min.set(B.x-A,B.y-z);Ea.max.set(B.x+A,B.y+z);!1===va.isIntersectionBox(Ea)?Ea.makeEmpty():I instanceof THREE.SpriteMaterial||I instanceof THREE.ParticleSystemMaterial?(void 0!==I.map.image?(D=I.map.image,G.save(),G.translate(B.x,B.y),G.rotate(-I.rotation),G.scale(A,-z),G.drawImage(D,0,0,D.width,D.height,-0.5,-0.5,1,1)):(r(I.color.getStyle()),
|
|
|
|
-G.save(),G.translate(B.x,B.y),G.rotate(-D.rotation),G.scale(A,z),G.fillRect(-0.5,-0.5,1,1)),G.restore()):I instanceof THREE.SpriteCanvasMaterial&&(s(I.color.getStyle()),r(I.color.getStyle()),G.save(),G.translate(B.x,B.y),G.rotate(-D.rotation),G.scale(A,z),I.program(G),G.restore())}else if(A instanceof THREE.RenderableLine){if(R=A.v1,K=A.v2,R.positionScreen.x*=E,R.positionScreen.y*=J,K.positionScreen.x*=E,K.positionScreen.y*=J,Ea.setFromPoints([R.positionScreen,K.positionScreen]),!0===va.isIntersectionBox(Ea))if(B=
|
|
|
|
-R,D=K,I=A,A=z,i(A.opacity),k(A.blending),G.beginPath(),G.moveTo(B.positionScreen.x,B.positionScreen.y),G.lineTo(D.positionScreen.x,D.positionScreen.y),A instanceof THREE.LineBasicMaterial){m(A.linewidth);l(A.linecap);n(A.linejoin);if(A.vertexColors!==THREE.VertexColors)s(A.color.getStyle());else if(z=I.vertexColors[0].getStyle(),I=I.vertexColors[1].getStyle(),z===I)s(z);else{try{var M=G.createLinearGradient(B.positionScreen.x,B.positionScreen.y,D.positionScreen.x,D.positionScreen.y);M.addColorStop(0,
|
|
|
|
-z);M.addColorStop(1,I)}catch(C){M=z}s(M)}G.stroke();Ea.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(m(A.linewidth),l(A.linecap),n(A.linejoin),s(A.color.getStyle()),q(A.dashSize,A.gapSize),G.stroke(),Ea.expandByScalar(2*A.linewidth),q(null,null))}else if(A instanceof THREE.RenderableFace3){R=A.v1;K=A.v2;ca=A.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>ca.positionScreen.z||1<ca.positionScreen.z)continue;
|
|
|
|
-R.positionScreen.x*=E;R.positionScreen.y*=J;K.positionScreen.x*=E;K.positionScreen.y*=J;ca.positionScreen.x*=E;ca.positionScreen.y*=J;0<z.overdraw&&(g(R.positionScreen,K.positionScreen,z.overdraw),g(K.positionScreen,ca.positionScreen,z.overdraw),g(ca.positionScreen,R.positionScreen,z.overdraw));Ea.setFromPoints([R.positionScreen,K.positionScreen,ca.positionScreen]);if(!0===va.isIntersectionBox(Ea)){B=R;D=K;I=ca;u.info.render.vertices+=3;u.info.render.faces++;i(z.opacity);k(z.blending);wa=B.positionScreen.x;
|
|
|
|
-Ba=B.positionScreen.y;P=D.positionScreen.x;Aa=D.positionScreen.y;Z=I.positionScreen.x;da=I.positionScreen.y;var S=wa,N=Ba,ia=P,ka=Aa,na=Z,pa=da;G.beginPath();G.moveTo(S,N);G.lineTo(ia,ka);G.lineTo(na,pa);G.closePath();(z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial)&&null===z.map?(sa.copy(z.color),ga.copy(z.emissive),z.vertexColors===THREE.FaceColors&&sa.multiply(A.color),!1===z.wireframe&&z.shading==THREE.SmoothShading&&3==A.vertexNormalsLength?(ba.copy(gb),$.copy(gb),
|
|
|
|
|
|
+O.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(O)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,F.save(),F.transform(n,k,c,e,a,g),F.fill(),F.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*n-h;i=i*p-g;k=k*n-h;m=m*p-g;p=1/(j*m-k*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;F.save();F.transform(n,i,c,d,a,b);F.clip();F.drawImage(l,0,0);F.restore()}function h(a,
|
|
|
|
+b,c,d){ua[0]=255*a.r|0;ua[1]=255*a.g|0;ua[2]=255*a.b|0;ua[4]=255*b.r|0;ua[5]=255*b.g|0;ua[6]=255*b.b|0;ua[8]=255*c.r|0;ua[9]=255*c.g|0;ua[10]=255*c.b|0;ua[12]=255*d.r|0;ua[13]=255*d.g|0;ua[14]=255*d.b|0;j.putImageData(Oa,0,0);Fa.drawImage(Pa,0,0);return La}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function i(a){z!==a&&(z=F.globalAlpha=a)}function k(a){I!==a&&(a===THREE.NormalBlending?F.globalCompositeOperation="source-over":
|
|
|
|
+a===THREE.AdditiveBlending?F.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(F.globalCompositeOperation="darker"),I=a)}function m(a){S!==a&&(S=F.lineWidth=a)}function l(a){ia!==a&&(ia=F.lineCap=a)}function n(a){na!==a&&(na=F.lineJoin=a)}function s(a){A!==a&&(A=F.strokeStyle=a)}function r(a){N!==a&&(N=F.fillStyle=a)}function q(a,b){if(pa!==a||C!==b)F.setLineDash([a,b]),pa=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var p=THREE.Math.smoothstep,a=a||{},t=this,u,v,w,E=
|
|
|
|
+new THREE.Projector,G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),y=G.width,D=G.height,x=Math.floor(y/2),J=Math.floor(D/2),F=G.getContext("2d"),B=new THREE.Color(0),M=0,z=1,I=0,A=null,N=null,S=null,ia=null,na=null,pa=null,C=0,Q,R,K,ca;new THREE.RenderableVertex;new THREE.RenderableVertex;var wa,Ba,P,Aa,Z,da,O=new THREE.Color,ba=new THREE.Color,$=new THREE.Color,V=new THREE.Color,ja=new THREE.Color,sa=new THREE.Color,ga=new THREE.Color,Ka=new THREE.Color,Ga={},ka={},Da,Ua,Qa,xa,bb,
|
|
|
|
+cb,Ma,fb,sb,pb,va=new THREE.Box2,la=new THREE.Box2,Ea=new THREE.Box2,gb=new THREE.Color,ra=new THREE.Color,ea=new THREE.Color,ta=new THREE.Vector3,Pa,j,Oa,ua,La,Fa,Ra=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;j=Pa.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Oa=j.getImageData(0,0,2,2);ua=Oa.data;La=document.createElement("canvas");La.width=La.height=Ra;Fa=La.getContext("2d");Fa.translate(-Ra/2,-Ra/2);Fa.scale(Ra,Ra);Ra--;void 0===F.setLineDash&&(F.setLineDash=
|
|
|
|
+void 0!==F.mozDash?function(a){F.mozDash=null!==a[0]?a:null}:function(){});this.domElement=G;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){y=a*this.devicePixelRatio;D=b*this.devicePixelRatio;x=Math.floor(y/2);J=Math.floor(D/2);
|
|
|
|
+G.width=y;G.height=D;1!==this.devicePixelRatio&&!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");va.set(new THREE.Vector2(-x,-J),new THREE.Vector2(x,J));la.set(new THREE.Vector2(-x,-J),new THREE.Vector2(x,J));z=1;I=0;na=ia=S=N=A=null};this.setClearColor=function(a,b){B.set(a);M=void 0!==b?b:1;la.set(new THREE.Vector2(-x,-J),new THREE.Vector2(x,J))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,
|
|
|
|
+b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){F.setTransform(1,0,0,-1,x,J);!1===la.empty()&&(la.intersect(va),la.expandByScalar(2),1>M&&F.clearRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0),0<M&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*B.r)+","+Math.floor(255*B.g)+","+Math.floor(255*B.b)+","+M+")"),F.fillRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0)),la.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
|
+else{!0===this.autoClear&&this.clear();F.setTransform(1,0,0,-1,x,J);t.info.render.vertices=0;t.info.render.faces=0;u=E.projectScene(a,j,this.sortObjects,this.sortElements);v=u.elements;w=u.lights;Q=j;gb.setRGB(0,0,0);ra.setRGB(0,0,0);ea.setRGB(0,0,0);for(var y=0,G=w.length;y<G;y++){var B=w[y],D=B.color;B instanceof THREE.AmbientLight?gb.add(D):B instanceof THREE.DirectionalLight?ra.add(D):B instanceof THREE.PointLight&&ea.add(D)}y=0;for(G=v.length;y<G;y++){var A=v[y],z=A.material;if(!(void 0===z||
|
|
|
|
+!1===z.visible)){Ea.makeEmpty();if(A instanceof THREE.RenderableSprite){R=A;R.x*=x;R.y*=J;var B=R,D=A,I=z;i(I.opacity);k(I.blending);A=D.scale.x*x;z=D.scale.y*J;Ea.min.set(B.x-A,B.y-z);Ea.max.set(B.x+A,B.y+z);!1===va.isIntersectionBox(Ea)?Ea.makeEmpty():I instanceof THREE.SpriteMaterial||I instanceof THREE.ParticleSystemMaterial?(void 0!==I.map.image?(D=I.map.image,F.save(),F.translate(B.x,B.y),F.rotate(-I.rotation),F.scale(A,-z),F.drawImage(D,0,0,D.width,D.height,-0.5,-0.5,1,1)):(r(I.color.getStyle()),
|
|
|
|
+F.save(),F.translate(B.x,B.y),F.rotate(-D.rotation),F.scale(A,z),F.fillRect(-0.5,-0.5,1,1)),F.restore()):I instanceof THREE.SpriteCanvasMaterial&&(s(I.color.getStyle()),r(I.color.getStyle()),F.save(),F.translate(B.x,B.y),F.rotate(-D.rotation),F.scale(A,z),I.program(F),F.restore())}else if(A instanceof THREE.RenderableLine){if(R=A.v1,K=A.v2,R.positionScreen.x*=x,R.positionScreen.y*=J,K.positionScreen.x*=x,K.positionScreen.y*=J,Ea.setFromPoints([R.positionScreen,K.positionScreen]),!0===va.isIntersectionBox(Ea))if(B=
|
|
|
|
+R,D=K,I=A,A=z,i(A.opacity),k(A.blending),F.beginPath(),F.moveTo(B.positionScreen.x,B.positionScreen.y),F.lineTo(D.positionScreen.x,D.positionScreen.y),A instanceof THREE.LineBasicMaterial){m(A.linewidth);l(A.linecap);n(A.linejoin);if(A.vertexColors!==THREE.VertexColors)s(A.color.getStyle());else if(z=I.vertexColors[0].getStyle(),I=I.vertexColors[1].getStyle(),z===I)s(z);else{try{var M=F.createLinearGradient(B.positionScreen.x,B.positionScreen.y,D.positionScreen.x,D.positionScreen.y);M.addColorStop(0,
|
|
|
|
+z);M.addColorStop(1,I)}catch(C){M=z}s(M)}F.stroke();Ea.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(m(A.linewidth),l(A.linecap),n(A.linejoin),s(A.color.getStyle()),q(A.dashSize,A.gapSize),F.stroke(),Ea.expandByScalar(2*A.linewidth),q(null,null))}else if(A instanceof THREE.RenderableFace3){R=A.v1;K=A.v2;ca=A.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>ca.positionScreen.z||1<ca.positionScreen.z)continue;
|
|
|
|
+R.positionScreen.x*=x;R.positionScreen.y*=J;K.positionScreen.x*=x;K.positionScreen.y*=J;ca.positionScreen.x*=x;ca.positionScreen.y*=J;0<z.overdraw&&(g(R.positionScreen,K.positionScreen,z.overdraw),g(K.positionScreen,ca.positionScreen,z.overdraw),g(ca.positionScreen,R.positionScreen,z.overdraw));Ea.setFromPoints([R.positionScreen,K.positionScreen,ca.positionScreen]);if(!0===va.isIntersectionBox(Ea)){B=R;D=K;I=ca;t.info.render.vertices+=3;t.info.render.faces++;i(z.opacity);k(z.blending);wa=B.positionScreen.x;
|
|
|
|
+Ba=B.positionScreen.y;P=D.positionScreen.x;Aa=D.positionScreen.y;Z=I.positionScreen.x;da=I.positionScreen.y;var S=wa,N=Ba,ia=P,ka=Aa,na=Z,pa=da;F.beginPath();F.moveTo(S,N);F.lineTo(ia,ka);F.lineTo(na,pa);F.closePath();(z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial)&&null===z.map?(sa.copy(z.color),ga.copy(z.emissive),z.vertexColors===THREE.FaceColors&&sa.multiply(A.color),!1===z.wireframe&&z.shading==THREE.SmoothShading&&3==A.vertexNormalsLength?(ba.copy(gb),$.copy(gb),
|
|
V.copy(gb),b(A.v1.positionWorld,A.vertexNormalsModel[0],ba),b(A.v2.positionWorld,A.vertexNormalsModel[1],$),b(A.v3.positionWorld,A.vertexNormalsModel[2],V),ba.multiply(sa).add(ga),$.multiply(sa).add(ga),V.multiply(sa).add(ga),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):(O.copy(gb),b(A.centroidModel,A.normalModel,O),O.multiply(sa).add(ga),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O))):z instanceof THREE.MeshBasicMaterial||
|
|
V.copy(gb),b(A.v1.positionWorld,A.vertexNormalsModel[0],ba),b(A.v2.positionWorld,A.vertexNormalsModel[1],$),b(A.v3.positionWorld,A.vertexNormalsModel[2],V),ba.multiply(sa).add(ga),$.multiply(sa).add(ga),V.multiply(sa).add(ga),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):(O.copy(gb),b(A.centroidModel,A.normalModel,O),O.multiply(sa).add(ga),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O))):z instanceof THREE.MeshBasicMaterial||
|
|
z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial?null!==z.map?z.map.mapping instanceof THREE.UVMapping&&(xa=A.uvs[0],e(wa,Ba,P,Aa,Z,da,xa[0].x,xa[0].y,xa[1].x,xa[1].y,xa[2].x,xa[2].y,z.map)):null!==z.envMap?z.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ta.copy(A.vertexNormalsModelView[0]),bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[2]),sb=0.5*ta.x+0.5,pb=0.5*ta.y+
|
|
z instanceof THREE.MeshLambertMaterial||z instanceof THREE.MeshPhongMaterial?null!==z.map?z.map.mapping instanceof THREE.UVMapping&&(xa=A.uvs[0],e(wa,Ba,P,Aa,Z,da,xa[0].x,xa[0].y,xa[1].x,xa[1].y,xa[2].x,xa[2].y,z.map)):null!==z.envMap?z.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ta.copy(A.vertexNormalsModelView[0]),bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(A.vertexNormalsModelView[2]),sb=0.5*ta.x+0.5,pb=0.5*ta.y+
|
|
0.5,e(wa,Ba,P,Aa,Z,da,bb,cb,Ma,fb,sb,pb,z.envMap)):(O.copy(z.color),z.vertexColors===THREE.FaceColors&&O.multiply(A.color),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,ba.r=ba.g=ba.b=1-p(B.positionScreen.z*B.positionScreen.w,Da,Ua),$.r=$.g=$.b=1-p(D.positionScreen.z*D.positionScreen.w,Da,Ua),V.r=V.g=V.b=1-p(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,
|
|
0.5,e(wa,Ba,P,Aa,Z,da,bb,cb,Ma,fb,sb,pb,z.envMap)):(O.copy(z.color),z.vertexColors===THREE.FaceColors&&O.multiply(A.color),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,ba.r=ba.g=ba.b=1-p(B.positionScreen.z*B.positionScreen.w,Da,Ua),$.r=$.g=$.b=1-p(D.positionScreen.z*D.positionScreen.w,Da,Ua),V.r=V.g=V.b=1-p(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,
|
|
V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):z instanceof THREE.MeshNormalMaterial&&(B=void 0,z.shading==THREE.FlatShading?(B=A.normalModelView,O.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z.shading==THREE.SmoothShading&&(B=A.vertexNormalsModelView[0],ba.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[1],$.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[2],
|
|
V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)):z instanceof THREE.MeshNormalMaterial&&(B=void 0,z.shading==THREE.FlatShading?(B=A.normalModelView,O.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===z.wireframe?c(O,z.wireframeLinewidth,z.wireframeLinecap,z.wireframeLinejoin):d(O)):z.shading==THREE.SmoothShading&&(B=A.vertexNormalsModelView[0],ba.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[1],$.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=A.vertexNormalsModelView[2],
|
|
-V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)))}}la.union(Ea)}}G.setTransform(1,0,0,1,0,0)}}};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",
|
|
|
|
|
|
+V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors($,V).multiplyScalar(0.5),Qa=h(ba,$,V,ja),f(wa,Ba,P,Aa,Z,da,0,0,1,0,0,1,Qa)))}}la.union(Ea)}}F.setTransform(1,0,0,1,0,0)}}};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\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -375,7 +373,7 @@ function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.leng
|
|
(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
|
|
(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
|
|
a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){va[a]||(j.enableVertexAttribArray(a),va[a]=!0)}function g(){for(var a in va)va[a]&&(j.disableVertexAttribArray(a),va[a]=
|
|
a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){va[a]||(j.enableVertexAttribArray(a),va[a]=!0)}function g(){for(var a in va)va[a]&&(j.disableVertexAttribArray(a),va[a]=
|
|
!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)da=Ba=null,Aa=Z=V=$=ka=Ga=ja=-1,ta=!0,a[d].render(b,c,sb,pb),da=Ba=null,Aa=Z=V=$=ka=Ga=ja=-1,ta=!0}function l(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)da=Ba=null,Aa=Z=V=$=ka=Ga=ja=-1,ta=!0,a[d].render(b,c,sb,pb),da=Ba=null,Aa=Z=V=$=ka=Ga=ja=-1,ta=!0}function l(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
-K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);E(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function n(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);E(g.polygonOffset,
|
|
|
|
|
|
+K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);x(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function n(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);x(g.polygonOffset,
|
|
g.polygonOffsetFactor,g.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,g,j)}}function s(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Cb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
|
|
g.polygonOffsetFactor,g.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,g,j)}}function s(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Cb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
|
|
void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,s=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=s?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&
|
|
void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,s=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=s?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&
|
|
(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=O++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
|
|
(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=O++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
|
|
@@ -384,13 +382,13 @@ k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBu
|
|
j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
|
|
j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
|
|
K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],r(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
|
|
K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)r(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],r(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
|
|
THREE.ParticleSystem?(f=a.geometry,r(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function r(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
THREE.ParticleSystem?(f=a.geometry,r(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function r(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
-return!1}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?t(b.__webglObjects,a):a instanceof THREE.Sprite?v(b.__webglSprites,a):a instanceof THREE.LensFlare?v(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&t(b.__webglObjectsImmediate,a);delete a.__webglActive}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}
|
|
|
|
|
|
+return!1}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function t(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?u(b.__webglObjects,a):a instanceof THREE.Sprite?v(b.__webglSprites,a):a instanceof THREE.LensFlare?v(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&u(b.__webglObjectsImmediate,a);delete a.__webglActive}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}
|
|
function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function w(a,b,c,d,e){ba=0;d.needsUpdate&&(d.program&&Gb(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Ba&&(j.useProgram(g),Ba=g,f=!0);d.id!==Aa&&(Aa=d.id,f=!0);if(f||a!==da)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==da&&(da=a);if(d.skinning)if(yb&&
|
|
function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function w(a,b,c,d,e){ba=0;d.needsUpdate&&(d.program&&Gb(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Ba&&(j.useProgram(g),Ba=g,f=!0);d.id!==Aa&&(Aa=d.id,f=!0);if(f||a!==da)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==da&&(da=a);if(d.skinning)if(yb&&
|
|
-e.useVertexTexture){if(null!==h.boneTexture){var k=x();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&j.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&j.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
|
-(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ta){for(var m,l=k=0,n=0,p,q,s,r=Pa,t=r.directional.colors,u=r.directional.positions,v=r.point.colors,w=r.point.positions,z=r.point.distances,E=r.spot.colors,D=r.spot.positions,G=r.spot.distances,J=r.spot.directions,M=r.spot.anglesCos,C=r.spot.exponents,O=r.hemi.skyColors,Q=r.hemi.groundColors,V=r.hemi.positions,S=0,$=0,wa=0,Z=0,N=0,dc=0,X=0,W=0,R=m=0,c=s=R=0,f=b.length;c<f;c++)m=
|
|
|
|
-b[c],m.onlyShadow||(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(N+=1,m.visible&&(ea.getPositionFromMatrix(m.matrixWorld),ra.getPositionFromMatrix(m.target.matrixWorld),ea.sub(ra),ea.normalize(),0===ea.x&&0===ea.y&&0===ea.z||(m=3*S,u[m]=ea.x,u[m+1]=ea.y,u[m+2]=ea.z,K.gammaInput?F(t,m,p,q*q):y(t,m,p,q),S+=1))):m instanceof THREE.PointLight?(dc+=1,m.visible&&
|
|
|
|
-(R=3*$,K.gammaInput?F(v,R,p,q*q):y(v,R,p,q),ra.getPositionFromMatrix(m.matrixWorld),w[R]=ra.x,w[R+1]=ra.y,w[R+2]=ra.z,z[$]=s,$+=1)):m instanceof THREE.SpotLight?(X+=1,m.visible&&(R=3*wa,K.gammaInput?F(E,R,p,q*q):y(E,R,p,q),ra.getPositionFromMatrix(m.matrixWorld),D[R]=ra.x,D[R+1]=ra.y,D[R+2]=ra.z,G[wa]=s,ea.copy(ra),ra.getPositionFromMatrix(m.target.matrixWorld),ea.sub(ra),ea.normalize(),J[R]=ea.x,J[R+1]=ea.y,J[R+2]=ea.z,M[wa]=Math.cos(m.angle),C[wa]=m.exponent,wa+=1)):m instanceof THREE.HemisphereLight&&
|
|
|
|
-(W+=1,m.visible&&(ea.getPositionFromMatrix(m.matrixWorld),ea.normalize(),0===ea.x&&0===ea.y&&0===ea.z||(s=3*Z,V[s]=ea.x,V[s+1]=ea.y,V[s+2]=ea.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,F(O,s,p,q),F(Q,s,m,q)):(y(O,s,p,q),y(Q,s,m,q)),Z+=1))));c=3*S;for(f=Math.max(t.length,3*N);c<f;c++)t[c]=0;c=3*$;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*wa;for(f=Math.max(E.length,3*X);c<f;c++)E[c]=0;c=3*Z;for(f=Math.max(O.length,3*W);c<f;c++)O[c]=0;c=3*Z;for(f=Math.max(Q.length,3*W);c<f;c++)Q[c]=0;r.directional.length=
|
|
|
|
|
|
+e.useVertexTexture){if(null!==h.boneTexture){var k=E();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&j.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&j.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
|
|
|
|
+(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ta){for(var m,l=k=0,n=0,p,q,s,r=Pa,t=r.directional.colors,u=r.directional.positions,v=r.point.colors,w=r.point.positions,z=r.point.distances,x=r.spot.colors,D=r.spot.positions,F=r.spot.distances,J=r.spot.directions,M=r.spot.anglesCos,C=r.spot.exponents,O=r.hemi.skyColors,Q=r.hemi.groundColors,V=r.hemi.positions,S=0,$=0,wa=0,Z=0,N=0,dc=0,X=0,W=0,R=m=0,c=s=R=0,f=b.length;c<f;c++)m=
|
|
|
|
+b[c],m.onlyShadow||(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(N+=1,m.visible&&(ea.getPositionFromMatrix(m.matrixWorld),ra.getPositionFromMatrix(m.target.matrixWorld),ea.sub(ra),ea.normalize(),0===ea.x&&0===ea.y&&0===ea.z||(m=3*S,u[m]=ea.x,u[m+1]=ea.y,u[m+2]=ea.z,K.gammaInput?G(t,m,p,q*q):y(t,m,p,q),S+=1))):m instanceof THREE.PointLight?(dc+=1,m.visible&&
|
|
|
|
+(R=3*$,K.gammaInput?G(v,R,p,q*q):y(v,R,p,q),ra.getPositionFromMatrix(m.matrixWorld),w[R]=ra.x,w[R+1]=ra.y,w[R+2]=ra.z,z[$]=s,$+=1)):m instanceof THREE.SpotLight?(X+=1,m.visible&&(R=3*wa,K.gammaInput?G(x,R,p,q*q):y(x,R,p,q),ra.getPositionFromMatrix(m.matrixWorld),D[R]=ra.x,D[R+1]=ra.y,D[R+2]=ra.z,F[wa]=s,ea.copy(ra),ra.getPositionFromMatrix(m.target.matrixWorld),ea.sub(ra),ea.normalize(),J[R]=ea.x,J[R+1]=ea.y,J[R+2]=ea.z,M[wa]=Math.cos(m.angle),C[wa]=m.exponent,wa+=1)):m instanceof THREE.HemisphereLight&&
|
|
|
|
+(W+=1,m.visible&&(ea.getPositionFromMatrix(m.matrixWorld),ea.normalize(),0===ea.x&&0===ea.y&&0===ea.z||(s=3*Z,V[s]=ea.x,V[s+1]=ea.y,V[s+2]=ea.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,G(O,s,p,q),G(Q,s,m,q)):(y(O,s,p,q),y(Q,s,m,q)),Z+=1))));c=3*S;for(f=Math.max(t.length,3*N);c<f;c++)t[c]=0;c=3*$;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*wa;for(f=Math.max(x.length,3*X);c<f;c++)x[c]=0;c=3*Z;for(f=Math.max(O.length,3*W);c<f;c++)O[c]=0;c=3*Z;for(f=Math.max(Q.length,3*W);c<f;c++)Q[c]=0;r.directional.length=
|
|
S;r.point.length=$;r.spot.length=wa;r.hemi.length=Z;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;ta=!1}c=Pa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;
|
|
S;r.point.length=$;r.spot.length=wa;r.hemi.length=Z;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;ta=!1}c=Pa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;
|
|
i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=
|
|
i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=
|
|
d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var P;d.map?P=d.map:d.specularMap?P=d.specularMap:d.normalMap?P=d.normalMap:d.bumpMap&&(P=d.bumpMap);void 0!==P&&(c=P.offset,P=P.repeat,i.offsetRepeat.value.set(c.x,c.y,P.x,P.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var P;d.map?P=d.map:d.specularMap?P=d.specularMap:d.normalMap?P=d.normalMap:d.bumpMap&&(P=d.bumpMap);void 0!==P&&(c=P.offset,P=P.repeat,i.offsetRepeat.value.set(c.x,c.y,P.x,P.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
@@ -400,13 +398,13 @@ d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.spec
|
|
THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[P]=k.shadowMap,i.shadowMapSize.value[P]=k.shadowMapSize,i.shadowMatrix.value[P]=k.shadowMatrix,i.shadowDarkness.value[P]=k.shadowDarkness,i.shadowBias.value[P]=k.shadowBias,P++}b=d.uniformsList;i=0;for(P=b.length;i<P;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
|
|
THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[P]=k.shadowMap,i.shadowMapSize.value[P]=k.shadowMapSize,i.shadowMatrix.value[P]=k.shadowMatrix,i.shadowDarkness.value[P]=k.shadowDarkness,i.shadowBias.value[P]=k.shadowBias,P++}b=d.uniformsList;i=0;for(P=b.length;i<P;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
|
|
k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
|
|
k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
|
|
k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
|
|
k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
|
|
-new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=x(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
|
|
|
|
+new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=E(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],v=ac,t.width<=v&&t.height<=v||(w=Math.max(t.width,t.height),u=Math.floor(t.width*v/w),v=Math.floor(t.height*v/w),w=document.createElement("canvas"),w.width=u,w.height=v,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=w),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=I(c.format);t=I(c.type);B(j.TEXTURE_CUBE_MAP,
|
|
j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],v=ac,t.width<=v&&t.height<=v||(w=Math.max(t.width,t.height),u=Math.floor(t.width*v/w),v=Math.floor(t.height*v/w),w=document.createElement("canvas"),w.width=u,w.height=v,w.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=w),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=I(c.format);t=I(c.type);B(j.TEXTURE_CUBE_MAP,
|
|
c,n);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;w=0;for(z=v.length;w<z;w++)u=v[w],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,r,u.width,u.height,0,r,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
c,n);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;w=0;for(z=v.length;w<z;w++)u=v[w],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,w,r,u.width,u.height,0,r,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
-c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=x();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&K.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
|
|
|
+c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=E();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&K.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ra.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,ra.x,ra.y,ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);
|
|
THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ra.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,ra.x,ra.y,ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);
|
|
-null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function x(){var a=ba;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);ba+=1;return a}function F(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a!==xa&&(j.lineWidth(a),xa=a)}function E(a,b,c){Da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Da=a);
|
|
|
|
-if(a&&(Ua!==b||Qa!==c))j.polygonOffset(b,c),Ua=b,Qa=c}function J(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function G(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(J(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,I(b.wrapS)),j.texParameteri(a,
|
|
|
|
|
|
+null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=ba;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);ba+=1;return a}function G(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a!==xa&&(j.lineWidth(a),xa=a)}function x(a,b,c){Da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Da=a);
|
|
|
|
+if(a&&(Ua!==b||Qa!==c))j.polygonOffset(b,c),Ua=b,Qa=c}function J(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function F(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(J(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,I(b.wrapS)),j.texParameteri(a,
|
|
j.TEXTURE_WRAP_T,I(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,z(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,z(b.minFilter)));if(La&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,La.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=
|
|
j.TEXTURE_WRAP_T,I(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,z(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,z(b.minFilter)));if(La&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,La.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=
|
|
b.anisotropy}function M(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}
|
|
b.anisotropy}function M(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}
|
|
function z(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function I(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
|
|
function z(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function I(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
|
|
@@ -451,16 +449,16 @@ K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCou
|
|
else{var e,f,h,g,k=a.__lights,p=a.fog;Aa=-1;ta=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ea.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(Ea);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
else{var e,f,h,g,k=a.__lights,p=a.fog;Aa=-1;ta=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ea.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(Ea);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||la.intersectsObject(h))){var q=h;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,r=q.buffer,s=void 0,t=s=void 0,t=q.object.material;if(t instanceof THREE.MeshFaceMaterial)s=r.materialIndex,s=t.materials[s],
|
|
this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||la.intersectsObject(h))){var q=h;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,r=q.buffer,s=void 0,t=s=void 0,t=q.object.material;if(t instanceof THREE.MeshFaceMaterial)s=r.materialIndex,s=t.materials[s],
|
|
s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);else if(s=t)s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ra.getPositionFromMatrix(h.matrixWorld),ra.applyProjection(Ea),f.z=ra.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),
|
|
s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);else if(s=t)s.transparent?(q.transparent=s,q.opaque=null):(q.opaque=s,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ra.getPositionFromMatrix(h.matrixWorld),ra.applyProjection(Ea),f.z=ra.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),
|
|
-h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),E(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,k,p,!0,d),n(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
|
|
|
|
|
|
+h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),x(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,k,p,!0,d),n(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
|
|
l(a.__webglObjects,!0,"opaque",b,k,p,!1,d),n(a.__webglObjectsImmediate,"opaque",b,k,p,!1,d),l(a.__webglObjects,!1,"transparent",b,k,p,!0,d),n(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));m(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,
|
|
l(a.__webglObjects,!0,"opaque",b,k,p,!1,d),n(a.__webglObjectsImmediate,"opaque",b,k,p,!1,d),l(a.__webglObjects,!1,"transparent",b,k,p,!0,d),n(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));m(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,
|
|
c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=w(a,b,c,d,e);Z=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,la):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],
|
|
c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=w(a,b,c,d,e);Z=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,la):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)s(a.__objectsAdded[0],
|
|
-a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&u(g,a),s(g,a));var i=g,l=i.geometry,m=void 0,n=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var t=j.DYNAMIC_DRAW,v=!l.dynamic,w=l.attributes,y=void 0,z=void 0;for(y in w)z=w[y],z.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-z.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,z.array,t)):(j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,t)),z.needsUpdate=!1),v&&!z.dynamic&&(z.array=null)}else if(i instanceof THREE.Mesh){for(var A=0,B=l.geometryGroupsList.length;A<B;A++)if(m=l.geometryGroupsList[A],r=d(i,m),l.buffersNeedUpdate&&c(m,i),n=r.attributes&&q(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||
|
|
|
|
-n){var x=m,E=i,D=j.DYNAMIC_DRAW,F=!l.dynamic,G=r;if(x.__inittedArrays){var I=e(G),J=G.vertexColors?G.vertexColors:!1,K=f(G),M=I===THREE.SmoothShading,C=void 0,O=void 0,Q=void 0,P=void 0,R=void 0,V=void 0,S=void 0,wa=void 0,$=void 0,Z=void 0,ba=void 0,N=void 0,X=void 0,W=void 0,Ba=void 0,da=void 0,Aa=void 0,ca=void 0,ga=void 0,ea=void 0,ja=void 0,ia=void 0,ka=void 0,la=void 0,na=void 0,pa=void 0,sa=void 0,ta=void 0,ua=void 0,Ca=void 0,Da=void 0,Ga=void 0,Fa=void 0,Ka=void 0,Sa=void 0,La=void 0,va=
|
|
|
|
|
|
+a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)t(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&t(g,a),s(g,a));var i=g,l=i.geometry,m=void 0,n=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var u=j.DYNAMIC_DRAW,v=!l.dynamic,w=l.attributes,y=void 0,z=void 0;for(y in w)z=w[y],z.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+z.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,z.array,u)):(j.bindBuffer(j.ARRAY_BUFFER,z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,u)),z.needsUpdate=!1),v&&!z.dynamic&&(z.array=null)}else if(i instanceof THREE.Mesh){for(var A=0,B=l.geometryGroupsList.length;A<B;A++)if(m=l.geometryGroupsList[A],r=d(i,m),l.buffersNeedUpdate&&c(m,i),n=r.attributes&&q(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||
|
|
|
|
+n){var x=m,E=i,D=j.DYNAMIC_DRAW,G=!l.dynamic,F=r;if(x.__inittedArrays){var I=e(F),J=F.vertexColors?F.vertexColors:!1,K=f(F),M=I===THREE.SmoothShading,C=void 0,O=void 0,Q=void 0,P=void 0,R=void 0,V=void 0,S=void 0,wa=void 0,$=void 0,Z=void 0,ba=void 0,N=void 0,X=void 0,W=void 0,Ba=void 0,da=void 0,Aa=void 0,ca=void 0,ga=void 0,ea=void 0,ja=void 0,ia=void 0,ka=void 0,la=void 0,na=void 0,pa=void 0,sa=void 0,ta=void 0,ua=void 0,Ca=void 0,Da=void 0,Ga=void 0,Fa=void 0,Ka=void 0,Sa=void 0,La=void 0,va=
|
|
void 0,xa=void 0,Qa=void 0,Ra=void 0,db=0,eb=0,Oa=0,Pa=0,Ua=0,hb=0,Ta=0,tb=0,Za=0,qa=0,ya=0,L=0,Na=void 0,ib=x.__vertexArray,bb=x.__uvArray,cb=x.__uv2Array,Ma=x.__normalArray,Va=x.__tangentArray,jb=x.__colorArray,Wa=x.__skinIndexArray,Xa=x.__skinWeightArray,fb=x.__morphTargetsArrays,sb=x.__morphNormalsArrays,pb=x.__webglCustomAttributesList,H=void 0,Pb=x.__faceArray,vb=x.__lineArray,Ha=E.geometry,Bb=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,Db=Ha.normalsNeedUpdate,Mb=Ha.tangentsNeedUpdate,Nb=Ha.colorsNeedUpdate,
|
|
void 0,xa=void 0,Qa=void 0,Ra=void 0,db=0,eb=0,Oa=0,Pa=0,Ua=0,hb=0,Ta=0,tb=0,Za=0,qa=0,ya=0,L=0,Na=void 0,ib=x.__vertexArray,bb=x.__uvArray,cb=x.__uv2Array,Ma=x.__normalArray,Va=x.__tangentArray,jb=x.__colorArray,Wa=x.__skinIndexArray,Xa=x.__skinWeightArray,fb=x.__morphTargetsArrays,sb=x.__morphNormalsArrays,pb=x.__webglCustomAttributesList,H=void 0,Pb=x.__faceArray,vb=x.__lineArray,Ha=E.geometry,Bb=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,Db=Ha.normalsNeedUpdate,Mb=Ha.tangentsNeedUpdate,Nb=Ha.colorsNeedUpdate,
|
|
Ob=Ha.morphTargetsNeedUpdate,ec=Ha.vertices,aa=x.faces3,kb=Ha.faces,Cb=Ha.faceVertexUvs[0],Eb=Ha.faceVertexUvs[1],fc=Ha.skinIndices,Qb=Ha.skinWeights,Rb=Ha.morphTargets,Fb=Ha.morphNormals;if(Ha.verticesNeedUpdate){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],N=ec[P.a],X=ec[P.b],W=ec[P.c],ib[eb]=N.x,ib[eb+1]=N.y,ib[eb+2]=N.z,ib[eb+3]=X.x,ib[eb+4]=X.y,ib[eb+5]=X.z,ib[eb+6]=W.x,ib[eb+7]=W.y,ib[eb+8]=W.z,eb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,D)}if(Ob){Sa=0;
|
|
Ob=Ha.morphTargetsNeedUpdate,ec=Ha.vertices,aa=x.faces3,kb=Ha.faces,Cb=Ha.faceVertexUvs[0],Eb=Ha.faceVertexUvs[1],fc=Ha.skinIndices,Qb=Ha.skinWeights,Rb=Ha.morphTargets,Fb=Ha.morphNormals;if(Ha.verticesNeedUpdate){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],N=ec[P.a],X=ec[P.b],W=ec[P.c],ib[eb]=N.x,ib[eb+1]=N.y,ib[eb+2]=N.z,ib[eb+3]=X.x,ib[eb+4]=X.y,ib[eb+5]=X.z,ib[eb+6]=W.x,ib[eb+7]=W.y,ib[eb+8]=W.z,eb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,D)}if(Ob){Sa=0;
|
|
-for(La=Rb.length;Sa<La;Sa++){C=ya=0;for(O=aa.length;C<O;C++)Qa=aa[C],P=kb[Qa],N=Rb[Sa].vertices[P.a],X=Rb[Sa].vertices[P.b],W=Rb[Sa].vertices[P.c],va=fb[Sa],va[ya]=N.x,va[ya+1]=N.y,va[ya+2]=N.z,va[ya+3]=X.x,va[ya+4]=X.y,va[ya+5]=X.z,va[ya+6]=W.x,va[ya+7]=W.y,va[ya+8]=W.z,G.morphNormals&&(M?(Ra=Fb[Sa].vertexNormals[Qa],ca=Ra.a,ga=Ra.b,ea=Ra.c):ea=ga=ca=Fb[Sa].faceNormals[Qa],xa=sb[Sa],xa[ya]=ca.x,xa[ya+1]=ca.y,xa[ya+2]=ca.z,xa[ya+3]=ga.x,xa[ya+4]=ga.y,xa[ya+5]=ga.z,xa[ya+6]=ea.x,xa[ya+7]=ea.y,xa[ya+
|
|
|
|
-8]=ea.z),ya+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Sa]);j.bufferData(j.ARRAY_BUFFER,fb[Sa],D);G.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Sa]),j.bufferData(j.ARRAY_BUFFER,sb[Sa],D))}}if(Qb.length){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],la=Qb[P.a],na=Qb[P.b],pa=Qb[P.c],Xa[qa]=la.x,Xa[qa+1]=la.y,Xa[qa+2]=la.z,Xa[qa+3]=la.w,Xa[qa+4]=na.x,Xa[qa+5]=na.y,Xa[qa+6]=na.z,Xa[qa+7]=na.w,Xa[qa+8]=pa.x,Xa[qa+9]=pa.y,Xa[qa+10]=pa.z,Xa[qa+11]=pa.w,sa=fc[P.a],ta=
|
|
|
|
|
|
+for(La=Rb.length;Sa<La;Sa++){C=ya=0;for(O=aa.length;C<O;C++)Qa=aa[C],P=kb[Qa],N=Rb[Sa].vertices[P.a],X=Rb[Sa].vertices[P.b],W=Rb[Sa].vertices[P.c],va=fb[Sa],va[ya]=N.x,va[ya+1]=N.y,va[ya+2]=N.z,va[ya+3]=X.x,va[ya+4]=X.y,va[ya+5]=X.z,va[ya+6]=W.x,va[ya+7]=W.y,va[ya+8]=W.z,F.morphNormals&&(M?(Ra=Fb[Sa].vertexNormals[Qa],ca=Ra.a,ga=Ra.b,ea=Ra.c):ea=ga=ca=Fb[Sa].faceNormals[Qa],xa=sb[Sa],xa[ya]=ca.x,xa[ya+1]=ca.y,xa[ya+2]=ca.z,xa[ya+3]=ga.x,xa[ya+4]=ga.y,xa[ya+5]=ga.z,xa[ya+6]=ea.x,xa[ya+7]=ea.y,xa[ya+
|
|
|
|
+8]=ea.z),ya+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Sa]);j.bufferData(j.ARRAY_BUFFER,fb[Sa],D);F.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Sa]),j.bufferData(j.ARRAY_BUFFER,sb[Sa],D))}}if(Qb.length){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],la=Qb[P.a],na=Qb[P.b],pa=Qb[P.c],Xa[qa]=la.x,Xa[qa+1]=la.y,Xa[qa+2]=la.z,Xa[qa+3]=la.w,Xa[qa+4]=na.x,Xa[qa+5]=na.y,Xa[qa+6]=na.z,Xa[qa+7]=na.w,Xa[qa+8]=pa.x,Xa[qa+9]=pa.y,Xa[qa+10]=pa.z,Xa[qa+11]=pa.w,sa=fc[P.a],ta=
|
|
fc[P.b],ua=fc[P.c],Wa[qa]=sa.x,Wa[qa+1]=sa.y,Wa[qa+2]=sa.z,Wa[qa+3]=sa.w,Wa[qa+4]=ta.x,Wa[qa+5]=ta.y,Wa[qa+6]=ta.z,Wa[qa+7]=ta.w,Wa[qa+8]=ua.x,Wa[qa+9]=ua.y,Wa[qa+10]=ua.z,Wa[qa+11]=ua.w,qa+=12;0<qa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,D),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Xa,D))}if(Nb&&J){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],S=P.vertexColors,wa=P.color,3===S.length&&J===THREE.VertexColors?(ja=
|
|
fc[P.b],ua=fc[P.c],Wa[qa]=sa.x,Wa[qa+1]=sa.y,Wa[qa+2]=sa.z,Wa[qa+3]=sa.w,Wa[qa+4]=ta.x,Wa[qa+5]=ta.y,Wa[qa+6]=ta.z,Wa[qa+7]=ta.w,Wa[qa+8]=ua.x,Wa[qa+9]=ua.y,Wa[qa+10]=ua.z,Wa[qa+11]=ua.w,qa+=12;0<qa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,D),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Xa,D))}if(Nb&&J){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],S=P.vertexColors,wa=P.color,3===S.length&&J===THREE.VertexColors?(ja=
|
|
S[0],ia=S[1],ka=S[2]):ka=ia=ja=wa,jb[Za]=ja.r,jb[Za+1]=ja.g,jb[Za+2]=ja.b,jb[Za+3]=ia.r,jb[Za+4]=ia.g,jb[Za+5]=ia.b,jb[Za+6]=ka.r,jb[Za+7]=ka.g,jb[Za+8]=ka.b,Za+=9;0<Za&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,D))}if(Mb&&Ha.hasTangents){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],$=P.vertexTangents,Ba=$[0],da=$[1],Aa=$[2],Va[Ta]=Ba.x,Va[Ta+1]=Ba.y,Va[Ta+2]=Ba.z,Va[Ta+3]=Ba.w,Va[Ta+4]=da.x,Va[Ta+5]=da.y,Va[Ta+6]=da.z,Va[Ta+7]=da.w,Va[Ta+8]=Aa.x,Va[Ta+9]=Aa.y,Va[Ta+
|
|
S[0],ia=S[1],ka=S[2]):ka=ia=ja=wa,jb[Za]=ja.r,jb[Za+1]=ja.g,jb[Za+2]=ja.b,jb[Za+3]=ia.r,jb[Za+4]=ia.g,jb[Za+5]=ia.b,jb[Za+6]=ka.r,jb[Za+7]=ka.g,jb[Za+8]=ka.b,Za+=9;0<Za&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,D))}if(Mb&&Ha.hasTangents){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],$=P.vertexTangents,Ba=$[0],da=$[1],Aa=$[2],Va[Ta]=Ba.x,Va[Ta+1]=Ba.y,Va[Ta+2]=Ba.z,Va[Ta+3]=Ba.w,Va[Ta+4]=da.x,Va[Ta+5]=da.y,Va[Ta+6]=da.z,Va[Ta+7]=da.w,Va[Ta+8]=Aa.x,Va[Ta+9]=Aa.y,Va[Ta+
|
|
10]=Aa.z,Va[Ta+11]=Aa.w,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Va,D)}if(Db&&I){C=0;for(O=aa.length;C<O;C++)if(P=kb[aa[C]],R=P.vertexNormals,V=P.normal,3===R.length&&M)for(Ca=0;3>Ca;Ca++)Ga=R[Ca],Ma[hb]=Ga.x,Ma[hb+1]=Ga.y,Ma[hb+2]=Ga.z,hb+=3;else for(Ca=0;3>Ca;Ca++)Ma[hb]=V.x,Ma[hb+1]=V.y,Ma[hb+2]=V.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,D)}if(yb&&Cb&&K){C=0;for(O=aa.length;C<O;C++)if(Q=aa[C],Z=Cb[Q],
|
|
10]=Aa.z,Va[Ta+11]=Aa.w,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Va,D)}if(Db&&I){C=0;for(O=aa.length;C<O;C++)if(P=kb[aa[C]],R=P.vertexNormals,V=P.normal,3===R.length&&M)for(Ca=0;3>Ca;Ca++)Ga=R[Ca],Ma[hb]=Ga.x,Ma[hb+1]=Ga.y,Ma[hb+2]=Ga.z,hb+=3;else for(Ca=0;3>Ca;Ca++)Ma[hb]=V.x,Ma[hb+1]=V.y,Ma[hb+2]=V.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,D)}if(yb&&Cb&&K){C=0;for(O=aa.length;C<O;C++)if(Q=aa[C],Z=Cb[Q],
|
|
@@ -471,7 +469,7 @@ H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}}else i
|
|
0;for(O=aa.length;C<O;C++)W=X=N=Na=H.value[aa[C]],H.array[L]=N[oa[0]],H.array[L+1]=N[oa[1]],H.array[L+2]=N[oa[2]],H.array[L+3]=X[oa[0]],H.array[L+4]=X[oa[1]],H.array[L+5]=X[oa[2]],H.array[L+6]=W[oa[0]],H.array[L+7]=W[oa[1]],H.array[L+8]=W[oa[2]],L+=9}else if("faceVertices"===H.boundTo){C=0;for(O=aa.length;C<O;C++)Na=H.value[aa[C]],N=Na[0],X=Na[1],W=Na[2],H.array[L]=N[oa[0]],H.array[L+1]=N[oa[1]],H.array[L+2]=N[oa[2]],H.array[L+3]=X[oa[0]],H.array[L+4]=X[oa[1]],H.array[L+5]=X[oa[2]],H.array[L+6]=W[oa[0]],
|
|
0;for(O=aa.length;C<O;C++)W=X=N=Na=H.value[aa[C]],H.array[L]=N[oa[0]],H.array[L+1]=N[oa[1]],H.array[L+2]=N[oa[2]],H.array[L+3]=X[oa[0]],H.array[L+4]=X[oa[1]],H.array[L+5]=X[oa[2]],H.array[L+6]=W[oa[0]],H.array[L+7]=W[oa[1]],H.array[L+8]=W[oa[2]],L+=9}else if("faceVertices"===H.boundTo){C=0;for(O=aa.length;C<O;C++)Na=H.value[aa[C]],N=Na[0],X=Na[1],W=Na[2],H.array[L]=N[oa[0]],H.array[L+1]=N[oa[1]],H.array[L+2]=N[oa[2]],H.array[L+3]=X[oa[0]],H.array[L+4]=X[oa[1]],H.array[L+5]=X[oa[2]],H.array[L+6]=W[oa[0]],
|
|
H.array[L+7]=W[oa[1]],H.array[L+8]=W[oa[2]],L+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],N=H.value[P.a],X=H.value[P.b],W=H.value[P.c],H.array[L]=N.x,H.array[L+1]=N.y,H.array[L+2]=N.z,H.array[L+3]=N.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faces"===H.boundTo){C=0;for(O=aa.length;C<O;C++)W=X=N=Na=H.value[aa[C]],H.array[L]=
|
|
H.array[L+7]=W[oa[1]],H.array[L+8]=W[oa[2]],L+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(O=aa.length;C<O;C++)P=kb[aa[C]],N=H.value[P.a],X=H.value[P.b],W=H.value[P.c],H.array[L]=N.x,H.array[L+1]=N.y,H.array[L+2]=N.z,H.array[L+3]=N.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faces"===H.boundTo){C=0;for(O=aa.length;C<O;C++)W=X=N=Na=H.value[aa[C]],H.array[L]=
|
|
N.x,H.array[L+1]=N.y,H.array[L+2]=N.z,H.array[L+3]=N.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faceVertices"===H.boundTo){C=0;for(O=aa.length;C<O;C++)Na=H.value[aa[C]],N=Na[0],X=Na[1],W=Na[2],H.array[L]=N.x,H.array[L+1]=N.y,H.array[L+2]=N.z,H.array[L+3]=N.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+
|
|
N.x,H.array[L+1]=N.y,H.array[L+2]=N.z,H.array[L+3]=N.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faceVertices"===H.boundTo){C=0;for(O=aa.length;C<O;C++)Na=H.value[aa[C]],N=Na[0],X=Na[1],W=Na[2],H.array[L]=N.x,H.array[L+1]=N.y,H.array[L+2]=N.z,H.array[L+3]=N.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+
|
|
-11]=W.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,D)}}F&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=
|
|
|
|
|
|
+11]=W.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,D)}}G&&(delete x.__inittedArrays,delete x.__colorArray,delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=
|
|
!1;l.buffersNeedUpdate=!1;r.attributes&&p(r)}else if(i instanceof THREE.Line){r=d(i,l);n=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||n){var Ya=l,Sb=j.DYNAMIC_DRAW,Ib=void 0,Jb=void 0,Kb=void 0,Tb=void 0,ma=void 0,Ub=void 0,Gb=Ya.vertices,Hb=Ya.colors,kc=Ya.lineDistances,Zb=Gb.length,$b=Hb.length,ac=kc.length,Vb=Ya.__vertexArray,Wb=Ya.__colorArray,lc=Ya.__lineDistanceArray,bc=Ya.colorsNeedUpdate,cc=Ya.lineDistancesNeedUpdate,gc=Ya.__webglCustomAttributesList,
|
|
!1;l.buffersNeedUpdate=!1;r.attributes&&p(r)}else if(i instanceof THREE.Line){r=d(i,l);n=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||n){var Ya=l,Sb=j.DYNAMIC_DRAW,Ib=void 0,Jb=void 0,Kb=void 0,Tb=void 0,ma=void 0,Ub=void 0,Gb=Ya.vertices,Hb=Ya.colors,kc=Ya.lineDistances,Zb=Gb.length,$b=Hb.length,ac=kc.length,Vb=Ya.__vertexArray,Wb=Ya.__colorArray,lc=Ya.__lineDistanceArray,bc=Ya.colorsNeedUpdate,cc=Ya.lineDistancesNeedUpdate,gc=Ya.__webglCustomAttributesList,
|
|
Xb=void 0,mc=void 0,za=void 0,zb=void 0,Ia=void 0,ha=void 0;if(Ya.verticesNeedUpdate){for(Ib=0;Ib<Zb;Ib++)Tb=Gb[Ib],ma=3*Ib,Vb[ma]=Tb.x,Vb[ma+1]=Tb.y,Vb[ma+2]=Tb.z;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Vb,Sb)}if(bc){for(Jb=0;Jb<$b;Jb++)Ub=Hb[Jb],ma=3*Jb,Wb[ma]=Ub.r,Wb[ma+1]=Ub.g,Wb[ma+2]=Ub.b;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Wb,Sb)}if(cc){for(Kb=0;Kb<ac;Kb++)lc[Kb]=kc[Kb];j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglLineDistanceBuffer);
|
|
Xb=void 0,mc=void 0,za=void 0,zb=void 0,Ia=void 0,ha=void 0;if(Ya.verticesNeedUpdate){for(Ib=0;Ib<Zb;Ib++)Tb=Gb[Ib],ma=3*Ib,Vb[ma]=Tb.x,Vb[ma+1]=Tb.y,Vb[ma+2]=Tb.z;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Vb,Sb)}if(bc){for(Jb=0;Jb<$b;Jb++)Ub=Hb[Jb],ma=3*Jb,Wb[ma]=Ub.r,Wb[ma+1]=Ub.g,Wb[ma+2]=Ub.b;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Wb,Sb)}if(cc){for(Kb=0;Kb<ac;Kb++)lc[Kb]=kc[Kb];j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglLineDistanceBuffer);
|
|
j.bufferData(j.ARRAY_BUFFER,lc,Sb)}if(gc){Xb=0;for(mc=gc.length;Xb<mc;Xb++)if(ha=gc[Xb],ha.needsUpdate&&(void 0===ha.boundTo||"vertices"===ha.boundTo)){ma=0;zb=ha.value.length;if(1===ha.size)for(za=0;za<zb;za++)ha.array[za]=ha.value[za];else if(2===ha.size)for(za=0;za<zb;za++)Ia=ha.value[za],ha.array[ma]=Ia.x,ha.array[ma+1]=Ia.y,ma+=2;else if(3===ha.size)if("c"===ha.type)for(za=0;za<zb;za++)Ia=ha.value[za],ha.array[ma]=Ia.r,ha.array[ma+1]=Ia.g,ha.array[ma+2]=Ia.b,ma+=3;else for(za=0;za<zb;za++)Ia=
|
|
j.bufferData(j.ARRAY_BUFFER,lc,Sb)}if(gc){Xb=0;for(mc=gc.length;Xb<mc;Xb++)if(ha=gc[Xb],ha.needsUpdate&&(void 0===ha.boundTo||"vertices"===ha.boundTo)){ma=0;zb=ha.value.length;if(1===ha.size)for(za=0;za<zb;za++)ha.array[za]=ha.value[za];else if(2===ha.size)for(za=0;za<zb;za++)Ia=ha.value[za],ha.array[ma]=Ia.x,ha.array[ma+1]=Ia.y,ma+=2;else if(3===ha.size)if("c"===ha.type)for(za=0;za<zb;za++)Ia=ha.value[za],ha.array[ma]=Ia.r,ha.array[ma+1]=Ia.g,ha.array[ma+2]=Ia.b,ma+=3;else for(za=0;za<zb;za++)Ia=
|
|
@@ -491,7 +489,7 @@ c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LI
|
|
"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
t=["precision "+N+" float;","precision "+N+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
t=["precision "+N+" float;","precision "+N+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=G("vertex",u+q);t=G("fragment",t+r);j.attachShader(v,u);j.attachShader(v,t);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,
|
|
|
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=F("vertex",u+q);t=F("fragment",t+r);j.attachShader(v,u);j.attachShader(v,t);d&&j.bindAttribLocation(v,0,d);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,
|
|
j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(v)));j.deleteShader(t);j.deleteShader(u);v.uniforms={};v.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(t.push("boneTexture"),t.push("boneTextureWidth"),t.push("boneTextureHeight")):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(u=w.length;t<u;t++)p=w[t],v.uniforms[p]=
|
|
j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(v)));j.deleteShader(t);j.deleteShader(u);v.uniforms={};v.attributes={};var w;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(t.push("boneTexture"),t.push("boneTextureWidth"),t.push("boneTextureHeight")):t.push("boneGlobalMatrices");for(w in p)t.push(w);w=t;t=0;for(u=w.length;t<u;t++)p=w[t],v.uniforms[p]=
|
|
j.getUniformLocation(v,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],v.attributes[t]=j.getAttribLocation(v,t);v.id=wa++;ca.push({program:v,code:n,usedTimes:1});K.info.memory.programs=ca.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";
|
|
j.getUniformLocation(v,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)t.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)t.push("morphNormal"+w);for(k in b)t.push(k);k=t;w=0;for(b=k.length;w<b;w++)t=k[w],v.attributes[t]=j.getAttribLocation(v,t);v.id=wa++;ca.push({program:v,code:n,usedTimes:1});K.info.memory.programs=ca.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";
|
|
for(k=0;k<this.maxMorphTargets;k++)v=b+k,0<=w[v]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)v=b+k,0<=w[v]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?
|
|
for(k=0;k<this.maxMorphTargets;k++)v=b+k,0<=w[v]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)v=b+k,0<=w[v]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?
|
|
@@ -520,16 +518,16 @@ e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.
|
|
b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;var h=new XMLHttpRequest;h.onload=function(){var a=THREE.ImageUtils.parseDDS(h.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var m=0;m<a.mipmapCount;m++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+m]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}else f.image.width=a.width,f.image.height=a.height,
|
|
b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;var h=new XMLHttpRequest;h.onload=function(){var a=THREE.ImageUtils.parseDDS(h.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var m=0;m<a.mipmapCount;m++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+m]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}else f.image.width=a.width,f.image.height=a.height,
|
|
f.mipmaps=a.mipmaps;f.format=a.format;f.needsUpdate=!0;c&&c(f)};h.onerror=d;h.open("GET",a,!0);h.responseType="arraybuffer";h.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&
|
|
f.mipmaps=a.mipmaps;f.format=a.format;f.needsUpdate=!0;c&&c(f)};h.onerror=d;h.open("GET",a,!0);h.responseType="arraybuffer";h.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&
|
|
4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[21],k=!1;switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:if(32==g[22]&&g[23]&16711680&&g[24]&65280&&g[25]&255&&g[26]&4278190080)k=!0,e=64,d.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&
|
|
4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[21],k=!1;switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:if(32==g[22]&&g[23]&16711680&&g[24]&65280&&g[25]&255&&g[26]&4278190080)k=!0,e=64,d.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&
|
|
-255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,m=0;m<i;m++){for(var l=0;l<d.mipmapCount;l++){if(k){var n;n=f;for(var s=h,r=4*n*s,q=new Uint8Array(a,g,r),r=new Uint8Array(r),p=0,u=0,t=0;t<s;t++)for(var v=0;v<n;v++){var w=q[u];u++;var x=q[u];u++;var F=q[u];u++;var y=q[u];u++;r[p]=F;p++;r[p]=x;p++;r[p]=w;p++;r[p]=y;p++}n=r;s=n.length}else s=
|
|
|
|
|
|
+255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,m=0;m<i;m++){for(var l=0;l<d.mipmapCount;l++){if(k){var n;n=f;for(var s=h,r=4*n*s,q=new Uint8Array(a,g,r),r=new Uint8Array(r),p=0,t=0,u=0;u<s;u++)for(var v=0;v<n;v++){var w=q[t];t++;var E=q[t];t++;var G=q[t];t++;var y=q[t];t++;r[p]=G;p++;r[p]=E;p++;r[p]=w;p++;r[p]=y;p++}n=r;s=n.length}else s=
|
|
Math.max(4,f)/4*Math.max(4,h)/4*e,n=new Uint8Array(a,g,s);d.mipmaps.push({data:n,width:f,height:h});g+=s;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),k=i.data,m=0;m<
|
|
Math.max(4,f)/4*Math.max(4,h)/4*e,n=new Uint8Array(a,g,s);d.mipmaps.push({data:n,width:f,height:h});g+=s;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),k=i.data,m=0;m<
|
|
-d;m++)for(var l=0;l<e;l++){var n=0>l-1?0:l-1,s=l+1>e-1?e-1:l+1,r=0>m-1?0:m-1,q=m+1>d-1?d-1:m+1,p=[],u=[0,0,g[4*(l*d+m)]/255*b];p.push([-1,0,g[4*(l*d+r)]/255*b]);p.push([-1,-1,g[4*(n*d+r)]/255*b]);p.push([0,-1,g[4*(n*d+m)]/255*b]);p.push([1,-1,g[4*(n*d+q)]/255*b]);p.push([1,0,g[4*(l*d+q)]/255*b]);p.push([1,1,g[4*(s*d+q)]/255*b]);p.push([0,1,g[4*(s*d+m)]/255*b]);p.push([-1,1,g[4*(s*d+r)]/255*b]);n=[];r=p.length;for(s=0;s<r;s++){var q=p[s],t=p[(s+1)%r],q=[q[0]-u[0],q[1]-u[1],q[2]-u[2]],t=[t[0]-u[0],
|
|
|
|
-t[1]-u[1],t[2]-u[2]];n.push(c([q[1]*t[2]-q[2]*t[1],q[2]*t[0]-q[0]*t[2],q[0]*t[1]-q[1]*t[0]]))}p=[0,0,0];for(s=0;s<n.length;s++)p[0]+=n[s][0],p[1]+=n[s][1],p[2]+=n[s][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;u=4*(l*d+m);k[u]=255*((p[0]+1)/2)|0;k[u+1]=255*((p[1]+1)/2)|0;k[u+2]=255*p[2]|0;k[u+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+
|
|
|
|
|
|
+d;m++)for(var l=0;l<e;l++){var n=0>l-1?0:l-1,s=l+1>e-1?e-1:l+1,r=0>m-1?0:m-1,q=m+1>d-1?d-1:m+1,p=[],t=[0,0,g[4*(l*d+m)]/255*b];p.push([-1,0,g[4*(l*d+r)]/255*b]);p.push([-1,-1,g[4*(n*d+r)]/255*b]);p.push([0,-1,g[4*(n*d+m)]/255*b]);p.push([1,-1,g[4*(n*d+q)]/255*b]);p.push([1,0,g[4*(l*d+q)]/255*b]);p.push([1,1,g[4*(s*d+q)]/255*b]);p.push([0,1,g[4*(s*d+m)]/255*b]);p.push([-1,1,g[4*(s*d+r)]/255*b]);n=[];r=p.length;for(s=0;s<r;s++){var q=p[s],u=p[(s+1)%r],q=[q[0]-t[0],q[1]-t[1],q[2]-t[2]],u=[u[0]-t[0],
|
|
|
|
+u[1]-t[1],u[2]-t[2]];n.push(c([q[1]*u[2]-q[2]*u[1],q[2]*u[0]-q[0]*u[2],q[0]*u[1]-q[1]*u[0]]))}p=[0,0,0];for(s=0;s<n.length;s++)p[0]+=n[s][0],p[1]+=n[s][1],p[2]+=n[s][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;t=4*(l*d+m);k[t]=255*((p[0]+1)/2)|0;k[t+1]=255*((p[1]+1)/2)|0;k[t+2]=255*p[2]|0;k[t+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+
|
|
1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
-0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,m,l,n,s,r,q,p,u=b.glyphs[a]||b.glyphs["?"];if(u){if(u.o){b=u._cachedOutline||(u._cachedOutline=u.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
|
-c+d;m=b[a++]*c;s=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(s,r,i,m);if(h=f[f.length-1]){l=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var t=h/g;THREE.Shape.Utils.b2(t,l,s,i);THREE.Shape.Utils.b2(t,n,r,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,s=b[a++]*c+d,r=b[a++]*-c,q=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,m,s,r,q,p),h=f[f.length-1]){l=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)t=h/g,THREE.Shape.Utils.b3(t,l,s,q,i),THREE.Shape.Utils.b3(t,n,r,p,m)}}}return{offset:u.ha*c,path:e}}}};
|
|
|
|
|
|
+0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,m,l,n,s,r,q,p,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
|
+c+d;m=b[a++]*c;s=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(s,r,i,m);if(h=f[f.length-1]){l=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var u=h/g;THREE.Shape.Utils.b2(u,l,s,i);THREE.Shape.Utils.b2(u,n,r,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,s=b[a++]*c+d,r=b[a++]*-c,q=b[a++]*c+d,p=b[a++]*-c,e.bezierCurveTo(i,m,s,r,q,p),h=f[f.length-1]){l=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)u=h/g,THREE.Shape.Utils.b3(u,l,s,q,i),THREE.Shape.Utils.b3(u,n,r,p,m)}}}return{offset:t.ha*c,path:e}}}};
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,m;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var l=2*e;for(k=e-1;2<e;){if(0>=l--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var n;a:{var s=n=void 0,r=void 0,q=void 0,p=void 0,u=void 0,t=void 0,v=void 0,w=
|
|
|
|
-void 0,s=a[h[i]].x,r=a[h[i]].y,q=a[h[k]].x,p=a[h[k]].y,u=a[h[m]].x,t=a[h[m]].y;if(1E-10>(q-s)*(t-r)-(p-r)*(u-s))n=!1;else{var x=void 0,F=void 0,y=void 0,D=void 0,E=void 0,J=void 0,G=void 0,B=void 0,M=void 0,z=void 0,M=B=G=w=v=void 0,x=u-q,F=t-p,y=s-u,D=r-t,E=q-s,J=p-r;for(n=0;n<e;n++)if(!(n===i||n===k||n===m))if(v=a[h[n]].x,w=a[h[n]].y,G=v-s,B=w-r,M=v-q,z=w-p,v-=u,w-=t,M=x*z-F*M,G=E*B-J*G,B=y*w-D*v,-1E-10<=M&&-1E-10<=B&&-1E-10<=G){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[k]],a[h[m]]]);g.push([h[i],
|
|
|
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,m;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var l=2*e;for(k=e-1;2<e;){if(0>=l--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var n;a:{var s=n=void 0,r=void 0,q=void 0,p=void 0,t=void 0,u=void 0,v=void 0,w=
|
|
|
|
+void 0,s=a[h[i]].x,r=a[h[i]].y,q=a[h[k]].x,p=a[h[k]].y,t=a[h[m]].x,u=a[h[m]].y;if(1E-10>(q-s)*(u-r)-(p-r)*(t-s))n=!1;else{var E=void 0,G=void 0,y=void 0,D=void 0,x=void 0,J=void 0,F=void 0,B=void 0,M=void 0,z=void 0,M=B=F=w=v=void 0,E=t-q,G=u-p,y=s-t,D=r-u,x=q-s,J=p-r;for(n=0;n<e;n++)if(!(n===i||n===k||n===m))if(v=a[h[n]].x,w=a[h[n]].y,F=v-s,B=w-r,M=v-q,z=w-p,v-=t,w-=u,M=E*z-G*M,F=x*B-J*F,B=y*w-D*v,-1E-10<=M&&-1E-10<=B&&-1E-10<=F){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[k]],a[h[m]]]);g.push([h[i],
|
|
h[k],h[m]]);i=k;for(m=k+1;m<e;i++,m++)h[i]=h[m];e--;l=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
h[k],h[m]]);i=k;for(m=k+1;m<e;i++,m++)h[i]=h[m];e--;l=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -597,21 +595,21 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
|
|
-e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),h.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,q){var p,u=g.widthSegments,t=g.heightSegments,v=e/2,w=f/2,x=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)p="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)p="y",t=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)p="x",u=g.depthSegments;var F=u+1,y=t+1,D=e/u,E=f/t,J=new THREE.Vector3;J[p]=0<h?1:-1;for(e=0;e<y;e++)for(f=0;f<F;f++){var G=new THREE.Vector3;G[a]=(f*D-v)*c;G[b]=(e*E-w)*d;G[p]=h;g.vertices.push(G)}for(e=
|
|
|
|
-0;e<t;e++)for(f=0;f<u;f++)w=f+F*e,a=f+F*(e+1),b=f+1+F*(e+1),c=f+1+F*e,d=new THREE.Vector2(f/u,1-e/t),h=new THREE.Vector2(f/u,1-(e+1)/t),p=new THREE.Vector2((f+1)/u,1-(e+1)/t),v=new THREE.Vector2((f+1)/u,1-e/t),w=new THREE.Face3(w+x,a+x,c+x),w.normal.copy(J),w.vertexNormals.push(J.clone(),J.clone(),J.clone()),w.materialIndex=q,g.faces.push(w),g.faceVertexUvs[0].push([d,h,v]),w=new THREE.Face3(a+x,b+x,c+x),w.normal.copy(J),w.vertexNormals.push(J.clone(),J.clone(),J.clone()),w.materialIndex=q,g.faces.push(w),
|
|
|
|
|
|
+e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),h.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,q){var p,t=g.widthSegments,u=g.heightSegments,v=e/2,w=f/2,E=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)p="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)p="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)p="x",t=g.depthSegments;var G=t+1,y=u+1,D=e/t,x=f/u,J=new THREE.Vector3;J[p]=0<h?1:-1;for(e=0;e<y;e++)for(f=0;f<G;f++){var F=new THREE.Vector3;F[a]=(f*D-v)*c;F[b]=(e*x-w)*d;F[p]=h;g.vertices.push(F)}for(e=
|
|
|
|
+0;e<u;e++)for(f=0;f<t;f++)w=f+G*e,a=f+G*(e+1),b=f+1+G*(e+1),c=f+1+G*e,d=new THREE.Vector2(f/t,1-e/u),h=new THREE.Vector2(f/t,1-(e+1)/u),p=new THREE.Vector2((f+1)/t,1-(e+1)/u),v=new THREE.Vector2((f+1)/t,1-e/u),w=new THREE.Face3(w+E,a+E,c+E),w.normal.copy(J),w.vertexNormals.push(J.clone(),J.clone(),J.clone()),w.materialIndex=q,g.faces.push(w),g.faceVertexUvs[0].push([d,h,v]),w=new THREE.Face3(a+E,b+E,c+E),w.normal.copy(J),w.vertexNormals.push(J.clone(),J.clone(),J.clone()),w.materialIndex=q,g.faces.push(w),
|
|
g.faceVertexUvs[0].push([h.clone(),p,v.clone()])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",-1,-1,this.width,this.height,-c,
|
|
g.faceVertexUvs[0].push([h.clone(),p,v.clone()])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",-1,-1,this.width,this.height,-c,
|
|
5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],m=[];for(i=0;i<=e;i++){var l=[],n=[],s=i/e,r=s*(b-a)+a;for(g=0;g<=d;g++){var q=g/d,p=new THREE.Vector3;p.x=r*Math.sin(2*q*Math.PI);p.y=-s*c+h;p.z=r*Math.cos(2*q*Math.PI);this.vertices.push(p);l.push(this.vertices.length-1);n.push(new THREE.Vector2(q,
|
|
5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],m=[];for(i=0;i<=e;i++){var l=[],n=[],s=i/e,r=s*(b-a)+a;for(g=0;g<=d;g++){var q=g/d,p=new THREE.Vector3;p.x=r*Math.sin(2*q*Math.PI);p.y=-s*c+h;p.z=r*Math.cos(2*q*Math.PI);this.vertices.push(p);l.push(this.vertices.length-1);n.push(new THREE.Vector2(q,
|
|
-1-s))}k.push(l);m.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(l=this.vertices[k[0][g]].clone(),n=this.vertices[k[0][g+1]].clone()):(l=this.vertices[k[1][g]].clone(),n=this.vertices[k[1][g+1]].clone());l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][g],r=k[i+1][g],q=k[i+1][g+1],p=k[i][g+1],u=l.clone(),t=l.clone(),v=n.clone(),w=n.clone(),x=m[i][g].clone(),F=m[i+1][g].clone(),y=m[i+1][g+1].clone(),D=m[i][g+1].clone();this.faces.push(new THREE.Face3(s,
|
|
|
|
-r,p,[u,t,w]));this.faceVertexUvs[0].push([x,F,D]);this.faces.push(new THREE.Face3(r,q,p,[t.clone(),v,w.clone()]));this.faceVertexUvs[0].push([F.clone(),y,D.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)s=k[0][g],r=k[0][g+1],q=this.vertices.length-1,u=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),x=m[0][g].clone(),F=m[0][g+1].clone(),y=new THREE.Vector2(F.x,0),this.faces.push(new THREE.Face3(s,r,q,[u,t,v])),this.faceVertexUvs[0].push([x,
|
|
|
|
-F,y])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)s=k[i][g+1],r=k[i][g],q=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),x=m[i][g+1].clone(),F=m[i][g].clone(),y=new THREE.Vector2(F.x,1),this.faces.push(new THREE.Face3(s,r,q,[u,t,v])),this.faceVertexUvs[0].push([x,F,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
|
|
|
+1-s))}k.push(l);m.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(l=this.vertices[k[0][g]].clone(),n=this.vertices[k[0][g+1]].clone()):(l=this.vertices[k[1][g]].clone(),n=this.vertices[k[1][g+1]].clone());l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][g],r=k[i+1][g],q=k[i+1][g+1],p=k[i][g+1],t=l.clone(),u=l.clone(),v=n.clone(),w=n.clone(),E=m[i][g].clone(),G=m[i+1][g].clone(),y=m[i+1][g+1].clone(),D=m[i][g+1].clone();this.faces.push(new THREE.Face3(s,
|
|
|
|
+r,p,[t,u,w]));this.faceVertexUvs[0].push([E,G,D]);this.faces.push(new THREE.Face3(r,q,p,[u.clone(),v,w.clone()]));this.faceVertexUvs[0].push([G.clone(),y,D.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)s=k[0][g],r=k[0][g+1],q=this.vertices.length-1,t=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),E=m[0][g].clone(),G=m[0][g+1].clone(),y=new THREE.Vector2(G.x,0),this.faces.push(new THREE.Face3(s,r,q,[t,u,v])),this.faceVertexUvs[0].push([E,
|
|
|
|
+G,y])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)s=k[i][g+1],r=k[i][g],q=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),E=m[i][g+1].clone(),G=m[i][g].clone(),y=new THREE.Vector2(G.x,1),this.faces.push(new THREE.Face3(s,r,q,[t,u,v])),this.faceVertexUvs[0].push([E,G,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(C=c.length;0<=--C;){e=C;f=C-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*m,
|
|
h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(C=c.length;0<=--C;){e=C;f=C-1;0>f&&(f=c.length-1);for(var g=0,h=s+2*m,
|
|
-g=0;g<h;g++){var i=ia*g,k=ia*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,u=e,w=f,l=l+B,i=i+B,n=n+B,k=k+B;G.faces.push(new THREE.Face3(l,i,k,null,null,t));G.faces.push(new THREE.Face3(i,n,k,null,null,t));l=v.generateSideWallUV(G,a,p,b,l,i,n,k,q,r,u,w);G.faceVertexUvs[0].push([l[0],l[1],l[3]]);G.faceVertexUvs[0].push([l[1],l[2],l[3]])}}}function f(a,b,c){G.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=B;d+=B;e+=B;G.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?v.generateBottomUV(G,
|
|
|
|
-a,b,c,d,e):v.generateTopUV(G,a,b,c,d,e);G.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,l=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,q,p=!1,u=b.material,t=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,x,F,y;r&&(q=
|
|
|
|
-r.getSpacedPoints(s),p=!0,l=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,!1),x=new THREE.Vector3,F=new THREE.Vector3,y=new THREE.Vector3);l||(k=i=m=0);var D,E,J,G=this,B=this.vertices.length,n=a.extractPoints(n),M=n.shape,n=n.holes;if(r=!THREE.Shape.Utils.isClockWise(M)){M=M.reverse();E=0;for(J=n.length;E<J;E++)D=n[E],THREE.Shape.Utils.isClockWise(D)&&(n[E]=D.reverse());r=!1}var z=THREE.Shape.Utils.triangulateShape(M,n),r=M;E=0;for(J=n.length;E<J;E++)D=n[E],M=M.concat(D);
|
|
|
|
-var I,A,N,S,ia=M.length,na=z.length,pa=[],C=0,Q=r.length;I=Q-1;for(A=C+1;C<Q;C++,I++,A++)I===Q&&(I=0),A===Q&&(A=0),pa[C]=d(r[C],r[I],r[A]);var R=[],K,ca=pa.concat();E=0;for(J=n.length;E<J;E++){D=n[E];K=[];C=0;Q=D.length;I=Q-1;for(A=C+1;C<Q;C++,I++,A++)I===Q&&(I=0),A===Q&&(A=0),K[C]=d(D[C],D[I],D[A]);R.push(K);ca=ca.concat(K)}for(I=0;I<m;I++){D=I/m;N=i*(1-D);A=k*Math.sin(D*Math.PI/2);C=0;for(Q=r.length;C<Q;C++)S=c(r[C],pa[C],A),f(S.x,S.y,-N);E=0;for(J=n.length;E<J;E++){D=n[E];K=R[E];C=0;for(Q=D.length;C<
|
|
|
|
-Q;C++)S=c(D[C],K[C],A),f(S.x,S.y,-N)}}A=k;for(C=0;C<ia;C++)S=l?c(M[C],ca[C],A):M[C],p?(F.copy(w.normals[0]).multiplyScalar(S.x),x.copy(w.binormals[0]).multiplyScalar(S.y),y.copy(q[0]).add(F).add(x),f(y.x,y.y,y.z)):f(S.x,S.y,0);for(D=1;D<=s;D++)for(C=0;C<ia;C++)S=l?c(M[C],ca[C],A):M[C],p?(F.copy(w.normals[D]).multiplyScalar(S.x),x.copy(w.binormals[D]).multiplyScalar(S.y),y.copy(q[D]).add(F).add(x),f(y.x,y.y,y.z)):f(S.x,S.y,g/s*D);for(I=m-1;0<=I;I--){D=I/m;N=i*(1-D);A=k*Math.sin(D*Math.PI/2);C=0;for(Q=
|
|
|
|
-r.length;C<Q;C++)S=c(r[C],pa[C],A),f(S.x,S.y,g+N);E=0;for(J=n.length;E<J;E++){D=n[E];K=R[E];C=0;for(Q=D.length;C<Q;C++)S=c(D[C],K[C],A),p?f(S.x,S.y+q[s-1].y,q[s-1].x+N):f(S.x,S.y,g+N)}}if(l){i=0*ia;for(C=0;C<na;C++)g=z[C],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ia*(s+2*m);for(C=0;C<na;C++)g=z[C],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(C=0;C<na;C++)g=z[C],h(g[2],g[1],g[0],!0);for(C=0;C<na;C++)g=z[C],h(g[0]+ia*s,g[1]+ia*s,g[2]+ia*s,!1)}g=0;e(r,g);g+=r.length;E=0;for(J=n.length;E<J;E++)D=n[E],e(D,g),g+=D.length};
|
|
|
|
|
|
+g=0;g<h;g++){var i=ia*g,k=ia*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,t=e,w=f,l=l+B,i=i+B,n=n+B,k=k+B;F.faces.push(new THREE.Face3(l,i,k,null,null,u));F.faces.push(new THREE.Face3(i,n,k,null,null,u));l=v.generateSideWallUV(F,a,p,b,l,i,n,k,q,r,t,w);F.faceVertexUvs[0].push([l[0],l[1],l[3]]);F.faceVertexUvs[0].push([l[1],l[2],l[3]])}}}function f(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=B;d+=B;e+=B;F.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?v.generateBottomUV(F,
|
|
|
|
+a,b,c,d,e):v.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,l=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,r=b.extrudePath,q,p=!1,t=b.material,u=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,E,G,y;r&&(q=
|
|
|
|
+r.getSpacedPoints(s),p=!0,l=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,s,!1),E=new THREE.Vector3,G=new THREE.Vector3,y=new THREE.Vector3);l||(k=i=m=0);var D,x,J,F=this,B=this.vertices.length,n=a.extractPoints(n),M=n.shape,n=n.holes;if(r=!THREE.Shape.Utils.isClockWise(M)){M=M.reverse();x=0;for(J=n.length;x<J;x++)D=n[x],THREE.Shape.Utils.isClockWise(D)&&(n[x]=D.reverse());r=!1}var z=THREE.Shape.Utils.triangulateShape(M,n),r=M;x=0;for(J=n.length;x<J;x++)D=n[x],M=M.concat(D);
|
|
|
|
+var I,A,N,S,ia=M.length,na=z.length,pa=[],C=0,Q=r.length;I=Q-1;for(A=C+1;C<Q;C++,I++,A++)I===Q&&(I=0),A===Q&&(A=0),pa[C]=d(r[C],r[I],r[A]);var R=[],K,ca=pa.concat();x=0;for(J=n.length;x<J;x++){D=n[x];K=[];C=0;Q=D.length;I=Q-1;for(A=C+1;C<Q;C++,I++,A++)I===Q&&(I=0),A===Q&&(A=0),K[C]=d(D[C],D[I],D[A]);R.push(K);ca=ca.concat(K)}for(I=0;I<m;I++){D=I/m;N=i*(1-D);A=k*Math.sin(D*Math.PI/2);C=0;for(Q=r.length;C<Q;C++)S=c(r[C],pa[C],A),f(S.x,S.y,-N);x=0;for(J=n.length;x<J;x++){D=n[x];K=R[x];C=0;for(Q=D.length;C<
|
|
|
|
+Q;C++)S=c(D[C],K[C],A),f(S.x,S.y,-N)}}A=k;for(C=0;C<ia;C++)S=l?c(M[C],ca[C],A):M[C],p?(G.copy(w.normals[0]).multiplyScalar(S.x),E.copy(w.binormals[0]).multiplyScalar(S.y),y.copy(q[0]).add(G).add(E),f(y.x,y.y,y.z)):f(S.x,S.y,0);for(D=1;D<=s;D++)for(C=0;C<ia;C++)S=l?c(M[C],ca[C],A):M[C],p?(G.copy(w.normals[D]).multiplyScalar(S.x),E.copy(w.binormals[D]).multiplyScalar(S.y),y.copy(q[D]).add(G).add(E),f(y.x,y.y,y.z)):f(S.x,S.y,g/s*D);for(I=m-1;0<=I;I--){D=I/m;N=i*(1-D);A=k*Math.sin(D*Math.PI/2);C=0;for(Q=
|
|
|
|
+r.length;C<Q;C++)S=c(r[C],pa[C],A),f(S.x,S.y,g+N);x=0;for(J=n.length;x<J;x++){D=n[x];K=R[x];C=0;for(Q=D.length;C<Q;C++)S=c(D[C],K[C],A),p?f(S.x,S.y+q[s-1].y,q[s-1].x+N):f(S.x,S.y,g+N)}}if(l){i=0*ia;for(C=0;C<na;C++)g=z[C],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ia*(s+2*m);for(C=0;C<na;C++)g=z[C],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(C=0;C<na;C++)g=z[C],h(g[2],g[1],g[0],!0);for(C=0;C<na;C++)g=z[C],h(g[0]+ia*s,g[1]+ia*s,g[2]+ia*s,!1)}g=0;e(r,g);g+=r.length;x=0;for(J=n.length;x<J;x++)D=n[x],e(D,g),g+=D.length};
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,h,g){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[h].x,
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,h,g){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[h].x,
|
|
m=a.vertices[h].y,h=a.vertices[h].z,l=a.vertices[g].x,n=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-h),new THREE.Vector2(l,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-h),new THREE.Vector2(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
m=a.vertices[h].y,h=a.vertices[h].z,l=a.vertices[g].x,n=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-h),new THREE.Vector2(l,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-h),new THREE.Vector2(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
@@ -634,7 +632,7 @@ THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THRE
|
|
d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),h[k]=h[k-1].clone(),g.crossVectors(e[k-1],e[k]),1E-4<g.length()&&(g.normalize(),d=Math.acos(THREE.Math.clamp(e[k-1].dot(e[k]),-1,1)),f[k].applyMatrix4(i.makeRotationAxis(g,d))),h[k].crossVectors(e[k],f[k]);if(c){d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(k=1;k<b;k++)f[k].applyMatrix4(i.makeRotationAxis(e[k],d*k)),h[k].crossVectors(e[k],
|
|
d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),h[k]=h[k-1].clone(),g.crossVectors(e[k-1],e[k]),1E-4<g.length()&&(g.normalize(),d=Math.acos(THREE.Math.clamp(e[k-1].dot(e[k]),-1,1)),f[k].applyMatrix4(i.makeRotationAxis(g,d))),h[k].crossVectors(e[k],f[k]);if(c){d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(k=1;k<b;k++)f[k].applyMatrix4(i.makeRotationAxis(e[k],d*k)),h[k].crossVectors(e[k],
|
|
f[k])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
|
|
f[k])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
|
|
h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,k=a.length;i<k;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var m=this.vertices,a=[],i=0,k=b.length;i<k;i++){var l=m[b[i][0]],n=m[b[i][1]],s=m[b[i][2]];a[i]=new THREE.Face3(l.index,n.index,s.index,[l.clone(),n.clone(),s.clone()])}i=0;for(k=a.length;i<k;i++){n=a[i];m=d;b=Math.pow(2,
|
|
h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,k=a.length;i<k;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var m=this.vertices,a=[],i=0,k=b.length;i<k;i++){var l=m[b[i][0]],n=m[b[i][1]],s=m[b[i][2]];a[i]=new THREE.Face3(l.index,n.index,s.index,[l.clone(),n.clone(),s.clone()])}i=0;for(k=a.length;i<k;i++){n=a[i];m=d;b=Math.pow(2,
|
|
-m);Math.pow(4,m);for(var m=e(g.vertices[n.a]),l=e(g.vertices[n.b]),r=e(g.vertices[n.c]),n=[],s=0;s<=b;s++){n[s]=[];for(var q=e(m.clone().lerp(r,s/b)),p=e(l.clone().lerp(r,s/b)),u=b-s,t=0;t<=u;t++)n[s][t]=0==t&&s==b?q:e(q.clone().lerp(p,t/u))}for(s=0;s<b;s++)for(t=0;t<2*(b-s)-1;t++)m=Math.floor(t/2),0==t%2?f(n[s][m+1],n[s+1][m],n[s][m]):f(n[s][m+1],n[s+1][m+1],n[s+1][m])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,m=d[2].x,l=Math.max(a,Math.max(b,m)),
|
|
|
|
|
|
+m);Math.pow(4,m);for(var m=e(g.vertices[n.a]),l=e(g.vertices[n.b]),r=e(g.vertices[n.c]),n=[],s=0;s<=b;s++){n[s]=[];for(var q=e(m.clone().lerp(r,s/b)),p=e(l.clone().lerp(r,s/b)),t=b-s,u=0;u<=t;u++)n[s][u]=0==u&&s==b?q:e(q.clone().lerp(p,u/t))}for(s=0;s<b;s++)for(u=0;u<2*(b-s)-1;u++)m=Math.floor(u/2),0==u%2?f(n[s][m+1],n[s+1][m],n[s][m]):f(n[s][m+1],n[s+1][m+1],n[s+1][m])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,m=d[2].x,l=Math.max(a,Math.max(b,m)),
|
|
n=Math.min(a,Math.min(b,m)),0.9<l&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>m&&(d[2].x+=1));i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],h,g,i,k,m=b+1;for(h=0;h<=c;h++){k=h/c;for(g=0;g<=b;g++)i=g/b,i=a(i,k),d.push(i)}var l,n,s,r;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*m+g,d=h*m+g+1,k=(h+1)*m+g+1,i=(h+1)*m+g,l=new THREE.Vector2(g/b,h/c),n=new THREE.Vector2((g+1)/b,h/c),s=new THREE.Vector2((g+1)/b,(h+1)/c),r=new THREE.Vector2(g/b,(h+1)/c),e.push(new THREE.Face3(a,d,i)),f.push([l,n,r]),e.push(new THREE.Face3(d,k,i)),
|
|
n=Math.min(a,Math.min(b,m)),0.9<l&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>m&&(d[2].x+=1));i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],h,g,i,k,m=b+1;for(h=0;h<=c;h++){k=h/c;for(g=0;g<=b;g++)i=g/b,i=a(i,k),d.push(i)}var l,n,s,r;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*m+g,d=h*m+g+1,k=(h+1)*m+g+1,i=(h+1)*m+g,l=new THREE.Vector2(g/b,h/c),n=new THREE.Vector2((g+1)/b,h/c),s=new THREE.Vector2((g+1)/b,(h+1)/c),r=new THREE.Vector2(g/b,(h+1)/c),e.push(new THREE.Face3(a,d,i)),f.push([l,n,r]),e.push(new THREE.Face3(d,k,i)),
|
|
f.push([n.clone(),s,r.clone()]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
f.push([n.clone(),s,r.clone()]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);this.position=b;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.05,0.25,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,0.875,0));this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);this.position=b;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.05,0.25,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,0.875,0));this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));
|
|
@@ -672,34 +670,33 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
e[r++]=0;e[r++]=0;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=1;e[r++]=-1;e[r++]=1;e[r++]=0;e[r++]=1;r=0;f[r++]=0;f[r++]=1;f[r++]=2;f[r++]=0;f[r++]=2;f[r++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,l=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};s={};n.vertex=b.getAttribLocation(l,"position");n.uv=b.getAttribLocation(l,"uv");s.renderType=b.getUniformLocation(l,"renderType");s.map=b.getUniformLocation(l,"map");s.occlusionMap=b.getUniformLocation(l,"occlusionMap");s.opacity=
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,l=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,l=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};s={};n.vertex=b.getAttribLocation(l,"position");n.uv=b.getAttribLocation(l,"uv");s.renderType=b.getUniformLocation(l,"renderType");s.map=b.getUniformLocation(l,"map");s.occlusionMap=b.getUniformLocation(l,"occlusionMap");s.opacity=
|
|
-b.getUniformLocation(l,"opacity");s.color=b.getUniformLocation(l,"color");s.scale=b.getUniformLocation(l,"scale");s.rotation=b.getUniformLocation(l,"rotation");s.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,t=a.length;if(t){var v=new THREE.Vector3,w=f/e,x=0.5*e,F=0.5*f,y=16/f,D=new THREE.Vector2(y*w,y),E=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1),G=s,y=n;b.useProgram(l);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
|
-b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(y.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(y.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var B,M,z,I,A;for(B=0;B<t;B++)if(y=16/f,D.set(y*w,y),I=a[B],v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),E.copy(v),J.x=E.x*x+x,
|
|
|
|
-J.y=E.y*F+F,m||0<J.x&&J.x<e&&0<J.y&&J.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,J.x-8,J.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,D.x,D.y);b.uniform3f(G.screenPosition,E.x,E.y,E.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,J.x-8,J.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);I.positionScreen.copy(E);I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);M=0;for(z=I.lensFlares.length;M<z;M++)A=I.lensFlares[M],0.0010<A.opacity&&0.0010<A.scale&&(E.x=A.x,E.y=A.y,E.z=A.z,y=A.size*A.scale/f,D.x=y*w,D.y=y,b.uniform3f(G.screenPosition,E.x,E.y,E.z),b.uniform2f(G.scale,D.x,D.y),b.uniform1f(G.rotation,A.rotation),
|
|
|
|
-b.uniform1f(G.opacity,A.opacity),b.uniform3f(G.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),c.setTexture(A.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,n){var s,r,q,p,u,t,v,w,x,F=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=l.__lights.length;s<r;s++)if(q=l.__lights[s],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(u=0;u<q.shadowCascadeCount;u++){var y;if(q.shadowCascadeArray[u])y=q.shadowCascadeArray[u];else{x=q;v=u;y=new THREE.DirectionalLight;y.isVirtual=!0;y.onlyShadow=!0;y.castShadow=!0;y.shadowCameraNear=x.shadowCameraNear;y.shadowCameraFar=x.shadowCameraFar;y.shadowCameraLeft=x.shadowCameraLeft;y.shadowCameraRight=x.shadowCameraRight;
|
|
|
|
-y.shadowCameraBottom=x.shadowCameraBottom;y.shadowCameraTop=x.shadowCameraTop;y.shadowCameraVisible=x.shadowCameraVisible;y.shadowDarkness=x.shadowDarkness;y.shadowBias=x.shadowCascadeBias[v];y.shadowMapWidth=x.shadowCascadeWidth[v];y.shadowMapHeight=x.shadowCascadeHeight[v];y.pointsWorld=[];y.pointsFrustum=[];w=y.pointsWorld;t=y.pointsFrustum;for(var D=0;8>D;D++)w[D]=new THREE.Vector3,t[D]=new THREE.Vector3;w=x.shadowCascadeNearZ[v];x=x.shadowCascadeFarZ[v];t[0].set(-1,-1,w);t[1].set(1,-1,w);t[2].set(-1,
|
|
|
|
-1,w);t[3].set(1,1,w);t[4].set(-1,-1,x);t[5].set(1,-1,x);t[6].set(-1,1,x);t[7].set(1,1,x);y.originalCamera=n;t=new THREE.Gyroscope;t.position=q.shadowCascadeOffset;t.add(y);t.add(y.target);n.add(t);q.shadowCascadeArray[u]=y;console.log("Created virtualLight",y)}v=q;w=u;x=v.shadowCascadeArray[w];x.position.copy(v.position);x.target.position.copy(v.target.position);x.lookAt(x.target);x.shadowCameraVisible=v.shadowCameraVisible;x.shadowDarkness=v.shadowDarkness;x.shadowBias=v.shadowCascadeBias[w];t=v.shadowCascadeNearZ[w];
|
|
|
|
-v=v.shadowCascadeFarZ[w];x=x.pointsFrustum;x[0].z=t;x[1].z=t;x[2].z=t;x[3].z=t;x[4].z=v;x[5].z=v;x[6].z=v;x[7].z=v;F[p]=y;p++}else F[p]=q,p++;s=0;for(r=F.length;s<r;s++){q=F[s];q.shadowMap||(u=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(u=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:u,magFilter:u,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
|
|
|
+b.getUniformLocation(l,"opacity");s.color=b.getUniformLocation(l,"color");s.scale=b.getUniformLocation(l,"scale");s.rotation=b.getUniformLocation(l,"rotation");s.screenPosition=b.getUniformLocation(l,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,w=f/e,E=0.5*e,G=0.5*f,y=16/f,D=new THREE.Vector2(y*w,y),x=new THREE.Vector3(1,1,0),J=new THREE.Vector2(1,1),F=s,y=n;b.useProgram(l);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
|
+b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(y.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(y.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var B,M,z,I,A;for(B=0;B<u;B++)if(y=16/f,D.set(y*w,y),I=a[B],v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),x.copy(v),J.x=x.x*E+E,
|
|
|
|
+J.y=x.y*G+G,m||0<J.x&&J.x<e&&0<J.y&&J.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,J.x-8,J.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,D.x,D.y);b.uniform3f(F.screenPosition,x.x,x.y,x.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,J.x-8,J.y-8,16,16,0);b.uniform1i(F.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);I.positionScreen.copy(x);I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);M=0;for(z=I.lensFlares.length;M<z;M++)A=I.lensFlares[M],0.0010<A.opacity&&0.0010<A.scale&&(x.x=A.x,x.y=A.y,x.z=A.z,y=A.size*A.scale/f,D.x=y*w,D.y=y,b.uniform3f(F.screenPosition,x.x,x.y,x.z),b.uniform2f(F.scale,D.x,D.y),b.uniform1f(F.rotation,A.rotation),
|
|
|
|
+b.uniform1f(F.opacity,A.opacity),b.uniform3f(F.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),c.setTexture(A.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,n){var s,r,q,p,t,u,v,w,E,G=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);s=0;for(r=l.__lights.length;s<r;s++)if(q=l.__lights[s],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(t=0;t<q.shadowCascadeCount;t++){var y;if(q.shadowCascadeArray[t])y=q.shadowCascadeArray[t];else{E=q;v=t;y=new THREE.DirectionalLight;y.isVirtual=!0;y.onlyShadow=!0;y.castShadow=!0;y.shadowCameraNear=E.shadowCameraNear;y.shadowCameraFar=E.shadowCameraFar;y.shadowCameraLeft=E.shadowCameraLeft;y.shadowCameraRight=E.shadowCameraRight;
|
|
|
|
+y.shadowCameraBottom=E.shadowCameraBottom;y.shadowCameraTop=E.shadowCameraTop;y.shadowCameraVisible=E.shadowCameraVisible;y.shadowDarkness=E.shadowDarkness;y.shadowBias=E.shadowCascadeBias[v];y.shadowMapWidth=E.shadowCascadeWidth[v];y.shadowMapHeight=E.shadowCascadeHeight[v];y.pointsWorld=[];y.pointsFrustum=[];w=y.pointsWorld;u=y.pointsFrustum;for(var D=0;8>D;D++)w[D]=new THREE.Vector3,u[D]=new THREE.Vector3;w=E.shadowCascadeNearZ[v];E=E.shadowCascadeFarZ[v];u[0].set(-1,-1,w);u[1].set(1,-1,w);u[2].set(-1,
|
|
|
|
+1,w);u[3].set(1,1,w);u[4].set(-1,-1,E);u[5].set(1,-1,E);u[6].set(-1,1,E);u[7].set(1,1,E);y.originalCamera=n;u=new THREE.Gyroscope;u.position=q.shadowCascadeOffset;u.add(y);u.add(y.target);n.add(u);q.shadowCascadeArray[t]=y;console.log("Created virtualLight",y)}v=q;w=t;E=v.shadowCascadeArray[w];E.position.copy(v.position);E.target.position.copy(v.target.position);E.lookAt(E.target);E.shadowCameraVisible=v.shadowCameraVisible;E.shadowDarkness=v.shadowDarkness;E.shadowBias=v.shadowCascadeBias[w];u=v.shadowCascadeNearZ[w];
|
|
|
|
+v=v.shadowCascadeFarZ[w];E=E.pointsFrustum;E[0].z=u;E[1].z=u;E[2].z=u;E[3].z=u;E[4].z=v;E[5].z=v;E[6].z=v;E[7].z=v;G[p]=y;p++}else G[p]=q,p++;s=0;for(r=G.length;s<r;s++){q=G[s];q.shadowMap||(t=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(t=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:t,magFilter:t,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(q.shadowCamera);!0===l.autoUpdate&&l.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(q.shadowCamera);!0===l.autoUpdate&&l.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
-!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&y.originalCamera==n){u=n;p=q.shadowCamera;t=q.pointsFrustum;x=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=x[v],w.copy(t[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,u),w.applyMatrix4(p.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
|
-(k.z=w.z);p.left=i.x;p.right=k.x;p.top=k.y;p.bottom=i.y;p.updateProjectionMatrix()}p=q.shadowMap;t=q.shadowMatrix;u=q.shadowCamera;u.position.getPositionFromMatrix(q.matrixWorld);m.getPositionFromMatrix(q.target.matrixWorld);u.lookAt(m);u.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiply(u.projectionMatrix);t.multiply(u.matrixWorldInverse);
|
|
|
|
-g.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(p);b.clear();x=l.__webglObjects;q=0;for(p=x.length;q<p;q++)if(v=x[q],t=v.object,v.render=!1,t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||h.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,t.matrixWorld),v.render=!0;q=0;for(p=x.length;q<p;q++)v=x[q],v.render&&(t=v.object,v=v.buffer,D=t.material instanceof THREE.MeshFaceMaterial?
|
|
|
|
-t.material.materials[0]:t.material,w=0<t.geometry.morphTargets.length&&D.morphTargets,D=t instanceof THREE.SkinnedMesh&&D.skinning,w=t.customDepthMaterial?t.customDepthMaterial:D?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(u,l.__lights,null,w,v,t):b.renderBuffer(u,l.__lights,null,w,v,t));x=l.__webglObjectsImmediate;q=0;for(p=x.length;q<p;q++)v=x[q],t=v.object,t.visible&&t.castShadow&&(t._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,t.matrixWorld),b.renderImmediateObject(u,
|
|
|
|
-l.__lights,null,c,t))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,k,m;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-0.5;e[a++]=-0.5;e[a++]=0;e[a++]=0;e[a++]=0.5;e[a++]=-0.5;e[a++]=1;e[a++]=0;e[a++]=0.5;e[a++]=0.5;e[a++]=1;e[a++]=1;e[a++]=-0.5;e[a++]=0.5;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);
|
|
|
|
|
|
+!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&y.originalCamera==n){t=n;p=q.shadowCamera;u=q.pointsFrustum;E=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)w=E[v],w.copy(u[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,t),w.applyMatrix4(p.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
|
+(k.z=w.z);p.left=i.x;p.right=k.x;p.top=k.y;p.bottom=i.y;p.updateProjectionMatrix()}p=q.shadowMap;u=q.shadowMatrix;t=q.shadowCamera;t.position.getPositionFromMatrix(q.matrixWorld);m.getPositionFromMatrix(q.target.matrixWorld);t.lookAt(m);t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(t.projectionMatrix);u.multiply(t.matrixWorldInverse);
|
|
|
|
+g.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(p);b.clear();E=l.__webglObjects;q=0;for(p=E.length;q<p;q++)if(v=E[q],u=v.object,v.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,u.matrixWorld),v.render=!0;q=0;for(p=E.length;q<p;q++)v=E[q],v.render&&(u=v.object,v=v.buffer,D=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
|
+u.material.materials[0]:u.material,w=0<u.geometry.morphTargets.length&&D.morphTargets,D=u instanceof THREE.SkinnedMesh&&D.skinning,w=u.customDepthMaterial?u.customDepthMaterial:D?w?f:e:w?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(t,l.__lights,null,w,v,u):b.renderBuffer(t,l.__lights,null,w,v,u));E=l.__webglObjectsImmediate;q=0;for(p=E.length;q<p;q++)v=E[q],u=v.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(t,
|
|
|
|
+l.__lights,null,c,u))}s=b.getClearColor();r=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,k,m;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-0.5;e[a++]=-0.5;e[a++]=0;e[a++]=0;e[a++]=0.5;e[a++]=-0.5;e[a++]=1;e[a++]=0;e[a++]=0.5;e[a++]=0.5;e[a++]=1;e[a++]=1;e[a++]=-0.5;e[a++]=0.5;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);
|
|
b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER),q="precision "+d+" float;\n";b.shaderSource(s,q+a.fragmentShader);b.shaderSource(r,q+a.vertexShader);b.compileShader(s);b.compileShader(r);b.attachShader(n,s);b.attachShader(n,r);b.linkProgram(n);i=n;k={};m={};k.position=b.getAttribLocation(i,
|
|
b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),r=b.createShader(b.VERTEX_SHADER),q="precision "+d+" float;\n";b.shaderSource(s,q+a.fragmentShader);b.shaderSource(r,q+a.vertexShader);b.compileShader(s);b.compileShader(r);b.attachShader(n,s);b.attachShader(n,r);b.linkProgram(n);i=n;k={};m={};k.position=b.getAttribLocation(i,
|
|
-"position");k.uv=b.getAttribLocation(i,"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.halfViewport=b.getUniformLocation(i,"halfViewport");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");
|
|
|
|
-m.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");m.screenPosition=b.getUniformLocation(i,"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,
|
|
|
|
-"alphaTest")};this.render=function(d,e,f,r){var q=d.__webglSprites,p=q.length;if(p){var u=k,t=m,f=0.5*f,r=0.5*r;b.useProgram(i);b.enableVertexAttribArray(u.position);b.enableVertexAttribArray(u.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(u.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(u.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(t.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);
|
|
|
|
-b.uniform1i(t.map,0);var v=u=0,w=d.fog;w?(b.uniform3f(t.fogColor,w.color.r,w.color.g,w.color.b),w instanceof THREE.Fog?(b.uniform1f(t.fogNear,w.near),b.uniform1f(t.fogFar,w.far),b.uniform1i(t.fogType,1),v=u=1):w instanceof THREE.FogExp2&&(b.uniform1f(t.fogDensity,w.density),b.uniform1i(t.fogType,2),v=u=2)):(b.uniform1i(t.fogType,0),v=u=0);for(var x,F,y=[],w=0;w<p;w++)x=q[w],F=x.material,x.visible&&0!==F.opacity&&(F.useScreenCoordinates?x.z=-x.position.z:(x._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,
|
|
|
|
-x.matrixWorld),x.z=-x._modelViewMatrix.elements[14]));q.sort(a);for(w=0;w<p;w++)x=q[w],F=x.material,x.visible&&0!==F.opacity&&(F.map&&F.map.image&&F.map.image.width)&&(b.uniform1f(t.alphaTest,F.alphaTest),!0===F.useScreenCoordinates?(b.uniform1i(t.useScreenCoordinates,1),b.uniform3f(t.screenPosition,(x.position.x*c.devicePixelRatio-f)/f,(r-x.position.y*c.devicePixelRatio)/r,Math.max(0,Math.min(1,x.position.z))),y[0]=c.devicePixelRatio*x.scale.x,y[1]=c.devicePixelRatio*x.scale.y):(b.uniform1i(t.useScreenCoordinates,
|
|
|
|
-0),b.uniform1i(t.sizeAttenuation,F.sizeAttenuation?1:0),b.uniformMatrix4fv(t.modelViewMatrix,!1,x._modelViewMatrix.elements),y[0]=x.scale.x,y[1]=x.scale.y),e=d.fog&&F.fog?v:0,u!==e&&(b.uniform1i(t.fogType,e),u=e),b.uniform2f(t.uvScale,F.uvScale.x,F.uvScale.y),b.uniform2f(t.uvOffset,F.uvOffset.x,F.uvOffset.y),b.uniform2f(t.alignment,F.alignment.x,F.alignment.y),b.uniform1f(t.opacity,F.opacity),b.uniform3f(t.color,F.color.r,F.color.g,F.color.b),b.uniform1f(t.rotation,F.rotation),b.uniform2fv(t.scale,
|
|
|
|
-y),b.uniform2f(t.halfViewport,f,r),c.setBlending(F.blending,F.blendEquation,F.blendSrc,F.blendDst),c.setDepthTest(F.depthTest),c.setDepthWrite(F.depthWrite),c.setTexture(F.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
|
|
|
+"position");k.uv=b.getAttribLocation(i,"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.halfViewport=b.getUniformLocation(i,"halfViewport");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");
|
|
|
|
+m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,r){var q=d.__webglSprites,p=q.length;if(p){var t=k,u=m,f=0.5*f,r=0.5*r;b.useProgram(i);b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
|
+h);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var v=t=0,w=d.fog;w?(b.uniform3f(u.fogColor,w.color.r,w.color.g,w.color.b),w instanceof THREE.Fog?(b.uniform1f(u.fogNear,w.near),b.uniform1f(u.fogFar,w.far),b.uniform1i(u.fogType,1),v=t=1):w instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,
|
|
|
|
+w.density),b.uniform1i(u.fogType,2),v=t=2)):(b.uniform1i(u.fogType,0),v=t=0);for(var E,G,y=[],w=0;w<p;w++)E=q[w],G=E.material,E.visible&&0!==G.opacity&&(E._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,E.matrixWorld),E.z=-E._modelViewMatrix.elements[14]);q.sort(a);for(w=0;w<p;w++)E=q[w],G=E.material,E.visible&&0!==G.opacity&&(G.map&&G.map.image&&G.map.image.width)&&(b.uniform1f(u.alphaTest,G.alphaTest),b.uniformMatrix4fv(u.modelViewMatrix,!1,E._modelViewMatrix.elements),y[0]=E.scale.x,y[1]=
|
|
|
|
+E.scale.y,e=d.fog&&G.fog?v:0,t!==e&&(b.uniform1i(u.fogType,e),t=e),b.uniform2f(u.uvScale,G.uvScale.x,G.uvScale.y),b.uniform2f(u.uvOffset,G.uvOffset.x,G.uvOffset.y),b.uniform1f(u.opacity,G.opacity),b.uniform3f(u.color,G.color.r,G.color.g,G.color.b),b.uniform1f(u.rotation,G.rotation),b.uniform2fv(u.scale,y),b.uniform2f(u.halfViewport,f,r),c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst),c.setDepthTest(G.depthTest),c.setDepthWrite(G.depthWrite),c.setTexture(G.map,0),b.drawElements(b.TRIANGLES,
|
|
|
|
+6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var m,l,n,s,r,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var m,l,n,s,r,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
|
|
k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();q=i.__webglObjects;m=0;for(l=q.length;m<l;m++)if(n=q[m],r=n.object,n.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),n.render=!0;var p;m=0;for(l=q.length;m<l;m++)if(n=q[m],n.render&&(r=n.object,n=n.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(p=
|
|
k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();q=i.__webglObjects;m=0;for(l=q.length;m<l;m++)if(n=q[m],r=n.object,n.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),n.render=!0;var p;m=0;for(l=q.length;m<l;m++)if(n=q[m],n.render&&(r=n.object,n=n.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(p=
|
|
r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),s=0<r.geometry.morphTargets.length&&p.morphTargets,p=r instanceof THREE.SkinnedMesh&&p.skinning,s=r.customDepthMaterial?r.customDepthMaterial:p?s?f:e:s?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,n,r):b.renderBuffer(k,i.__lights,null,s,n,r);q=i.__webglObjectsImmediate;m=0;for(l=q.length;m<l;m++)n=q[m],r=n.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),s=0<r.geometry.morphTargets.length&&p.morphTargets,p=r instanceof THREE.SkinnedMesh&&p.skinning,s=r.customDepthMaterial?r.customDepthMaterial:p?s?f:e:s?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,n,r):b.renderBuffer(k,i.__lights,null,s,n,r);q=i.__webglObjectsImmediate;m=0;for(l=q.length;m<l;m++)n=q[m],r=n.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
r.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,r));m=b.getClearColor();l=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,l);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
r.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,r));m=b.getClearColor();l=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,l);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
-fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nuniform vec2 halfViewport;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = ( position + alignment ) * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + ( rotatedPosition / halfViewport ), screenPosition.z, 1.0 );\n} else {\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\nfinalPosition = projectionMatrix * finalPosition;\n}\ngl_Position = finalPosition;\n}",
|
|
|
|
|
|
+fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nuniform vec2 halfViewport;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}",
|
|
fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};
|
|
fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};
|