|
@@ -83,22 +83,23 @@ this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a
|
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,h,g,i){var k=this.elements;k[0]=a;k[3]=b;k[6]=c;k[1]=d;k[4]=e;k[7]=f;k[2]=h;k[5]=g;k[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(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.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],h=a[5],g=a[6],i=a[7],a=a[8];return b*f*a-b*h*i-c*e*a+c*h*g+d*e*i-d*f*g},getInverse:function(a,
|
|
|
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
|
|
|
-c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,l,p,m,s,t,q){var n=this.elements=new Float32Array(16);n[0]=void 0!==a?a:1;n[4]=b||0;n[8]=c||0;n[12]=d||0;n[1]=e||0;n[5]=void 0!==f?f:1;n[9]=h||0;n[13]=g||0;n[2]=i||0;n[6]=k||0;n[10]=void 0!==l?l:1;n[14]=p||0;n[3]=m||0;n[7]=s||0;n[11]=t||0;n[15]=void 0!==q?q:1};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,l,p,m,s,t,q){var n=this.elements;n[0]=a;n[4]=b;n[8]=c;n[12]=d;n[1]=e;n[5]=f;n[9]=h;n[13]=g;n[2]=i;n[6]=k;n[10]=l;n[14]=p;n[3]=m;n[7]=s;n[11]=t;n[15]=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
+c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],
|
|
|
+a[6],a[7],a[8]]},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,l,p,m,t,r,n){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=h||0;q[13]=g||0;q[2]=i||0;q[6]=k||0;q[10]=void 0!==l?l:1;q[14]=p||0;q[3]=m||0;q[7]=t||0;q[11]=r||0;q[15]=void 0!==n?n:1};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,l,p,m,t,r,n){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=h;q[13]=g;q[2]=i;q[6]=k;q[10]=l;q[14]=p;q[3]=m;q[7]=t;q[11]=r;q[15]=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
return this.copyPosition(a)},copyPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){!1===
|
|
|
a instanceof THREE.Euler&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){var a=f*g,i=f*e,k=c*g,l=c*e;b[0]=h*g;b[4]=-h*e;b[8]=d;b[1]=i+k*d;b[5]=a-l*d;b[9]=-c*h;b[2]=l-a*d;b[6]=k+i*d;b[10]=f*h}else"YXZ"===a.order?(a=h*g,i=h*e,k=d*g,l=d*e,b[0]=a+l*c,b[4]=k*c-i,b[8]=
|
|
|
f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=l+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,k=d*g,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=k+i*c,b[1]=i+k*c,b[5]=f*g,b[9]=l-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,l=c*e,b[0]=h*g,b[4]=k*d-i,b[8]=a*d+l,b[1]=h*e,b[5]=l*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,l=c*d,b[0]=h*g,b[4]=l-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-l*e):"XZY"===a.order&&(a=f*h,i=f*d,k=c*h,l=c*d,b[0]=
|
|
|
h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+l,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=l*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,l=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(l+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+l);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],l=c[5],p=c[9],m=c[13],s=c[2],t=c[6],q=c[10],n=c[14],u=c[3],r=c[7],v=c[11],c=c[15],
|
|
|
-z=d[0],G=d[4],w=d[8],y=d[12],E=d[1],A=d[5],K=d[9],D=d[13],F=d[2],O=d[6],x=d[10],I=d[14],B=d[3],M=d[7],J=d[11],d=d[15];e[0]=f*z+h*E+g*F+i*B;e[4]=f*G+h*A+g*O+i*M;e[8]=f*w+h*K+g*x+i*J;e[12]=f*y+h*D+g*I+i*d;e[1]=k*z+l*E+p*F+m*B;e[5]=k*G+l*A+p*O+m*M;e[9]=k*w+l*K+p*x+m*J;e[13]=k*y+l*D+p*I+m*d;e[2]=s*z+t*E+q*F+n*B;e[6]=s*G+t*A+q*O+n*M;e[10]=s*w+t*K+q*x+n*J;e[14]=s*y+t*D+q*I+n*d;e[3]=u*z+r*E+v*F+c*B;e[7]=u*G+r*A+v*O+c*M;e[11]=u*w+r*K+v*x+c*J;e[15]=u*y+r*D+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],l=c[5],p=c[9],m=c[13],t=c[2],r=c[6],n=c[10],q=c[14],u=c[3],s=c[7],v=c[11],c=c[15],
|
|
|
+z=d[0],G=d[4],w=d[8],y=d[12],E=d[1],A=d[5],K=d[9],D=d[13],F=d[2],O=d[6],x=d[10],I=d[14],B=d[3],M=d[7],J=d[11],d=d[15];e[0]=f*z+h*E+g*F+i*B;e[4]=f*G+h*A+g*O+i*M;e[8]=f*w+h*K+g*x+i*J;e[12]=f*y+h*D+g*I+i*d;e[1]=k*z+l*E+p*F+m*B;e[5]=k*G+l*A+p*O+m*M;e[9]=k*w+l*K+p*x+m*J;e[13]=k*y+l*D+p*I+m*d;e[2]=t*z+r*E+n*F+q*B;e[6]=t*G+r*A+n*O+q*M;e[10]=t*w+r*K+n*x+q*J;e[14]=t*y+r*D+n*I+q*d;e[3]=u*z+s*E+v*F+c*B;e[7]=u*G+s*A+v*O+c*M;e[11]=u*w+s*K+v*x+c*J;e[15]=u*y+s*D+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.");
|
|
|
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],l=a[6],p=a[10],m=a[14];return a[3]*(+e*g*l-d*i*l-e*h*p+c*i*p+d*h*m-c*g*m)+a[7]*(+b*g*m-b*i*p+e*f*p-d*f*m+d*i*k-e*g*k)+a[11]*(+b*i*l-b*h*m-e*f*l+c*f*m+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*l+b*h*p+d*f*l-c*f*
|
|
|
p+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.setFromMatrixPosition( 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],l=d[9],p=d[13],m=d[2],s=d[6],t=d[10],q=d[14],n=d[3],u=d[7],r=d[11],d=d[15];c[0]=l*q*u-p*t*u+p*s*r-k*q*r-l*s*d+k*t*d;c[4]=g*t*u-h*q*u-g*s*r+f*q*r+h*s*d-f*t*d;c[8]=h*p*u-g*l*u+g*k*r-f*p*r-h*k*d+f*l*d;c[12]=g*l*s-h*p*s-g*k*t+f*p*t+h*k*q-f*l*q;c[1]=p*t*n-l*q*n-p*m*r+i*q*r+l*m*d-i*t*d;c[5]=h*q*n-g*t*n+g*m*r-e*q*r-h*m*d+e*t*d;c[9]=g*l*n-h*p*n-g*i*r+e*p*r+h*i*d-
|
|
|
-e*l*d;c[13]=h*p*m-g*l*m+g*i*t-e*p*t-h*i*q+e*l*q;c[2]=k*q*n-p*s*n+p*m*u-i*q*u-k*m*d+i*s*d;c[6]=g*s*n-f*q*n-g*m*u+e*q*u+f*m*d-e*s*d;c[10]=f*p*n-g*k*n+g*i*u-e*p*u-f*i*d+e*k*d;c[14]=g*k*m-f*p*m-g*i*s+e*p*s+f*i*q-e*k*q;c[3]=l*s*n-k*t*n-l*m*u+i*t*u+k*m*r-i*s*r;c[7]=f*t*n-h*s*n+h*m*u-e*t*u-f*m*r+e*s*r;c[11]=h*k*n-f*l*n-h*i*u+e*l*u+f*i*r-e*k*r;c[15]=f*l*m-h*k*m+h*i*s-e*l*s-f*i*t+e*k*t;c=e*c[0]+i*c[4]+m*c[8]+n*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],l=d[9],p=d[13],m=d[2],t=d[6],r=d[10],n=d[14],q=d[3],u=d[7],s=d[11],d=d[15];c[0]=l*n*u-p*r*u+p*t*s-k*n*s-l*t*d+k*r*d;c[4]=g*r*u-h*n*u-g*t*s+f*n*s+h*t*d-f*r*d;c[8]=h*p*u-g*l*u+g*k*s-f*p*s-h*k*d+f*l*d;c[12]=g*l*t-h*p*t-g*k*r+f*p*r+h*k*n-f*l*n;c[1]=p*r*q-l*n*q-p*m*s+i*n*s+l*m*d-i*r*d;c[5]=h*n*q-g*r*q+g*m*s-e*n*s-h*m*d+e*r*d;c[9]=g*l*q-h*p*q-g*i*s+e*p*s+h*i*d-
|
|
|
+e*l*d;c[13]=h*p*m-g*l*m+g*i*r-e*p*r-h*i*n+e*l*n;c[2]=k*n*q-p*t*q+p*m*u-i*n*u-k*m*d+i*t*d;c[6]=g*t*q-f*n*q-g*m*u+e*n*u+f*m*d-e*t*d;c[10]=f*p*q-g*k*q+g*i*u-e*p*u-f*i*d+e*k*d;c[14]=g*k*m-f*p*m-g*i*t+e*p*t+f*i*n-e*k*n;c[3]=l*t*q-k*r*q-l*m*u+i*r*u+k*m*s-i*t*s;c[7]=f*r*q-h*t*q+h*m*u-e*r*u-f*m*s+e*t*s;c[11]=h*k*q-f*l*q-h*i*u+e*l*u+f*i*s-e*k*s;c[15]=f*l*m-h*k*m+h*i*t-e*l*t-f*i*r+e*k*r;c=e*c[0]+i*c[4]+m*c[8]+q*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.")},
|
|
|
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,
|
|
@@ -117,8 +118,8 @@ clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){t
|
|
|
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,h=b.length;f<h;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}}(),copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=
|
|
|
this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);
|
|
|
return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
|
|
|
-THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],l=c[8],p=c[9],m=c[10],s=c[11],t=c[12],q=c[13],n=c[14],c=c[15];b[0].setComponents(f-a,k-h,s-l,c-t).normalize();b[1].setComponents(f+
|
|
|
-a,k+h,s+l,c+t).normalize();b[2].setComponents(f+d,k+g,s+p,c+q).normalize();b[3].setComponents(f-d,k-g,s-p,c-q).normalize();b[4].setComponents(f-e,k-i,s-m,c-n).normalize();b[5].setComponents(f+e,k+i,s+m,c+n).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){for(var b=this.planes,
|
|
|
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],l=c[8],p=c[9],m=c[10],t=c[11],r=c[12],n=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-h,t-l,c-r).normalize();b[1].setComponents(f+
|
|
|
+a,k+h,t+l,c+r).normalize();b[2].setComponents(f+d,k+g,t+p,c+n).normalize();b[3].setComponents(f-d,k-g,t-p,c-n).normalize();b[4].setComponents(f-e,k-i,t-m,c-q).normalize();b[5].setComponents(f+e,k+i,t+m,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){for(var b=this.planes,
|
|
|
c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var h=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>h&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=
|
|
|
this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
|
|
|
THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
|
|
@@ -140,13 +141,13 @@ THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=thi
|
|
|
a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){};
|
|
|
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[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.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,l,s){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var t=l.ray.distanceToPoint(d);if(t>f.scale.x)return s;s.push({distance:t,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
-a.LOD)d.setFromMatrixPosition(f.matrixWorld),t=l.ray.origin.distanceTo(d),k(f.getObjectForDistance(t),l,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===l.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(null!==q.boundingBox&&!1===c.isIntersectionBox(q.boundingBox))return s;if(q instanceof a.BufferGeometry){var n=f.material;if(void 0===
|
|
|
-n||!1===q.dynamic)return s;var u,r,v=l.precision;if(void 0!==q.attributes.index)for(var z=q.offsets,G=q.attributes.index.array,w=q.attributes.position.array,y=q.offsets.length,E=q.attributes.index.array.length/3,E=0;E<y;++E)for(var t=z[E].start,A=z[E].index,q=t,K=t+z[E].count;q<K;q+=3)t=A+G[q],u=A+G[q+1],r=A+G[q+2],h.set(w[3*t],w[3*t+1],w[3*t+2]),g.set(w[3*u],w[3*u+1],w[3*u+2]),i.set(w[3*r],w[3*r+1],w[3*r+2]),u=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),
|
|
|
-null!==u&&(u.applyMatrix4(f.matrixWorld),t=l.ray.origin.distanceTo(u),t<v||(t<l.near||t>l.far)||s.push({distance:t,point:u,face:null,faceIndex:null,object:f}));else{w=q.attributes.position.array;E=q.attributes.position.array.length;for(q=0;q<E;q+=3)t=q,u=q+1,r=q+2,h.set(w[3*t],w[3*t+1],w[3*t+2]),g.set(w[3*u],w[3*u+1],w[3*u+2]),i.set(w[3*r],w[3*r+1],w[3*r+2]),u=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
-t=l.ray.origin.distanceTo(u),t<v||(t<l.near||t>l.far)||s.push({distance:t,point:u,face:null,faceIndex:null,object:f}))}}else if(q instanceof a.Geometry){G=f.material instanceof a.MeshFaceMaterial;w=!0===G?f.material.materials:null;v=l.precision;z=q.vertices;y=0;for(E=q.faces.length;y<E;y++)A=q.faces[y],n=!0===G?w[A.materialIndex]:f.material,void 0!==n&&(t=z[A.a],u=z[A.b],r=z[A.c],u=n.side===a.BackSide?c.intersectTriangle(r,u,t,!0):c.intersectTriangle(t,u,r,n.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
-t=l.ray.origin.distanceTo(u),t<v||(t<l.near||t>l.far)||s.push({distance:t,point:u,face:A,faceIndex:y,object:f})))}}else if(f instanceof a.Line){v=l.linePrecision;n=v*v;q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===l.ray.isIntersectionSphere(b))return s;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(q instanceof a.Geometry){z=q.vertices;v=z.length;u=new a.Vector3;r=new a.Vector3;E=f.type===a.LineStrip?1:
|
|
|
-2;for(q=0;q<v-1;q+=E)c.distanceSqToSegment(z[q],z[q+1],r,u)>n||(t=c.origin.distanceTo(r),t<l.near||t>l.far||s.push({distance:t,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},l=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&&l(a,
|
|
|
+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,l,t){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var r=l.ray.distanceToPoint(d);if(r>f.scale.x)return t;t.push({distance:r,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
+a.LOD)d.setFromMatrixPosition(f.matrixWorld),r=l.ray.origin.distanceTo(d),k(f.getObjectForDistance(r),l,t);else if(f instanceof a.Mesh){var n=f.geometry;null===n.boundingSphere&&n.computeBoundingSphere();b.copy(n.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===l.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(null!==n.boundingBox&&!1===c.isIntersectionBox(n.boundingBox))return t;if(n instanceof a.BufferGeometry){var q=f.material;if(void 0===
|
|
|
+q||!1===n.dynamic)return t;var u,s,v=l.precision;if(void 0!==n.attributes.index)for(var z=n.offsets,G=n.attributes.index.array,w=n.attributes.position.array,y=n.offsets.length,E=n.attributes.index.array.length/3,E=0;E<y;++E)for(var r=z[E].start,A=z[E].index,n=r,K=r+z[E].count;n<K;n+=3)r=A+G[n],u=A+G[n+1],s=A+G[n+2],h.set(w[3*r],w[3*r+1],w[3*r+2]),g.set(w[3*u],w[3*u+1],w[3*u+2]),i.set(w[3*s],w[3*s+1],w[3*s+2]),u=q.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,q.side!==a.DoubleSide),
|
|
|
+null!==u&&(u.applyMatrix4(f.matrixWorld),r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:null,faceIndex:null,object:f}));else{w=n.attributes.position.array;E=n.attributes.position.array.length;for(n=0;n<E;n+=3)r=n,u=n+1,s=n+2,h.set(w[3*r],w[3*r+1],w[3*r+2]),g.set(w[3*u],w[3*u+1],w[3*u+2]),i.set(w[3*s],w[3*s+1],w[3*s+2]),u=q.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,q.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
+r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:null,faceIndex:null,object:f}))}}else if(n instanceof a.Geometry){G=f.material instanceof a.MeshFaceMaterial;w=!0===G?f.material.materials:null;v=l.precision;z=n.vertices;y=0;for(E=n.faces.length;y<E;y++)A=n.faces[y],q=!0===G?w[A.materialIndex]:f.material,void 0!==q&&(r=z[A.a],u=z[A.b],s=z[A.c],u=q.side===a.BackSide?c.intersectTriangle(s,u,r,!0):c.intersectTriangle(r,u,s,q.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
|
|
|
+r=l.ray.origin.distanceTo(u),r<v||(r<l.near||r>l.far)||t.push({distance:r,point:u,face:A,faceIndex:y,object:f})))}}else if(f instanceof a.Line){v=l.linePrecision;q=v*v;n=f.geometry;null===n.boundingSphere&&n.computeBoundingSphere();b.copy(n.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===l.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(l.ray).applyMatrix4(e);if(n instanceof a.Geometry){z=n.vertices;v=z.length;u=new a.Vector3;s=new a.Vector3;E=f.type===a.LineStrip?1:
|
|
|
+2;for(n=0;n<v-1;n+=E)c.distanceSqToSegment(z[n],z[n+1],s,u)>q||(r=c.origin.distanceTo(s),r<l.near||r>l.far||t.push({distance:r,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},l=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&&l(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&&l(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={}};
|
|
|
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.");
|
|
@@ -160,16 +161,16 @@ 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):
|
|
|
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===l){var a=new THREE.RenderableVertex;k.push(a);l++;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=[],l=0,p,m,s=[],t=0,q,n,u=[],r=0,v,z,G=[],w=0,y={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,A=new THREE.Vector4,K=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),D=new THREE.Box3,F=Array(3),O=new THREE.Matrix4,x=new THREE.Matrix4,I,B=new THREE.Matrix4,M=new THREE.Matrix3,J=new THREE.Matrix3,ca=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=[],l=0,p,m,t=[],r=0,n,q,u=[],s=0,v,z,G=[],w=0,y={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,A=new THREE.Vector4,K=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),D=new THREE.Box3,F=Array(3),O=new THREE.Matrix4,x=new THREE.Matrix4,I,B=new THREE.Matrix4,M=new THREE.Matrix3,J=new THREE.Matrix3,ca=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);
|
|
|
x.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(x)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);x.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(x)};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:(E.setFromMatrixPosition(a.matrixWorld),E.applyProjection(x),d.z=E.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,l){var E=!1,Q,$,ea,V,P,Y,U,ja,sa,ha,Ka,Ga;z=n=m=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();O.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));x.multiplyMatrices(f.projectionMatrix,O);J.getNormalMatrix(O);na.setFromMatrix(x);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(U=y.objects[d].object,I=U.matrixWorld,i=0,U instanceof THREE.Mesh){ja=U.geometry;
|
|
|
+f,h,l){var E=!1,Q,$,ea,V,P,Y,U,ja,sa,ha,Ka,Ga;z=q=m=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();O.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));x.multiplyMatrices(f.projectionMatrix,O);J.getNormalMatrix(O);na.setFromMatrix(x);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(U=y.objects[d].object,I=U.matrixWorld,i=0,U instanceof THREE.Mesh){ja=U.geometry;
|
|
|
ea=ja.vertices;sa=ja.faces;ja=ja.faceVertexUvs;M.getNormalMatrix(I);Ka=U.material instanceof THREE.MeshFaceMaterial;Ga=!0===Ka?U.material:null;Q=0;for($=ea.length;Q<$;Q++){g=a();g.positionWorld.copy(ea[Q]).applyMatrix4(I);g.positionScreen.copy(g.positionWorld).applyMatrix4(x);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)}ea=0;for(Q=sa.length;ea<Q;ea++)if($=sa[ea],ka=!0===Ka?Ga.materials[$.materialIndex]:U.material,void 0!==ka&&(Y=ka.side,V=k[$.a],P=k[$.b],ha=k[$.c],F[0]=V.positionScreen,F[1]=P.positionScreen,F[2]=ha.positionScreen,!0===V.visible||!0===P.visible||!0===ha.visible||K.isIntersectionBox(D.setFromPoints(F))))if(E=0>(ha.positionScreen.x-V.positionScreen.x)*(P.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-V.positionScreen.y)*(P.positionScreen.x-V.positionScreen.x),Y===THREE.DoubleSide||
|
|
|
-E===(Y===THREE.FrontSide)){if(m===t){var Da=new THREE.RenderableFace3;s.push(Da);t++;m++;p=Da}else p=s[m++];p.id=U.id;p.v1.copy(V);p.v2.copy(P);p.v3.copy(ha);p.normalModel.copy($.normal);!1===E&&(Y===THREE.BackSide||Y===THREE.DoubleSide)&&p.normalModel.negate();p.normalModel.applyMatrix3(M).normalize();p.normalModelView.copy(p.normalModel).applyMatrix3(J);p.centroidModel.copy($.centroid).applyMatrix4(I);ha=$.vertexNormals;V=0;for(P=Math.min(ha.length,3);V<P;V++)Da=p.vertexNormalsModel[V],Da.copy(ha[V]),
|
|
|
+E===(Y===THREE.FrontSide)){if(m===r){var Da=new THREE.RenderableFace3;t.push(Da);r++;m++;p=Da}else p=t[m++];p.id=U.id;p.v1.copy(V);p.v2.copy(P);p.v3.copy(ha);p.normalModel.copy($.normal);!1===E&&(Y===THREE.BackSide||Y===THREE.DoubleSide)&&p.normalModel.negate();p.normalModel.applyMatrix3(M).normalize();p.normalModelView.copy(p.normalModel).applyMatrix3(J);p.centroidModel.copy($.centroid).applyMatrix4(I);ha=$.vertexNormals;V=0;for(P=Math.min(ha.length,3);V<P;V++)Da=p.vertexNormalsModel[V],Da.copy(ha[V]),
|
|
|
!1===E&&(Y===THREE.BackSide||Y===THREE.DoubleSide)&&Da.negate(),Da.applyMatrix3(M).normalize(),p.vertexNormalsModelView[V].copy(Da).applyMatrix3(J);p.vertexNormalsLength=ha.length;E=0;for(V=Math.min(ja.length,3);E<V;E++)if(ha=ja[E][ea],void 0!==ha){P=0;for(Y=ha.length;P<Y;P++)p.uvs[E][P]=ha[P]}p.color=$.color;p.material=ka;ca.copy(p.centroidModel).applyProjection(x);p.z=ca.z;y.elements.push(p)}}else if(U instanceof THREE.Line){B.multiplyMatrices(x,I);ea=U.geometry.vertices;V=a();V.positionScreen.copy(ea[0]).applyMatrix4(B);
|
|
|
-sa=U.type===THREE.LinePieces?2:1;Q=1;for($=ea.length;Q<$;Q++)V=a(),V.positionScreen.copy(ea[Q]).applyMatrix4(B),0<(Q+1)%sa||(P=k[i-2],pa.copy(V.positionScreen),C.copy(P.positionScreen),!0===c(pa,C)&&(pa.multiplyScalar(1/pa.w),C.multiplyScalar(1/C.w),n===r?(ja=new THREE.RenderableLine,u.push(ja),r++,n++,q=ja):q=u[n++],q.id=U.id,q.v1.positionScreen.copy(pa),q.v2.positionScreen.copy(C),q.z=Math.max(pa.z,C.z),q.material=U.material,U.material.vertexColors===THREE.VertexColors&&(q.vertexColors[0].copy(U.geometry.colors[Q]),
|
|
|
-q.vertexColors[1].copy(U.geometry.colors[Q-1])),y.elements.push(q)))}d=0;for(h=y.sprites.length;d<h;d++)U=y.sprites[d].object,I=U.matrixWorld,A.set(I.elements[12],I.elements[13],I.elements[14],1),A.applyMatrix4(x),ka=1/A.w,A.z*=ka,-1<=A.z&&1>=A.z&&(z===w?(sa=new THREE.RenderableSprite,G.push(sa),w++,z++,v=sa):v=G[z++],v.id=U.id,v.x=A.x*ka,v.y=A.y*ka,v.z=A.z,v.object=U,v.rotation=U.rotation,v.scale.x=U.scale.x*Math.abs(v.x-(A.x+f.projectionMatrix.elements[0])/(A.w+f.projectionMatrix.elements[12])),
|
|
|
+sa=U.type===THREE.LinePieces?2:1;Q=1;for($=ea.length;Q<$;Q++)V=a(),V.positionScreen.copy(ea[Q]).applyMatrix4(B),0<(Q+1)%sa||(P=k[i-2],pa.copy(V.positionScreen),C.copy(P.positionScreen),!0===c(pa,C)&&(pa.multiplyScalar(1/pa.w),C.multiplyScalar(1/C.w),q===s?(ja=new THREE.RenderableLine,u.push(ja),s++,q++,n=ja):n=u[q++],n.id=U.id,n.v1.positionScreen.copy(pa),n.v2.positionScreen.copy(C),n.z=Math.max(pa.z,C.z),n.material=U.material,U.material.vertexColors===THREE.VertexColors&&(n.vertexColors[0].copy(U.geometry.colors[Q]),
|
|
|
+n.vertexColors[1].copy(U.geometry.colors[Q-1])),y.elements.push(n)))}d=0;for(h=y.sprites.length;d<h;d++)U=y.sprites[d].object,I=U.matrixWorld,A.set(I.elements[12],I.elements[13],I.elements[14],1),A.applyMatrix4(x),ka=1/A.w,A.z*=ka,-1<=A.z&&1>=A.z&&(z===w?(sa=new THREE.RenderableSprite,G.push(sa),w++,z++,v=sa):v=G[z++],v.id=U.id,v.x=A.x*ka,v.y=A.y*ka,v.z=A.z,v.object=U,v.rotation=U.rotation,v.scale.x=U.scale.x*Math.abs(v.x-(A.x+f.projectionMatrix.elements[0])/(A.w+f.projectionMatrix.elements[12])),
|
|
|
v.scale.y=U.scale.y*Math.abs(v.y-(A.y+f.projectionMatrix.elements[5])/(A.w+f.projectionMatrix.elements[13])),v.material=U.material,y.elements.push(v));!0===l&&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();
|
|
|
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=
|
|
@@ -180,21 +181,21 @@ h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
|
0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal)}b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},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();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,l,p,m,s,t,q,n,u=[],r=[];c=new THREE.Vector3;var v=new THREE.Vector3,z=new THREE.Vector3,G=new THREE.Vector3,w=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)u[a]=new THREE.Vector3,r[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,n=e.b,e=e.c,h=this.vertices[d],g=this.vertices[n],
|
|
|
-i=this.vertices[e],k=f[0],l=f[1],p=f[2],f=g.x-h.x,m=i.x-h.x,s=g.y-h.y,t=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,q=p.x-k.x,l=l.y-k.y,k=p.y-k.y,p=1/(i*k-q*l),c.set((k*f-l*m)*p,(k*s-l*t)*p,(k*g-l*h)*p),v.set((i*m-q*f)*p,(i*t-q*s)*p,(i*h-q*g)*p),u[d].add(c),u[n].add(c),u[e].add(c),r[d].add(v),r[n].add(v),r[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++)w.copy(e.vertexNormals[c]),d=e[v[c]],n=u[d],z.copy(n),z.sub(w.multiplyScalar(w.dot(n))).normalize(),
|
|
|
-G.crossVectors(e.vertexNormals[c],n),d=G.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.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.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,l,p,m,t,r,n,q,u=[],s=[];c=new THREE.Vector3;var v=new THREE.Vector3,z=new THREE.Vector3,G=new THREE.Vector3,w=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)u[a]=new THREE.Vector3,s[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,q=e.b,e=e.c,h=this.vertices[d],g=this.vertices[q],
|
|
|
+i=this.vertices[e],k=f[0],l=f[1],p=f[2],f=g.x-h.x,m=i.x-h.x,t=g.y-h.y,r=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,n=p.x-k.x,l=l.y-k.y,k=p.y-k.y,p=1/(i*k-n*l),c.set((k*f-l*m)*p,(k*t-l*r)*p,(k*g-l*h)*p),v.set((i*m-n*f)*p,(i*r-n*t)*p,(i*h-n*g)*p),u[d].add(c),u[q].add(c),u[e].add(c),s[d].add(v),s[q].add(v),s[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++)w.copy(e.vertexNormals[c]),d=e[v[c]],q=u[d],z.copy(q),z.sub(w.multiplyScalar(w.dot(q))).normalize(),
|
|
|
+G.crossVectors(e.vertexNormals[c],q),d=G.dot(s[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.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;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=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===
|
|
|
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;
|
|
|
-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,l,p,m=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3;if(this.attributes.index){var u=this.attributes.index.array,r=this.offsets;c=0;for(d=r.length;c<d;++c){b=r[c].start;h=r[c].count;var v=
|
|
|
-r[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],l=e[3*h+1],p=e[3*h+2],m.set(k,l,p),k=e[3*g],l=e[3*g+1],p=e[3*g+2],s.set(k,l,p),k=e[3*i],l=e[3*i+1],p=e[3*i+2],t.set(k,l,p),q.subVectors(t,s),n.subVectors(m,s),q.cross(n),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],l=e[a+1],p=e[a+2],m.set(k,l,p),k=e[a+3],l=e[a+4],p=e[a+5],s.set(k,l,p),k=e[a+6],l=e[a+7],p=e[a+8],
|
|
|
-t.set(k,l,p),q.subVectors(t,s),n.subVectors(m,s),q.cross(n),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];J.copy(Q);J.sub(na.multiplyScalar(na.dot(Q))).normalize();
|
|
|
+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,l,p,m=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,n=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var u=this.attributes.index.array,s=this.offsets;c=0;for(d=s.length;c<d;++c){b=s[c].start;h=s[c].count;var v=
|
|
|
+s[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],l=e[3*h+1],p=e[3*h+2],m.set(k,l,p),k=e[3*g],l=e[3*g+1],p=e[3*g+2],t.set(k,l,p),k=e[3*i],l=e[3*i+1],p=e[3*i+2],r.set(k,l,p),n.subVectors(r,t),q.subVectors(m,t),n.cross(q),f[3*h]+=n.x,f[3*h+1]+=n.y,f[3*h+2]+=n.z,f[3*g]+=n.x,f[3*g+1]+=n.y,f[3*g+2]+=n.z,f[3*i]+=n.x,f[3*i+1]+=n.y,f[3*i+2]+=n.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],p=e[a+2],m.set(k,l,p),k=e[a+3],l=e[a+4],p=e[a+5],t.set(k,l,p),k=e[a+6],l=e[a+7],p=e[a+8],
|
|
|
+r.set(k,l,p),n.subVectors(r,t),q.subVectors(m,t),n.cross(q),f[a]=n.x,f[a+1]=n.y,f[a+2]=n.z,f[a+3]=n.x,f[a+4]=n.y,f[a+5]=n.z,f[a+6]=n.x,f[a+7]=n.y,f[a+8]=n.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];J.copy(Q);J.sub(na.multiplyScalar(na.dot(Q))).normalize();
|
|
|
ca.crossVectors(pa,Q);R=ca.dot(i[a]);C=0>R?-1:1;h[4*a]=J.x;h[4*a+1]=J.y;h[4*a+2]=J.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 l,p,m,s,t,q,n,u,r,v,z,G,w,y,E,f=new THREE.Vector3,k=new THREE.Vector3,A,K,D,F,O,x,I,B=this.offsets;D=0;for(F=B.length;D<F;++D){K=B[D].start;O=B[D].count;var M=B[D].index;A=K;for(K+=O;A<K;A+=3)O=M+b[A],x=M+b[A+1],I=M+b[A+2],l=c[3*O],p=c[3*O+1],m=c[3*O+2],s=c[3*x],t=c[3*x+1],q=c[3*x+2],n=c[3*I],u=c[3*I+1],r=c[3*I+2],v=e[2*
|
|
|
-O],z=e[2*O+1],G=e[2*x],w=e[2*x+1],y=e[2*I],E=e[2*I+1],s-=l,l=n-l,t-=p,p=u-p,q-=m,m=r-m,G-=v,v=y-v,w-=z,z=E-z,E=1/(G*z-v*w),f.set((z*s-w*l)*E,(z*t-w*p)*E,(z*q-w*m)*E),k.set((G*l-v*s)*E,(G*p-v*t)*E,(G*m-v*q)*E),g[O].add(f),g[x].add(f),g[I].add(f),i[O].add(k),i[x].add(k),i[I].add(k)}var J=new THREE.Vector3,ca=new THREE.Vector3,na=new THREE.Vector3,pa=new THREE.Vector3,C,Q,R;D=0;for(F=B.length;D<F;++D){K=B[D].start;O=B[D].count;M=B[D].index;A=K;for(K+=O;A<K;A+=3)O=M+b[A],x=M+b[A+1],I=M+b[A+2],a(O),a(x),
|
|
|
+(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 l,p,m,t,r,n,q,u,s,v,z,G,w,y,E,f=new THREE.Vector3,k=new THREE.Vector3,A,K,D,F,O,x,I,B=this.offsets;D=0;for(F=B.length;D<F;++D){K=B[D].start;O=B[D].count;var M=B[D].index;A=K;for(K+=O;A<K;A+=3)O=M+b[A],x=M+b[A+1],I=M+b[A+2],l=c[3*O],p=c[3*O+1],m=c[3*O+2],t=c[3*x],r=c[3*x+1],n=c[3*x+2],q=c[3*I],u=c[3*I+1],s=c[3*I+2],v=e[2*
|
|
|
+O],z=e[2*O+1],G=e[2*x],w=e[2*x+1],y=e[2*I],E=e[2*I+1],t-=l,l=q-l,r-=p,p=u-p,n-=m,m=s-m,G-=v,v=y-v,w-=z,z=E-z,E=1/(G*z-v*w),f.set((z*t-w*l)*E,(z*r-w*p)*E,(z*n-w*m)*E),k.set((G*l-v*t)*E,(G*p-v*r)*E,(G*m-v*n)*E),g[O].add(f),g[x].add(f),g[I].add(f),i[O].add(k),i[x].add(k),i[I].add(k)}var J=new THREE.Vector3,ca=new THREE.Vector3,na=new THREE.Vector3,pa=new THREE.Vector3,C,Q,R;D=0;for(F=B.length;D<F;++D){K=B[D].start;O=B[D].count;M=B[D].index;A=K;for(K+=O;A<K;A+=3)O=M+b[A],x=M+b[A+1],I=M+b[A+2],a(O),a(x),
|
|
|
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)}}();
|
|
|
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)};
|
|
@@ -207,8 +208,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(){}};
|
|
|
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}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,n){var u=/\.dds$/i.test(f),r=b+"/"+f;if(u){var v=THREE.ImageUtils.loadCompressedTexture(r);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]]));n&&(a[e].anisotropy=n);if(!u){var z=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);z.image.width=a;z.image.height=b;z.image.getContext("2d").drawImage(this,0,0,a,b)}else z.image=this;z.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=r}}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,q){var u=/\.dds$/i.test(f),s=b+"/"+f;if(u){var v=THREE.ImageUtils.loadCompressedTexture(s);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]]));q&&(a[e].anisotropy=q);if(!u){var z=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);z.image.width=a;z.image.height=b;z.image.getContext("2d").drawImage(this,0,0,a,b)}else z.image=this;z.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=s}}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);
|
|
|
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,
|
|
@@ -218,12 +219,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.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)};
|
|
|
-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,l,p,m,s,t,q,n,u,r=a.faces;m=a.vertices;var v=a.normals,z=a.colors,G=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&G++;for(e=0;e<G;e++)c.faceVertexUvs[e]=[]}g=0;for(i=m.length;g<i;)k=new THREE.Vector3,k.x=m[g++]*d,k.y=m[g++]*d,k.z=m[g++]*d,c.vertices.push(k);g=0;for(i=r.length;g<i;)if(m=r[g++],s=m&1,h=m&2,e=m&8,l=m&16,t=m&32,k=m&64,m&=128,s){s=new THREE.Face3;s.a=r[g];
|
|
|
-s.b=r[g+1];s.c=r[g+3];q=new THREE.Face3;q.a=r[g+1];q.b=r[g+2];q.c=r[g+3];g+=4;h&&(h=r[g++],s.materialIndex=h,q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)p=r[g++],u=n[2*p],p=n[2*p+1],u=new THREE.Vector2(u,p),2!==f&&c.faceVertexUvs[e][h].push(u),0!==f&&c.faceVertexUvs[e][h+1].push(u)}l&&(l=3*r[g++],s.normal.set(v[l++],v[l++],v[l]),q.normal.copy(s.normal));if(t)for(e=0;4>e;e++)l=3*r[g++],t=new THREE.Vector3(v[l++],
|
|
|
-v[l++],v[l]),2!==e&&s.vertexNormals.push(t),0!==e&&q.vertexNormals.push(t);k&&(k=r[g++],k=z[k],s.color.setHex(k),q.color.setHex(k));if(m)for(e=0;4>e;e++)k=r[g++],k=z[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=r[g++];s.b=r[g++];s.c=r[g++];h&&(h=r[g++],s.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)p=r[g++],u=n[2*p],p=n[2*p+1],
|
|
|
-u=new THREE.Vector2(u,p),c.faceVertexUvs[e][h].push(u)}l&&(l=3*r[g++],s.normal.set(v[l++],v[l++],v[l]));if(t)for(e=0;3>e;e++)l=3*r[g++],t=new THREE.Vector3(v[l++],v[l++],v[l]),s.vertexNormals.push(t);k&&(k=r[g++],s.color.setHex(z[k]));if(m)for(e=0;3>e;e++)k=r[g++],s.vertexColors.push(new THREE.Color(z[k]));c.faces.push(s)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)r=a.skinWeights[g],v=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(r,v,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
|
|
|
-i;g+=2)r=a.skinIndices[g],v=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(r,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=[];z=c.morphTargets[g].vertices;G=a.morphTargets[g].vertices;r=0;for(v=G.length;r<v;r+=3)m=new THREE.Vector3,m.x=G[r]*d,m.y=G[r+1]*d,m.z=G[r+2]*d,z.push(m)}}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;z=a.morphColors[g].colors;d=0;for(r=z.length;d<r;d+=3)G=new THREE.Color(16755200),G.setRGB(z[d],z[d+1],z[d+2]),v.push(G)}}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,l,p,m,t,r,n,q,u,s=a.faces;m=a.vertices;var v=a.normals,z=a.colors,G=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&G++;for(e=0;e<G;e++)c.faceVertexUvs[e]=[]}g=0;for(i=m.length;g<i;)k=new THREE.Vector3,k.x=m[g++]*d,k.y=m[g++]*d,k.z=m[g++]*d,c.vertices.push(k);g=0;for(i=s.length;g<i;)if(m=s[g++],t=m&1,h=m&2,e=m&8,l=m&16,r=m&32,k=m&64,m&=128,t){t=new THREE.Face3;t.a=s[g];
|
|
|
+t.b=s[g+1];t.c=s[g+3];n=new THREE.Face3;n.a=s[g+1];n.b=s[g+2];n.c=s[g+3];g+=4;h&&(h=s[g++],t.materialIndex=h,n.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){q=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)p=s[g++],u=q[2*p],p=q[2*p+1],u=new THREE.Vector2(u,p),2!==f&&c.faceVertexUvs[e][h].push(u),0!==f&&c.faceVertexUvs[e][h+1].push(u)}l&&(l=3*s[g++],t.normal.set(v[l++],v[l++],v[l]),n.normal.copy(t.normal));if(r)for(e=0;4>e;e++)l=3*s[g++],r=new THREE.Vector3(v[l++],
|
|
|
+v[l++],v[l]),2!==e&&t.vertexNormals.push(r),0!==e&&n.vertexNormals.push(r);k&&(k=s[g++],k=z[k],t.color.setHex(k),n.color.setHex(k));if(m)for(e=0;4>e;e++)k=s[g++],k=z[k],2!==e&&t.vertexColors.push(new THREE.Color(k)),0!==e&&n.vertexColors.push(new THREE.Color(k));c.faces.push(t);c.faces.push(n)}else{t=new THREE.Face3;t.a=s[g++];t.b=s[g++];t.c=s[g++];h&&(h=s[g++],t.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){q=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)p=s[g++],u=q[2*p],p=q[2*p+1],
|
|
|
+u=new THREE.Vector2(u,p),c.faceVertexUvs[e][h].push(u)}l&&(l=3*s[g++],t.normal.set(v[l++],v[l++],v[l]));if(r)for(e=0;3>e;e++)l=3*s[g++],r=new THREE.Vector3(v[l++],v[l++],v[l]),t.vertexNormals.push(r);k&&(k=s[g++],t.color.setHex(z[k]));if(m)for(e=0;3>e;e++)k=s[g++],t.vertexColors.push(new THREE.Color(z[k]));c.faces.push(t)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)s=a.skinWeights[g],v=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(s,v,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
|
|
|
+i;g+=2)s=a.skinIndices[g],v=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(s,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=[];z=c.morphTargets[g].vertices;G=a.morphTargets[g].vertices;s=0;for(v=G.length;s<v;s+=3)m=new THREE.Vector3,m.x=G[s]*d,m.y=G[s+1]*d,m.z=G[s+2]*d,z.push(m)}}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;z=a.morphColors[g].colors;d=0;for(s=z.length;d<s;d+=3)G=new THREE.Color(16755200),G.setRGB(z[d],z[d+1],z[d+2]),v.push(G)}}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)));
|
|
|
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&&
|
|
@@ -236,27 +237,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;case "Sprite":f=d[b.material];void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Sprite(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)};
|
|
|
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:m+"/"+a}function e(){f(y.scene,
|
|
|
-A.objects)}function f(a,b){var c,e,h,i,k,l;for(l in b){var m=y.objects[l],n=b[l];if(void 0===m){if(n.type&&n.type in p.hierarchyHandlers){if(void 0===n.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 n)v in c||(u[v]=n[v]);t=y.materials[n.material];n.loading=!0;c=p.hierarchyHandlers[n.type].loaderObject;c.options?c.load(d(n.url,A.urlBaseType),g(l,a,t,n)):c.load(d(n.url,A.urlBaseType),g(l,
|
|
|
-a,t,n),u)}}else if(void 0!==n.geometry){if(s=y.geometries[n.geometry]){m=!1;t=y.materials[n.material];m=t instanceof THREE.ShaderMaterial;e=n.position;h=n.rotation;i=n.scale;c=n.matrix;k=n.quaternion;n.material||(t=new THREE.MeshFaceMaterial(y.face_materials[n.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(y.face_materials[n.geometry]));if(t instanceof THREE.MeshFaceMaterial)for(u=0;u<t.materials.length;u++)m=m||t.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
-m&&s.computeTangents();n.skin?m=new THREE.SkinnedMesh(s,t):n.morph?(m=new THREE.MorphAnimMesh(s,t),void 0!==n.duration&&(m.duration=n.duration),void 0!==n.time&&(m.time=n.time),void 0!==n.mirroredLoop&&(m.mirroredLoop=n.mirroredLoop),t.morphNormals&&s.computeMorphNormals()):m=new THREE.Mesh(s,t);m.name=l;c?(m.matrixAutoUpdate=!1,m.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])):(m.position.fromArray(e),k?m.quaternion.fromArray(k):m.rotation.fromArray(h),
|
|
|
-m.scale.fromArray(i));m.visible=n.visible;m.castShadow=n.castShadow;m.receiveShadow=n.receiveShadow;a.add(m);y.objects[l]=m}}else if("AmbientLight"===n.type||"PointLight"===n.type||"DirectionalLight"===n.type||"SpotLight"===n.type||"HemisphereLight"===n.type||"AreaLight"===n.type){u=n.color;c=n.intensity;e=n.distance;h=n.position;i=n.rotation;switch(n.type){case "AmbientLight":r=new THREE.AmbientLight(u);break;case "PointLight":r=new THREE.PointLight(u,c,e);r.position.fromArray(h);break;case "DirectionalLight":r=
|
|
|
-new THREE.DirectionalLight(u,c);r.position.fromArray(n.direction);break;case "SpotLight":r=new THREE.SpotLight(u,c,e,1);r.angle=n.angle;r.position.fromArray(h);r.target.set(h[0],h[1]-e,h[2]);r.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":r=new THREE.DirectionalLight(u,c,e);r.target.set(h[0],h[1]-e,h[2]);r.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":r=new THREE.AreaLight(u,c),r.position.fromArray(h),r.width=n.size,r.height=
|
|
|
-n.size_y}a.add(r);r.name=l;y.lights[l]=r;y.objects[l]=r}else"PerspectiveCamera"===n.type||"OrthographicCamera"===n.type?(e=n.position,h=n.rotation,k=n.quaternion,"PerspectiveCamera"===n.type?q=new THREE.PerspectiveCamera(n.fov,n.aspect,n.near,n.far):"OrthographicCamera"===n.type&&(q=new THREE.OrthographicCamera(n.left,n.right,n.top,n.bottom,n.near,n.far)),q.name=l,q.position.fromArray(e),void 0!==k?q.quaternion.fromArray(k):void 0!==h&&q.rotation.fromArray(h),a.add(q),y.cameras[l]=q,y.objects[l]=
|
|
|
-q):(e=n.position,h=n.rotation,i=n.scale,k=n.quaternion,m=new THREE.Object3D,m.name=l,m.position.fromArray(e),k?m.quaternion.fromArray(k):m.rotation.fromArray(h),m.scale.fromArray(i),m.visible=void 0!==n.visible?n.visible:!1,a.add(m),y.objects[l]=m,y.empties[l]=m);if(m){if(void 0!==n.userData)for(var z in n.userData)m.userData[z]=n.userData[z];if(void 0!==n.groups)for(u=0;u<n.groups.length;u++)c=n.groups[u],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(l)}}void 0!==m&&void 0!==n.children&&
|
|
|
-f(m,n.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();v-=1;p.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 l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;y.objects[a]=
|
|
|
+A.objects)}function f(a,b){var c,e,h,i,k,l;for(l in b){var m=y.objects[l],q=b[l];if(void 0===m){if(q.type&&q.type in p.hierarchyHandlers){if(void 0===q.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 q)v in c||(u[v]=q[v]);r=y.materials[q.material];q.loading=!0;c=p.hierarchyHandlers[q.type].loaderObject;c.options?c.load(d(q.url,A.urlBaseType),g(l,a,r,q)):c.load(d(q.url,A.urlBaseType),g(l,
|
|
|
+a,r,q),u)}}else if(void 0!==q.geometry){if(t=y.geometries[q.geometry]){m=!1;r=y.materials[q.material];m=r instanceof THREE.ShaderMaterial;e=q.position;h=q.rotation;i=q.scale;c=q.matrix;k=q.quaternion;q.material||(r=new THREE.MeshFaceMaterial(y.face_materials[q.geometry]));r instanceof THREE.MeshFaceMaterial&&0===r.materials.length&&(r=new THREE.MeshFaceMaterial(y.face_materials[q.geometry]));if(r instanceof THREE.MeshFaceMaterial)for(u=0;u<r.materials.length;u++)m=m||r.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
+m&&t.computeTangents();q.skin?m=new THREE.SkinnedMesh(t,r):q.morph?(m=new THREE.MorphAnimMesh(t,r),void 0!==q.duration&&(m.duration=q.duration),void 0!==q.time&&(m.time=q.time),void 0!==q.mirroredLoop&&(m.mirroredLoop=q.mirroredLoop),r.morphNormals&&t.computeMorphNormals()):m=new THREE.Mesh(t,r);m.name=l;c?(m.matrixAutoUpdate=!1,m.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])):(m.position.fromArray(e),k?m.quaternion.fromArray(k):m.rotation.fromArray(h),
|
|
|
+m.scale.fromArray(i));m.visible=q.visible;m.castShadow=q.castShadow;m.receiveShadow=q.receiveShadow;a.add(m);y.objects[l]=m}}else if("AmbientLight"===q.type||"PointLight"===q.type||"DirectionalLight"===q.type||"SpotLight"===q.type||"HemisphereLight"===q.type||"AreaLight"===q.type){u=q.color;c=q.intensity;e=q.distance;h=q.position;i=q.rotation;switch(q.type){case "AmbientLight":s=new THREE.AmbientLight(u);break;case "PointLight":s=new THREE.PointLight(u,c,e);s.position.fromArray(h);break;case "DirectionalLight":s=
|
|
|
+new THREE.DirectionalLight(u,c);s.position.fromArray(q.direction);break;case "SpotLight":s=new THREE.SpotLight(u,c,e,1);s.angle=q.angle;s.position.fromArray(h);s.target.set(h[0],h[1]-e,h[2]);s.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":s=new THREE.DirectionalLight(u,c,e);s.target.set(h[0],h[1]-e,h[2]);s.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":s=new THREE.AreaLight(u,c),s.position.fromArray(h),s.width=q.size,s.height=
|
|
|
+q.size_y}a.add(s);s.name=l;y.lights[l]=s;y.objects[l]=s}else"PerspectiveCamera"===q.type||"OrthographicCamera"===q.type?(e=q.position,h=q.rotation,k=q.quaternion,"PerspectiveCamera"===q.type?n=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):"OrthographicCamera"===q.type&&(n=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),n.name=l,n.position.fromArray(e),void 0!==k?n.quaternion.fromArray(k):void 0!==h&&n.rotation.fromArray(h),a.add(n),y.cameras[l]=n,y.objects[l]=
|
|
|
+n):(e=q.position,h=q.rotation,i=q.scale,k=q.quaternion,m=new THREE.Object3D,m.name=l,m.position.fromArray(e),k?m.quaternion.fromArray(k):m.rotation.fromArray(h),m.scale.fromArray(i),m.visible=void 0!==q.visible?q.visible:!1,a.add(m),y.objects[l]=m,y.empties[l]=m);if(m){if(void 0!==q.userData)for(var z in q.userData)m.userData[z]=q.userData[z];if(void 0!==q.groups)for(u=0;u<q.groups.length;u++)c=q.groups[u],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(l)}}void 0!==m&&void 0!==q.children&&
|
|
|
+f(m,q.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();v-=1;p.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 l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;y.objects[a]=
|
|
|
f;e();v-=1;p.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){p.callbackProgress({totalModels:G,totalTextures:w,loadedModels:G-v,loadedTextures:w-z},y);p.onLoadProgress();if(0===v&&0===z){for(var a=0;a<E.length;a++){var c=E[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 l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],
|
|
|
-b)}var p=this,m=THREE.Loader.prototype.extractUrlBase(c),s,t,q,n,u,r,v,z,G,w,y,E=[],A=a,K;for(K in this.geometryHandlers)a=this.geometryHandlers[K].loaderClass,this.geometryHandlers[K].loaderObject=new a;for(K in this.hierarchyHandlers)a=this.hierarchyHandlers[K].loaderClass,this.hierarchyHandlers[K].loaderObject=new a;z=v=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(A.transform&&(K=A.transform.position,
|
|
|
-a=A.transform.rotation,c=A.transform.scale,K&&y.scene.position.fromArray(K),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),K||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();K=function(a){return function(){z-=a;k();p.onLoadComplete()}};for(var D in A.fogs)a=A.fogs[D],"linear"===a.type?n=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(n=new THREE.FogExp2(0,a.density)),a=a.color,n.color.setRGB(a[0],a[1],a[2]),y.fogs[D]=n;for(var F in A.geometries)n=A.geometries[F],n.type in
|
|
|
-this.geometryHandlers&&(v+=1,p.onLoadStart());for(var O in A.objects)l(A.objects[O],function(a){a.type&&a.type in p.hierarchyHandlers&&(v+=1,p.onLoadStart())});G=v;for(F in A.geometries)if(n=A.geometries[F],"cube"===n.type)s=new THREE.CubeGeometry(n.width,n.height,n.depth,n.widthSegments,n.heightSegments,n.depthSegments),s.name=F,y.geometries[F]=s;else if("plane"===n.type)s=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),s.name=F,y.geometries[F]=s;else if("sphere"===n.type)s=
|
|
|
-new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),s.name=F,y.geometries[F]=s;else if("cylinder"===n.type)s=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),s.name=F,y.geometries[F]=s;else if("torus"===n.type)s=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),s.name=F,y.geometries[F]=s;else if("icosahedron"===n.type)s=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),s.name=F,y.geometries[F]=s;else if(n.type in this.geometryHandlers){O=
|
|
|
-{};for(u in n)"type"!==u&&"url"!==u&&(O[u]=n[u]);this.geometryHandlers[n.type].loaderObject.load(d(n.url,A.urlBaseType),h(F),O)}else"embedded"===n.type&&(O=A.embeds[n.id],O.metadata=A.metadata,O&&(O=this.geometryHandlers.ascii.loaderObject.parse(O,""),i(F)(O.geometry,O.materials)));for(var x in A.textures)if(F=A.textures[x],F.url instanceof Array){z+=F.url.length;for(u=0;u<F.url.length;u++)p.onLoadStart()}else z+=1,p.onLoadStart();w=z;for(x in A.textures){F=A.textures[x];void 0!==F.mapping&&void 0!==
|
|
|
-THREE[F.mapping]&&(F.mapping=new THREE[F.mapping]);if(F.url instanceof Array){O=F.url.length;n=[];for(u=0;u<O;u++)n[u]=d(F.url[u],A.urlBaseType);u=(u=/\.dds$/i.test(n[0]))?THREE.ImageUtils.loadCompressedTextureCube(n,F.mapping,K(O)):THREE.ImageUtils.loadTextureCube(n,F.mapping,K(O))}else u=/\.dds$/i.test(F.url),O=d(F.url,A.urlBaseType),n=K(1),u=u?THREE.ImageUtils.loadCompressedTexture(O,F.mapping,n):THREE.ImageUtils.loadTexture(O,F.mapping,n),void 0!==THREE[F.minFilter]&&(u.minFilter=THREE[F.minFilter]),
|
|
|
+b)}var p=this,m=THREE.Loader.prototype.extractUrlBase(c),t,r,n,q,u,s,v,z,G,w,y,E=[],A=a,K;for(K in this.geometryHandlers)a=this.geometryHandlers[K].loaderClass,this.geometryHandlers[K].loaderObject=new a;for(K in this.hierarchyHandlers)a=this.hierarchyHandlers[K].loaderClass,this.hierarchyHandlers[K].loaderObject=new a;z=v=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(A.transform&&(K=A.transform.position,
|
|
|
+a=A.transform.rotation,c=A.transform.scale,K&&y.scene.position.fromArray(K),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),K||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();K=function(a){return function(){z-=a;k();p.onLoadComplete()}};for(var D in A.fogs)a=A.fogs[D],"linear"===a.type?q=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(q=new THREE.FogExp2(0,a.density)),a=a.color,q.color.setRGB(a[0],a[1],a[2]),y.fogs[D]=q;for(var F in A.geometries)q=A.geometries[F],q.type in
|
|
|
+this.geometryHandlers&&(v+=1,p.onLoadStart());for(var O in A.objects)l(A.objects[O],function(a){a.type&&a.type in p.hierarchyHandlers&&(v+=1,p.onLoadStart())});G=v;for(F in A.geometries)if(q=A.geometries[F],"cube"===q.type)t=new THREE.CubeGeometry(q.width,q.height,q.depth,q.widthSegments,q.heightSegments,q.depthSegments),t.name=F,y.geometries[F]=t;else if("plane"===q.type)t=new THREE.PlaneGeometry(q.width,q.height,q.widthSegments,q.heightSegments),t.name=F,y.geometries[F]=t;else if("sphere"===q.type)t=
|
|
|
+new THREE.SphereGeometry(q.radius,q.widthSegments,q.heightSegments),t.name=F,y.geometries[F]=t;else if("cylinder"===q.type)t=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs),t.name=F,y.geometries[F]=t;else if("torus"===q.type)t=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT),t.name=F,y.geometries[F]=t;else if("icosahedron"===q.type)t=new THREE.IcosahedronGeometry(q.radius,q.subdivisions),t.name=F,y.geometries[F]=t;else if(q.type in this.geometryHandlers){O=
|
|
|
+{};for(u in q)"type"!==u&&"url"!==u&&(O[u]=q[u]);this.geometryHandlers[q.type].loaderObject.load(d(q.url,A.urlBaseType),h(F),O)}else"embedded"===q.type&&(O=A.embeds[q.id],O.metadata=A.metadata,O&&(O=this.geometryHandlers.ascii.loaderObject.parse(O,""),i(F)(O.geometry,O.materials)));for(var x in A.textures)if(F=A.textures[x],F.url instanceof Array){z+=F.url.length;for(u=0;u<F.url.length;u++)p.onLoadStart()}else z+=1,p.onLoadStart();w=z;for(x in A.textures){F=A.textures[x];void 0!==F.mapping&&void 0!==
|
|
|
+THREE[F.mapping]&&(F.mapping=new THREE[F.mapping]);if(F.url instanceof Array){O=F.url.length;q=[];for(u=0;u<O;u++)q[u]=d(F.url[u],A.urlBaseType);u=(u=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,F.mapping,K(O)):THREE.ImageUtils.loadTextureCube(q,F.mapping,K(O))}else u=/\.dds$/i.test(F.url),O=d(F.url,A.urlBaseType),q=K(1),u=u?THREE.ImageUtils.loadCompressedTexture(O,F.mapping,q):THREE.ImageUtils.loadTexture(O,F.mapping,q),void 0!==THREE[F.minFilter]&&(u.minFilter=THREE[F.minFilter]),
|
|
|
void 0!==THREE[F.magFilter]&&(u.magFilter=THREE[F.magFilter]),F.anisotropy&&(u.anisotropy=F.anisotropy),F.repeat&&(u.repeat.set(F.repeat[0],F.repeat[1]),1!==F.repeat[0]&&(u.wrapS=THREE.RepeatWrapping),1!==F.repeat[1]&&(u.wrapT=THREE.RepeatWrapping)),F.offset&&u.offset.set(F.offset[0],F.offset[1]),F.wrap&&(O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==O[F.wrap[0]]&&(u.wrapS=O[F.wrap[0]]),void 0!==O[F.wrap[1]]&&(u.wrapT=O[F.wrap[1]]));y.textures[x]=u}var I,B;for(I in A.materials){x=
|
|
|
A.materials[I];for(B in x.parameters)"envMap"===B||"map"===B||"lightMap"===B||"bumpMap"===B?x.parameters[B]=y.textures[x.parameters[B]]:"shading"===B?x.parameters[B]="flat"===x.parameters[B]?THREE.FlatShading:THREE.SmoothShading:"side"===B?x.parameters[B]="double"==x.parameters[B]?THREE.DoubleSide:"back"==x.parameters[B]?THREE.BackSide:THREE.FrontSide:"blending"===B?x.parameters[B]=x.parameters[B]in THREE?THREE[x.parameters[B]]:THREE.NormalBlending:"combine"===B?x.parameters[B]=x.parameters[B]in THREE?
|
|
|
-THREE[x.parameters[B]]:THREE.MultiplyOperation:"vertexColors"===B?"face"==x.parameters[B]?x.parameters[B]=THREE.FaceColors:x.parameters[B]&&(x.parameters[B]=THREE.VertexColors):"wrapRGB"===B&&(K=x.parameters[B],x.parameters[B]=new THREE.Vector3(K[0],K[1],K[2]));void 0!==x.parameters.opacity&&1>x.parameters.opacity&&(x.parameters.transparent=!0);x.parameters.normalMap?(K=THREE.ShaderLib.normalmap,F=THREE.UniformsUtils.clone(K.uniforms),u=x.parameters.color,O=x.parameters.specular,n=x.parameters.ambient,
|
|
|
+THREE[x.parameters[B]]:THREE.MultiplyOperation:"vertexColors"===B?"face"==x.parameters[B]?x.parameters[B]=THREE.FaceColors:x.parameters[B]&&(x.parameters[B]=THREE.VertexColors):"wrapRGB"===B&&(K=x.parameters[B],x.parameters[B]=new THREE.Vector3(K[0],K[1],K[2]));void 0!==x.parameters.opacity&&1>x.parameters.opacity&&(x.parameters.transparent=!0);x.parameters.normalMap?(K=THREE.ShaderLib.normalmap,F=THREE.UniformsUtils.clone(K.uniforms),u=x.parameters.color,O=x.parameters.specular,q=x.parameters.ambient,
|
|
|
D=x.parameters.shininess,F.tNormal.value=y.textures[x.parameters.normalMap],x.parameters.normalScale&&F.uNormalScale.value.set(x.parameters.normalScale[0],x.parameters.normalScale[1]),x.parameters.map&&(F.tDiffuse.value=x.parameters.map,F.enableDiffuse.value=!0),x.parameters.envMap&&(F.tCube.value=x.parameters.envMap,F.enableReflection.value=!0,F.uReflectivity.value=x.parameters.reflectivity),x.parameters.lightMap&&(F.tAO.value=x.parameters.lightMap,F.enableAO.value=!0),x.parameters.specularMap&&
|
|
|
-(F.tSpecular.value=y.textures[x.parameters.specularMap],F.enableSpecular.value=!0),x.parameters.displacementMap&&(F.tDisplacement.value=y.textures[x.parameters.displacementMap],F.enableDisplacement.value=!0,F.uDisplacementBias.value=x.parameters.displacementBias,F.uDisplacementScale.value=x.parameters.displacementScale),F.uDiffuseColor.value.setHex(u),F.uSpecularColor.value.setHex(O),F.uAmbientColor.value.setHex(n),F.uShininess.value=D,x.parameters.opacity&&(F.uOpacity.value=x.parameters.opacity),
|
|
|
-t=new THREE.ShaderMaterial({fragmentShader:K.fragmentShader,vertexShader:K.vertexShader,uniforms:F,lights:!0,fog:!0})):t=new THREE[x.type](x.parameters);t.name=I;y.materials[I]=t}for(I in A.materials)if(x=A.materials[I],x.parameters.materials){B=[];for(u=0;u<x.parameters.materials.length;u++)B.push(y.materials[x.parameters.materials[u]]);y.materials[I].materials=B}e();y.cameras&&A.defaults.camera&&(y.currentCamera=y.cameras[A.defaults.camera]);y.fogs&&A.defaults.fog&&(y.scene.fog=y.fogs[A.defaults.fog]);
|
|
|
+(F.tSpecular.value=y.textures[x.parameters.specularMap],F.enableSpecular.value=!0),x.parameters.displacementMap&&(F.tDisplacement.value=y.textures[x.parameters.displacementMap],F.enableDisplacement.value=!0,F.uDisplacementBias.value=x.parameters.displacementBias,F.uDisplacementScale.value=x.parameters.displacementScale),F.uDiffuseColor.value.setHex(u),F.uSpecularColor.value.setHex(O),F.uAmbientColor.value.setHex(q),F.uShininess.value=D,x.parameters.opacity&&(F.uOpacity.value=x.parameters.opacity),
|
|
|
+r=new THREE.ShaderMaterial({fragmentShader:K.fragmentShader,vertexShader:K.vertexShader,uniforms:F,lights:!0,fog:!0})):r=new THREE[x.type](x.parameters);r.name=I;y.materials[I]=r}for(I in A.materials)if(x=A.materials[I],x.parameters.materials){B=[];for(u=0;u<x.parameters.materials.length;u++)B.push(y.materials[x.parameters.materials[u]]);y.materials[I].materials=B}e();y.cameras&&A.defaults.camera&&(y.currentCamera=y.cameras[A.defaults.camera]);y.fogs&&A.defaults.fog&&(y.scene.fog=y.fogs[A.defaults.fog]);
|
|
|
p.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;
|
|
|
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);
|
|
@@ -298,27 +299,27 @@ 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)}this.dispatchEvent({type:"objectAdded",object:a});a.dispatchEvent({type:"addedToScene",scene:this});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));this.dispatchEvent({type:"objectRemoved",object:a});a.dispatchEvent({type:"removedFromScene",scene:this});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=z.length;d<e;d++){var f=z[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=ta.setFromMatrixPosition(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ka.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=ta.setFromMatrixPosition(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){l(b);p(c);m(d);s(a.getStyle());D.stroke();Ea.expandByScalar(2*b)}function d(a){t(a.getStyle());D.fill()}function e(a,b,c,e,f,h,g,j,i,k,l,p,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0===m.image.width)){if(!0===m.needsUpdate){var n=m.wrapS===THREE.RepeatWrapping,q=m.wrapT===THREE.RepeatWrapping;Ga[m.id]=D.createPattern(m.image,!0===n&&!0===q?"repeat":!0===n&&!1===q?"repeat-x":!1===n&&!0===q?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ga[m.id]?t("rgba(0,0,0,1)"):
|
|
|
-t(Ga[m.id]);var n=m.offset.x/m.repeat.x,q=m.offset.y/m.repeat.y,s=m.image.width*m.repeat.x,r=m.image.height*m.repeat.y,g=(g+n)*s,j=(1-j+q)*r,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+n)*s-g,k=(1-k+q)*r-j,l=(l+n)*s-g,p=(1-p+q)*r-j,n=i*p-l*k;0===n?(void 0===ka[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),ka[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=ka[m.id],g=4*(Math.floor(g)+Math.floor(j)*m.image.width),
|
|
|
-V.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(V)):(n=1/n,m=(p*c-k*f)*n,k=(p*e-k*h)*n,c=(i*f-l*c)*n,e=(i*h-l*e)*n,a=a-m*g-c*j,g=b-k*g-e*j,D.save(),D.transform(m,k,c,e,a,g),D.fill(),D.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,l,p){var m,n;m=p.width-1;n=p.height-1;h*=m;g*=n;c-=a;d-=b;e-=a;f-=b;j=j*m-h;i=i*n-g;k=k*m-h;l=l*n-g;n=1/(j*l-k*i);m=(l*c-i*e)*n;i=(l*d-i*f)*n;c=(j*e-k*c)*n;d=(j*f-k*d)*n;a=a-m*h-c*g;b=b-i*h-d*g;D.save();D.transform(m,i,c,d,a,b);D.clip();D.drawImage(p,0,0);D.restore()}function h(a,
|
|
|
+function c(a,b,c,d){l(b);p(c);m(d);t(a.getStyle());D.stroke();Ea.expandByScalar(2*b)}function d(a){r(a.getStyle());D.fill()}function e(a,b,c,e,f,h,g,j,i,k,l,p,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0===m.image.width)){if(!0===m.needsUpdate){var n=m.wrapS===THREE.RepeatWrapping,q=m.wrapT===THREE.RepeatWrapping;Ga[m.id]=D.createPattern(m.image,!0===n&&!0===q?"repeat":!0===n&&!1===q?"repeat-x":!1===n&&!0===q?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ga[m.id]?r("rgba(0,0,0,1)"):
|
|
|
+r(Ga[m.id]);var n=m.offset.x/m.repeat.x,q=m.offset.y/m.repeat.y,t=m.image.width*m.repeat.x,s=m.image.height*m.repeat.y,g=(g+n)*t,j=(1-j+q)*s,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+n)*t-g,k=(1-k+q)*s-j,l=(l+n)*t-g,p=(1-p+q)*s-j,n=i*p-l*k;0===n?(void 0===ka[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),ka[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=ka[m.id],g=4*(Math.floor(g)+Math.floor(j)*m.image.width),
|
|
|
+V.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(V)):(n=1/n,m=(p*c-k*f)*n,k=(p*e-k*h)*n,c=(i*f-l*c)*n,e=(i*h-l*e)*n,a=a-m*g-c*j,g=b-k*g-e*j,D.save(),D.transform(m,k,c,e,a,g),D.fill(),D.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,l,m){var p,n;p=m.width-1;n=m.height-1;h*=p;g*=n;c-=a;d-=b;e-=a;f-=b;j=j*p-h;i=i*n-g;k=k*p-h;l=l*n-g;n=1/(j*l-k*i);p=(l*c-i*e)*n;i=(l*d-i*f)*n;c=(j*e-k*c)*n;d=(j*f-k*d)*n;a=a-p*h-c*g;b=b-i*h-d*g;D.save();D.transform(p,i,c,d,a,b);D.clip();D.drawImage(m,0,0);D.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){x!==a&&(x=D.globalAlpha=a)}function k(a){I!==a&&(a===THREE.NormalBlending?D.globalCompositeOperation="source-over":
|
|
|
-a===THREE.AdditiveBlending?D.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(D.globalCompositeOperation="darker"),I=a)}function l(a){J!==a&&(J=D.lineWidth=a)}function p(a){ca!==a&&(ca=D.lineCap=a)}function m(a){na!==a&&(na=D.lineJoin=a)}function s(a){B!==a&&(B=D.strokeStyle=a)}function t(a){M!==a&&(M=D.fillStyle=a)}function q(a,b){if(pa!==a||C!==b)D.setLineDash([a,b]),pa=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var n=THREE.Math.smoothstep,a=a||{},u=this,r,v,z,G=
|
|
|
+a===THREE.AdditiveBlending?D.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(D.globalCompositeOperation="darker"),I=a)}function l(a){J!==a&&(J=D.lineWidth=a)}function p(a){ca!==a&&(ca=D.lineCap=a)}function m(a){na!==a&&(na=D.lineJoin=a)}function t(a){B!==a&&(B=D.strokeStyle=a)}function r(a){M!==a&&(M=D.fillStyle=a)}function n(a,b){if(pa!==a||C!==b)D.setLineDash([a,b]),pa=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var q=THREE.Math.smoothstep,a=a||{},u=this,s,v,z,G=
|
|
|
new THREE.Projector,w=void 0!==a.canvas?a.canvas:document.createElement("canvas"),y=w.width,E=w.height,A=Math.floor(y/2),K=Math.floor(E/2),D=w.getContext("2d"),F=new THREE.Color(0),O=0,x=1,I=0,B=null,M=null,J=null,ca=null,na=null,pa=null,C=0,Q,R,L,da;new THREE.RenderableVertex;new THREE.RenderableVertex;var za,Ba,ba,Aa,$,ea,V=new THREE.Color,P=new THREE.Color,Y=new THREE.Color,U=new THREE.Color,ja=new THREE.Color,sa=new THREE.Color,ha=new THREE.Color,Ka=new THREE.Color,Ga={},ka={},Da,Ua,Qa,wa,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,fa=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===D.setLineDash&&(D.setLineDash=
|
|
|
void 0!==D.mozDash?function(a){D.mozDash=null!==a[0]?a:null}:function(){});this.domElement=w;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;E=b*this.devicePixelRatio;A=Math.floor(y/2);K=Math.floor(E/2);
|
|
|
w.width=y;w.height=E;1!==this.devicePixelRatio&&!1!==c&&(w.style.width=a+"px",w.style.height=b+"px");va.set(new THREE.Vector2(-A,-K),new THREE.Vector2(A,K));la.set(new THREE.Vector2(-A,-K),new THREE.Vector2(A,K));x=1;I=0;na=ca=J=M=B=null};this.setClearColor=function(a,b){F.set(a);O=void 0!==b?b:1;la.set(new THREE.Vector2(-A,-K),new THREE.Vector2(A,K))};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(){D.setTransform(1,0,0,-1,A,K);!1===la.empty()&&(la.intersect(va),la.expandByScalar(2),1>O&&D.clearRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0),0<O&&(k(THREE.NormalBlending),i(1),t("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+O+")"),D.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.clearColor=function(){};this.clearDepth=function(){};
|
|
|
-this.clearStencil=function(){};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();D.setTransform(1,0,0,-1,A,K);u.info.render.vertices=0;u.info.render.faces=0;r=G.projectScene(a,j,this.sortObjects,this.sortElements);v=r.elements;z=r.lights;Q=j;gb.setRGB(0,0,0);ra.setRGB(0,0,0);fa.setRGB(0,0,0);for(var y=0,F=z.length;y<F;y++){var B=z[y],E=B.color;B instanceof THREE.AmbientLight?
|
|
|
+b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){D.setTransform(1,0,0,-1,A,K);!1===la.empty()&&(la.intersect(va),la.expandByScalar(2),1>O&&D.clearRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0),0<O&&(k(THREE.NormalBlending),i(1),r("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+O+")"),D.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.clearColor=function(){};this.clearDepth=function(){};
|
|
|
+this.clearStencil=function(){};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();D.setTransform(1,0,0,-1,A,K);u.info.render.vertices=0;u.info.render.faces=0;s=G.projectScene(a,j,this.sortObjects,this.sortElements);v=s.elements;z=s.lights;Q=j;gb.setRGB(0,0,0);ra.setRGB(0,0,0);fa.setRGB(0,0,0);for(var y=0,F=z.length;y<F;y++){var B=z[y],E=B.color;B instanceof THREE.AmbientLight?
|
|
|
gb.add(E):B instanceof THREE.DirectionalLight?ra.add(E):B instanceof THREE.PointLight&&fa.add(E)}y=0;for(F=v.length;y<F;y++){var x=v[y],w=x.material;if(!(void 0===w||!1===w.visible)){Ea.makeEmpty();if(x instanceof THREE.RenderableSprite){R=x;R.x*=A;R.y*=K;var B=R,E=x,I=w;i(I.opacity);k(I.blending);var x=E.scale.x*A,w=E.scale.y*K,O=0.5*Math.sqrt(x*x+w*w);Ea.min.set(B.x-O,B.y-O);Ea.max.set(B.x+O,B.y+O);!1===va.isIntersectionBox(Ea)?Ea.makeEmpty():I instanceof THREE.SpriteMaterial||I instanceof THREE.ParticleSystemMaterial?
|
|
|
-(null!==I.map?(E=I.map.image,D.save(),D.translate(B.x,B.y),D.rotate(I.rotation),D.scale(x,-w),D.drawImage(E,0,0,E.width,E.height,-0.5,-0.5,1,1)):(t(I.color.getStyle()),D.save(),D.translate(B.x,B.y),D.rotate(I.rotation),D.scale(x,-w),D.fillRect(-0.5,-0.5,1,1)),D.restore()):I instanceof THREE.SpriteCanvasMaterial&&(s(I.color.getStyle()),t(I.color.getStyle()),D.save(),D.translate(B.x,B.y),D.rotate(-E.rotation),D.scale(x,w),I.program(D),D.restore())}else if(x instanceof THREE.RenderableLine){if(R=x.v1,
|
|
|
-L=x.v2,R.positionScreen.x*=A,R.positionScreen.y*=K,L.positionScreen.x*=A,L.positionScreen.y*=K,Ea.setFromPoints([R.positionScreen,L.positionScreen]),!0===va.isIntersectionBox(Ea))if(B=R,E=L,I=x,x=w,i(x.opacity),k(x.blending),D.beginPath(),D.moveTo(B.positionScreen.x,B.positionScreen.y),D.lineTo(E.positionScreen.x,E.positionScreen.y),x instanceof THREE.LineBasicMaterial){l(x.linewidth);p(x.linecap);m(x.linejoin);if(x.vertexColors!==THREE.VertexColors)s(x.color.getStyle());else if(w=I.vertexColors[0].getStyle(),
|
|
|
-I=I.vertexColors[1].getStyle(),w===I)s(w);else{try{var C=D.createLinearGradient(B.positionScreen.x,B.positionScreen.y,E.positionScreen.x,E.positionScreen.y);C.addColorStop(0,w);C.addColorStop(1,I)}catch(J){C=w}s(C)}D.stroke();Ea.expandByScalar(2*x.linewidth)}else x instanceof THREE.LineDashedMaterial&&(l(x.linewidth),p(x.linecap),m(x.linejoin),s(x.color.getStyle()),q(x.dashSize,x.gapSize),D.stroke(),Ea.expandByScalar(2*x.linewidth),q(null,null))}else if(x instanceof THREE.RenderableFace3){R=x.v1;
|
|
|
+(null!==I.map?(E=I.map.image,D.save(),D.translate(B.x,B.y),D.rotate(I.rotation),D.scale(x,-w),D.drawImage(E,0,0,E.width,E.height,-0.5,-0.5,1,1)):(r(I.color.getStyle()),D.save(),D.translate(B.x,B.y),D.rotate(I.rotation),D.scale(x,-w),D.fillRect(-0.5,-0.5,1,1)),D.restore()):I instanceof THREE.SpriteCanvasMaterial&&(t(I.color.getStyle()),r(I.color.getStyle()),D.save(),D.translate(B.x,B.y),D.rotate(-E.rotation),D.scale(x,w),I.program(D),D.restore())}else if(x instanceof THREE.RenderableLine){if(R=x.v1,
|
|
|
+L=x.v2,R.positionScreen.x*=A,R.positionScreen.y*=K,L.positionScreen.x*=A,L.positionScreen.y*=K,Ea.setFromPoints([R.positionScreen,L.positionScreen]),!0===va.isIntersectionBox(Ea))if(B=R,E=L,I=x,x=w,i(x.opacity),k(x.blending),D.beginPath(),D.moveTo(B.positionScreen.x,B.positionScreen.y),D.lineTo(E.positionScreen.x,E.positionScreen.y),x instanceof THREE.LineBasicMaterial){l(x.linewidth);p(x.linecap);m(x.linejoin);if(x.vertexColors!==THREE.VertexColors)t(x.color.getStyle());else if(w=I.vertexColors[0].getStyle(),
|
|
|
+I=I.vertexColors[1].getStyle(),w===I)t(w);else{try{var C=D.createLinearGradient(B.positionScreen.x,B.positionScreen.y,E.positionScreen.x,E.positionScreen.y);C.addColorStop(0,w);C.addColorStop(1,I)}catch(J){C=w}t(C)}D.stroke();Ea.expandByScalar(2*x.linewidth)}else x instanceof THREE.LineDashedMaterial&&(l(x.linewidth),p(x.linecap),m(x.linejoin),t(x.color.getStyle()),n(x.dashSize,x.gapSize),D.stroke(),Ea.expandByScalar(2*x.linewidth),n(null,null))}else if(x instanceof THREE.RenderableFace3){R=x.v1;
|
|
|
L=x.v2;da=x.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>da.positionScreen.z||1<da.positionScreen.z)continue;R.positionScreen.x*=A;R.positionScreen.y*=K;L.positionScreen.x*=A;L.positionScreen.y*=K;da.positionScreen.x*=A;da.positionScreen.y*=K;0<w.overdraw&&(g(R.positionScreen,L.positionScreen,w.overdraw),g(L.positionScreen,da.positionScreen,w.overdraw),g(da.positionScreen,R.positionScreen,w.overdraw));Ea.setFromPoints([R.positionScreen,
|
|
|
L.positionScreen,da.positionScreen]);if(!0===va.isIntersectionBox(Ea)){B=R;E=L;I=da;u.info.render.vertices+=3;u.info.render.faces++;i(w.opacity);k(w.blending);za=B.positionScreen.x;Ba=B.positionScreen.y;ba=E.positionScreen.x;Aa=E.positionScreen.y;$=I.positionScreen.x;ea=I.positionScreen.y;var O=za,M=Ba,ca=ba,ka=Aa,na=$,pa=ea;D.beginPath();D.moveTo(O,M);D.lineTo(ca,ka);D.lineTo(na,pa);D.closePath();(w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial)&&null===w.map?(sa.copy(w.color),
|
|
|
ha.copy(w.emissive),w.vertexColors===THREE.FaceColors&&sa.multiply(x.color),!1===w.wireframe&&w.shading===THREE.SmoothShading&&3===x.vertexNormalsLength?(P.copy(gb),Y.copy(gb),U.copy(gb),b(x.v1.positionWorld,x.vertexNormalsModel[0],P),b(x.v2.positionWorld,x.vertexNormalsModel[1],Y),b(x.v3.positionWorld,x.vertexNormalsModel[2],U),P.multiply(sa).add(ha),Y.multiply(sa).add(ha),U.multiply(sa).add(ha),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)):(V.copy(gb),
|
|
|
b(x.centroidModel,x.normalModel,V),V.multiply(sa).add(ha),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V))):w instanceof THREE.MeshBasicMaterial||w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial?null!==w.map?w.map.mapping instanceof THREE.UVMapping&&(wa=x.uvs[0],e(za,Ba,ba,Aa,$,ea,wa[0].x,wa[0].y,wa[1].x,wa[1].y,wa[2].x,wa[2].y,w.map)):null!==w.envMap?w.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ta.copy(x.vertexNormalsModelView[0]),
|
|
|
-bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(x.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(x.vertexNormalsModelView[2]),sb=0.5*ta.x+0.5,pb=0.5*ta.y+0.5,e(za,Ba,ba,Aa,$,ea,bb,cb,Ma,fb,sb,pb,w.envMap)):(V.copy(w.color),w.vertexColors===THREE.FaceColors&&V.multiply(x.color),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V)):w instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,P.r=P.g=P.b=1-n(B.positionScreen.z*B.positionScreen.w,Da,Ua),Y.r=Y.g=
|
|
|
-Y.b=1-n(E.positionScreen.z*E.positionScreen.w,Da,Ua),U.r=U.g=U.b=1-n(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)):w instanceof THREE.MeshNormalMaterial&&(B=void 0,w.shading===THREE.FlatShading?(B=x.normalModelView,V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V)):w.shading===THREE.SmoothShading&&(B=x.vertexNormalsModelView[0],
|
|
|
+bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(x.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(x.vertexNormalsModelView[2]),sb=0.5*ta.x+0.5,pb=0.5*ta.y+0.5,e(za,Ba,ba,Aa,$,ea,bb,cb,Ma,fb,sb,pb,w.envMap)):(V.copy(w.color),w.vertexColors===THREE.FaceColors&&V.multiply(x.color),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V)):w instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,P.r=P.g=P.b=1-q(B.positionScreen.z*B.positionScreen.w,Da,Ua),Y.r=Y.g=
|
|
|
+Y.b=1-q(E.positionScreen.z*E.positionScreen.w,Da,Ua),U.r=U.g=U.b=1-q(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)):w instanceof THREE.MeshNormalMaterial&&(B=void 0,w.shading===THREE.FlatShading?(B=x.normalModelView,V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V)):w.shading===THREE.SmoothShading&&(B=x.vertexNormalsModelView[0],
|
|
|
P.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=x.vertexNormalsModelView[1],Y.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=x.vertexNormalsModelView[2],U.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)))}}la.union(Ea)}}D.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_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",
|
|
@@ -373,36 +374,36 @@ function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.leng
|
|
|
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 l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ea=Ba=null,Aa=$=U=Y=ka=Ga=ja=-1,ta=!0,a[d].render(b,c,sb,pb),ea=Ba=null,Aa=$=U=Y=ka=Ga=ja=-1,ta=!0}function p(a,b,c,d,e,f,h,g){var j,i,k,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(j=a[m],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&L.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
|
|
|
L.setDepthTest(j.depthTest);L.setDepthWrite(j.depthWrite);A(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.setMaterialFaces(j);k instanceof THREE.BufferGeometry?L.renderBufferDirect(d,e,f,j,k,i):L.renderBuffer(d,e,f,j,k,i)}}function m(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&&L.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);L.setDepthTest(g.depthTest);L.setDepthWrite(g.depthWrite);A(g.polygonOffset,
|
|
|
-g.polygonOffsetFactor,g.polygonOffsetUnits)}L.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 l,m,p;k={};var n=i.morphTargets.length,q=i.morphNormals.length,s=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(l=i.faces.length;h<l;h++)m=i.faces[h],m=s?m.materialIndex:0,void 0===k[m]&&(k[m]={hash:m,counter:0}),p=k[m].hash+"_"+k[m].counter,void 0===i.geometryGroups[p]&&
|
|
|
+g.polygonOffsetFactor,g.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,g,j)}}function t(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 l,m,p;k={};var n=i.morphTargets.length,q=i.morphNormals.length,t=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(l=i.faces.length;h<l;h++)m=i.faces[h],m=t?m.materialIndex:0,void 0===k[m]&&(k[m]={hash:m,counter:0}),p=k[m].hash+"_"+k[m].counter,void 0===i.geometryGroups[p]&&
|
|
|
(i.geometryGroups[p]={faces3:[],materialIndex:m,vertices:0,numMorphTargets:n,numMorphNormals:q}),65535<i.geometryGroups[p].vertices+3&&(k[m].counter+=1,p=k[m].hash+"_"+k[m].counter,void 0===i.geometryGroups[p]&&(i.geometryGroups[p]={faces3:[],materialIndex:m,vertices:0,numMorphTargets:n,numMorphNormals:q})),i.geometryGroups[p].faces3.push(h),i.geometryGroups[p].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=V++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
|
|
|
f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();n=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];
|
|
|
k=0;for(n=i.numMorphTargets;k<n;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(n=i.numMorphNormals;k<n;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}L.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
|
|
|
j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),L.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(),
|
|
|
-L.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)t(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],t(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
|
|
|
-THREE.ParticleSystem?(f=a.geometry,t(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 t(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 n(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?r(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)&&r(b.__webglObjectsImmediate,a);delete a.__webglActive}function r(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 z(a,b,c,d,e){P=0;d.needsUpdate&&(d.program&&Gb(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.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!==ea)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ea&&(ea=a);if(d.skinning)if(yb&&
|
|
|
-e.useVertexTexture){if(null!==h.boneTexture){var k=G();j.uniform1i(h.boneTexture,k);L.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 l,m=k=0,p=0,n,q,s,r=Pa,t=r.directional.colors,u=r.directional.positions,v=r.point.colors,z=r.point.positions,x=r.point.distances,A=r.spot.colors,E=r.spot.positions,D=r.spot.distances,K=r.spot.directions,O=r.spot.anglesCos,C=r.spot.exponents,J=r.hemi.skyColors,V=r.hemi.groundColors,M=r.hemi.positions,Q=0,U=0,Y=0,za=0,$=0,dc=0,X=0,W=0,R=l=0,c=s=R=0,f=b.length;c<f;c++)l=
|
|
|
-b[c],l.onlyShadow||(n=l.color,q=l.intensity,s=l.distance,l instanceof THREE.AmbientLight?l.visible&&(L.gammaInput?(k+=n.r*n.r,m+=n.g*n.g,p+=n.b*n.b):(k+=n.r,m+=n.g,p+=n.b)):l instanceof THREE.DirectionalLight?($+=1,l.visible&&(fa.setFromMatrixPosition(l.matrixWorld),ra.setFromMatrixPosition(l.target.matrixWorld),fa.sub(ra),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(l=3*Q,u[l]=fa.x,u[l+1]=fa.y,u[l+2]=fa.z,L.gammaInput?w(t,l,n,q*q):y(t,l,n,q),Q+=1))):l instanceof THREE.PointLight?(dc+=1,l.visible&&
|
|
|
-(R=3*U,L.gammaInput?w(v,R,n,q*q):y(v,R,n,q),ra.setFromMatrixPosition(l.matrixWorld),z[R]=ra.x,z[R+1]=ra.y,z[R+2]=ra.z,x[U]=s,U+=1)):l instanceof THREE.SpotLight?(X+=1,l.visible&&(R=3*Y,L.gammaInput?w(A,R,n,q*q):y(A,R,n,q),ra.setFromMatrixPosition(l.matrixWorld),E[R]=ra.x,E[R+1]=ra.y,E[R+2]=ra.z,D[Y]=s,fa.copy(ra),ra.setFromMatrixPosition(l.target.matrixWorld),fa.sub(ra),fa.normalize(),K[R]=fa.x,K[R+1]=fa.y,K[R+2]=fa.z,O[Y]=Math.cos(l.angle),C[Y]=l.exponent,Y+=1)):l instanceof THREE.HemisphereLight&&
|
|
|
-(W+=1,l.visible&&(fa.setFromMatrixPosition(l.matrixWorld),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(s=3*za,M[s]=fa.x,M[s+1]=fa.y,M[s+2]=fa.z,n=l.color,l=l.groundColor,L.gammaInput?(q*=q,w(J,s,n,q),w(V,s,l,q)):(y(J,s,n,q),y(V,s,l,q)),za+=1))));c=3*Q;for(f=Math.max(t.length,3*$);c<f;c++)t[c]=0;c=3*U;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(A.length,3*X);c<f;c++)A[c]=0;c=3*za;for(f=Math.max(J.length,3*W);c<f;c++)J[c]=0;c=3*za;for(f=Math.max(V.length,3*W);c<f;c++)V[c]=0;r.directional.length=
|
|
|
+L.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 n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
|
+return!1}function q(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?s(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)&&s(b.__webglObjectsImmediate,a);delete a.__webglActive}function s(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 z(a,b,c,d,e){P=0;d.needsUpdate&&(d.program&&Gb(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));var f=!1,h=d.program,g=h.uniforms,i=d.uniforms;h!==Ba&&(j.useProgram(h),Ba=h,f=!0);d.id!==Aa&&(Aa=d.id,f=!0);if(f||a!==ea)j.uniformMatrix4fv(g.projectionMatrix,!1,a.projectionMatrix.elements),a!==ea&&(ea=a);if(d.skinning)if(yb&&
|
|
|
+e.useVertexTexture){if(null!==g.boneTexture){var k=G();j.uniform1i(g.boneTexture,k);L.setTexture(e.boneTexture,k)}null!==g.boneTextureWidth&&j.uniform1i(g.boneTextureWidth,e.boneTextureWidth);null!==g.boneTextureHeight&&j.uniform1i(g.boneTextureHeight,e.boneTextureHeight)}else null!==g.boneGlobalMatrices&&j.uniformMatrix4fv(g.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 l,m=k=0,p=0,n,q,t,r=Pa,s=r.directional.colors,u=r.directional.positions,v=r.point.colors,z=r.point.positions,x=r.point.distances,A=r.spot.colors,E=r.spot.positions,D=r.spot.distances,K=r.spot.directions,O=r.spot.anglesCos,C=r.spot.exponents,J=r.hemi.skyColors,V=r.hemi.groundColors,M=r.hemi.positions,Q=0,U=0,Y=0,za=0,$=0,dc=0,X=0,W=0,R=l=0,c=t=R=0,f=b.length;c<f;c++)l=
|
|
|
+b[c],l.onlyShadow||(n=l.color,q=l.intensity,t=l.distance,l instanceof THREE.AmbientLight?l.visible&&(L.gammaInput?(k+=n.r*n.r,m+=n.g*n.g,p+=n.b*n.b):(k+=n.r,m+=n.g,p+=n.b)):l instanceof THREE.DirectionalLight?($+=1,l.visible&&(fa.setFromMatrixPosition(l.matrixWorld),ra.setFromMatrixPosition(l.target.matrixWorld),fa.sub(ra),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(l=3*Q,u[l]=fa.x,u[l+1]=fa.y,u[l+2]=fa.z,L.gammaInput?w(s,l,n,q*q):y(s,l,n,q),Q+=1))):l instanceof THREE.PointLight?(dc+=1,l.visible&&
|
|
|
+(R=3*U,L.gammaInput?w(v,R,n,q*q):y(v,R,n,q),ra.setFromMatrixPosition(l.matrixWorld),z[R]=ra.x,z[R+1]=ra.y,z[R+2]=ra.z,x[U]=t,U+=1)):l instanceof THREE.SpotLight?(X+=1,l.visible&&(R=3*Y,L.gammaInput?w(A,R,n,q*q):y(A,R,n,q),ra.setFromMatrixPosition(l.matrixWorld),E[R]=ra.x,E[R+1]=ra.y,E[R+2]=ra.z,D[Y]=t,fa.copy(ra),ra.setFromMatrixPosition(l.target.matrixWorld),fa.sub(ra),fa.normalize(),K[R]=fa.x,K[R+1]=fa.y,K[R+2]=fa.z,O[Y]=Math.cos(l.angle),C[Y]=l.exponent,Y+=1)):l instanceof THREE.HemisphereLight&&
|
|
|
+(W+=1,l.visible&&(fa.setFromMatrixPosition(l.matrixWorld),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(t=3*za,M[t]=fa.x,M[t+1]=fa.y,M[t+2]=fa.z,n=l.color,l=l.groundColor,L.gammaInput?(q*=q,w(J,t,n,q),w(V,t,l,q)):(y(J,t,n,q),y(V,t,l,q)),za+=1))));c=3*Q;for(f=Math.max(s.length,3*$);c<f;c++)s[c]=0;c=3*U;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(A.length,3*X);c<f;c++)A[c]=0;c=3*za;for(f=Math.max(J.length,3*W);c<f;c++)J[c]=0;c=3*za;for(f=Math.max(V.length,3*W);c<f;c++)V[c]=0;r.directional.length=
|
|
|
Q;r.point.length=U;r.spot.length=Y;r.hemi.length=za;r.ambient[0]=k;r.ambient[1]=m;r.ambient[2]=p;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;L.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 ba;d.map?ba=d.map:d.specularMap?ba=d.specularMap:d.normalMap?ba=d.normalMap:d.bumpMap&&(ba=d.bumpMap);void 0!==ba&&(c=ba.offset,ba=ba.repeat,i.offsetRepeat.value.set(c.x,c.y,ba.x,ba.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
|
1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?
|
|
|
(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=B.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
|
|
|
(L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=ba=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
|
|
|
-THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[ba]=k.shadowMap,i.shadowMapSize.value[ba]=k.shadowMapSize,i.shadowMatrix.value[ba]=k.shadowMatrix,i.shadowDarkness.value[ba]=k.shadowDarkness,i.shadowBias.value[ba]=k.shadowBias,ba++}b=d.uniformsList;i=0;for(ba=b.length;i<ba;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,
|
|
|
+THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[ba]=k.shadowMap,i.shadowMapSize.value[ba]=k.shadowMapSize,i.shadowMatrix.value[ba]=k.shadowMatrix,i.shadowDarkness.value[ba]=k.shadowDarkness,i.shadowBias.value[ba]=k.shadowBias,ba++}b=d.uniformsList;i=0;for(ba=b.length;i<ba;i++)if(f=h.uniforms[b[i][1]])if(c=b[i][0],m=c.type,k=c.value,"i"===m)j.uniform1i(f,k);else if("f"===m)j.uniform1f(f,k);else if("v2"===m)j.uniform2f(f,k.x,k.y);else if("v3"===m)j.uniform3f(f,
|
|
|
k.x,k.y,k.z);else if("v4"===m)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===m)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===m)j.uniform1iv(f,k);else if("iv"===m)j.uniform3iv(f,k);else if("fv1"===m)j.uniform1fv(f,k);else if("fv"===m)j.uniform3fv(f,k);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*k.length));m=0;for(p=k.length;m<p;m++)r=2*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y;j.uniform2fv(f,c._array)}else if("v3v"===m){void 0===c._array&&(c._array=new Float32Array(3*k.length));m=
|
|
|
0;for(p=k.length;m<p;m++)r=3*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z;j.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*k.length));m=0;for(p=k.length;m<p;m++)r=4*m,c._array[r]=k[m].x,c._array[r+1]=k[m].y,c._array[r+2]=k[m].z,c._array[r+3]=k[m].w;j.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===m){void 0===c._array&&
|
|
|
(c._array=new Float32Array(16*k.length));m=0;for(p=k.length;m<p;m++)k[m].flattenToArrayOffset(c._array,16*m);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(r=k,k=G(),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(),L.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(m=0;6>m;m++)L.autoScaleCubemaps&&!f?(p=k,r=m,t=c.image[m],v=ac,t.width<=v&&t.height<=v||(z=Math.max(t.width,t.height),u=Math.floor(t.width*v/z),v=Math.floor(t.height*v/z),z=document.createElement("canvas"),z.width=u,z.height=v,z.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,v),t=z),p[r]=t):k[m]=c.image[m];m=k[0];p=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=I(c.format);t=I(c.type);F(j.TEXTURE_CUBE_MAP,
|
|
|
-c,p);for(m=0;6>m;m++)if(f){v=k[m].mipmaps;z=0;for(x=v.length;z<x;z++)u=v[z],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,z,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,z,r,u.width,u.height,0,r,t,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,t,k[m]);c.generateMipmaps&&p&&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,
|
|
|
+j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(m=0;6>m;m++)L.autoScaleCubemaps&&!f?(p=k,r=m,s=c.image[m],v=ac,s.width<=v&&s.height<=v||(z=Math.max(s.width,s.height),u=Math.floor(s.width*v/z),v=Math.floor(s.height*v/z),z=document.createElement("canvas"),z.width=u,z.height=v,z.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,v),s=z),p[r]=s):k[m]=c.image[m];m=k[0];p=0===(m.width&m.width-1)&&0===(m.height&m.height-1);r=I(c.format);s=I(c.type);F(j.TEXTURE_CUBE_MAP,
|
|
|
+c,p);for(m=0;6>m;m++)if(f){v=k[m].mipmaps;z=0;for(x=v.length;z<x;z++)u=v[z],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,z,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,z,r,u.width,u.height,0,r,s,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,r,r,s,k[m]);c.generateMipmaps&&p&&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)):L.setTexture(r,k)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(p=c.value.length;m<p;m++)c._array[m]=G();j.uniform1iv(f,c._array);m=0;for(p=c.value.length;m<p;m++)r=c.value[m],k=c._array[m],r&&L.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+m);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
-THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ra.setFromMatrixPosition(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 G(){var a=P;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);P+=1;return a}function w(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 E(a){a!==wa&&(j.lineWidth(a),wa=a)}function A(a,b,c){Da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Da=a);
|
|
|
+THREE.MeshPhongMaterial||d.envMap)&&null!==g.cameraPosition)ra.setFromMatrixPosition(a.matrixWorld),j.uniform3f(g.cameraPosition,ra.x,ra.y,ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==g.viewMatrix&&j.uniformMatrix4fv(g.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrix.elements);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrix.elements);
|
|
|
+null!==g.modelMatrix&&j.uniformMatrix4fv(g.modelMatrix,!1,e.matrixWorld.elements);return h}function G(){var a=P;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);P+=1;return a}function w(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 E(a){a!==wa&&(j.lineWidth(a),wa=a)}function A(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 K(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 D(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(K(b)),null):c}function F(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,x(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,x(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 O(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)}
|
|
@@ -447,13 +448,13 @@ d.defaultAttributeValues.uv2));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j
|
|
|
(d.wireframe?(E(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,E(d.linewidth),j.drawArrays(f,0,
|
|
|
e.__webglLineCount),L.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,h,g,k=a.__lights,n=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);l(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.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],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=
|
|
|
+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,t=void 0,s=t=void 0,s=q.object.material;if(s instanceof THREE.MeshFaceMaterial)t=r.materialIndex,t=s.materials[t],t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);else if(t=s)t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);f.render=
|
|
|
!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ra.setFromMatrixPosition(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),A(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),p(a.__webglObjects,!1,"",b,k,n,!0,d),m(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),p(a.__webglObjects,!0,"opaque",b,k,n,!1,d),m(a.__webglObjectsImmediate,"opaque",b,k,n,!1,d),p(a.__webglObjects,!1,"transparent",b,k,n,!0,d),m(a.__webglObjectsImmediate,"transparent",b,
|
|
|
k,n,!0,d));l(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=z(a,b,c,d,e);$=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,la):e.render(function(a){L.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,p=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var t=j.DYNAMIC_DRAW,v=!l.dynamic,z=l.attributes,y=void 0,x=void 0;for(y in z)x=z[y],x.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,x.array,t)):(j.bindBuffer(j.ARRAY_BUFFER,x.buffer),j.bufferData(j.ARRAY_BUFFER,x.array,t)),x.needsUpdate=!1),v&&!x.dynamic&&
|
|
|
-(x.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),p=r.attributes&&q(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||p){var w=m,E=i,D=j.DYNAMIC_DRAW,G=!l.dynamic,F=r;if(w.__inittedArrays){var K=e(F),I=F.vertexColors?F.vertexColors:!1,L=f(F),O=K===THREE.SmoothShading,C=void 0,J=void 0,
|
|
|
+b,c,d,e){var f=z(a,b,c,d,e);$=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,la):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(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),t(g,a));var i=g,l=i.geometry,m=void 0,p=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var s=j.DYNAMIC_DRAW,v=!l.dynamic,z=l.attributes,y=void 0,x=void 0;for(y in z)x=z[y],x.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,x.array,s)):(j.bindBuffer(j.ARRAY_BUFFER,x.buffer),j.bufferData(j.ARRAY_BUFFER,x.array,s)),x.needsUpdate=!1),v&&!x.dynamic&&
|
|
|
+(x.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),p=r.attributes&&n(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||p){var w=m,E=i,D=j.DYNAMIC_DRAW,G=!l.dynamic,F=r;if(w.__inittedArrays){var K=e(F),I=F.vertexColors?F.vertexColors:!1,L=f(F),O=K===THREE.SmoothShading,C=void 0,J=void 0,
|
|
|
V=void 0,M=void 0,Q=void 0,ba=void 0,R=void 0,U=void 0,Y=void 0,za=void 0,$=void 0,P=void 0,X=void 0,W=void 0,Ba=void 0,ea=void 0,Aa=void 0,ca=void 0,da=void 0,ha=void 0,fa=void 0,ja=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,wa=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,xa=0,N=0,Na=void 0,ib=w.__vertexArray,bb=w.__uvArray,cb=w.__uv2Array,Ma=w.__normalArray,
|
|
|
Va=w.__tangentArray,jb=w.__colorArray,Wa=w.__skinIndexArray,Xa=w.__skinWeightArray,fb=w.__morphTargetsArrays,sb=w.__morphNormalsArrays,pb=w.__webglCustomAttributesList,H=void 0,Pb=w.__faceArray,vb=w.__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=w.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(J=aa.length;C<J;C++)M=kb[aa[C]],P=ec[M.a],X=ec[M.b],W=ec[M.c],ib[eb]=P.x,ib[eb+1]=P.y,ib[eb+2]=P.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,w.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,D)}if(Ob){Sa=0;for(La=Rb.length;Sa<La;Sa++){C=xa=0;for(J=aa.length;C<J;C++)Qa=aa[C],M=kb[Qa],P=Rb[Sa].vertices[M.a],X=Rb[Sa].vertices[M.b],W=Rb[Sa].vertices[M.c],va=fb[Sa],va[xa]=P.x,
|
|
@@ -469,29 +470,29 @@ aa.length;C<J;C++)M=kb[aa[C]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.arr
|
|
|
H.array[N+7]=W[oa[1]],H.array[N+8]=W[oa[2]],N+=9}else if("faceVertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)Na=H.value[aa[C]],P=Na[0],X=Na[1],W=Na[2],H.array[N]=P[oa[0]],H.array[N+1]=P[oa[1]],H.array[N+2]=P[oa[2]],H.array[N+3]=X[oa[0]],H.array[N+4]=X[oa[1]],H.array[N+5]=X[oa[2]],H.array[N+6]=W[oa[0]],H.array[N+7]=W[oa[1]],H.array[N+8]=W[oa[2]],N+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],
|
|
|
H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=P.z,H.array[N+3]=P.w,H.array[N+4]=X.x,H.array[N+5]=X.y,H.array[N+6]=X.z,H.array[N+7]=X.w,H.array[N+8]=W.x,H.array[N+9]=W.y,H.array[N+10]=W.z,H.array[N+11]=W.w,N+=12}else if("faces"===H.boundTo){C=0;for(J=aa.length;C<J;C++)W=X=P=Na=H.value[aa[C]],H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=P.z,H.array[N+3]=P.w,H.array[N+4]=X.x,H.array[N+5]=X.y,H.array[N+6]=X.z,H.array[N+7]=X.w,H.array[N+8]=W.x,H.array[N+9]=W.y,H.array[N+10]=W.z,H.array[N+11]=W.w,N+=12}else if("faceVertices"===
|
|
|
H.boundTo){C=0;for(J=aa.length;C<J;C++)Na=H.value[aa[C]],P=Na[0],X=Na[1],W=Na[2],H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=P.z,H.array[N+3]=P.w,H.array[N+4]=X.x,H.array[N+5]=X.y,H.array[N+6]=X.z,H.array[N+7]=X.w,H.array[N+8]=W.x,H.array[N+9]=W.y,H.array[N+10]=W.z,H.array[N+11]=W.w,N+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,D)}}G&&(delete w.__inittedArrays,delete w.__colorArray,delete w.__normalArray,delete w.__tangentArray,delete w.__uvArray,delete w.__uv2Array,
|
|
|
-delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinIndexArray,delete w.__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&&n(r)}else if(i instanceof THREE.Line){r=d(i,l);p=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||p){var Ya=l,Sb=j.DYNAMIC_DRAW,Ib=void 0,
|
|
|
+delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinIndexArray,delete w.__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&&q(r)}else if(i instanceof THREE.Line){r=d(i,l);p=r.attributes&&n(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||p){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,ya=void 0,zb=void 0,Ia=void 0,ia=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(ia=gc[Xb],ia.needsUpdate&&(void 0===ia.boundTo||"vertices"===ia.boundTo)){ma=0;zb=ia.value.length;if(1===ia.size)for(ya=
|
|
|
0;ya<zb;ya++)ia.array[ya]=ia.value[ya];else if(2===ia.size)for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.x,ia.array[ma+1]=Ia.y,ma+=2;else if(3===ia.size)if("c"===ia.type)for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.r,ia.array[ma+1]=Ia.g,ia.array[ma+2]=Ia.b,ma+=3;else for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.x,ia.array[ma+1]=Ia.y,ia.array[ma+2]=Ia.z,ma+=3;else if(4===ia.size)for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.x,ia.array[ma+1]=Ia.y,ia.array[ma+2]=Ia.z,ia.array[ma+
|
|
|
-3]=Ia.w,ma+=4;j.bindBuffer(j.ARRAY_BUFFER,ia.buffer);j.bufferData(j.ARRAY_BUFFER,ia.array,Sb)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&n(r)}else if(i instanceof THREE.ParticleSystem){r=d(i,l);p=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||p){var lb=l,hc=j.DYNAMIC_DRAW,Lb=i,Ja=void 0,mb=void 0,nb=void 0,T=void 0,ob=void 0,ub=void 0,Yb=lb.vertices,ic=Yb.length,jc=lb.colors,nc=jc.length,wb=lb.__vertexArray,xb=lb.__colorArray,
|
|
|
+3]=Ia.w,ma+=4;j.bindBuffer(j.ARRAY_BUFFER,ia.buffer);j.bufferData(j.ARRAY_BUFFER,ia.array,Sb)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&q(r)}else if(i instanceof THREE.ParticleSystem){r=d(i,l);p=r.attributes&&n(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||p){var lb=l,hc=j.DYNAMIC_DRAW,Lb=i,Ja=void 0,mb=void 0,nb=void 0,T=void 0,ob=void 0,ub=void 0,Yb=lb.vertices,ic=Yb.length,jc=lb.colors,nc=jc.length,wb=lb.__vertexArray,xb=lb.__colorArray,
|
|
|
qb=lb.__sortArray,oc=lb.verticesNeedUpdate,pc=lb.colorsNeedUpdate,rb=lb.__webglCustomAttributesList,$a=void 0,Ab=void 0,Z=void 0,ab=void 0,ga=void 0,S=void 0;if(Lb.sortParticles){gb.copy(Ea);gb.multiply(Lb.matrixWorld);for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],ra.copy(nb),ra.applyProjection(gb),qb[Ja]=[ra.z,Ja];qb.sort(k);for(Ja=0;Ja<ic;Ja++)nb=Yb[qb[Ja][1]],T=3*Ja,wb[T]=nb.x,wb[T+1]=nb.y,wb[T+2]=nb.z;for(mb=0;mb<nc;mb++)T=3*mb,ub=jc[qb[mb][1]],xb[T]=ub.r,xb[T+1]=ub.g,xb[T+2]=ub.b;if(rb){$a=0;for(Ab=rb.length;$a<
|
|
|
Ab;$a++)if(S=rb[$a],void 0===S.boundTo||"vertices"===S.boundTo)if(T=0,ab=S.value.length,1===S.size)for(Z=0;Z<ab;Z++)ob=qb[Z][1],S.array[Z]=S.value[ob];else if(2===S.size)for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.x,S.array[T+1]=ga.y,T+=2;else if(3===S.size)if("c"===S.type)for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.r,S.array[T+1]=ga.g,S.array[T+2]=ga.b,T+=3;else for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,T+=3;else if(4===
|
|
|
S.size)for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,S.array[T+3]=ga.w,T+=4}}else{if(oc)for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],T=3*Ja,wb[T]=nb.x,wb[T+1]=nb.y,wb[T+2]=nb.z;if(pc)for(mb=0;mb<nc;mb++)ub=jc[mb],T=3*mb,xb[T]=ub.r,xb[T+1]=ub.g,xb[T+2]=ub.b;if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(S=rb[$a],S.needsUpdate&&(void 0===S.boundTo||"vertices"===S.boundTo))if(ab=S.value.length,T=0,1===S.size)for(Z=0;Z<ab;Z++)S.array[Z]=S.value[Z];else if(2===S.size)for(Z=
|
|
|
0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.x,S.array[T+1]=ga.y,T+=2;else if(3===S.size)if("c"===S.type)for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.r,S.array[T+1]=ga.g,S.array[T+2]=ga.b,T+=3;else for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,T+=3;else if(4===S.size)for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,S.array[T+3]=ga.w,T+=4}}if(oc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-wb,hc);if(pc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xb,hc);if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(S=rb[$a],S.needsUpdate||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,S.buffer),j.bufferData(j.ARRAY_BUFFER,S.array,hc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&n(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Fb);var i,k,l,m,p;a instanceof THREE.MeshDepthMaterial?p="depth":a instanceof
|
|
|
-THREE.MeshNormalMaterial?p="normal":a instanceof THREE.MeshBasicMaterial?p="basic":a instanceof THREE.MeshLambertMaterial?p="lambert":a instanceof THREE.MeshPhongMaterial?p="phong":a instanceof THREE.LineBasicMaterial?p="basic":a instanceof THREE.LineDashedMaterial?p="dashed":a instanceof THREE.ParticleSystemMaterial&&(p="particle_basic");if(p){var n=THREE.ShaderLib[p];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var q=e=0,r=0,s=
|
|
|
-n=0;for(f=b.length;s<f;s++)h=b[s],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&n++);f=q;h=r;g=n;r=n=0;for(q=b.length;r<q;r++)s=b[r],s.castShadow&&(s instanceof THREE.SpotLight&&n++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&n++);m=n;yb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
|
|
|
-(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,n=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
|
|
|
+wb,hc);if(pc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xb,hc);if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(S=rb[$a],S.needsUpdate||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,S.buffer),j.bufferData(j.ARRAY_BUFFER,S.array,hc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;r.attributes&&q(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Fb);var i,k,l,m,p;a instanceof THREE.MeshDepthMaterial?p="depth":a instanceof
|
|
|
+THREE.MeshNormalMaterial?p="normal":a instanceof THREE.MeshBasicMaterial?p="basic":a instanceof THREE.MeshLambertMaterial?p="lambert":a instanceof THREE.MeshPhongMaterial?p="phong":a instanceof THREE.LineBasicMaterial?p="basic":a instanceof THREE.LineDashedMaterial?p="dashed":a instanceof THREE.ParticleSystemMaterial&&(p="particle_basic");if(p){var n=THREE.ShaderLib[p];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var q=e=0,r=0,t=
|
|
|
+n=0;for(f=b.length;t<f;t++)h=b[t],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&n++);f=q;h=r;g=n;r=n=0;for(q=b.length;r<q;r++)t=b[r],t.castShadow&&(t instanceof THREE.SpotLight&&n++,t instanceof THREE.DirectionalLight&&!t.shadowCascade&&n++);m=n;yb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&
|
|
|
+(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,n=a.uniforms,b=a.attributes,t=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
|
|
|
skinning:a.skinning,maxBones:l,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,
|
|
|
-doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},d=a.index0AttributeName,t,u,v;e=[];p?e.push(p):(e.push(r),e.push(q));for(u in s)e.push(u),e.push(s[u]);for(t in c)e.push(t),e.push(c[t]);p=e.join();t=0;for(u=da.length;t<u;t++)if(e=da[t],e.code===p){e.usedTimes++;k=e.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in s)e=s[v],!1!==e&&(e="#define "+
|
|
|
+doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},d=a.index0AttributeName,s,u,v;e=[];p?e.push(p):(e.push(r),e.push(q));for(u in t)e.push(u),e.push(t[u]);for(s in c)e.push(s),e.push(c[s]);p=e.join();s=0;for(u=da.length;s<u;s++)if(e=da[s],e.code===p){e.usedTimes++;k=e.program;break a}s="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?s="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(s="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(v in t)e=t[v],!1!==e&&(e="#define "+
|
|
|
v+" "+e,u.push(e));e=u.join("\n");v=j.createProgram();u=["precision "+M+" float;","precision "+M+" int;",e,Bb?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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,"#define MAX_BONES "+
|
|
|
c.maxBones,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.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",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 "+M+" float;","precision "+M+" 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:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
+"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+s:"",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");
|
|
|
+s=["precision "+M+" float;","precision "+M+" 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:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.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.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=D("vertex",u+q);t=D("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 n)t.push(w);w=t;t=0;for(u=w.length;t<u;t++)n=w[t],v.uniforms[n]=
|
|
|
-j.getUniformLocation(v,n);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=za++;da.push({program:v,code:p,usedTimes:1});L.info.memory.programs=da.length;k=v}a.program=k;w=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=D("vertex",u+q);s=D("fragment",s+r);j.attachShader(v,u);j.attachShader(v,s);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(s);j.deleteShader(u);v.uniforms={};v.attributes={};var w;s="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(s.push("boneTexture"),s.push("boneTextureWidth"),s.push("boneTextureHeight")):s.push("boneGlobalMatrices");for(w in n)s.push(w);w=s;s=0;for(u=w.length;s<u;s++)n=w[s],v.uniforms[n]=
|
|
|
+j.getUniformLocation(v,n);s="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(w=0;w<c.maxMorphTargets;w++)s.push("morphTarget"+w);for(w=0;w<c.maxMorphNormals;w++)s.push("morphNormal"+w);for(k in b)s.push(k);k=s;w=0;for(b=k.length;w<b;w++)s=k[w],v.attributes[s]=j.getAttribLocation(v,s);v.id=za++;da.push({program:v,code:p,usedTimes:1});L.info.memory.programs=da.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?
|
|
|
j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;Y!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Y=b);U!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),U=a)};this.setDepthTest=function(a){Ga!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Ga=a)};this.setDepthWrite=function(a){ka!==a&&(j.depthMask(a),ka=a)};this.setBlending=function(a,b,c,d){a!==ja&&(a===THREE.NoBlending?j.disable(j.BLEND):
|
|
|
a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,
|
|
@@ -506,8 +507,8 @@ j.viewport(d,e,c,a),ba=b);sb=c;pb=a};this.shadowMapPlugin=new THREE.ShadowMapPlu
|
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;
|
|
|
return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=
|
|
|
-0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,k=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,p=i.length;b<p;b++){var m=i[b].clone();d&&m.applyMatrix4(d);g.push(m)}b=0;for(p=l.length;b<p;b++){var m=l[b],s,t,q=m.vertexNormals,n=m.vertexColors;s=new THREE.Face3(m.a+
|
|
|
-f,m.b+f,m.c+f);s.normal.copy(m.normal);e&&s.normal.applyMatrix3(e).normalize();g=0;for(i=q.length;g<i;g++)t=q[g].clone(),e&&t.applyMatrix3(e).normalize(),s.vertexNormals.push(t);s.color.copy(m.color);g=0;for(i=n.length;g<i;g++)t=n[g],s.vertexColors.push(t.clone());s.materialIndex=m.materialIndex+c;s.centroid.copy(m.centroid);d&&s.centroid.applyMatrix4(d);k.push(s)}b=0;for(p=h.length;b<p;b++){c=h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},randomPointInTriangle:function(){var a=
|
|
|
+0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,k=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,p=i.length;b<p;b++){var m=i[b].clone();d&&m.applyMatrix4(d);g.push(m)}b=0;for(p=l.length;b<p;b++){var m=l[b],t,r,n=m.vertexNormals,q=m.vertexColors;t=new THREE.Face3(m.a+
|
|
|
+f,m.b+f,m.c+f);t.normal.copy(m.normal);e&&t.normal.applyMatrix3(e).normalize();g=0;for(i=n.length;g<i;g++)r=n[g].clone(),e&&r.applyMatrix3(e).normalize(),t.vertexNormals.push(r);t.color.copy(m.color);g=0;for(i=q.length;g<i;g++)r=q[g],t.vertexColors.push(r.clone());t.materialIndex=m.materialIndex+c;t.centroid.copy(m.centroid);d&&t.centroid.applyMatrix4(d);k.push(t)}b=0;for(p=h.length;b<p;b++){c=h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},randomPointInTriangle:function(){var a=
|
|
|
new THREE.Vector3;return function(b,c,d){var e=new THREE.Vector3,f=THREE.Math.random16(),h=THREE.Math.random16();1<f+h&&(f=1-f,h=1-h);var g=1-f-h;e.copy(b);e.multiplyScalar(f);a.copy(c);a.multiplyScalar(h);e.add(a);a.copy(d);a.multiplyScalar(g);e.add(a);return e}}(),randomPointInFace:function(a,b){return THREE.GeometryUtils.randomPointInTriangle(b.vertices[a.a],b.vertices[a.b],b.vertices[a.c])},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-
|
|
|
c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,h=a.vertices,g=f.length,i=0,k=[],l,p,m;for(e=0;e<g;e++)d=f[e],l=h[d.a],p=h[d.b],m=h[d.c],d._area=THREE.GeometryUtils.triangleArea(l,p,m),i+=d._area,k[e]=i;d=[];for(e=0;e<b;e++)h=THREE.Math.random16()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0);return d},triangleArea:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){a.subVectors(d,c);b.subVectors(e,c);a.cross(b);return 0.5*
|
|
|
a.length()}}(),center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},triangulateQuads:function(a){var b,c,d,e,f=[],h=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){f.push(a.faces[b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceVertexUvs=h;a.computeCentroids();
|
|
@@ -518,16 +519,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 l=0;l<a.mipmapCount;l++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+l]),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]&
|
|
|
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,l=0;l<i;l++){for(var p=0;p<d.mipmapCount;p++){if(k){var m;m=f;for(var s=h,t=4*m*s,q=new Uint8Array(a,g,t),t=new Uint8Array(t),n=0,u=0,r=0;r<s;r++)for(var v=0;v<m;v++){var z=q[u];u++;var G=q[u];u++;var w=q[u];u++;var y=q[u];u++;t[n]=w;n++;t[n]=G;n++;t[n]=z;n++;t[n]=y;n++}m=t;s=m.length}else s=
|
|
|
-Math.max(4,f)/4*Math.max(4,h)/4*e,m=new Uint8Array(a,g,s);d.mipmaps.push({data:m,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,l=0;l<
|
|
|
-d;l++)for(var p=0;p<e;p++){var m=0>p-1?0:p-1,s=p+1>e-1?e-1:p+1,t=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,n=[],u=[0,0,g[4*(p*d+l)]/255*b];n.push([-1,0,g[4*(p*d+t)]/255*b]);n.push([-1,-1,g[4*(m*d+t)]/255*b]);n.push([0,-1,g[4*(m*d+l)]/255*b]);n.push([1,-1,g[4*(m*d+q)]/255*b]);n.push([1,0,g[4*(p*d+q)]/255*b]);n.push([1,1,g[4*(s*d+q)]/255*b]);n.push([0,1,g[4*(s*d+l)]/255*b]);n.push([-1,1,g[4*(s*d+t)]/255*b]);m=[];t=n.length;for(s=0;s<t;s++){var q=n[s],r=n[(s+1)%t],q=[q[0]-u[0],q[1]-u[1],q[2]-u[2]],r=[r[0]-u[0],
|
|
|
-r[1]-u[1],r[2]-u[2]];m.push(c([q[1]*r[2]-q[2]*r[1],q[2]*r[0]-q[0]*r[2],q[0]*r[1]-q[1]*r[0]]))}n=[0,0,0];for(s=0;s<m.length;s++)n[0]+=m[s][0],n[1]+=m[s][1],n[2]+=m[s][2];n[0]/=m.length;n[1]/=m.length;n[2]/=m.length;u=4*(p*d+l);k[u]=255*((n[0]+1)/2)|0;k[u+1]=255*((n[1]+1)/2)|0;k[u+2]=255*n[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+
|
|
|
+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,l=0;l<i;l++){for(var p=0;p<d.mipmapCount;p++){if(k){var m;m=f;for(var t=h,r=4*m*t,n=new Uint8Array(a,g,r),r=new Uint8Array(r),q=0,u=0,s=0;s<t;s++)for(var v=0;v<m;v++){var z=n[u];u++;var G=n[u];u++;var w=n[u];u++;var y=n[u];u++;r[q]=w;q++;r[q]=G;q++;r[q]=z;q++;r[q]=y;q++}m=r;t=m.length}else t=
|
|
|
+Math.max(4,f)/4*Math.max(4,h)/4*e,m=new Uint8Array(a,g,t);d.mipmaps.push({data:m,width:f,height:h});g+=t;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,l=0;l<
|
|
|
+d;l++)for(var p=0;p<e;p++){var m=0>p-1?0:p-1,t=p+1>e-1?e-1:p+1,r=0>l-1?0:l-1,n=l+1>d-1?d-1:l+1,q=[],u=[0,0,g[4*(p*d+l)]/255*b];q.push([-1,0,g[4*(p*d+r)]/255*b]);q.push([-1,-1,g[4*(m*d+r)]/255*b]);q.push([0,-1,g[4*(m*d+l)]/255*b]);q.push([1,-1,g[4*(m*d+n)]/255*b]);q.push([1,0,g[4*(p*d+n)]/255*b]);q.push([1,1,g[4*(t*d+n)]/255*b]);q.push([0,1,g[4*(t*d+l)]/255*b]);q.push([-1,1,g[4*(t*d+r)]/255*b]);m=[];r=q.length;for(t=0;t<r;t++){var n=q[t],s=q[(t+1)%r],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],s=[s[0]-u[0],
|
|
|
+s[1]-u[1],s[2]-u[2]];m.push(c([n[1]*s[2]-n[2]*s[1],n[2]*s[0]-n[0]*s[2],n[0]*s[1]-n[1]*s[0]]))}q=[0,0,0];for(t=0;t<m.length;t++)q[0]+=m[t][0],q[1]+=m[t][1],q[2]+=m[t][2];q[0]/=m.length;q[1]/=m.length;q[2]/=m.length;u=4*(p*d+l);k[u]=255*((q[0]+1)/2)|0;k[u+1]=255*((q[1]+1)/2)|0;k[u+2]=255*q[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+
|
|
|
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,l,p,m,s,t,q,n,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;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
-c+d;l=b[a++]*c;s=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(s,t,i,l);if(h=f[f.length-1]){p=h.x;m=h.y;h=1;for(g=this.divisions;h<=g;h++){var r=h/g;THREE.Shape.Utils.b2(r,p,s,i);THREE.Shape.Utils.b2(r,m,t,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,s=b[a++]*c+d,t=b[a++]*-c,q=b[a++]*c+d,n=b[a++]*-c,e.bezierCurveTo(i,l,s,t,q,n),h=f[f.length-1]){p=h.x;m=h.y;h=1;for(g=this.divisions;h<=g;h++)r=h/g,THREE.Shape.Utils.b3(r,p,s,q,i),THREE.Shape.Utils.b3(r,m,t,n,l)}}}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,l,p,m,t,r,n,q,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;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
+c+d;l=b[a++]*c;t=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(t,r,i,l);if(h=f[f.length-1]){p=h.x;m=h.y;h=1;for(g=this.divisions;h<=g;h++){var s=h/g;THREE.Shape.Utils.b2(s,p,t,i);THREE.Shape.Utils.b2(s,m,r,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,t=b[a++]*c+d,r=b[a++]*-c,n=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,t,r,n,q),h=f[f.length-1]){p=h.x;m=h.y;h=1;for(g=this.divisions;h<=g;h++)s=h/g,THREE.Shape.Utils.b3(s,p,t,n,i),THREE.Shape.Utils.b3(s,m,r,q,l)}}}return{offset:u.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};
|
|
|
-(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,l;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 p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{var s=m=void 0,t=void 0,q=void 0,n=void 0,u=void 0,r=void 0,v=void 0,z=
|
|
|
-void 0,s=a[h[i]].x,t=a[h[i]].y,q=a[h[k]].x,n=a[h[k]].y,u=a[h[l]].x,r=a[h[l]].y;if(1E-10>(q-s)*(r-t)-(n-t)*(u-s))m=!1;else{var G=void 0,w=void 0,y=void 0,E=void 0,A=void 0,K=void 0,D=void 0,F=void 0,O=void 0,x=void 0,O=F=D=z=v=void 0,G=u-q,w=r-n,y=s-u,E=t-r,A=q-s,K=n-t;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(v=a[h[m]].x,z=a[h[m]].y,D=v-s,F=z-t,O=v-q,x=z-n,v-=u,z-=r,O=G*x-w*O,D=A*F-K*D,F=y*z-E*v,-1E-10<=O&&-1E-10<=F&&-1E-10<=D){m=!1;break a}m=!0}}if(m){f.push([a[h[i]],a[h[k]],a[h[l]]]);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,l;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 p=2*e;for(k=e-1;2<e;){if(0>=p--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var m;a:{var t=m=void 0,r=void 0,n=void 0,q=void 0,u=void 0,s=void 0,v=void 0,z=
|
|
|
+void 0,t=a[h[i]].x,r=a[h[i]].y,n=a[h[k]].x,q=a[h[k]].y,u=a[h[l]].x,s=a[h[l]].y;if(1E-10>(n-t)*(s-r)-(q-r)*(u-t))m=!1;else{var G=void 0,w=void 0,y=void 0,E=void 0,A=void 0,K=void 0,D=void 0,F=void 0,O=void 0,x=void 0,O=F=D=z=v=void 0,G=u-n,w=s-q,y=t-u,E=r-s,A=n-t,K=q-r;for(m=0;m<e;m++)if(!(m===i||m===k||m===l))if(v=a[h[m]].x,z=a[h[m]].y,D=v-t,F=z-r,O=v-n,x=z-q,v-=u,z-=s,O=G*x-w*O,D=A*F-K*D,F=y*z-E*v,-1E-10<=O&&-1E-10<=F&&-1E-10<=D){m=!1;break a}m=!0}}if(m){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],
|
|
|
h[k],h[l]]);i=k;for(l=k+1;l<e;i++,l++)h[i]=h[l];e--;p=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.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()};
|
|
@@ -548,17 +549,17 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var h=Array.prototype.s
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var h=this.actions[this.actions.length-1].args;this.absarc(a+h[h.length-2],b+h[h.length-1],c,d,e,f)};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,h){var g=this.actions[this.actions.length-1].args;this.absellipse(a+g[g.length-2],b+g[g.length-1],c,d,e,f,h)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,h){var g=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,h);this.curves.push(i);i=i.getPoint(1);g.push(i.x);g.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:g})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,h,g,i,k,l,p,m,s,t,q;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];p=f[0];m=f[1];0<c.length?(h=c[c.length-1],s=h.x,
|
|
|
-t=h.y):(h=this.actions[d-1].args,s=h[h.length-2],t=h[h.length-1]);for(f=1;f<=a;f++)q=f/a,h=THREE.Shape.Utils.b2(q,s,p,g),q=THREE.Shape.Utils.b2(q,t,m,i),c.push(new THREE.Vector2(h,q));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];p=f[0];m=f[1];k=f[2];l=f[3];0<c.length?(h=c[c.length-1],s=h.x,t=h.y):(h=this.actions[d-1].args,s=h[h.length-2],t=h[h.length-1]);for(f=1;f<=a;f++)q=f/a,h=THREE.Shape.Utils.b3(q,s,p,k,g),q=THREE.Shape.Utils.b3(q,t,m,l,i),c.push(new THREE.Vector2(h,q));break;case THREE.PathActions.CSPLINE_THRU:h=
|
|
|
-this.actions[d-1].args;q=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;q=q.concat(f[0]);q=new THREE.SplineCurve(q);for(f=1;f<=h;f++)c.push(q.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];m=f[2];k=f[3];h=f[4];p=!!f[5];s=h-k;t=2*a;for(f=1;f<=t;f++)q=f/t,p||(q=1-q),q=k+q*s,h=g+m*Math.cos(q),q=i+m*Math.sin(q),c.push(new THREE.Vector2(h,q));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];m=f[2];l=f[3];k=f[4];h=f[5];p=!!f[6];s=h-k;t=2*a;for(f=1;f<=t;f++)q=f/t,p||
|
|
|
-(q=1-q),q=k+q*s,h=g+m*Math.cos(q),q=i+l*Math.sin(q),c.push(new THREE.Vector2(h,q))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,h,g,i,k,l,p,m,t,r,n;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];p=f[0];m=f[1];0<c.length?(h=c[c.length-1],t=h.x,
|
|
|
+r=h.y):(h=this.actions[d-1].args,t=h[h.length-2],r=h[h.length-1]);for(f=1;f<=a;f++)n=f/a,h=THREE.Shape.Utils.b2(n,t,p,g),n=THREE.Shape.Utils.b2(n,r,m,i),c.push(new THREE.Vector2(h,n));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];p=f[0];m=f[1];k=f[2];l=f[3];0<c.length?(h=c[c.length-1],t=h.x,r=h.y):(h=this.actions[d-1].args,t=h[h.length-2],r=h[h.length-1]);for(f=1;f<=a;f++)n=f/a,h=THREE.Shape.Utils.b3(n,t,p,k,g),n=THREE.Shape.Utils.b3(n,r,m,l,i),c.push(new THREE.Vector2(h,n));break;case THREE.PathActions.CSPLINE_THRU:h=
|
|
|
+this.actions[d-1].args;n=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;n=n.concat(f[0]);n=new THREE.SplineCurve(n);for(f=1;f<=h;f++)c.push(n.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];m=f[2];k=f[3];h=f[4];p=!!f[5];t=h-k;r=2*a;for(f=1;f<=r;f++)n=f/r,p||(n=1-n),n=k+n*t,h=g+m*Math.cos(n),n=i+m*Math.sin(n),c.push(new THREE.Vector2(h,n));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];m=f[2];l=f[3];k=f[4];h=f[5];p=!!f[6];t=h-k;r=2*a;for(f=1;f<=r;f++)n=f/r,p||
|
|
|
+(n=1-n),n=k+n*t,h=g+m*Math.cos(n),n=i+l*Math.sin(n),c.push(new THREE.Vector2(h,n))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
THREE.Path.prototype.toShapes=function(a){var b,c,d,e,f=[],h=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)d=this.actions[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=h.actions.length&&(f.push(h),h=new THREE.Path),h[d].apply(h,e);0!=h.actions.length&&f.push(h);if(0==f.length)return[];var g;e=[];if(1==f.length)return d=f[0],g=new THREE.Shape,g.actions=d.actions,g.curves=d.curves,e.push(g),e;b=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(a?!b:b){g=new THREE.Shape;b=0;for(c=
|
|
|
f.length;b<c;b++)d=f[b],h=THREE.Shape.Utils.isClockWise(d.getPoints()),(h=a?!h:h)?(g.actions=d.actions,g.curves=d.curves,e.push(g),g=new THREE.Shape):g.holes.push(d)}else{g=void 0;b=0;for(c=f.length;b<c;b++)d=f[b],h=THREE.Shape.Utils.isClockWise(d.getPoints()),(h=a?!h:h)?(g&&e.push(g),g=new THREE.Shape,g.actions=d.actions,g.curves=d.curves):g.holes.push(d);e.push(g)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,k,l,p,m,s,t=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];s=[];for(p=0;p<c.length;p++)l=c[p],l=m.distanceToSquared(l),s.push(l),l<f&&(f=l,h=e,g=p)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;var q=[k[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(q);var n=[k[h],k[f],c[g]];m=THREE.FontUtils.Triangulate.area(n);s=g;l=h;g+=1;h+=-1;0>
|
|
|
-g&&(g+=c.length);g%=c.length;0>h&&(h+=k.length);h%=k.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;q=[k[h],c[g],c[e]];q=THREE.FontUtils.Triangulate.area(q);n=[k[h],k[f],c[g]];n=THREE.FontUtils.Triangulate.area(n);p+m>q+n&&(g=s,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=k.length),h%=k.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:k.length-1);p=c.slice(0,g);m=c.slice(g);s=k.slice(h);l=k.slice(0,h);f=[k[h],k[f],c[g]];t.push([k[h],c[g],c[e]]);t.push(f);c=p.concat(s).concat(l).concat(m)}return{shape:c,
|
|
|
-isolatedPts:t,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,k={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,k,l,p,m,t,r=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){m=k[e];t=[];for(p=0;p<c.length;p++)l=c[p],l=m.distanceToSquared(l),t.push(l),l<f&&(f=l,h=e,g=p)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;var n=[k[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(n);var q=[k[h],k[f],c[g]];m=THREE.FontUtils.Triangulate.area(q);t=g;l=h;g+=1;h+=-1;0>
|
|
|
+g&&(g+=c.length);g%=c.length;0>h&&(h+=k.length);h%=k.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;n=[k[h],c[g],c[e]];n=THREE.FontUtils.Triangulate.area(n);q=[k[h],k[f],c[g]];q=THREE.FontUtils.Triangulate.area(q);p+m>n+q&&(g=t,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=k.length),h%=k.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:k.length-1);p=c.slice(0,g);m=c.slice(g);t=k.slice(h);l=k.slice(0,h);f=[k[h],k[f],c[g]];r.push([k[h],c[g],c[e]]);r.push(f);c=p.concat(t).concat(l).concat(m)}return{shape:c,
|
|
|
+isolatedPts:r,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,k={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
|
|
|
THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};
|
|
@@ -572,7 +573,7 @@ b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];e.matrixAutoUpdate=!0;void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:e.matrix);var f=e.animationCache.prevKey;e=e.animationCache.nextKey;
|
|
|
f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.Animation.prototype.pause=function(){!0===this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this)};
|
|
|
-THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,h,g,i,k,l;for(l=this.currentTime+=a*this.timeScale;this.currentTime>this.data.length;)this.currentTime-=this.data.length;k=this.currentTime%=this.data.length;parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,m=this.hierarchy.length;p<m;p++){a=this.hierarchy[p];i=a.animationCache;for(var s=0;3>s;s++){c=b[s];h=i.prevKey[c];g=i.nextKey[c];if(g.time<=l){if(k<=l)if(this.loop){h=
|
|
|
+THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,h,g,i,k,l;for(l=this.currentTime+=a*this.timeScale;this.currentTime>this.data.length;)this.currentTime-=this.data.length;k=this.currentTime%=this.data.length;parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,m=this.hierarchy.length;p<m;p++){a=this.hierarchy[p];i=a.animationCache;for(var t=0;3>t;t++){c=b[t];h=i.prevKey[c];g=i.nextKey[c];if(g.time<=l){if(k<=l)if(this.loop){h=
|
|
|
this.data.hierarchy[p].keys[0];for(g=this.getNextKeyWith(c,p,1);null!==g&&g.time<k&&g.index>h.index;)h=g,g=this.getNextKeyWith(c,p,g.index+1)}else{this.stop();return}else{do h=g,g=this.getNextKeyWith(c,p,g.index+1);while(null!==g&&g.time<k&&g.index>h.index)}i.prevKey[c]=h;i.nextKey[c]=g}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(k-h.time)/(g.time-h.time);e=h[c];f=g[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p),d=0>d?0:1;if("pos"===c)if(c=
|
|
|
a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",p,h.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",p,g.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],
|
|
|
this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}};
|
|
@@ -595,34 +596,34 @@ 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.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,
|
|
|
-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 n,u=g.widthSegments,r=g.heightSegments,v=e/2,z=f/2,G=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)n="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)n="y",r=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)n="x",u=g.depthSegments;var w=u+1,y=r+1,E=e/u,A=f/r,K=new THREE.Vector3;K[n]=0<h?1:-1;for(e=0;e<y;e++)for(f=0;f<w;f++){var D=new THREE.Vector3;D[a]=(f*E-v)*c;D[b]=(e*A-z)*d;D[n]=h;g.vertices.push(D)}for(e=
|
|
|
-0;e<r;e++)for(f=0;f<u;f++)z=f+w*e,a=f+w*(e+1),b=f+1+w*(e+1),c=f+1+w*e,d=new THREE.Vector2(f/u,1-e/r),h=new THREE.Vector2(f/u,1-(e+1)/r),n=new THREE.Vector2((f+1)/u,1-(e+1)/r),v=new THREE.Vector2((f+1)/u,1-e/r),z=new THREE.Face3(z+G,a+G,c+G),z.normal.copy(K),z.vertexNormals.push(K.clone(),K.clone(),K.clone()),z.materialIndex=q,g.faces.push(z),g.faceVertexUvs[0].push([d,h,v]),z=new THREE.Face3(a+G,b+G,c+G),z.normal.copy(K),z.vertexNormals.push(K.clone(),K.clone(),K.clone()),z.materialIndex=q,g.faces.push(z),
|
|
|
-g.faceVertexUvs[0].push([h.clone(),n,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=[],l=[];for(i=0;i<=e;i++){var p=[],m=[],s=i/e,t=s*(b-a)+a;for(g=0;g<=d;g++){var q=g/d,n=new THREE.Vector3;n.x=t*Math.sin(2*q*Math.PI);n.y=-s*c+h;n.z=t*Math.cos(2*q*Math.PI);this.vertices.push(n);p.push(this.vertices.length-1);m.push(new THREE.Vector2(q,
|
|
|
-1-s))}k.push(p);l.push(m)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(p=this.vertices[k[0][g]].clone(),m=this.vertices[k[0][g+1]].clone()):(p=this.vertices[k[1][g]].clone(),m=this.vertices[k[1][g+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][g],t=k[i+1][g],q=k[i+1][g+1],n=k[i][g+1],u=p.clone(),r=p.clone(),v=m.clone(),z=m.clone(),G=l[i][g].clone(),w=l[i+1][g].clone(),y=l[i+1][g+1].clone(),E=l[i][g+1].clone();this.faces.push(new THREE.Face3(s,
|
|
|
-t,n,[u,r,z]));this.faceVertexUvs[0].push([G,w,E]);this.faces.push(new THREE.Face3(t,q,n,[r.clone(),v,z.clone()]));this.faceVertexUvs[0].push([w.clone(),y,E.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],t=k[0][g+1],q=this.vertices.length-1,u=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),G=l[0][g].clone(),w=l[0][g+1].clone(),y=new THREE.Vector2(w.x,0),this.faces.push(new THREE.Face3(s,t,q,[u,r,v])),this.faceVertexUvs[0].push([G,
|
|
|
-w,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],t=k[i][g],q=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),G=l[i][g+1].clone(),w=l[i][g].clone(),y=new THREE.Vector2(w.x,1),this.faces.push(new THREE.Face3(s,t,q,[u,r,v])),this.faceVertexUvs[0].push([G,w,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)};
|
|
|
+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,n){var q,u=g.widthSegments,s=g.heightSegments,v=e/2,z=f/2,G=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",s=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",u=g.depthSegments;var w=u+1,y=s+1,E=e/u,A=f/s,K=new THREE.Vector3;K[q]=0<h?1:-1;for(e=0;e<y;e++)for(f=0;f<w;f++){var D=new THREE.Vector3;D[a]=(f*E-v)*c;D[b]=(e*A-z)*d;D[q]=h;g.vertices.push(D)}for(e=
|
|
|
+0;e<s;e++)for(f=0;f<u;f++)z=f+w*e,a=f+w*(e+1),b=f+1+w*(e+1),c=f+1+w*e,d=new THREE.Vector2(f/u,1-e/s),h=new THREE.Vector2(f/u,1-(e+1)/s),q=new THREE.Vector2((f+1)/u,1-(e+1)/s),v=new THREE.Vector2((f+1)/u,1-e/s),z=new THREE.Face3(z+G,a+G,c+G),z.normal.copy(K),z.vertexNormals.push(K.clone(),K.clone(),K.clone()),z.materialIndex=n,g.faces.push(z),g.faceVertexUvs[0].push([d,h,v]),z=new THREE.Face3(a+G,b+G,c+G),z.normal.copy(K),z.vertexNormals.push(K.clone(),K.clone(),K.clone()),z.materialIndex=n,g.faces.push(z),
|
|
|
+g.faceVertexUvs[0].push([h.clone(),q,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=[],l=[];for(i=0;i<=e;i++){var p=[],m=[],t=i/e,r=t*(b-a)+a;for(g=0;g<=d;g++){var n=g/d,q=new THREE.Vector3;q.x=r*Math.sin(2*n*Math.PI);q.y=-t*c+h;q.z=r*Math.cos(2*n*Math.PI);this.vertices.push(q);p.push(this.vertices.length-1);m.push(new THREE.Vector2(n,
|
|
|
+1-t))}k.push(p);l.push(m)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(p=this.vertices[k[0][g]].clone(),m=this.vertices[k[0][g+1]].clone()):(p=this.vertices[k[1][g]].clone(),m=this.vertices[k[1][g+1]].clone());p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<e;i++){var t=k[i][g],r=k[i+1][g],n=k[i+1][g+1],q=k[i][g+1],u=p.clone(),s=p.clone(),v=m.clone(),z=m.clone(),G=l[i][g].clone(),w=l[i+1][g].clone(),y=l[i+1][g+1].clone(),E=l[i][g+1].clone();this.faces.push(new THREE.Face3(t,
|
|
|
+r,q,[u,s,z]));this.faceVertexUvs[0].push([G,w,E]);this.faces.push(new THREE.Face3(r,n,q,[s.clone(),v,z.clone()]));this.faceVertexUvs[0].push([w.clone(),y,E.clone()])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)t=k[0][g],r=k[0][g+1],n=this.vertices.length-1,u=new THREE.Vector3(0,1,0),s=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),G=l[0][g].clone(),w=l[0][g+1].clone(),y=new THREE.Vector2(w.x,0),this.faces.push(new THREE.Face3(t,r,n,[u,s,v])),this.faceVertexUvs[0].push([G,
|
|
|
+w,y])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)t=k[i][g+1],r=k[i][g],n=this.vertices.length-1,u=new THREE.Vector3(0,-1,0),s=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),G=l[i][g+1].clone(),w=l[i][g].clone(),y=new THREE.Vector2(w.x,1),this.faces.push(new THREE.Face3(t,r,n,[u,s,v])),this.faceVertexUvs[0].push([G,w,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();
|
|
|
-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*l,
|
|
|
-g=0;g<h;g++){var i=ca*g,k=ca*(g+1),m=d+e+i,i=d+f+i,p=d+f+k,k=d+e+k,n=c,q=g,t=h,u=e,w=f,m=m+F,i=i+F,p=p+F,k=k+F;D.faces.push(new THREE.Face3(m,i,k,null,null,r));D.faces.push(new THREE.Face3(i,p,k,null,null,r));m=v.generateSideWallUV(D,a,n,b,m,i,p,k,q,t,u,w);D.faceVertexUvs[0].push([m[0],m[1],m[3]]);D.faceVertexUvs[0].push([m[1],m[2],m[3]])}}}function f(a,b,c){D.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=F;d+=F;e+=F;D.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?v.generateBottomUV(D,
|
|
|
-a,b,c,d,e):v.generateTopUV(D,a,b,c,d,e);D.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,l=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,t=b.extrudePath,q,n=!1,u=b.material,r=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,z,G,w,y;t&&(q=
|
|
|
-t.getSpacedPoints(s),n=!0,p=!1,z=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,s,!1),G=new THREE.Vector3,w=new THREE.Vector3,y=new THREE.Vector3);p||(k=i=l=0);var E,A,K,D=this,F=this.vertices.length,m=a.extractPoints(m),O=m.shape,m=m.holes;if(t=!THREE.Shape.Utils.isClockWise(O)){O=O.reverse();A=0;for(K=m.length;A<K;A++)E=m[A],THREE.Shape.Utils.isClockWise(E)&&(m[A]=E.reverse());t=!1}var x=THREE.Shape.Utils.triangulateShape(O,m),t=O;A=0;for(K=m.length;A<K;A++)E=m[A],O=O.concat(E);
|
|
|
-var I,B,M,J,ca=O.length,na=x.length,pa=[],C=0,Q=t.length;I=Q-1;for(B=C+1;C<Q;C++,I++,B++)I===Q&&(I=0),B===Q&&(B=0),pa[C]=d(t[C],t[I],t[B]);var R=[],L,da=pa.concat();A=0;for(K=m.length;A<K;A++){E=m[A];L=[];C=0;Q=E.length;I=Q-1;for(B=C+1;C<Q;C++,I++,B++)I===Q&&(I=0),B===Q&&(B=0),L[C]=d(E[C],E[I],E[B]);R.push(L);da=da.concat(L)}for(I=0;I<l;I++){E=I/l;M=i*(1-E);B=k*Math.sin(E*Math.PI/2);C=0;for(Q=t.length;C<Q;C++)J=c(t[C],pa[C],B),f(J.x,J.y,-M);A=0;for(K=m.length;A<K;A++){E=m[A];L=R[A];C=0;for(Q=E.length;C<
|
|
|
-Q;C++)J=c(E[C],L[C],B),f(J.x,J.y,-M)}}B=k;for(C=0;C<ca;C++)J=p?c(O[C],da[C],B):O[C],n?(w.copy(z.normals[0]).multiplyScalar(J.x),G.copy(z.binormals[0]).multiplyScalar(J.y),y.copy(q[0]).add(w).add(G),f(y.x,y.y,y.z)):f(J.x,J.y,0);for(E=1;E<=s;E++)for(C=0;C<ca;C++)J=p?c(O[C],da[C],B):O[C],n?(w.copy(z.normals[E]).multiplyScalar(J.x),G.copy(z.binormals[E]).multiplyScalar(J.y),y.copy(q[E]).add(w).add(G),f(y.x,y.y,y.z)):f(J.x,J.y,g/s*E);for(I=l-1;0<=I;I--){E=I/l;M=i*(1-E);B=k*Math.sin(E*Math.PI/2);C=0;for(Q=
|
|
|
-t.length;C<Q;C++)J=c(t[C],pa[C],B),f(J.x,J.y,g+M);A=0;for(K=m.length;A<K;A++){E=m[A];L=R[A];C=0;for(Q=E.length;C<Q;C++)J=c(E[C],L[C],B),n?f(J.x,J.y+q[s-1].y,q[s-1].x+M):f(J.x,J.y,g+M)}}if(p){i=0*ca;for(C=0;C<na;C++)g=x[C],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ca*(s+2*l);for(C=0;C<na;C++)g=x[C],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(C=0;C<na;C++)g=x[C],h(g[2],g[1],g[0],!0);for(C=0;C<na;C++)g=x[C],h(g[0]+ca*s,g[1]+ca*s,g[2]+ca*s,!1)}g=0;e(t,g);g+=t.length;A=0;for(K=m.length;A<K;A++)E=m[A],e(E,g),g+=E.length};
|
|
|
+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=t+2*l,
|
|
|
+g=0;g<h;g++){var i=ca*g,k=ca*(g+1),m=d+e+i,i=d+f+i,p=d+f+k,k=d+e+k,n=c,q=g,r=h,u=e,w=f,m=m+F,i=i+F,p=p+F,k=k+F;D.faces.push(new THREE.Face3(m,i,k,null,null,s));D.faces.push(new THREE.Face3(i,p,k,null,null,s));m=v.generateSideWallUV(D,a,n,b,m,i,p,k,q,r,u,w);D.faceVertexUvs[0].push([m[0],m[1],m[3]]);D.faceVertexUvs[0].push([m[1],m[2],m[3]])}}}function f(a,b,c){D.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=F;d+=F;e+=F;D.faces.push(new THREE.Face3(c,d,e,null,null,u));c=f?v.generateBottomUV(D,
|
|
|
+a,b,c,d,e):v.generateTopUV(D,a,b,c,d,e);D.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,l=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,r=b.extrudePath,n,q=!1,u=b.material,s=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,z,G,w,y;r&&(n=
|
|
|
+r.getSpacedPoints(t),q=!0,p=!1,z=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,t,!1),G=new THREE.Vector3,w=new THREE.Vector3,y=new THREE.Vector3);p||(k=i=l=0);var E,A,K,D=this,F=this.vertices.length,m=a.extractPoints(m),O=m.shape,m=m.holes;if(r=!THREE.Shape.Utils.isClockWise(O)){O=O.reverse();A=0;for(K=m.length;A<K;A++)E=m[A],THREE.Shape.Utils.isClockWise(E)&&(m[A]=E.reverse());r=!1}var x=THREE.Shape.Utils.triangulateShape(O,m),r=O;A=0;for(K=m.length;A<K;A++)E=m[A],O=O.concat(E);
|
|
|
+var I,B,M,J,ca=O.length,na=x.length,pa=[],C=0,Q=r.length;I=Q-1;for(B=C+1;C<Q;C++,I++,B++)I===Q&&(I=0),B===Q&&(B=0),pa[C]=d(r[C],r[I],r[B]);var R=[],L,da=pa.concat();A=0;for(K=m.length;A<K;A++){E=m[A];L=[];C=0;Q=E.length;I=Q-1;for(B=C+1;C<Q;C++,I++,B++)I===Q&&(I=0),B===Q&&(B=0),L[C]=d(E[C],E[I],E[B]);R.push(L);da=da.concat(L)}for(I=0;I<l;I++){E=I/l;M=i*(1-E);B=k*Math.sin(E*Math.PI/2);C=0;for(Q=r.length;C<Q;C++)J=c(r[C],pa[C],B),f(J.x,J.y,-M);A=0;for(K=m.length;A<K;A++){E=m[A];L=R[A];C=0;for(Q=E.length;C<
|
|
|
+Q;C++)J=c(E[C],L[C],B),f(J.x,J.y,-M)}}B=k;for(C=0;C<ca;C++)J=p?c(O[C],da[C],B):O[C],q?(w.copy(z.normals[0]).multiplyScalar(J.x),G.copy(z.binormals[0]).multiplyScalar(J.y),y.copy(n[0]).add(w).add(G),f(y.x,y.y,y.z)):f(J.x,J.y,0);for(E=1;E<=t;E++)for(C=0;C<ca;C++)J=p?c(O[C],da[C],B):O[C],q?(w.copy(z.normals[E]).multiplyScalar(J.x),G.copy(z.binormals[E]).multiplyScalar(J.y),y.copy(n[E]).add(w).add(G),f(y.x,y.y,y.z)):f(J.x,J.y,g/t*E);for(I=l-1;0<=I;I--){E=I/l;M=i*(1-E);B=k*Math.sin(E*Math.PI/2);C=0;for(Q=
|
|
|
+r.length;C<Q;C++)J=c(r[C],pa[C],B),f(J.x,J.y,g+M);A=0;for(K=m.length;A<K;A++){E=m[A];L=R[A];C=0;for(Q=E.length;C<Q;C++)J=c(E[C],L[C],B),q?f(J.x,J.y+n[t-1].y,n[t-1].x+M):f(J.x,J.y,g+M)}}if(p){i=0*ca;for(C=0;C<na;C++)g=x[C],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ca*(t+2*l);for(C=0;C<na;C++)g=x[C],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(C=0;C<na;C++)g=x[C],h(g[2],g[1],g[0],!0);for(C=0;C<na;C++)g=x[C],h(g[0]+ca*t,g[1]+ca*t,g[2]+ca*t,!1)}g=0;e(r,g);g+=r.length;A=0;for(K=m.length;A<K;A++)E=m[A],e(E,g),g+=E.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,
|
|
|
l=a.vertices[h].y,h=a.vertices[h].z,p=a.vertices[g].x,m=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(p,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-h),new THREE.Vector2(m,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.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,h,g=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,k=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=k.length;e<f;e++)h=k[e],THREE.Shape.Utils.isClockWise(h)&&(k[e]=h.reverse())}var l=THREE.Shape.Utils.triangulateShape(i,k);e=0;for(f=k.length;e<f;e++)h=k[e],
|
|
|
-i=i.concat(h);k=i.length;f=l.length;for(e=0;e<k;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+g,h=k[1]+g,k=k[2]+g,this.faces.push(new THREE.Face3(i,h,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,k=Math.cos(i),l=Math.sin(i),i=0,p=a.length;i<p;i++){var m=a[i],s=new THREE.Vector3;s.x=k*m.x-l*m.y;s.y=l*m.x+k*m.y;s.z=m.z;this.vertices.push(s)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(p=a.length-1;i<p;i++){var b=l=i+c*h,d=l+c,k=l+1+c,l=l+1,m=h*f,s=i*e,t=m+f,q=s+e;this.faces.push(new THREE.Face3(b,d,l));this.faceVertexUvs[0].push([new THREE.Vector2(m,
|
|
|
-s),new THREE.Vector2(t,s),new THREE.Vector2(m,q)]);this.faces.push(new THREE.Face3(d,k,l));this.faceVertexUvs[0].push([new THREE.Vector2(t,s),new THREE.Vector2(t,q),new THREE.Vector2(m,q)])}}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var e=a/2,f=b/2,c=this.widthSegments,d=this.heightSegments,h=c+1,g=d+1,i=this.width/c,k=this.height/d,l=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var p=b+h*a,e=b+h*(a+1),f=b+1+h*(a+1),g=b+1+h*a,i=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+1)/
|
|
|
-d),m=new THREE.Vector2((b+1)/c,1-(a+1)/d),s=new THREE.Vector2((b+1)/c,1-a/d),p=new THREE.Face3(p,e,g);p.normal.copy(l);p.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(p);this.faceVertexUvs[0].push([i,k,s]);p=new THREE.Face3(e,f,g);p.normal.copy(l);p.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(p);this.faceVertexUvs[0].push([k.clone(),m,s.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,h,g=[],i=a,k=(b-a)/d,a=0;a<=d;a++){for(h=0;h<=c;h++){var l=new THREE.Vector3,p=e+h/c*f;l.x=i*Math.cos(p);l.y=i*Math.sin(p);this.vertices.push(l);g.push(new THREE.Vector2((l.x/b+1)/2,(l.y/b+1)/2))}i+=k}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){e=a*c;for(h=0;h<=c;h++)p=h+e,f=p+a,k=p+c+a,l=p+c+1+a,this.faces.push(new THREE.Face3(f,
|
|
|
-k,l,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([g[f].clone(),g[k].clone(),g[l].clone()]),f=p+a,k=p+c+1+a,l=p+1+a,this.faces.push(new THREE.Face3(f,k,l,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([g[f].clone(),g[k].clone(),g[l].clone()])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,i)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,k=[],l=[];for(i=0;i<=c;i++){var p=[],m=[];for(g=0;g<=b;g++){var s=g/b,t=i/c,q=new THREE.Vector3;q.x=-a*Math.cos(d+s*e)*Math.sin(f+t*h);q.y=a*Math.cos(f+t*h);
|
|
|
-q.z=a*Math.sin(d+s*e)*Math.sin(f+t*h);this.vertices.push(q);p.push(this.vertices.length-1);m.push(new THREE.Vector2(s,1-t))}k.push(p);l.push(m)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=k[i][g+1],c=k[i][g],d=k[i+1][g],e=k[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),s=l[i][g+1].clone(),t=l[i][g].clone(),q=l[i+1][g].clone(),n=l[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
-this.radius?(s.x=(s.x+t.x)/2,this.faces.push(new THREE.Face3(b,d,e,[f,p,m])),this.faceVertexUvs[0].push([s,q,n])):Math.abs(this.vertices[d].y)===this.radius?(q.x=(q.x+n.x)/2,this.faces.push(new THREE.Face3(b,c,d,[f,h,p])),this.faceVertexUvs[0].push([s,t,q])):(this.faces.push(new THREE.Face3(b,c,e,[f,h,m])),this.faceVertexUvs[0].push([s,t,n]),this.faces.push(new THREE.Face3(c,d,e,[h.clone(),p,m.clone()])),this.faceVertexUvs[0].push([t.clone(),q,n.clone()]))}this.computeCentroids();this.computeFaceNormals();
|
|
|
+i=i.concat(h);k=i.length;f=l.length;for(e=0;e<k;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+g,h=k[1]+g,k=k[2]+g,this.faces.push(new THREE.Face3(i,h,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,k=Math.cos(i),l=Math.sin(i),i=0,p=a.length;i<p;i++){var m=a[i],t=new THREE.Vector3;t.x=k*m.x-l*m.y;t.y=l*m.x+k*m.y;t.z=m.z;this.vertices.push(t)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(p=a.length-1;i<p;i++){var b=l=i+c*h,d=l+c,k=l+1+c,l=l+1,m=h*f,t=i*e,r=m+f,n=t+e;this.faces.push(new THREE.Face3(b,d,l));this.faceVertexUvs[0].push([new THREE.Vector2(m,
|
|
|
+t),new THREE.Vector2(r,t),new THREE.Vector2(m,n)]);this.faces.push(new THREE.Face3(d,k,l));this.faceVertexUvs[0].push([new THREE.Vector2(r,t),new THREE.Vector2(r,n),new THREE.Vector2(m,n)])}}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var e=a/2,f=b/2,c=this.widthSegments,d=this.heightSegments,h=c+1,g=d+1,i=this.width/c,k=this.height/d,l=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var p=b+h*a,e=b+h*(a+1),f=b+1+h*(a+1),g=b+1+h*a,i=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+1)/
|
|
|
+d),m=new THREE.Vector2((b+1)/c,1-(a+1)/d),t=new THREE.Vector2((b+1)/c,1-a/d),p=new THREE.Face3(p,e,g);p.normal.copy(l);p.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(p);this.faceVertexUvs[0].push([i,k,t]);p=new THREE.Face3(e,f,g);p.normal.copy(l);p.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(p);this.faceVertexUvs[0].push([k.clone(),m,t.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,h,g=[],i=a,k=(b-a)/d,a=0;a<=d;a++){for(h=0;h<=c;h++){var l=new THREE.Vector3,p=e+h/c*f;l.x=i*Math.cos(p);l.y=i*Math.sin(p);this.vertices.push(l);g.push(new THREE.Vector2((l.x/b+1)/2,(l.y/b+1)/2))}i+=k}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){e=a*c;for(h=0;h<=c;h++)p=h+e,f=p+a,k=p+c+a,l=p+c+1+a,this.faces.push(new THREE.Face3(f,
|
|
|
+k,l,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([g[f].clone(),g[k].clone(),g[l].clone()]),f=p+a,k=p+c+1+a,l=p+1+a,this.faces.push(new THREE.Face3(f,k,l,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([g[f].clone(),g[k].clone(),g[l].clone()])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,i)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,k=[],l=[];for(i=0;i<=c;i++){var p=[],m=[];for(g=0;g<=b;g++){var t=g/b,r=i/c,n=new THREE.Vector3;n.x=-a*Math.cos(d+t*e)*Math.sin(f+r*h);n.y=a*Math.cos(f+r*h);
|
|
|
+n.z=a*Math.sin(d+t*e)*Math.sin(f+r*h);this.vertices.push(n);p.push(this.vertices.length-1);m.push(new THREE.Vector2(t,1-r))}k.push(p);l.push(m)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=k[i][g+1],c=k[i][g],d=k[i+1][g],e=k[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),t=l[i][g+1].clone(),r=l[i][g].clone(),n=l[i+1][g].clone(),q=l[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
+this.radius?(t.x=(t.x+r.x)/2,this.faces.push(new THREE.Face3(b,d,e,[f,p,m])),this.faceVertexUvs[0].push([t,n,q])):Math.abs(this.vertices[d].y)===this.radius?(n.x=(n.x+q.x)/2,this.faces.push(new THREE.Face3(b,c,d,[f,h,p])),this.faceVertexUvs[0].push([t,r,n])):(this.faces.push(new THREE.Face3(b,c,e,[f,h,m])),this.faceVertexUvs[0].push([t,r,q]),this.faces.push(new THREE.Face3(c,d,e,[h.clone(),p,m.clone()])),this.faceVertexUvs[0].push([r.clone(),n,q.clone()]))}this.computeCentroids();this.computeFaceNormals();
|
|
|
this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var b=b||{},c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,h=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var g=new THREE.Vector3;g.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);g.y=(this.radius+this.tube*
|
|
|
-Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(g.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,h=(this.tubularSegments+1)*(c-1)+d,g=(this.tubularSegments+1)*c+d,i=new THREE.Face3(e,f,g,[b[e],b[f],b[g]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[g]);i.normal.normalize();
|
|
|
-this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone()]);i=new THREE.Face3(f,h,g,[b[f],b[h],b[g]]);i.normal.add(b[f]);i.normal.add(b[h]);i.normal.add(b[g]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a),a=b/c*a,b=Math.cos(a),f=0.5*(d*(2+b))*f,g=0.5*d*(2+b)*g,d=0.5*e*d*Math.sin(a);return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
+Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(g.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,h=(this.tubularSegments+1)*(c-1)+d,g=(this.tubularSegments+1)*c+d,i=new THREE.Face3(e,f,g,[b[e].clone(),b[f].clone(),b[g].clone()]);this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),
|
|
|
+a[f].clone(),a[g].clone()]);i=new THREE.Face3(f,h,g,[b[f].clone(),b[h].clone(),b[g].clone()]);this.faces.push(i);this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids();this.computeFaceNormals()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a),a=b/c*a,b=Math.cos(a),f=0.5*(d*(2+b))*f,g=0.5*d*(2+b)*g,d=0.5*e*d*Math.sin(a);return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
Array(this.tubularSegments);b=2*(a/this.radialSegments)*this.p*Math.PI;f=g(b,this.q,this.p,this.radius,this.heightScale);b=g(b+0.01,this.q,this.p,this.radius,this.heightScale);c.subVectors(b,f);d.addVectors(b,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();for(b=0;b<this.tubularSegments;++b){var i=2*(b/this.tubularSegments)*Math.PI,h=-this.tube*Math.cos(i),i=this.tube*Math.sin(i),k=new THREE.Vector3;k.x=f.x+h*d.x+i*e.x;k.y=f.y+h*d.y+i*e.y;k.z=f.z+h*d.z+i*e.z;this.grid[a][b]=
|
|
|
this.vertices.push(k)-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),k=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),l=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);
|
|
|
this.faces.push(new THREE.Face3(c,d,f));this.faceVertexUvs[0].push([h,i,l]);this.faces.push(new THREE.Face3(d,e,f));this.faceVertexUvs[0].push([i.clone(),k,l.clone()])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radialSegments=d||8;this.closed=e||!1;this.grid=[];var f,h,d=this.segments+1,g,i,k,e=new THREE.Vector3,l,p,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);l=b.normals;p=b.binormals;this.tangents=b.tangents;this.normals=l;this.binormals=p;for(b=0;b<d;b++){this.grid[b]=[];c=b/(d-1);k=a.getPointAt(c);f=l[b];h=p[b];for(c=0;c<this.radialSegments;c++)g=2*(c/this.radialSegments)*
|
|
@@ -631,10 +632,10 @@ h=new THREE.Vector2((b+1)/this.segments,(c+1)/this.radialSegments),i=new THREE.V
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],h=[],g=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,p;this.tangents=e;this.normals=f;this.binormals=h;for(k=0;k<b;k++)l=k/(b-1),e[k]=a.getTangentAt(l),e[k].normalize();f[0]=new THREE.Vector3;h[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);p=Math.abs(e[0].z);k<=a&&(a=k,d.set(1,0,0));l<=a&&(a=l,d.set(0,1,0));p<=a&&d.set(0,0,1);g.crossVectors(e[0],
|
|
|
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),
|
|
|
-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 l=this.vertices,a=[],i=0,k=b.length;i<k;i++){var p=l[b[i][0]],m=l[b[i][1]],s=l[b[i][2]];a[i]=new THREE.Face3(p.index,m.index,s.index,[p.clone(),m.clone(),s.clone()])}i=0;for(k=a.length;i<k;i++){m=a[i];l=d;b=Math.pow(2,
|
|
|
-l);Math.pow(4,l);for(var l=e(g.vertices[m.a]),p=e(g.vertices[m.b]),t=e(g.vertices[m.c]),m=[],s=0;s<=b;s++){m[s]=[];for(var q=e(l.clone().lerp(t,s/b)),n=e(p.clone().lerp(t,s/b)),u=b-s,r=0;r<=u;r++)m[s][r]=0==r&&s==b?q:e(q.clone().lerp(n,r/u))}for(s=0;s<b;s++)for(r=0;r<2*(b-s)-1;r++)l=Math.floor(r/2),0==r%2?f(m[s][l+1],m[s+1][l],m[s][l]):f(m[s][l+1],m[s+1][l+1],m[s+1][l])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,p=Math.max(a,Math.max(b,l)),
|
|
|
-m=Math.min(a,Math.min(b,l)),0.9<p&&0.1>m&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(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,l=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 p,m,s,t;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*l+g,d=h*l+g+1,k=(h+1)*l+g+1,i=(h+1)*l+g,p=new THREE.Vector2(g/b,h/c),m=new THREE.Vector2((g+1)/b,h/c),s=new THREE.Vector2((g+1)/b,(h+1)/c),t=new THREE.Vector2(g/b,(h+1)/c),e.push(new THREE.Face3(a,d,i)),f.push([p,m,t]),e.push(new THREE.Face3(d,k,i)),
|
|
|
-f.push([m.clone(),s,t.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)};
|
|
|
+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 l=this.vertices,a=[],i=0,k=b.length;i<k;i++){var p=l[b[i][0]],m=l[b[i][1]],t=l[b[i][2]];a[i]=new THREE.Face3(p.index,m.index,t.index,[p.clone(),m.clone(),t.clone()])}i=0;for(k=a.length;i<k;i++){m=a[i];l=d;b=Math.pow(2,
|
|
|
+l);Math.pow(4,l);for(var l=e(g.vertices[m.a]),p=e(g.vertices[m.b]),r=e(g.vertices[m.c]),m=[],t=0;t<=b;t++){m[t]=[];for(var n=e(l.clone().lerp(r,t/b)),q=e(p.clone().lerp(r,t/b)),u=b-t,s=0;s<=u;s++)m[t][s]=0==s&&t==b?n:e(n.clone().lerp(q,s/u))}for(t=0;t<b;t++)for(s=0;s<2*(b-t)-1;s++)l=Math.floor(s/2),0==s%2?f(m[t][l+1],m[t+1][l],m[t][l]):f(m[t][l+1],m[t+1][l+1],m[t+1][l])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,p=Math.max(a,Math.max(b,l)),
|
|
|
+m=Math.min(a,Math.min(b,l)),0.9<p&&0.1>m&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(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,l=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 p,m,t,r;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*l+g,d=h*l+g+1,k=(h+1)*l+g+1,i=(h+1)*l+g,p=new THREE.Vector2(g/b,h/c),m=new THREE.Vector2((g+1)/b,h/c),t=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([p,m,r]),e.push(new THREE.Face3(d,k,i)),
|
|
|
+f.push([m.clone(),t,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,e,f){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);void 0===e&&(e=0.2*c);void 0===f&&(f=0.2*e);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.5,1,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,-0.5,0));this.cone=
|
|
|
new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c,e,f)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(){var a=new THREE.Vector3,b;return function(c){0.99999<c.y?this.quaternion.set(0,0,0,1):-0.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();
|
|
|
THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=0.2*a);void 0===c&&(c=0.2*b);this.line.scale.set(1,a,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.BoxHelper=function(a){var b=[new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,1),new THREE.Vector3(1,-1,1),new THREE.Vector3(1,1,-1),new THREE.Vector3(-1,1,-1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1)];this.vertices=b;var c=new THREE.Geometry;c.vertices.push(b[0],b[1],b[1],b[2],b[2],b[3],b[3],b[0],b[4],b[5],b[5],b[6],b[6],b[7],b[7],b[4],b[0],b[4],b[1],b[5],b[2],b[6],b[3],b[7]);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);
|
|
@@ -645,7 +646,8 @@ THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Camera,c=new THREE.Projector;return function(){function d(d,h,g,i){a.set(h,g,i);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d){h=0;for(g=d.length;h<g;h++)e.geometry.vertices[d[h]].copy(a)}}var e=this;b.projectionMatrix.copy(this.camera.projectionMatrix);d("c",0,0,-1);d("t",0,0,1);d("n1",-1,-1,-1);d("n2",1,-1,-1);d("n3",-1,1,-1);d("n4",1,1,-1);d("f1",-1,-1,1);d("f2",1,-1,1);d("f3",-1,1,1);d("f4",1,1,1);d("u1",
|
|
|
0.7,1.1,-1);d("u2",-0.7,1.1,-1);d("u3",0,2,-1);d("cf1",-1,0,1);d("cf2",1,0,1);d("cf3",0,-1,1);d("cf4",0,1,1);d("cn1",-1,0,-1);d("cn2",1,0,-1);d("cn3",0,-1,-1);d("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0}}();THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;var b=b||1,c=new THREE.PlaneGeometry(b,b),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new THREE.Mesh(c,d);this.add(this.lightPlane);c=new THREE.Geometry;c.vertices.push(new THREE.Vector3);c.vertices.push(new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});
|
|
|
d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()};
|
|
|
-THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=b||1;for(var a=c||16776960,d=d||1,b=new THREE.Geometry,c=0,e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3),b.vertices.push(new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
+THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},h=["a","b","c"],g=new THREE.BufferGeometry,i=a.geometry.clone();i.mergeVertices();i.computeFaceNormals();for(var k=i.vertices,i=i.faces,l=0,p=0,m=i.length;p<m;p++)for(var t=i[p],r=0;3>r;r++){d[0]=t[h[r]];d[1]=t[h[(r+1)%3]];d.sort(f);var n=d.toString();void 0===e[n]?(e[n]={vert1:d[0],vert2:d[1],face1:p,face2:void 0},l++):e[n].face2=p}g.addAttribute("position",Float32Array,2*l,3);d=g.attributes.position.array;
|
|
|
+f=0;for(n in e)if(h=e[n],void 0===h.face2||0.9999>i[h.face1].normal.dot(i[h.face2].normal))l=k[h.vert1],d[f++]=l.x,d[f++]=l.y,d[f++]=l.z,l=k[h.vert2],d[f++]=l.x,d[f++]=l.y,d[f++]=l.z;THREE.Line.call(this,g,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=b||1;for(var a=c||16776960,d=d||1,b=new THREE.Geometry,c=0,e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3),b.vertices.push(new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.FaceNormalsHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var b=this.geometry.vertices,c=this.object.geometry.faces,d=this.object.matrixWorld,e=0,f=c.length;e<f;e++){var h=c[e];a.copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);var g=2*e;b[g].copy(h.centroid).applyMatrix4(d);b[g+1].addVectors(b[g],a)}this.geometry.verticesNeedUpdate=
|
|
|
!0;return this}}();THREE.GridHelper=function(a,b){var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924);this.color2=new THREE.Color(8947848);for(var e=-a;e<=a;e+=b){c.vertices.push(new THREE.Vector3(-a,0,e),new THREE.Vector3(a,0,e),new THREE.Vector3(e,0,-a),new THREE.Vector3(e,0,a));var f=0===e?this.color1:this.color2;c.colors.push(f,f,f,f)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.GridHelper.prototype.setColors=function(a,b){this.color1.set(a);this.color2.set(b);this.geometry.colorsNeedUpdate=!0};THREE.HemisphereLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.colors=[new THREE.Color,new THREE.Color];var c=new THREE.SphereGeometry(b,4,2);c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(var d=0;8>d;d++)c.faces[d].color=this.colors[4>d?0:1];d=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(c,d);this.add(this.lightSphere);
|
|
@@ -656,10 +658,10 @@ THREE.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose();
|
|
|
THREE.VertexNormalsHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){var b=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var c=this.geometry.vertices,d=this.object.geometry.vertices,e=this.object.geometry.faces,f=this.object.matrixWorld,h=0,g=0,i=e.length;g<i;g++)for(var k=e[g],l=0,p=k.vertexNormals.length;l<p;l++){var m=k.vertexNormals[l];c[h].copy(d[k[b[l]]]).applyMatrix4(f);a.copy(m).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);
|
|
|
a.add(c[h]);h+=1;c[h].copy(a);h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.VertexTangentsHelper=function(a,b,c,d){this.object=a;this.size=b||1;for(var b=c||255,d=d||1,c=new THREE.Geometry,a=a.geometry.faces,e=0,f=a.length;e<f;e++)for(var h=0,g=a[e].vertexTangents.length;h<g;h++)c.vertices.push(new THREE.Vector3),c.vertices.push(new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.update()};THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.VertexTangentsHelper.prototype.update=function(){var a=new THREE.Vector3;return function(){var b=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var c=this.geometry.vertices,d=this.object.geometry.vertices,e=this.object.geometry.faces,f=this.object.matrixWorld,h=0,g=0,i=e.length;g<i;g++)for(var k=e[g],l=0,p=k.vertexTangents.length;l<p;l++){var m=k.vertexTangents[l];c[h].copy(d[k[b[l]]]).applyMatrix4(f);a.copy(m).transformDirection(f).multiplyScalar(this.size);a.add(c[h]);h+=1;c[h].copy(a);
|
|
|
-h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.WireframeHelper=function(a){var b=[0,0],c={},d=function(a,b){return a-b},e=["a","b","c","d"],f=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var h=a.geometry.vertices,g=a.geometry.faces,i=0,k=new Uint32Array(6*g.length),l=0,p=g.length;l<p;l++)for(var m=g[l],s=0;3>s;s++){b[0]=m[e[s]];b[1]=m[e[(s+1)%3]];b.sort(d);var t=b.toString();void 0===c[t]&&(k[2*i]=b[0],k[2*i+1]=b[1],c[t]=!0,i++)}f.addAttribute("position",Float32Array,2*i,3);b=f.attributes.position.array;l=0;for(p=
|
|
|
-i;l<p;l++)for(s=0;2>s;s++)i=h[k[2*l+s]],e=6*l+3*s,b[e+0]=i.x,b[e+1]=i.y,b[e+2]=i.z}else if(a.geometry.offsets.length){for(var h=a.geometry.attributes.position.array,p=a.geometry.attributes.index.array,g=a.geometry.offsets,i=0,k=new Uint32Array(2*p.length),m=0,q=g.length;m<q;++m)for(var s=g[m].start,t=g[m].count,e=g[m].index,l=s,n=s+t;l<n;l+=3)for(s=0;3>s;s++)b[0]=e+p[l+s],b[1]=e+p[l+(s+1)%3],b.sort(d),t=b.toString(),void 0===c[t]&&(k[2*i]=b[0],k[2*i+1]=b[1],c[t]=!0,i++);f.addAttribute("position",
|
|
|
-Float32Array,2*i,3);b=f.attributes.position.array;l=0;for(p=i;l<p;l++)for(s=0;2>s;s++)e=6*l+3*s,i=3*k[2*l+s],b[e+0]=h[i],b[e+1]=h[i+1],b[e+2]=h[i+2]}else{h=a.geometry.attributes.position.array;i=h.length/3;k=i/3;f.addAttribute("position",Float32Array,2*i,3);b=f.attributes.position.array;l=0;for(p=k;l<p;l++){e=9*l;for(s=0;3>s;s++)i=2*e+6*s,k=3*s,c=3*((s+1)%3),b[i+0]=h[e+k],b[i+1]=h[e+k+1],b[i+2]=h[e+k+2],b[i+3]=h[e+c],b[i+4]=h[e+c+1],b[i+5]=h[e+c+2]}}THREE.Line.call(this,f,new THREE.LineBasicMaterial({color:16777215}),
|
|
|
-THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
+h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},h=["a","b","c"],g=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var i=a.geometry.vertices,k=a.geometry.faces,l=0,p=new Uint32Array(6*k.length),m=0,t=k.length;m<t;m++)for(var r=k[m],n=0;3>n;n++){d[0]=r[h[n]];d[1]=r[h[(n+1)%3]];d.sort(f);var q=d.toString();void 0===e[q]&&(p[2*l]=d[0],p[2*l+1]=d[1],e[q]=!0,l++)}g.addAttribute("position",Float32Array,2*l,3);d=g.attributes.position.array;
|
|
|
+m=0;for(t=l;m<t;m++)for(n=0;2>n;n++)l=i[p[2*m+n]],h=6*m+3*n,d[h+0]=l.x,d[h+1]=l.y,d[h+2]=l.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var i=a.geometry.attributes.position.array,t=a.geometry.attributes.index.array,k=a.geometry.offsets,l=0,p=new Uint32Array(2*t.length),r=0,u=k.length;r<u;++r)for(var n=k[r].start,q=k[r].count,h=k[r].index,m=n,s=n+q;m<s;m+=3)for(n=0;3>n;n++)d[0]=h+t[m+n],d[1]=h+t[m+(n+1)%3],d.sort(f),q=d.toString(),void 0===e[q]&&(p[2*
|
|
|
+l]=d[0],p[2*l+1]=d[1],e[q]=!0,l++);g.addAttribute("position",Float32Array,2*l,3);d=g.attributes.position.array;m=0;for(t=l;m<t;m++)for(n=0;2>n;n++)h=6*m+3*n,l=3*p[2*m+n],d[h+0]=i[l],d[h+1]=i[l+1],d[h+2]=i[l+2]}else if(a.geometry instanceof THREE.BufferGeometry){i=a.geometry.attributes.position.array;l=i.length/3;p=l/3;g.addAttribute("position",Float32Array,2*l,3);d=g.attributes.position.array;m=0;for(t=p;m<t;m++)for(n=0;3>n;n++)h=18*m+6*n,p=9*m+3*n,d[h+0]=i[p],d[h+1]=i[p+1],d[h+2]=i[p+2],l=9*m+3*
|
|
|
+((n+1)%3),d[h+3]=i[l],d[h+4]=i[l+1],d[h+5]=i[l+2]}THREE.Line.call(this,g,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
|
|
|
THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
|
|
@@ -668,36 +670,36 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),h=d.weight;
|
|
|
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,k,l,p,m,s;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1;
|
|
|
-e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=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,
|
|
|
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,k,l,p,m,t;this.init=function(r){b=r.context;c=r;d=r.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);r=0;e[r++]=-1;e[r++]=-1;
|
|
|
+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);
|
|
|
-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)?(l=!1,p=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,p=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};s={};m.vertex=b.getAttribLocation(p,"position");m.uv=b.getAttribLocation(p,"uv");s.renderType=b.getUniformLocation(p,"renderType");s.map=b.getUniformLocation(p,"map");s.occlusionMap=b.getUniformLocation(p,"occlusionMap");s.opacity=
|
|
|
-b.getUniformLocation(p,"opacity");s.color=b.getUniformLocation(p,"color");s.scale=b.getUniformLocation(p,"scale");s.rotation=b.getUniformLocation(p,"rotation");s.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,r=a.length;if(r){var v=new THREE.Vector3,z=f/e,G=0.5*e,w=0.5*f,y=16/f,E=new THREE.Vector2(y*z,y),A=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),D=s,y=m;b.useProgram(p);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
-b.uniform1i(D.occlusionMap,0);b.uniform1i(D.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 F,O,x,I,B;for(F=0;F<r;F++)if(y=16/f,E.set(y*z,y),I=a[F],v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),A.copy(v),K.x=A.x*G+G,
|
|
|
+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)?(l=!1,p=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,p=a(THREE.ShaderFlares.lensFlareVertexTexture,d));m={};t={};m.vertex=b.getAttribLocation(p,"position");m.uv=b.getAttribLocation(p,"uv");t.renderType=b.getUniformLocation(p,"renderType");t.map=b.getUniformLocation(p,"map");t.occlusionMap=b.getUniformLocation(p,"occlusionMap");t.opacity=
|
|
|
+b.getUniformLocation(p,"opacity");t.color=b.getUniformLocation(p,"color");t.scale=b.getUniformLocation(p,"scale");t.rotation=b.getUniformLocation(p,"rotation");t.screenPosition=b.getUniformLocation(p,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,s=a.length;if(s){var v=new THREE.Vector3,z=f/e,G=0.5*e,w=0.5*f,y=16/f,E=new THREE.Vector2(y*z,y),A=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),D=t,y=m;b.useProgram(p);b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);
|
|
|
+b.uniform1i(D.occlusionMap,0);b.uniform1i(D.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 F,O,x,I,B;for(F=0;F<s;F++)if(y=16/f,E.set(y*z,y),I=a[F],v.set(I.matrixWorld.elements[12],I.matrixWorld.elements[13],I.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),A.copy(v),K.x=A.x*G+G,
|
|
|
K.y=A.y*w+w,l||0<K.x&&K.x<e&&0<K.y&&K.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,K.x-8,K.y-8,16,16,0);b.uniform1i(D.renderType,0);b.uniform2f(D.scale,E.x,E.y);b.uniform3f(D.screenPosition,A.x,A.y,A.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,K.x-8,K.y-8,16,16,0);b.uniform1i(D.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(A);I.customUpdateCallback?I.customUpdateCallback(I):I.updateLensFlares();b.uniform1i(D.renderType,2);b.enable(b.BLEND);O=0;for(x=I.lensFlares.length;O<x;O++)B=I.lensFlares[O],0.001<B.opacity&&0.001<B.scale&&(A.x=B.x,A.y=B.y,A.z=B.z,y=B.size*B.scale/f,E.x=y*z,E.y=y,b.uniform3f(D.screenPosition,A.x,A.y,A.z),b.uniform2f(D.scale,E.x,E.y),b.uniform1f(D.rotation,B.rotation),b.uniform1f(D.opacity,
|
|
|
B.opacity),b.uniform3f(D.color,B.color.r,B.color.g,B.color.b),c.setBlending(B.blending,B.blendEquation,B.blendSrc,B.blendDst),c.setTexture(B.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,l=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(p,m){var s,t,q,n,u,r,v,z,G,w=[];n=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(t=p.__lights.length;s<t;s++)if(q=p.__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{G=q;v=u;y=new THREE.DirectionalLight;y.isVirtual=!0;y.onlyShadow=!0;y.castShadow=!0;y.shadowCameraNear=G.shadowCameraNear;y.shadowCameraFar=G.shadowCameraFar;y.shadowCameraLeft=G.shadowCameraLeft;y.shadowCameraRight=G.shadowCameraRight;
|
|
|
-y.shadowCameraBottom=G.shadowCameraBottom;y.shadowCameraTop=G.shadowCameraTop;y.shadowCameraVisible=G.shadowCameraVisible;y.shadowDarkness=G.shadowDarkness;y.shadowBias=G.shadowCascadeBias[v];y.shadowMapWidth=G.shadowCascadeWidth[v];y.shadowMapHeight=G.shadowCascadeHeight[v];y.pointsWorld=[];y.pointsFrustum=[];z=y.pointsWorld;r=y.pointsFrustum;for(var E=0;8>E;E++)z[E]=new THREE.Vector3,r[E]=new THREE.Vector3;z=G.shadowCascadeNearZ[v];G=G.shadowCascadeFarZ[v];r[0].set(-1,-1,z);r[1].set(1,-1,z);r[2].set(-1,
|
|
|
-1,z);r[3].set(1,1,z);r[4].set(-1,-1,G);r[5].set(1,-1,G);r[6].set(-1,1,G);r[7].set(1,1,G);y.originalCamera=m;r=new THREE.Gyroscope;r.position=q.shadowCascadeOffset;r.add(y);r.add(y.target);m.add(r);q.shadowCascadeArray[u]=y;console.log("Created virtualLight",y)}v=q;z=u;G=v.shadowCascadeArray[z];G.position.copy(v.position);G.target.position.copy(v.target.position);G.lookAt(G.target);G.shadowCameraVisible=v.shadowCameraVisible;G.shadowDarkness=v.shadowDarkness;G.shadowBias=v.shadowCascadeBias[z];r=v.shadowCascadeNearZ[z];
|
|
|
-v=v.shadowCascadeFarZ[z];G=G.pointsFrustum;G[0].z=r;G[1].z=r;G[2].z=r;G[3].z=r;G[4].z=v;G[5].z=v;G[6].z=v;G[7].z=v;w[n]=y;n++}else w[n]=q,n++;s=0;for(t=w.length;s<t;s++){q=w[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);
|
|
|
-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}p.add(q.shadowCamera);!0===p.autoUpdate&&p.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
|
-!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&y.originalCamera==m){u=m;n=q.shadowCamera;r=q.pointsFrustum;G=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)z=G[v],z.copy(r[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(z,u),z.applyMatrix4(n.matrixWorldInverse),z.x<i.x&&(i.x=z.x),z.x>k.x&&(k.x=z.x),z.y<i.y&&(i.y=z.y),z.y>k.y&&(k.y=z.y),z.z<i.z&&(i.z=z.z),z.z>k.z&&
|
|
|
-(k.z=z.z);n.left=i.x;n.right=k.x;n.top=k.y;n.bottom=i.y;n.updateProjectionMatrix()}n=q.shadowMap;r=q.shadowMatrix;u=q.shadowCamera;u.position.setFromMatrixPosition(q.matrixWorld);l.setFromMatrixPosition(q.target.matrixWorld);u.lookAt(l);u.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiply(u.projectionMatrix);r.multiply(u.matrixWorldInverse);
|
|
|
-g.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(n);b.clear();G=p.__webglObjects;q=0;for(n=G.length;q<n;q++)if(v=G[q],r=v.object,v.render=!1,r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,r.matrixWorld),v.render=!0;q=0;for(n=G.length;q<n;q++)v=G[q],v.render&&(r=v.object,v=v.buffer,E=r.material instanceof THREE.MeshFaceMaterial?
|
|
|
-r.material.materials[0]:r.material,z=0<r.geometry.morphTargets.length&&E.morphTargets,E=r instanceof THREE.SkinnedMesh&&E.skinning,z=r.customDepthMaterial?r.customDepthMaterial:E?z?f:e:z?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(u,p.__lights,null,z,v,r):b.renderBuffer(u,p.__lights,null,z,v,r));G=p.__webglObjectsImmediate;q=0;for(n=G.length;q<n;q++)v=G[q],r=v.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,r.matrixWorld),b.renderImmediateObject(u,
|
|
|
-p.__lights,null,c,r))}s=b.getClearColor();t=b.getClearAlpha();a.clearColor(s.r,s.g,s.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,h,g,i,k,l,p,m,s,t,q,n;function u(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var r,v,z,G,w,y,E,A;this.init=function(u){r=u.context;v=u;G=new Float32Array([-0.5,-0.5,0,0,0.5,-0.5,1,0,0.5,0.5,1,1,-0.5,0.5,0,1]);w=new Uint16Array([0,1,2,0,2,3]);y=r.createBuffer();E=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,y);r.bufferData(r.ARRAY_BUFFER,G,r.STATIC_DRAW);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,E);r.bufferData(r.ELEMENT_ARRAY_BUFFER,w,r.STATIC_DRAW);var u=r.createProgram(),
|
|
|
-D=r.createShader(r.VERTEX_SHADER),F=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(D,["precision "+v.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\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}"].join("\n"));
|
|
|
-r.shaderSource(F,["precision "+v.getPrecision()+" float;","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}"].join("\n"));
|
|
|
-r.compileShader(D);r.compileShader(F);r.attachShader(u,D);r.attachShader(u,F);r.linkProgram(u);A=u;q=r.getAttribLocation(A,"position");n=r.getAttribLocation(A,"uv");a=r.getUniformLocation(A,"uvOffset");b=r.getUniformLocation(A,"uvScale");c=r.getUniformLocation(A,"rotation");d=r.getUniformLocation(A,"scale");e=r.getUniformLocation(A,"color");f=r.getUniformLocation(A,"map");h=r.getUniformLocation(A,"opacity");g=r.getUniformLocation(A,"modelViewMatrix");i=r.getUniformLocation(A,"projectionMatrix");k=
|
|
|
-r.getUniformLocation(A,"fogType");l=r.getUniformLocation(A,"fogDensity");p=r.getUniformLocation(A,"fogNear");m=r.getUniformLocation(A,"fogFar");s=r.getUniformLocation(A,"fogColor");t=r.getUniformLocation(A,"alphaTest");u=document.createElement("canvas");u.width=8;u.height=8;D=u.getContext("2d");D.fillStyle="#ffffff";D.fillRect(0,0,u.width,u.height);z=new THREE.Texture(u);z.needsUpdate=!0};this.render=function(w,D){var F=w.__webglSprites,G=F.length;if(G){r.useProgram(A);r.enableVertexAttribArray(q);
|
|
|
-r.enableVertexAttribArray(n);r.disable(r.CULL_FACE);r.enable(r.BLEND);r.bindBuffer(r.ARRAY_BUFFER,y);r.vertexAttribPointer(q,2,r.FLOAT,!1,16,0);r.vertexAttribPointer(n,2,r.FLOAT,!1,16,8);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,E);r.uniformMatrix4fv(i,!1,D.projectionMatrix.elements);r.activeTexture(r.TEXTURE0);r.uniform1i(f,0);var x=0,I=0,B=w.fog;B?(r.uniform3f(s,B.color.r,B.color.g,B.color.b),B instanceof THREE.Fog?(r.uniform1f(p,B.near),r.uniform1f(m,B.far),r.uniform1i(k,1),I=x=1):B instanceof THREE.FogExp2&&
|
|
|
-(r.uniform1f(l,B.density),r.uniform1i(k,2),I=x=2)):(r.uniform1i(k,0),I=x=0);for(var M,J,ca=[],B=0;B<G;B++)M=F[B],!1!==M.visible&&(M._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,M.matrixWorld),M.z=-M._modelViewMatrix.elements[14]);F.sort(u);for(B=0;B<G;B++)M=F[B],!1!==M.visible&&(J=M.material,r.uniform1f(t,J.alphaTest),r.uniformMatrix4fv(g,!1,M._modelViewMatrix.elements),ca[0]=M.scale.x,ca[1]=M.scale.y,M=w.fog&&J.fog?I:0,x!==M&&(r.uniform1i(k,M),x=M),r.uniform2f(b,J.uvScale.x,J.uvScale.y),
|
|
|
-r.uniform2f(a,J.uvOffset.x,J.uvOffset.y),r.uniform1f(h,J.opacity),r.uniform3f(e,J.color.r,J.color.g,J.color.b),r.uniform1f(c,J.rotation),r.uniform2fv(d,ca),v.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst),v.setDepthTest(J.depthTest),v.setDepthWrite(J.depthWrite),J.map&&J.map.image&&J.map.image.width?v.setTexture(J.map,0):v.setTexture(z,0),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0));r.enable(r.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 l,p,m,s,t,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;l=0;for(p=q.length;l<p;l++)if(m=q[l],t=m.object,m.render=!1,t.visible&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||h.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,t.matrixWorld),m.render=!0;var n;l=0;for(p=q.length;l<p;l++)if(m=q[l],m.render&&(t=m.object,m=m.buffer,!(t instanceof THREE.ParticleSystem)||t.customDepthMaterial))(n=
|
|
|
-t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),s=0<t.geometry.morphTargets.length&&n.morphTargets,n=t instanceof THREE.SkinnedMesh&&n.skinning,s=t.customDepthMaterial?t.customDepthMaterial:n?s?f:e:s?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,s,m,t):b.renderBuffer(k,i.__lights,null,s,m,t);q=i.__webglObjectsImmediate;l=0;for(p=q.length;l<p;l++)m=q[l],t=m.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
-t.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,t));l=b.getClearColor();p=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,p);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}",
|
|
|
+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(p,m){var t,r,n,q,u,s,v,z,G,w=[];q=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);t=0;for(r=p.__lights.length;t<r;t++)if(n=p.__lights[t],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(u=0;u<n.shadowCascadeCount;u++){var y;if(n.shadowCascadeArray[u])y=n.shadowCascadeArray[u];else{G=n;v=u;y=new THREE.DirectionalLight;y.isVirtual=!0;y.onlyShadow=!0;y.castShadow=!0;y.shadowCameraNear=G.shadowCameraNear;y.shadowCameraFar=G.shadowCameraFar;y.shadowCameraLeft=G.shadowCameraLeft;y.shadowCameraRight=G.shadowCameraRight;
|
|
|
+y.shadowCameraBottom=G.shadowCameraBottom;y.shadowCameraTop=G.shadowCameraTop;y.shadowCameraVisible=G.shadowCameraVisible;y.shadowDarkness=G.shadowDarkness;y.shadowBias=G.shadowCascadeBias[v];y.shadowMapWidth=G.shadowCascadeWidth[v];y.shadowMapHeight=G.shadowCascadeHeight[v];y.pointsWorld=[];y.pointsFrustum=[];z=y.pointsWorld;s=y.pointsFrustum;for(var E=0;8>E;E++)z[E]=new THREE.Vector3,s[E]=new THREE.Vector3;z=G.shadowCascadeNearZ[v];G=G.shadowCascadeFarZ[v];s[0].set(-1,-1,z);s[1].set(1,-1,z);s[2].set(-1,
|
|
|
+1,z);s[3].set(1,1,z);s[4].set(-1,-1,G);s[5].set(1,-1,G);s[6].set(-1,1,G);s[7].set(1,1,G);y.originalCamera=m;s=new THREE.Gyroscope;s.position=n.shadowCascadeOffset;s.add(y);s.add(y.target);m.add(s);n.shadowCascadeArray[u]=y;console.log("Created virtualLight",y)}v=n;z=u;G=v.shadowCascadeArray[z];G.position.copy(v.position);G.target.position.copy(v.target.position);G.lookAt(G.target);G.shadowCameraVisible=v.shadowCameraVisible;G.shadowDarkness=v.shadowDarkness;G.shadowBias=v.shadowCascadeBias[z];s=v.shadowCascadeNearZ[z];
|
|
|
+v=v.shadowCascadeFarZ[z];G=G.pointsFrustum;G[0].z=s;G[1].z=s;G[2].z=s;G[3].z=s;G[4].z=v;G[5].z=v;G[6].z=v;G[7].z=v;w[q]=y;q++}else w[q]=n,q++;t=0;for(r=w.length;t<r;t++){n=w[t];n.shadowMap||(u=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(u=THREE.NearestFilter),n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:u,magFilter:u,format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4);
|
|
|
+if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}p.add(n.shadowCamera);!0===p.autoUpdate&&p.updateMatrixWorld()}n.shadowCameraVisible&&
|
|
|
+!n.cameraHelper&&(n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper));if(n.isVirtual&&y.originalCamera==m){u=m;q=n.shadowCamera;s=n.pointsFrustum;G=n.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(v=0;8>v;v++)z=G[v],z.copy(s[v]),THREE.ShadowMapPlugin.__projector.unprojectVector(z,u),z.applyMatrix4(q.matrixWorldInverse),z.x<i.x&&(i.x=z.x),z.x>k.x&&(k.x=z.x),z.y<i.y&&(i.y=z.y),z.y>k.y&&(k.y=z.y),z.z<i.z&&(i.z=z.z),z.z>k.z&&
|
|
|
+(k.z=z.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=n.shadowMap;s=n.shadowMatrix;u=n.shadowCamera;u.position.setFromMatrixPosition(n.matrixWorld);l.setFromMatrixPosition(n.target.matrixWorld);u.lookAt(l);u.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);n.cameraHelper&&(n.cameraHelper.visible=n.shadowCameraVisible);n.shadowCameraVisible&&n.cameraHelper.update();s.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiply(u.projectionMatrix);s.multiply(u.matrixWorldInverse);
|
|
|
+g.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(q);b.clear();G=p.__webglObjects;n=0;for(q=G.length;n<q;n++)if(v=G[n],s=v.object,v.render=!1,s.visible&&s.castShadow&&(!(s instanceof THREE.Mesh||s instanceof THREE.ParticleSystem)||!s.frustumCulled||h.intersectsObject(s)))s._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,s.matrixWorld),v.render=!0;n=0;for(q=G.length;n<q;n++)v=G[n],v.render&&(s=v.object,v=v.buffer,E=s.material instanceof THREE.MeshFaceMaterial?
|
|
|
+s.material.materials[0]:s.material,z=0<s.geometry.morphTargets.length&&E.morphTargets,E=s instanceof THREE.SkinnedMesh&&E.skinning,z=s.customDepthMaterial?s.customDepthMaterial:E?z?f:e:z?d:c,v instanceof THREE.BufferGeometry?b.renderBufferDirect(u,p.__lights,null,z,v,s):b.renderBuffer(u,p.__lights,null,z,v,s));G=p.__webglObjectsImmediate;n=0;for(q=G.length;n<q;n++)v=G[n],s=v.object,s.visible&&s.castShadow&&(s._modelViewMatrix.multiplyMatrices(u.matrixWorldInverse,s.matrixWorld),b.renderImmediateObject(u,
|
|
|
+p.__lights,null,c,s))}t=b.getClearColor();r=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,r);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,h,g,i,k,l,p,m,t,r,n,q;function u(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var s,v,z,G,w,y,E,A;this.init=function(u){s=u.context;v=u;G=new Float32Array([-0.5,-0.5,0,0,0.5,-0.5,1,0,0.5,0.5,1,1,-0.5,0.5,0,1]);w=new Uint16Array([0,1,2,0,2,3]);y=s.createBuffer();E=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,y);s.bufferData(s.ARRAY_BUFFER,G,s.STATIC_DRAW);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,E);s.bufferData(s.ELEMENT_ARRAY_BUFFER,w,s.STATIC_DRAW);var u=s.createProgram(),
|
|
|
+D=s.createShader(s.VERTEX_SHADER),F=s.createShader(s.FRAGMENT_SHADER);s.shaderSource(D,["precision "+v.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\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}"].join("\n"));
|
|
|
+s.shaderSource(F,["precision "+v.getPrecision()+" float;","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}"].join("\n"));
|
|
|
+s.compileShader(D);s.compileShader(F);s.attachShader(u,D);s.attachShader(u,F);s.linkProgram(u);A=u;n=s.getAttribLocation(A,"position");q=s.getAttribLocation(A,"uv");a=s.getUniformLocation(A,"uvOffset");b=s.getUniformLocation(A,"uvScale");c=s.getUniformLocation(A,"rotation");d=s.getUniformLocation(A,"scale");e=s.getUniformLocation(A,"color");f=s.getUniformLocation(A,"map");h=s.getUniformLocation(A,"opacity");g=s.getUniformLocation(A,"modelViewMatrix");i=s.getUniformLocation(A,"projectionMatrix");k=
|
|
|
+s.getUniformLocation(A,"fogType");l=s.getUniformLocation(A,"fogDensity");p=s.getUniformLocation(A,"fogNear");m=s.getUniformLocation(A,"fogFar");t=s.getUniformLocation(A,"fogColor");r=s.getUniformLocation(A,"alphaTest");u=document.createElement("canvas");u.width=8;u.height=8;D=u.getContext("2d");D.fillStyle="#ffffff";D.fillRect(0,0,u.width,u.height);z=new THREE.Texture(u);z.needsUpdate=!0};this.render=function(w,D){var F=w.__webglSprites,G=F.length;if(G){s.useProgram(A);s.enableVertexAttribArray(n);
|
|
|
+s.enableVertexAttribArray(q);s.disable(s.CULL_FACE);s.enable(s.BLEND);s.bindBuffer(s.ARRAY_BUFFER,y);s.vertexAttribPointer(n,2,s.FLOAT,!1,16,0);s.vertexAttribPointer(q,2,s.FLOAT,!1,16,8);s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,E);s.uniformMatrix4fv(i,!1,D.projectionMatrix.elements);s.activeTexture(s.TEXTURE0);s.uniform1i(f,0);var x=0,I=0,B=w.fog;B?(s.uniform3f(t,B.color.r,B.color.g,B.color.b),B instanceof THREE.Fog?(s.uniform1f(p,B.near),s.uniform1f(m,B.far),s.uniform1i(k,1),I=x=1):B instanceof THREE.FogExp2&&
|
|
|
+(s.uniform1f(l,B.density),s.uniform1i(k,2),I=x=2)):(s.uniform1i(k,0),I=x=0);for(var M,J,ca=[],B=0;B<G;B++)M=F[B],!1!==M.visible&&(M._modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,M.matrixWorld),M.z=-M._modelViewMatrix.elements[14]);F.sort(u);for(B=0;B<G;B++)M=F[B],!1!==M.visible&&(J=M.material,s.uniform1f(r,J.alphaTest),s.uniformMatrix4fv(g,!1,M._modelViewMatrix.elements),ca[0]=M.scale.x,ca[1]=M.scale.y,M=w.fog&&J.fog?I:0,x!==M&&(s.uniform1i(k,M),x=M),s.uniform2f(b,J.uvScale.x,J.uvScale.y),
|
|
|
+s.uniform2f(a,J.uvOffset.x,J.uvOffset.y),s.uniform1f(h,J.opacity),s.uniform3f(e,J.color.r,J.color.g,J.color.b),s.uniform1f(c,J.rotation),s.uniform2fv(d,ca),v.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst),v.setDepthTest(J.depthTest),v.setDepthWrite(J.depthWrite),J.map&&J.map.image&&J.map.image.width?v.setTexture(J.map,0):v.setTexture(z,0),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0));s.enable(s.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 l,p,m,t,r,n;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();n=i.__webglObjects;l=0;for(p=n.length;l<p;l++)if(m=n[l],r=m.object,m.render=!1,r.visible&&(!(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)||!r.frustumCulled||h.intersectsObject(r)))r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,r.matrixWorld),m.render=!0;var q;l=0;for(p=n.length;l<p;l++)if(m=n[l],m.render&&(r=m.object,m=m.buffer,!(r instanceof THREE.ParticleSystem)||r.customDepthMaterial))(q=
|
|
|
+r.material instanceof THREE.MeshFaceMaterial?r.material.materials[0]:r.material)&&b.setMaterialFaces(r.material),t=0<r.geometry.morphTargets.length&&q.morphTargets,q=r instanceof THREE.SkinnedMesh&&q.skinning,t=r.customDepthMaterial?r.customDepthMaterial:q?t?f:e:t?d:c,m instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,t,m,r):b.renderBuffer(k,i.__lights,null,t,m,r);n=i.__webglObjectsImmediate;l=0;for(p=n.length;l<p;l++)m=n[l],r=m.object,r.visible&&(r._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
+r.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,r));l=b.getClearColor();p=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,p);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:"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}"}};
|