|
@@ -84,22 +84,22 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,
|
|
|
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],g=a[5],h=a[6],k=a[7],a=a[8];return b*f*a-b*g*k-c*e*a+c*g*h+d*e*k-d*f*h},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},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,g,h,k,l,n,q,s,u,t,p){var v=this.elements=new Float32Array(16);v[0]=void 0!==a?a:1;v[4]=b||0;v[8]=c||0;v[12]=d||0;v[1]=e||0;v[5]=void 0!==f?f:1;v[9]=g||0;v[13]=h||0;v[2]=k||0;v[6]=l||0;v[10]=void 0!==n?n:1;v[14]=q||0;v[3]=s||0;v[7]=u||0;v[11]=t||0;v[15]=void 0!==p?p:1};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,n,q,s,u,t,p){var v=this.elements;v[0]=a;v[4]=b;v[8]=c;v[12]=d;v[1]=e;v[5]=f;v[9]=g;v[13]=h;v[2]=k;v[6]=l;v[10]=n;v[14]=q;v[3]=s;v[7]=u;v[11]=t;v[15]=p;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().");
|
|
|
+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,g,h,k,l,n,q,s,r,t,p){var v=this.elements=new Float32Array(16);v[0]=void 0!==a?a:1;v[4]=b||0;v[8]=c||0;v[12]=d||0;v[1]=e||0;v[5]=void 0!==f?f:1;v[9]=g||0;v[13]=h||0;v[2]=k||0;v[6]=l||0;v[10]=void 0!==n?n:1;v[14]=q||0;v[3]=s||0;v[7]=r||0;v[11]=t||0;v[15]=void 0!==p?p:1};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,n,q,s,r,t,p){var v=this.elements;v[0]=a;v[4]=b;v[8]=c;v[12]=d;v[1]=e;v[5]=f;v[9]=g;v[13]=h;v[2]=k;v[6]=l;v[10]=n;v[14]=q;v[3]=s;v[7]=r;v[11]=t;v[15]=p;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;var 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),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,l=c*h,n=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+l*d;b[5]=a-n*d;b[9]=-c*g;b[2]=n-a*d;b[6]=l+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,l=d*h,n=d*e,b[0]=a+n*c,b[4]=l*c-k,b[8]=
|
|
|
f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=n+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,l=d*h,n=d*e,b[0]=a-n*c,b[4]=-f*e,b[8]=l+k*c,b[1]=k+l*c,b[5]=f*h,b[9]=n-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,l=c*h,n=c*e,b[0]=g*h,b[4]=l*d-k,b[8]=a*d+n,b[1]=g*e,b[5]=n*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,l=c*g,n=c*d,b[0]=g*h,b[4]=n-a*e,b[8]=l*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-n*e):"XZY"===a.order&&(a=f*g,k=f*d,l=c*g,n=c*d,b[0]=
|
|
|
g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+n,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=n*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,g=c+c,h=d+d,k=e+e;a=c*g;var l=c*
|
|
|
h,c=c*k,n=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(n+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+n);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 g=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);g[0]=
|
|
|
-a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[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],g=c[4],h=c[8],k=c[12],l=c[1],n=c[5],q=c[9],s=c[13],u=c[2],t=c[6],p=c[10],v=c[14],w=c[3],r=c[7],x=c[11],
|
|
|
-c=c[15],A=d[0],F=d[4],P=d[8],I=d[12],z=d[1],B=d[5],L=d[9],H=d[13],J=d[2],y=d[6],N=d[10],E=d[14],C=d[3],D=d[7],G=d[11],d=d[15];e[0]=f*A+g*z+h*J+k*C;e[4]=f*F+g*B+h*y+k*D;e[8]=f*P+g*L+h*N+k*G;e[12]=f*I+g*H+h*E+k*d;e[1]=l*A+n*z+q*J+s*C;e[5]=l*F+n*B+q*y+s*D;e[9]=l*P+n*L+q*N+s*G;e[13]=l*I+n*H+q*E+s*d;e[2]=u*A+t*z+p*J+v*C;e[6]=u*F+t*B+p*y+v*D;e[10]=u*P+t*L+p*N+v*G;e[14]=u*I+t*H+p*E+v*d;e[3]=w*A+r*z+x*J+c*C;e[7]=w*F+r*B+x*y+c*D;e[11]=w*P+r*L+x*N+c*G;e[15]=w*I+r*H+x*E+c*d;return this},multiplyToArray:function(a,
|
|
|
+a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[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],g=c[4],h=c[8],k=c[12],l=c[1],n=c[5],q=c[9],s=c[13],r=c[2],t=c[6],p=c[10],v=c[14],w=c[3],u=c[7],x=c[11],
|
|
|
+c=c[15],A=d[0],F=d[4],P=d[8],I=d[12],z=d[1],B=d[5],L=d[9],H=d[13],J=d[2],y=d[6],N=d[10],E=d[14],C=d[3],D=d[7],G=d[11],d=d[15];e[0]=f*A+g*z+h*J+k*C;e[4]=f*F+g*B+h*y+k*D;e[8]=f*P+g*L+h*N+k*G;e[12]=f*I+g*H+h*E+k*d;e[1]=l*A+n*z+q*J+s*C;e[5]=l*F+n*B+q*y+s*D;e[9]=l*P+n*L+q*N+s*G;e[13]=l*I+n*H+q*E+s*d;e[2]=r*A+t*z+p*J+v*C;e[6]=r*F+t*B+p*y+v*D;e[10]=r*P+t*L+p*N+v*G;e[14]=r*I+t*H+p*E+v*d;e[3]=w*A+u*z+x*J+c*C;e[7]=w*F+u*B+x*y+c*D;e[11]=w*P+u*L+x*N+c*G;e[15]=w*I+u*H+x*E+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],g=a[5],h=a[9],k=a[13],l=a[2],n=a[6],q=a[10],s=a[14];return a[3]*(+e*h*n-d*k*n-e*g*q+c*k*q+d*g*s-c*h*s)+a[7]*(+b*h*s-b*k*q+e*f*q-d*f*s+d*k*l-e*h*l)+a[11]*(+b*k*n-b*g*s-e*f*n+c*f*s+e*g*l-c*k*l)+a[15]*(-d*g*l-b*h*n+b*g*q+d*f*n-c*f*
|
|
|
q+c*h*l)},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],g=d[8],h=d[12],k=d[1],l=d[5],n=d[9],q=d[13],s=d[2],u=d[6],t=d[10],p=d[14],v=d[3],w=d[7],r=d[11],d=d[15];c[0]=n*p*w-q*t*w+q*u*r-l*p*r-n*u*d+l*t*d;c[4]=h*t*w-g*p*w-h*u*r+f*p*r+g*u*d-f*t*d;c[8]=g*q*w-h*n*w+h*l*r-f*q*r-g*l*d+f*n*d;c[12]=h*n*u-g*q*u-h*l*t+f*q*t+g*l*p-f*n*p;c[1]=q*t*v-n*p*v-q*s*r+k*p*r+n*s*d-k*t*d;c[5]=g*p*v-h*t*v+h*s*r-e*p*r-g*s*d+e*t*d;c[9]=h*n*v-g*q*v-h*k*r+e*q*r+g*k*d-
|
|
|
-e*n*d;c[13]=g*q*s-h*n*s+h*k*t-e*q*t-g*k*p+e*n*p;c[2]=l*p*v-q*u*v+q*s*w-k*p*w-l*s*d+k*u*d;c[6]=h*u*v-f*p*v-h*s*w+e*p*w+f*s*d-e*u*d;c[10]=f*q*v-h*l*v+h*k*w-e*q*w-f*k*d+e*l*d;c[14]=h*l*s-f*q*s-h*k*u+e*q*u+f*k*p-e*l*p;c[3]=n*u*v-l*t*v-n*s*w+k*t*w+l*s*r-k*u*r;c[7]=f*t*v-g*u*v+g*s*w-e*t*w-f*s*r+e*u*r;c[11]=g*l*v-f*n*v-g*k*w+e*n*w+f*k*r-e*l*r;c[15]=f*n*s-g*l*s+g*k*u-e*n*u-f*k*t+e*l*t;c=e*c[0]+k*c[4]+s*c[8]+v*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],g=d[8],h=d[12],k=d[1],l=d[5],n=d[9],q=d[13],s=d[2],r=d[6],t=d[10],p=d[14],v=d[3],w=d[7],u=d[11],d=d[15];c[0]=n*p*w-q*t*w+q*r*u-l*p*u-n*r*d+l*t*d;c[4]=h*t*w-g*p*w-h*r*u+f*p*u+g*r*d-f*t*d;c[8]=g*q*w-h*n*w+h*l*u-f*q*u-g*l*d+f*n*d;c[12]=h*n*r-g*q*r-h*l*t+f*q*t+g*l*p-f*n*p;c[1]=q*t*v-n*p*v-q*s*u+k*p*u+n*s*d-k*t*d;c[5]=g*p*v-h*t*v+h*s*u-e*p*u-g*s*d+e*t*d;c[9]=h*n*v-g*q*v-h*k*u+e*q*u+g*k*d-
|
|
|
+e*n*d;c[13]=g*q*s-h*n*s+h*k*t-e*q*t-g*k*p+e*n*p;c[2]=l*p*v-q*r*v+q*s*w-k*p*w-l*s*d+k*r*d;c[6]=h*r*v-f*p*v-h*s*w+e*p*w+f*s*d-e*r*d;c[10]=f*q*v-h*l*v+h*k*w-e*q*w-f*k*d+e*l*d;c[14]=h*l*s-f*q*s-h*k*r+e*q*r+f*k*p-e*l*p;c[3]=n*r*v-l*t*v-n*s*w+k*t*w+l*s*u-k*r*u;c[7]=f*t*v-g*r*v+g*s*w-e*t*w-f*s*u+e*r*u;c[11]=g*l*v-f*n*v-g*k*w+e*n*w+f*k*u-e*l*u;c[15]=f*n*s-g*l*s+g*k*r-e*n*r-f*k*t+e*l*t;c=e*c[0]+k*c[4]+s*c[8]+v*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(a){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(a){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(a){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(a){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(a,b){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,g=a.y,h=a.z,k=e*f,l=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+d*h,l*g+c,l*h-d*f,0,k*h-d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
@@ -118,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,g=b.length;f<g;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 g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[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];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],n=c[8],q=c[9],s=c[10],u=c[11],t=c[12],p=c[13],v=c[14],c=c[15];b[0].setComponents(f-a,l-g,u-n,c-t).normalize();b[1].setComponents(f+
|
|
|
-a,l+g,u+n,c+t).normalize();b[2].setComponents(f+d,l+h,u+q,c+p).normalize();b[3].setComponents(f-d,l-h,u-q,c-p).normalize();b[4].setComponents(f-e,l-k,u-s,c-v).normalize();b[5].setComponents(f+e,l+k,u+s,c+v).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){var b=this.planes,
|
|
|
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[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];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],n=c[8],q=c[9],s=c[10],r=c[11],t=c[12],p=c[13],v=c[14],c=c[15];b[0].setComponents(f-a,l-g,r-n,c-t).normalize();b[1].setComponents(f+
|
|
|
+a,l+g,r+n,c+t).normalize();b[2].setComponents(f+d,l+h,r+q,c+p).normalize();b[3].setComponents(f-d,l-h,r-q,c-p).normalize();b[4].setComponents(f-e,l-k,r-s,c-v).normalize();b[5].setComponents(f+e,l+k,r+s,c+v).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){var b=this.planes,
|
|
|
c=a.center;a=-a.radius;for(var 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 g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&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,
|
|
@@ -141,14 +141,14 @@ 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},g=new a.Vector3,h=new a.Vector3,k=new a.Vector3,l=function(f,n,u){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var t=n.ray.distanceToPoint(d);if(t>f.scale.x)return u;u.push({distance:t,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
-a.LOD)d.setFromMatrixPosition(f.matrixWorld),t=n.ray.origin.distanceTo(d),l(f.getObjectForDistance(t),n,u);else if(f instanceof a.Mesh){var p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return u;if(p instanceof a.BufferGeometry){var v=f.material;if(void 0===
|
|
|
-v||!1===p.dynamic)return u;var w,r,x=n.precision;if(void 0!==p.attributes.index)for(var A=p.offsets,F=p.attributes.index.array,P=p.attributes.position.array,I=p.offsets.length,z=p.attributes.index.array.length/3,z=0;z<I;++z)for(var t=A[z].start,B=A[z].index,p=t,L=t+A[z].count;p<L;p+=3)t=B+F[p],w=B+F[p+1],r=B+F[p+2],g.set(P[3*t],P[3*t+1],P[3*t+2]),h.set(P[3*w],P[3*w+1],P[3*w+2]),k.set(P[3*r],P[3*r+1],P[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),
|
|
|
-null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,point:w,face:null,faceIndex:null,object:f}));else for(P=p.attributes.position.array,z=p.attributes.position.array.length,p=0;p<z;p+=3)t=p,w=p+1,r=p+2,g.set(P[3*t],P[3*t+1],P[3*t+2]),h.set(P[3*w],P[3*w+1],P[3*w+2]),k.set(P[3*r],P[3*r+1],P[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),null!==w&&(w.applyMatrix4(f.matrixWorld),
|
|
|
-t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,point:w,face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry)for(F=f.material instanceof a.MeshFaceMaterial,P=!0===F?f.material.materials:null,x=n.precision,A=p.vertices,I=0,z=p.faces.length;I<z;I++)if(B=p.faces[I],v=!0===F?P[B.materialIndex]:f.material,void 0!==v){t=A[B.a];w=A[B.b];r=A[B.c];if(!0===v.morphTargets){var L=p.morphTargets,H=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var J=
|
|
|
-0,y=L.length;J<y;J++){var N=H[J];if(0!==N){var E=L[J].vertices;g.x+=(E[B.a].x-t.x)*N;g.y+=(E[B.a].y-t.y)*N;g.z+=(E[B.a].z-t.z)*N;h.x+=(E[B.b].x-w.x)*N;h.y+=(E[B.b].y-w.y)*N;h.z+=(E[B.b].z-w.z)*N;k.x+=(E[B.c].x-r.x)*N;k.y+=(E[B.c].y-r.y)*N;k.z+=(E[B.c].z-r.z)*N}}g.add(t);h.add(w);k.add(r);t=g;w=h;r=k}w=v.side===a.BackSide?c.intersectTriangle(r,w,t,!0):c.intersectTriangle(t,w,r,v.side!==a.DoubleSide);null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||u.push({distance:t,
|
|
|
-point:w,face:B,faceIndex:I,object:f}))}}else if(f instanceof a.Line){x=n.linePrecision;v=x*x;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(p instanceof a.Geometry)for(A=p.vertices,x=A.length,w=new a.Vector3,r=new a.Vector3,z=f.type===a.LineStrip?1:2,p=0;p<x-1;p+=z)c.distanceSqToSegment(A[p],A[p+1],r,w)>v||(t=c.origin.distanceTo(r),
|
|
|
-t<n.near||t>n.far||u.push({distance:t,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},n=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)l(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&&n(a,this,c);l(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(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},g=new a.Vector3,h=new a.Vector3,k=new a.Vector3,l=function(f,n,r){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var t=n.ray.distanceToPoint(d);if(t>f.scale.x)return r;r.push({distance:t,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
+a.LOD)d.setFromMatrixPosition(f.matrixWorld),t=n.ray.origin.distanceTo(d),l(f.getObjectForDistance(t),n,r);else if(f instanceof a.Mesh){var p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return r;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return r;if(p instanceof a.BufferGeometry){var v=f.material;if(void 0===
|
|
|
+v||!1===p.dynamic)return r;var w,u,x=n.precision;if(void 0!==p.attributes.index)for(var A=p.offsets,F=p.attributes.index.array,P=p.attributes.position.array,I=p.offsets.length,z=p.attributes.index.array.length/3,z=0;z<I;++z)for(var t=A[z].start,B=A[z].index,p=t,L=t+A[z].count;p<L;p+=3)t=B+F[p],w=B+F[p+1],u=B+F[p+2],g.set(P[3*t],P[3*t+1],P[3*t+2]),h.set(P[3*w],P[3*w+1],P[3*w+2]),k.set(P[3*u],P[3*u+1],P[3*u+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),
|
|
|
+null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||r.push({distance:t,point:w,face:null,faceIndex:null,object:f}));else for(P=p.attributes.position.array,z=p.attributes.position.array.length,p=0;p<z;p+=3)t=p,w=p+1,u=p+2,g.set(P[3*t],P[3*t+1],P[3*t+2]),h.set(P[3*w],P[3*w+1],P[3*w+2]),k.set(P[3*u],P[3*u+1],P[3*u+2]),w=v.side===a.BackSide?c.intersectTriangle(k,h,g,!0):c.intersectTriangle(g,h,k,v.side!==a.DoubleSide),null!==w&&(w.applyMatrix4(f.matrixWorld),
|
|
|
+t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||r.push({distance:t,point:w,face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry)for(F=f.material instanceof a.MeshFaceMaterial,P=!0===F?f.material.materials:null,x=n.precision,A=p.vertices,I=0,z=p.faces.length;I<z;I++)if(B=p.faces[I],v=!0===F?P[B.materialIndex]:f.material,void 0!==v){t=A[B.a];w=A[B.b];u=A[B.c];if(!0===v.morphTargets){var L=p.morphTargets,H=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);k.set(0,0,0);for(var J=
|
|
|
+0,y=L.length;J<y;J++){var N=H[J];if(0!==N){var E=L[J].vertices;g.x+=(E[B.a].x-t.x)*N;g.y+=(E[B.a].y-t.y)*N;g.z+=(E[B.a].z-t.z)*N;h.x+=(E[B.b].x-w.x)*N;h.y+=(E[B.b].y-w.y)*N;h.z+=(E[B.b].z-w.z)*N;k.x+=(E[B.c].x-u.x)*N;k.y+=(E[B.c].y-u.y)*N;k.z+=(E[B.c].z-u.z)*N}}g.add(t);h.add(w);k.add(u);t=g;w=h;u=k}w=v.side===a.BackSide?c.intersectTriangle(u,w,t,!0):c.intersectTriangle(t,w,u,v.side!==a.DoubleSide);null!==w&&(w.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(w),t<x||t<n.near||t>n.far||r.push({distance:t,
|
|
|
+point:w,face:B,faceIndex:I,object:f}))}}else if(f instanceof a.Line){x=n.linePrecision;v=x*x;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return r;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(p instanceof a.Geometry)for(A=p.vertices,x=A.length,w=new a.Vector3,u=new a.Vector3,z=f.type===a.LineStrip?1:2,p=0;p<x-1;p+=z)c.distanceSqToSegment(A[p],A[p+1],u,w)>v||(t=c.origin.distanceTo(u),
|
|
|
+t<n.near||t>n.far||r.push({distance:t,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},n=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)l(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&&n(a,this,c);l(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++)l(a[d],this,c),!0===b&&n(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.");
|
|
@@ -161,18 +161,18 @@ this.children.indexOf(a);if(-1!==b){a.parent=void 0;a.dispatchEvent({type:"remov
|
|
|
b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getObjectByName(a,b),void 0!==e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName().");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(n===s){var a=new THREE.RenderableVertex;q.push(a);s++;n++;return a}return q[n++]}function b(){if(t===v){var a=new THREE.RenderableFace3;p.push(a);v++;t++;return a}return p[t++]}function c(){if(r===A){var a=new THREE.RenderableLine;x.push(a);A++;r++;return a}return x[r++]}function d(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function e(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&
|
|
|
-0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var f,g,h=[],k=0,l,n,q=[],s=0,u,t,p=[],v=0,w,r,x=[],A=0,F,P,I=[],z=0,B={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,H=new THREE.Vector3,J=new THREE.Vector3,y=new THREE.Vector3,N=new THREE.Vector4,E=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,D=Array(3),G=new THREE.Matrix4,
|
|
|
+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(n===s){var a=new THREE.RenderableVertex;q.push(a);s++;n++;return a}return q[n++]}function b(){if(t===v){var a=new THREE.RenderableFace3;p.push(a);v++;t++;return a}return p[t++]}function c(){if(u===A){var a=new THREE.RenderableLine;x.push(a);A++;u++;return a}return x[u++]}function d(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function e(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&
|
|
|
+0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var f,g,h=[],k=0,l,n,q=[],s=0,r,t,p=[],v=0,w,u,x=[],A=0,F,P,I=[],z=0,B={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,H=new THREE.Vector3,J=new THREE.Vector3,y=new THREE.Vector3,N=new THREE.Vector4,E=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),C=new THREE.Box3,D=Array(3),G=new THREE.Matrix4,
|
|
|
X=new THREE.Matrix4,T,ea=new THREE.Matrix4,Y=new THREE.Matrix3,la=new THREE.Matrix3,Q=new THREE.Vector3,ha=new THREE.Frustum,S=new THREE.Vector4,M=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(){var a=new THREE.Matrix4;return function(b,c){a.getInverse(c.projectionMatrix);X.multiplyMatrices(c.matrixWorld,a);return b.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 R=function(a){if(g===k){var b=new THREE.RenderableObject;h.push(b);k++;g++;f=b}else f=h[g++];f.id=a.id;f.object=a;null!==a.renderDepth?f.z=a.renderDepth:(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(X),f.z=y.z);return f},ma=function(a){if(!1!==a.visible){a instanceof THREE.Light?B.lights.push(a):a instanceof
|
|
|
THREE.Mesh||a instanceof THREE.Line?!1!==a.frustumCulled&&!0!==ha.intersectsObject(a)||B.objects.push(R(a)):a instanceof THREE.Sprite&&B.sprites.push(R(a));for(var b=0,c=a.children.length;b<c;b++)ma(a.children[b])}},fa=new function(){var d=null,e=function(a){var b=a.positionWorld,c=a.positionScreen;b.copy(a.position).applyMatrix4(T);c.copy(b).applyMatrix4(X);b=1/c.w;c.x*=b;c.y*=b;c.z*=b;a.visible=-1<=c.x&&1>=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},f=function(a,b,c){D[0]=a.positionScreen;D[1]=b.positionScreen;
|
|
|
D[2]=c.positionScreen;return!0===a.visible||!0===b.visible||!0===c.visible||E.isIntersectionBox(C.setFromPoints(D))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){d=a},projectVertex:e,checkTriangleVisibility:f,handleVertex:function(b,c,d){l=a();l.position.set(b,c,d);e(l)},handleLine:function(a,b){w=c();w.id=d.id;w.v1.copy(q[a]);w.v2.copy(q[b]);w.material=
|
|
|
-d.material;B.elements.push(w)},handleTriangle:function(a,c,e){a=q[a];c=q[c];e=q[e];!0===f(a,c,e)&&(u=b(),u.id=d.id,u.v1.copy(a),u.v2.copy(c),u.v3.copy(e),u.material=d.material,B.elements.push(u))}}};this.projectScene=function(f,h,k,l){var p,s,v,x,y,A,E,D,R;P=r=t=0;B.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();G.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));X.multiplyMatrices(h.projectionMatrix,G);la.getNormalMatrix(G);ha.setFromMatrix(X);
|
|
|
+d.material;B.elements.push(w)},handleTriangle:function(a,c,e){a=q[a];c=q[c];e=q[e];!0===f(a,c,e)&&(r=b(),r.id=d.id,r.v1.copy(a),r.v2.copy(c),r.v3.copy(e),r.material=d.material,B.elements.push(r))}}};this.projectScene=function(f,h,k,l){var p,s,v,x,y,A,E,D,R;P=u=t=0;B.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();G.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));X.multiplyMatrices(h.projectionMatrix,G);la.getNormalMatrix(G);ha.setFromMatrix(X);
|
|
|
g=0;B.objects.length=0;B.sprites.length=0;B.lights.length=0;ma(f);!0===k&&B.objects.sort(d);f=0;for(k=B.objects.length;f<k;f++)if(p=B.objects[f].object,s=p.geometry,fa.setObject(p),T=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;for(s=A.length;p<s;p+=3)fa.handleVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=3)fa.handleTriangle(x[p],x[p+1],x[p+2]);else for(p=0,s=
|
|
|
A.length/3;p<s;p+=3)fa.handleTriangle(p,p+1,p+2)}}else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;A=s.faceVertexUvs;Y.getNormalMatrix(T);D=p.material instanceof THREE.MeshFaceMaterial;R=!0===D?p.material:null;for(var C=0,ya=v.length;C<ya;C++){var za=v[C];fa.handleVertex(za.x,za.y,za.z)}C=0;for(ya=x.length;C<ya;C++)if(v=x[C],za=!0===D?R.materials[v.materialIndex]:p.material,void 0!==za){E=za.side;y=q[v.a];var ja=q[v.b],Ea=q[v.c];if(!0===za.morphTargets){var Fa=s.morphTargets,pa=p.morphTargetInfluences,
|
|
|
Aa=y.position,Ba=ja.position,$a=Ea.position;L.set(0,0,0);H.set(0,0,0);J.set(0,0,0);for(var Na=0,ga=Fa.length;Na<ga;Na++){var ia=pa[Na];if(0!==ia){var Ga=Fa[Na].vertices;L.x+=(Ga[v.a].x-Aa.x)*ia;L.y+=(Ga[v.a].y-Aa.y)*ia;L.z+=(Ga[v.a].z-Aa.z)*ia;H.x+=(Ga[v.b].x-Ba.x)*ia;H.y+=(Ga[v.b].y-Ba.y)*ia;H.z+=(Ga[v.b].z-Ba.z)*ia;J.x+=(Ga[v.c].x-$a.x)*ia;J.y+=(Ga[v.c].y-$a.y)*ia;J.z+=(Ga[v.c].z-$a.z)*ia}}y.position.add(L);ja.position.add(H);Ea.position.add(J);fa.projectVertex(y);fa.projectVertex(ja);fa.projectVertex(Ea)}Fa=
|
|
|
-fa.checkTriangleVisibility(y,ja,Ea);if(Fa!==(E===THREE.BackSide)){u=b();u.id=p.id;u.v1.copy(y);u.v2.copy(ja);u.v3.copy(Ea);u.normalModel.copy(v.normal);!1!==Fa||E!==THREE.BackSide&&E!==THREE.DoubleSide||u.normalModel.negate();u.normalModel.applyMatrix3(Y).normalize();u.normalModelView.copy(u.normalModel).applyMatrix3(la);u.centroidModel.copy(v.centroid).applyMatrix4(T);y=v.vertexNormals;ja=0;for(Ea=Math.min(y.length,3);ja<Ea;ja++)pa=u.vertexNormalsModel[ja],pa.copy(y[ja]),!1!==Fa||E!==THREE.BackSide&&
|
|
|
-E!==THREE.DoubleSide||pa.negate(),pa.applyMatrix3(Y).normalize(),u.vertexNormalsModelView[ja].copy(pa).applyMatrix3(la);u.vertexNormalsLength=y.length;y=0;for(ja=Math.min(A.length,3);y<ja;y++)if(E=A[y][C],void 0!==E)for(Ea=0,Fa=E.length;Ea<Fa;Ea++)u.uvs[y][Ea]=E[Ea];u.color=v.color;u.material=za;Q.copy(u.centroidModel).applyProjection(X);u.z=Q.z;B.elements.push(u)}}}}else if(p instanceof THREE.Line)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;
|
|
|
+fa.checkTriangleVisibility(y,ja,Ea);if(Fa!==(E===THREE.BackSide)){r=b();r.id=p.id;r.v1.copy(y);r.v2.copy(ja);r.v3.copy(Ea);r.normalModel.copy(v.normal);!1!==Fa||E!==THREE.BackSide&&E!==THREE.DoubleSide||r.normalModel.negate();r.normalModel.applyMatrix3(Y).normalize();r.normalModelView.copy(r.normalModel).applyMatrix3(la);r.centroidModel.copy(v.centroid).applyMatrix4(T);y=v.vertexNormals;ja=0;for(Ea=Math.min(y.length,3);ja<Ea;ja++)pa=r.vertexNormalsModel[ja],pa.copy(y[ja]),!1!==Fa||E!==THREE.BackSide&&
|
|
|
+E!==THREE.DoubleSide||pa.negate(),pa.applyMatrix3(Y).normalize(),r.vertexNormalsModelView[ja].copy(pa).applyMatrix3(la);r.vertexNormalsLength=y.length;y=0;for(ja=Math.min(A.length,3);y<ja;y++)if(E=A[y][C],void 0!==E)for(Ea=0,Fa=E.length;Ea<Fa;Ea++)r.uvs[y][Ea]=E[Ea];r.color=v.color;r.material=za;Q.copy(r.centroidModel).applyProjection(X);r.z=Q.z;B.elements.push(r)}}}}else if(p instanceof THREE.Line)if(s instanceof THREE.BufferGeometry){if(x=s.attributes,void 0!==x.position){A=x.position.array;p=0;
|
|
|
for(s=A.length;p<s;p+=3)fa.handleVertex(A[p],A[p+1],A[p+2]);if(void 0!==x.index)for(x=x.index.array,p=0,s=x.length;p<s;p+=2)fa.handleLine(x[p],x[p+1]);else for(p=0,s=A.length/3-1;p<s;p++)fa.handleLine(p,p+1)}}else if(s instanceof THREE.Geometry)for(ea.multiplyMatrices(X,T),v=p.geometry.vertices,y=a(),y.positionScreen.copy(v[0]).applyMatrix4(ea),s=p.type===THREE.LinePieces?2:1,C=1,ya=v.length;C<ya;C++)y=a(),y.positionScreen.copy(v[C]).applyMatrix4(ea),0<(C+1)%s||(ja=q[n-2],S.copy(y.positionScreen),
|
|
|
M.copy(ja.positionScreen),!0===e(S,M)&&(S.multiplyScalar(1/S.w),M.multiplyScalar(1/M.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(S),w.v2.positionScreen.copy(M),w.z=Math.max(S.z,M.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[C]),w.vertexColors[1].copy(p.geometry.colors[C-1])),B.elements.push(w)));f=0;for(k=B.sprites.length;f<k;f++)p=B.sprites[f].object,T=p.matrixWorld,N.set(T.elements[12],T.elements[13],T.elements[14],1),N.applyMatrix4(X),
|
|
|
s=1/N.w,N.z*=s,-1<=N.z&&1>=N.z&&(P===z?(x=new THREE.RenderableSprite,I.push(x),z++,P++,F=x):F=I[P++],F.id=p.id,F.x=N.x*s,F.y=N.y*s,F.z=N.z,F.object=p,F.rotation=p.rotation,F.scale.x=p.scale.x*Math.abs(F.x-(N.x+h.projectionMatrix.elements[0])/(N.w+h.projectionMatrix.elements[12])),F.scale.y=p.scale.y*Math.abs(F.y-(N.y+h.projectionMatrix.elements[5])/(N.w+h.projectionMatrix.elements[13])),F.material=p.material,B.elements.push(F));!0===l&&B.elements.sort(d);return B}};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};
|
|
@@ -185,21 +185,21 @@ g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
|
0,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++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=
|
|
|
e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,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 g=
|
|
|
this.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(k)}g=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],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.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,g,h,k,l,n,q,s,u,t,p,v,w=[],r=[];c=new THREE.Vector3;var x=new THREE.Vector3,A=new THREE.Vector3,F=new THREE.Vector3,P=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[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,v=e.b,e=e.c,g=this.vertices[d],h=this.vertices[v],k=this.vertices[e],
|
|
|
-l=f[0],n=f[1],q=f[2],f=h.x-g.x,s=k.x-g.x,u=h.y-g.y,t=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=n.x-l.x,p=q.x-l.x,n=n.y-l.y,l=q.y-l.y,q=1/(k*l-p*n),c.set((l*f-n*s)*q,(l*u-n*t)*q,(l*h-n*g)*q),x.set((k*s-p*f)*q,(k*t-p*u)*q,(k*g-p*h)*q),w[d].add(c),w[v].add(c),w[e].add(c),r[d].add(x),r[v].add(x),r[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)P.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],A.copy(v),A.sub(P.multiplyScalar(P.dot(v))).normalize(),
|
|
|
-F.crossVectors(e.vertexNormals[c],v),d=F.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(A.x,A.y,A.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);
|
|
|
+d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,k,l,n,q,s,r,t,p,v,w=[],u=[];c=new THREE.Vector3;var x=new THREE.Vector3,A=new THREE.Vector3,F=new THREE.Vector3,P=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,u[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,v=e.b,e=e.c,g=this.vertices[d],h=this.vertices[v],k=this.vertices[e],
|
|
|
+l=f[0],n=f[1],q=f[2],f=h.x-g.x,s=k.x-g.x,r=h.y-g.y,t=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=n.x-l.x,p=q.x-l.x,n=n.y-l.y,l=q.y-l.y,q=1/(k*l-p*n),c.set((l*f-n*s)*q,(l*r-n*t)*q,(l*h-n*g)*q),x.set((k*s-p*f)*q,(k*t-p*r)*q,(k*g-p*h)*q),w[d].add(c),w[v].add(c),w[e].add(c),u[d].add(x),u[v].add(x),u[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)P.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],A.copy(v),A.sub(P.multiplyScalar(P.dot(v))).normalize(),
|
|
|
+F.crossVectors(e.vertexNormals[c],v),d=F.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(A.x,A.y,A.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,g;f=0;for(g=this.vertices.length;f<g;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(g=this.faces.length;f<g;f++)for(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],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=
|
|
|
a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;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=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].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,g=a.length;f<g;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){a.makeEmpty();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 g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g)}}}(),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 for(a=0,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,g,h,k,l,n,q,s=new THREE.Vector3,u=new THREE.Vector3,t=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,r=this.offsets;c=0;for(d=
|
|
|
-r.length;c<d;++c){b=r[c].start;g=r[c].count;var x=r[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],k=x+w[a+2],l=e[3*g],n=e[3*g+1],q=e[3*g+2],s.set(l,n,q),l=e[3*h],n=e[3*h+1],q=e[3*h+2],u.set(l,n,q),l=e[3*k],n=e[3*k+1],q=e[3*k+2],t.set(l,n,q),p.subVectors(t,u),v.subVectors(s,u),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*k]+=p.x,f[3*k+1]+=p.y,f[3*k+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)l=e[a],n=e[a+1],q=e[a+2],s.set(l,n,q),l=e[a+3],n=e[a+4],
|
|
|
-q=e[a+5],u.set(l,n,q),l=e[a+6],n=e[a+7],q=e[a+8],t.set(l,n,q),p.subVectors(t,u),v.subVectors(s,u),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.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,b,c){q=d[3*a];s=d[3*a+1];
|
|
|
-u=d[3*a+2];t=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];r=d[3*c+1];x=d[3*c+2];A=f[2*a];F=f[2*a+1];P=f[2*b];I=f[2*b+1];z=f[2*c];B=f[2*c+1];L=t-q;H=w-q;J=p-s;y=r-s;N=v-u;E=x-u;C=P-A;D=z-A;G=I-F;X=B-F;T=1/(C*X-D*G);ea.set((X*L-G*H)*T,(X*J-G*y)*T,(X*N-G*E)*T);Y.set((C*H-D*L)*T,(C*y-D*J)*T,(C*E-D*N)*T);k[a].add(ea);k[b].add(ea);k[c].add(ea);l[a].add(Y);l[b].add(Y);l[c].add(Y)}function b(a){U.x=e[3*a];U.y=e[3*a+1];U.z=e[3*a+2];aa.copy(U);oa=k[a];fa.copy(oa);fa.sub(U.multiplyScalar(U.dot(oa))).normalize();Ka.crossVectors(aa,
|
|
|
+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 for(a=0,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,g,h,k,l,n,q,s=new THREE.Vector3,r=new THREE.Vector3,t=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,u=this.offsets;c=0;for(d=
|
|
|
+u.length;c<d;++c){b=u[c].start;g=u[c].count;var x=u[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],k=x+w[a+2],l=e[3*g],n=e[3*g+1],q=e[3*g+2],s.set(l,n,q),l=e[3*h],n=e[3*h+1],q=e[3*h+2],r.set(l,n,q),l=e[3*k],n=e[3*k+1],q=e[3*k+2],t.set(l,n,q),p.subVectors(t,r),v.subVectors(s,r),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*k]+=p.x,f[3*k+1]+=p.y,f[3*k+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)l=e[a],n=e[a+1],q=e[a+2],s.set(l,n,q),l=e[a+3],n=e[a+4],
|
|
|
+q=e[a+5],r.set(l,n,q),l=e[a+6],n=e[a+7],q=e[a+8],t.set(l,n,q),p.subVectors(t,r),v.subVectors(s,r),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.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,b,c){q=d[3*a];s=d[3*a+1];
|
|
|
+r=d[3*a+2];t=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];u=d[3*c+1];x=d[3*c+2];A=f[2*a];F=f[2*a+1];P=f[2*b];I=f[2*b+1];z=f[2*c];B=f[2*c+1];L=t-q;H=w-q;J=p-s;y=u-s;N=v-r;E=x-r;C=P-A;D=z-A;G=I-F;X=B-F;T=1/(C*X-D*G);ea.set((X*L-G*H)*T,(X*J-G*y)*T,(X*N-G*E)*T);Y.set((C*H-D*L)*T,(C*y-D*J)*T,(C*E-D*N)*T);k[a].add(ea);k[b].add(ea);k[c].add(ea);l[a].add(Y);l[b].add(Y);l[c].add(Y)}function b(a){U.x=e[3*a];U.y=e[3*a+1];U.z=e[3*a+2];aa.copy(U);oa=k[a];fa.copy(oa);fa.sub(U.multiplyScalar(U.dot(oa))).normalize();Ka.crossVectors(aa,
|
|
|
oa);xa=Ka.dot(l[a]);Ca=0>xa?-1:1;h[4*a]=fa.x;h[4*a+1]=fa.y;h[4*a+2]=fa.z;h[4*a+3]=Ca}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 c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&
|
|
|
-(this.attributes.tangent={itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<g;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var q,s,u,t,p,v,w,r,x,A,F,P,I,z,B,L,H,J,y,N,E,C,D,G,X,T,ea=new THREE.Vector3,Y=new THREE.Vector3,la,Q,ha,S,M,R=this.offsets,n=0;for(Q=R.length;n<Q;++n){la=R[n].start;ha=R[n].count;var ma=R[n].index,g=la;for(la+=ha;g<la;g+=3)ha=ma+c[g],S=ma+c[g+1],M=ma+c[g+2],a(ha,S,M)}var fa=new THREE.Vector3,Ka=new THREE.Vector3,U=new THREE.Vector3,
|
|
|
+(this.attributes.tangent={itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<g;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var q,s,r,t,p,v,w,u,x,A,F,P,I,z,B,L,H,J,y,N,E,C,D,G,X,T,ea=new THREE.Vector3,Y=new THREE.Vector3,la,Q,ha,S,M,R=this.offsets,n=0;for(Q=R.length;n<Q;++n){la=R[n].start;ha=R[n].count;var ma=R[n].index,g=la;for(la+=ha;g<la;g+=3)ha=ma+c[g],S=ma+c[g+1],M=ma+c[g+2],a(ha,S,M)}var fa=new THREE.Vector3,Ka=new THREE.Vector3,U=new THREE.Vector3,
|
|
|
aa=new THREE.Vector3,Ca,oa,xa,n=0;for(Q=R.length;n<Q;++n)for(la=R[n].start,ha=R[n].count,ma=R[n].index,g=la,la+=ha;g<la;g+=3)ha=ma+c[g],S=ma+c[g+1],M=ma+c[g+2],b(ha),b(S),b(M);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,array:null},d=0,g=b.length;d<
|
|
|
g;d++){var h=b[d];if(e instanceof h){f.array=new h(e);break}}a.attributes[c]=f}d=0;for(g=this.offsets.length;d<g;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};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);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)};
|
|
@@ -223,10 +223,10 @@ 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(c){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,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText),h=a.parse(h,d);c(h.geometry,h.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===g&&
|
|
|
(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=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;(function(b){var d,g,h,k,l,n,q,s,u,t,p,v,w,r=a.faces;n=a.vertices;var x=a.normals,A=a.colors,F=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=r.length;k<l;)if(b=r[k++],u=b&1,h=b&2,d=b&8,q=b&16,t=b&32,n=b&64,b&=128,u){u=new THREE.Face3;
|
|
|
-u.a=r[k];u.b=r[k+1];u.c=r[k+3];p=new THREE.Face3;p.a=r[k+1];p.b=r[k+2];p.c=r[k+3];k+=4;h&&(h=r[k++],u.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)s=r[k++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]),p.normal.copy(u.normal));if(t)for(d=0;4>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],
|
|
|
-x[q++],x[q]),2!==d&&u.vertexNormals.push(t),0!==d&&p.vertexNormals.push(t);n&&(n=r[k++],n=A[n],u.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=r[k++],n=A[n],2!==d&&u.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(u);c.faces.push(p)}else{u=new THREE.Face3;u.a=r[k++];u.b=r[k++];u.c=r[k++];h&&(h=r[k++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)s=r[k++],w=v[2*s],s=v[2*s+1],
|
|
|
-w=new THREE.Vector2(w,s),c.faceVertexUvs[d][h].push(w);q&&(q=3*r[k++],u.normal.set(x[q++],x[q++],x[q]));if(t)for(d=0;3>d;d++)q=3*r[k++],t=new THREE.Vector3(x[q++],x[q++],x[q]),u.vertexNormals.push(t);n&&(n=r[k++],u.color.setHex(A[n]));if(b)for(d=0;3>d;d++)n=r[k++],u.vertexColors.push(new THREE.Color(A[n]));c.faces.push(u)}})(d);(function(){var b,d,g,h;if(a.skinWeights)for(b=0,d=a.skinWeights.length;b<d;b+=2)g=a.skinWeights[b],h=a.skinWeights[b+1],c.skinWeights.push(new THREE.Vector4(g,h,0,0));if(a.skinIndices)for(b=
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,n,q,s,r,t,p,v,w,u=a.faces;n=a.vertices;var x=a.normals,A=a.colors,F=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=u.length;k<l;)if(b=u[k++],r=b&1,h=b&2,d=b&8,q=b&16,t=b&32,n=b&64,b&=128,r){r=new THREE.Face3;
|
|
|
+r.a=u[k];r.b=u[k+1];r.c=u[k+3];p=new THREE.Face3;p.a=u[k+1];p.b=u[k+2];p.c=u[k+3];k+=4;h&&(h=u[k++],r.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)s=u[k++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*u[k++],r.normal.set(x[q++],x[q++],x[q]),p.normal.copy(r.normal));if(t)for(d=0;4>d;d++)q=3*u[k++],t=new THREE.Vector3(x[q++],
|
|
|
+x[q++],x[q]),2!==d&&r.vertexNormals.push(t),0!==d&&p.vertexNormals.push(t);n&&(n=u[k++],n=A[n],r.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=u[k++],n=A[n],2!==d&&r.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(r);c.faces.push(p)}else{r=new THREE.Face3;r.a=u[k++];r.b=u[k++];r.c=u[k++];h&&(h=u[k++],r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)s=u[k++],w=v[2*s],s=v[2*s+1],
|
|
|
+w=new THREE.Vector2(w,s),c.faceVertexUvs[d][h].push(w);q&&(q=3*u[k++],r.normal.set(x[q++],x[q++],x[q]));if(t)for(d=0;3>d;d++)q=3*u[k++],t=new THREE.Vector3(x[q++],x[q++],x[q]),r.vertexNormals.push(t);n&&(n=u[k++],r.color.setHex(A[n]));if(b)for(d=0;3>d;d++)n=u[k++],r.vertexColors.push(new THREE.Color(A[n]));c.faces.push(r)}})(d);(function(){var b,d,g,h;if(a.skinWeights)for(b=0,d=a.skinWeights.length;b<d;b+=2)g=a.skinWeights[b],h=a.skinWeights[b+1],c.skinWeights.push(new THREE.Vector4(g,h,0,0));if(a.skinIndices)for(b=
|
|
|
0,d=a.skinIndices.length;b<d;b+=2)g=a.skinIndices[b],h=a.skinIndices[b+1],c.skinIndices.push(new THREE.Vector4(g,h,0,0));c.bones=a.bones;c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,g,h,k,l,n;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,k=n.length;h<k;h+=3){var q=new THREE.Vector3;q.x=n[h]*
|
|
|
b;q.y=n[h+1]*b;q.z=n[h+2]*b;l.push(q)}}if(void 0!==a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,b=0,h=l.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)})(d);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(a){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};
|
|
@@ -241,7 +241,7 @@ d.parse(h.data);break;case "Geometry":g=c.parse(h.data).geometry}g.uuid=h.uuid;v
|
|
|
b.aspect,b.near,b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,
|
|
|
b.groundColor,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 g in b.children)e.add(this.parseObject(b.children[g],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,c,d){var e=this;c=new THREE.XHRLoader(e.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(c){e.parse(JSON.parse(c),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:u+"/"+a}function e(){f(z.scene,
|
|
|
+THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b,c,d){var e=this;c=new THREE.XHRLoader(e.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(c){e.parse(JSON.parse(c),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:r+"/"+a}function e(){f(z.scene,
|
|
|
L.objects)}function f(a,b){var c,e,g,h,l,n;for(n in b){var q=z.objects[n],r=b[n];if(void 0===q){if(r.type&&r.type in s.hierarchyHandlers){if(void 0===r.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={},w;for(w in r)w in c||(u[w]=r[w]);p=z.materials[r.material];r.loading=!0;c=s.hierarchyHandlers[r.type].loaderObject;c.options?c.load(d(r.url,L.urlBaseType),k(n,a,p,r)):c.load(d(r.url,L.urlBaseType),k(n,
|
|
|
a,p,r),u)}}else if(void 0!==r.geometry){if(t=z.geometries[r.geometry]){q=!1;p=z.materials[r.material];q=p instanceof THREE.ShaderMaterial;e=r.position;g=r.rotation;h=r.scale;c=r.matrix;l=r.quaternion;r.material||(p=new THREE.MeshFaceMaterial(z.face_materials[r.geometry]));p instanceof THREE.MeshFaceMaterial&&0===p.materials.length&&(p=new THREE.MeshFaceMaterial(z.face_materials[r.geometry]));if(p instanceof THREE.MeshFaceMaterial)for(u=0;u<p.materials.length;u++)q=q||p.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
q&&t.computeTangents();r.skin?q=new THREE.SkinnedMesh(t,p):r.morph?(q=new THREE.MorphAnimMesh(t,p),void 0!==r.duration&&(q.duration=r.duration),void 0!==r.time&&(q.time=r.time),void 0!==r.mirroredLoop&&(q.mirroredLoop=r.mirroredLoop),p.morphNormals&&t.computeMorphNormals()):q=new THREE.Mesh(t,p);q.name=n;c?(q.matrixAutoUpdate=!1,q.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])):(q.position.fromArray(e),l?q.quaternion.fromArray(l):q.rotation.fromArray(g),
|
|
@@ -251,18 +251,18 @@ r.size_y}a.add(x);x.name=n;z.lights[n]=x;z.objects[n]=x}else"PerspectiveCamera"=
|
|
|
v):(e=r.position,g=r.rotation,h=r.scale,l=r.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(e),l?q.quaternion.fromArray(l):q.rotation.fromArray(g),q.scale.fromArray(h),q.visible=void 0!==r.visible?r.visible:!1,a.add(q),z.objects[n]=q,z.empties[n]=q);if(q){if(void 0!==r.userData)for(var y in r.userData)q.userData[y]=r.userData[y];if(void 0!==r.groups)for(u=0;u<r.groups.length;u++)c=r.groups[u],void 0===z.groups[c]&&(z.groups[c]=[]),z.groups[c].push(n)}}void 0!==q&&void 0!==r.children&&
|
|
|
f(q,r.children)}}function g(a,b,c,d,f){var g=f.rotation,h=f.quaternion,k=f.scale;a.position.fromArray(f.position);h?a.quaternion.fromArray(h):a.rotation.fromArray(g);a.scale.fromArray(k);d&&a.traverse(function(a){a.material=d});var l=void 0!==f.visible?f.visible:!0;a.traverse(function(a){a.visible=l});c.add(a);a.name=b;z.objects[b]=a;e()}function h(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c;e();A-=1;s.onLoadComplete();n()}}function k(a,b,c,d){return function(e){g(e.content?
|
|
|
e.content:e.dae?e.scene:e,a,b,c,d);A-=1;s.onLoadComplete();n()}}function l(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c}}function n(){s.callbackProgress({totalModels:P,totalTextures:I,loadedModels:P-A,loadedTextures:I-F},z);s.onLoadProgress();if(0===A&&0===F){for(var a=0;a<B.length;a++){var c=B[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,z.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(z)}}function q(a,
|
|
|
-b){b(a);if(void 0!==a.children)for(var c in a.children)q(a.children[c],b)}var s=this,u=THREE.Loader.prototype.extractUrlBase(c),t,p,v,w,r,x,A,F,P,I,z,B=[],L=a,H;for(H in this.geometryHandlers)a=this.geometryHandlers[H].loaderClass,this.geometryHandlers[H].loaderObject=new a;for(H in this.hierarchyHandlers)a=this.hierarchyHandlers[H].loaderClass,this.hierarchyHandlers[H].loaderObject=new a;F=A=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
+b){b(a);if(void 0!==a.children)for(var c in a.children)q(a.children[c],b)}var s=this,r=THREE.Loader.prototype.extractUrlBase(c),t,p,v,w,u,x,A,F,P,I,z,B=[],L=a,H;for(H in this.geometryHandlers)a=this.geometryHandlers[H].loaderClass,this.geometryHandlers[H].loaderObject=new a;for(H in this.hierarchyHandlers)a=this.hierarchyHandlers[H].loaderClass,this.hierarchyHandlers[H].loaderObject=new a;F=A=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
lights:{},fogs:{},empties:{},groups:{}};L.transform&&(H=L.transform.position,a=L.transform.rotation,c=L.transform.scale,H&&z.scene.position.fromArray(H),a&&z.scene.rotation.fromArray(a),c&&z.scene.scale.fromArray(c),H||a||c)&&(z.scene.updateMatrix(),z.scene.updateMatrixWorld());H=function(a){return function(){F-=a;n();s.onLoadComplete()}};for(var J in L.fogs)a=L.fogs[J],"linear"===a.type?w=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(w=new THREE.FogExp2(0,a.density)),a=a.color,w.color.setRGB(a[0],
|
|
|
a[1],a[2]),z.fogs[J]=w;for(var y in L.geometries)w=L.geometries[y],w.type in this.geometryHandlers&&(A+=1,s.onLoadStart());for(var N in L.objects)q(L.objects[N],function(a){a.type&&a.type in s.hierarchyHandlers&&(A+=1,s.onLoadStart())});P=A;for(y in L.geometries)if(w=L.geometries[y],"cube"===w.type)t=new THREE.BoxGeometry(w.width,w.height,w.depth,w.widthSegments,w.heightSegments,w.depthSegments),t.name=y,z.geometries[y]=t;else if("plane"===w.type)t=new THREE.PlaneGeometry(w.width,w.height,w.widthSegments,
|
|
|
w.heightSegments),t.name=y,z.geometries[y]=t;else if("sphere"===w.type)t=new THREE.SphereGeometry(w.radius,w.widthSegments,w.heightSegments),t.name=y,z.geometries[y]=t;else if("cylinder"===w.type)t=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),t.name=y,z.geometries[y]=t;else if("torus"===w.type)t=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),t.name=y,z.geometries[y]=t;else if("icosahedron"===w.type)t=new THREE.IcosahedronGeometry(w.radius,w.subdivisions),
|
|
|
-t.name=y,z.geometries[y]=t;else if(w.type in this.geometryHandlers){N={};for(r in w)"type"!==r&&"url"!==r&&(N[r]=w[r]);this.geometryHandlers[w.type].loaderObject.load(d(w.url,L.urlBaseType),h(y),N)}else"embedded"===w.type&&(N=L.embeds[w.id],N.metadata=L.metadata,N&&(N=this.geometryHandlers.ascii.loaderObject.parse(N,""),l(y)(N.geometry,N.materials)));for(var E in L.textures)if(y=L.textures[E],y.url instanceof Array)for(F+=y.url.length,r=0;r<y.url.length;r++)s.onLoadStart();else F+=1,s.onLoadStart();
|
|
|
-I=F;for(E in L.textures){y=L.textures[E];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){N=y.url.length;w=[];for(r=0;r<N;r++)w[r]=d(y.url[r],L.urlBaseType);r=(r=/\.dds$/i.test(w[0]))?THREE.ImageUtils.loadCompressedTextureCube(w,y.mapping,H(N)):THREE.ImageUtils.loadTextureCube(w,y.mapping,H(N))}else r=/\.dds$/i.test(y.url),N=d(y.url,L.urlBaseType),w=H(1),r=r?THREE.ImageUtils.loadCompressedTexture(N,y.mapping,w):THREE.ImageUtils.loadTexture(N,
|
|
|
-y.mapping,w),void 0!==THREE[y.minFilter]&&(r.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(r.magFilter=THREE[y.magFilter]),y.anisotropy&&(r.anisotropy=y.anisotropy),y.repeat&&(r.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),y.offset&&r.offset.set(y.offset[0],y.offset[1]),y.wrap&&(N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==N[y.wrap[0]]&&(r.wrapS=N[y.wrap[0]]),void 0!==
|
|
|
-N[y.wrap[1]]&&(r.wrapT=N[y.wrap[1]]));z.textures[E]=r}var C,D;for(C in L.materials){E=L.materials[C];for(D in E.parameters)"envMap"===D||"map"===D||"lightMap"===D||"bumpMap"===D?E.parameters[D]=z.textures[E.parameters[D]]:"shading"===D?E.parameters[D]="flat"===E.parameters[D]?THREE.FlatShading:THREE.SmoothShading:"side"===D?E.parameters[D]="double"==E.parameters[D]?THREE.DoubleSide:"back"==E.parameters[D]?THREE.BackSide:THREE.FrontSide:"blending"===D?E.parameters[D]=E.parameters[D]in THREE?THREE[E.parameters[D]]:
|
|
|
+t.name=y,z.geometries[y]=t;else if(w.type in this.geometryHandlers){N={};for(u in w)"type"!==u&&"url"!==u&&(N[u]=w[u]);this.geometryHandlers[w.type].loaderObject.load(d(w.url,L.urlBaseType),h(y),N)}else"embedded"===w.type&&(N=L.embeds[w.id],N.metadata=L.metadata,N&&(N=this.geometryHandlers.ascii.loaderObject.parse(N,""),l(y)(N.geometry,N.materials)));for(var E in L.textures)if(y=L.textures[E],y.url instanceof Array)for(F+=y.url.length,u=0;u<y.url.length;u++)s.onLoadStart();else F+=1,s.onLoadStart();
|
|
|
+I=F;for(E in L.textures){y=L.textures[E];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){N=y.url.length;w=[];for(u=0;u<N;u++)w[u]=d(y.url[u],L.urlBaseType);u=(u=/\.dds$/i.test(w[0]))?THREE.ImageUtils.loadCompressedTextureCube(w,y.mapping,H(N)):THREE.ImageUtils.loadTextureCube(w,y.mapping,H(N))}else u=/\.dds$/i.test(y.url),N=d(y.url,L.urlBaseType),w=H(1),u=u?THREE.ImageUtils.loadCompressedTexture(N,y.mapping,w):THREE.ImageUtils.loadTexture(N,
|
|
|
+y.mapping,w),void 0!==THREE[y.minFilter]&&(u.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(u.magFilter=THREE[y.magFilter]),y.anisotropy&&(u.anisotropy=y.anisotropy),y.repeat&&(u.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(u.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&(u.wrapT=THREE.RepeatWrapping)),y.offset&&u.offset.set(y.offset[0],y.offset[1]),y.wrap&&(N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==N[y.wrap[0]]&&(u.wrapS=N[y.wrap[0]]),void 0!==
|
|
|
+N[y.wrap[1]]&&(u.wrapT=N[y.wrap[1]]));z.textures[E]=u}var C,D;for(C in L.materials){E=L.materials[C];for(D in E.parameters)"envMap"===D||"map"===D||"lightMap"===D||"bumpMap"===D?E.parameters[D]=z.textures[E.parameters[D]]:"shading"===D?E.parameters[D]="flat"===E.parameters[D]?THREE.FlatShading:THREE.SmoothShading:"side"===D?E.parameters[D]="double"==E.parameters[D]?THREE.DoubleSide:"back"==E.parameters[D]?THREE.BackSide:THREE.FrontSide:"blending"===D?E.parameters[D]=E.parameters[D]in THREE?THREE[E.parameters[D]]:
|
|
|
THREE.NormalBlending:"combine"===D?E.parameters[D]=E.parameters[D]in THREE?THREE[E.parameters[D]]:THREE.MultiplyOperation:"vertexColors"===D?"face"==E.parameters[D]?E.parameters[D]=THREE.FaceColors:E.parameters[D]&&(E.parameters[D]=THREE.VertexColors):"wrapRGB"===D&&(H=E.parameters[D],E.parameters[D]=new THREE.Vector3(H[0],H[1],H[2]));void 0!==E.parameters.opacity&&1>E.parameters.opacity&&(E.parameters.transparent=!0);E.parameters.normalMap?(H=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(H.uniforms),
|
|
|
-r=E.parameters.color,N=E.parameters.specular,w=E.parameters.ambient,J=E.parameters.shininess,y.tNormal.value=z.textures[E.parameters.normalMap],E.parameters.normalScale&&y.uNormalScale.value.set(E.parameters.normalScale[0],E.parameters.normalScale[1]),E.parameters.map&&(y.tDiffuse.value=E.parameters.map,y.enableDiffuse.value=!0),E.parameters.envMap&&(y.tCube.value=E.parameters.envMap,y.enableReflection.value=!0,y.reflectivity.value=E.parameters.reflectivity),E.parameters.lightMap&&(y.tAO.value=E.parameters.lightMap,
|
|
|
-y.enableAO.value=!0),E.parameters.specularMap&&(y.tSpecular.value=z.textures[E.parameters.specularMap],y.enableSpecular.value=!0),E.parameters.displacementMap&&(y.tDisplacement.value=z.textures[E.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=E.parameters.displacementBias,y.uDisplacementScale.value=E.parameters.displacementScale),y.diffuse.value.setHex(r),y.specular.value.setHex(N),y.ambient.value.setHex(w),y.shininess.value=J,E.parameters.opacity&&(y.opacity.value=
|
|
|
-E.parameters.opacity),p=new THREE.ShaderMaterial({fragmentShader:H.fragmentShader,vertexShader:H.vertexShader,uniforms:y,lights:!0,fog:!0})):p=new THREE[E.type](E.parameters);p.name=C;z.materials[C]=p}for(C in L.materials)if(E=L.materials[C],E.parameters.materials){D=[];for(r=0;r<E.parameters.materials.length;r++)D.push(z.materials[E.parameters.materials[r]]);z.materials[C].materials=D}e();z.cameras&&L.defaults.camera&&(z.currentCamera=z.cameras[L.defaults.camera]);z.fogs&&L.defaults.fog&&(z.scene.fog=
|
|
|
+u=E.parameters.color,N=E.parameters.specular,w=E.parameters.ambient,J=E.parameters.shininess,y.tNormal.value=z.textures[E.parameters.normalMap],E.parameters.normalScale&&y.uNormalScale.value.set(E.parameters.normalScale[0],E.parameters.normalScale[1]),E.parameters.map&&(y.tDiffuse.value=E.parameters.map,y.enableDiffuse.value=!0),E.parameters.envMap&&(y.tCube.value=E.parameters.envMap,y.enableReflection.value=!0,y.reflectivity.value=E.parameters.reflectivity),E.parameters.lightMap&&(y.tAO.value=E.parameters.lightMap,
|
|
|
+y.enableAO.value=!0),E.parameters.specularMap&&(y.tSpecular.value=z.textures[E.parameters.specularMap],y.enableSpecular.value=!0),E.parameters.displacementMap&&(y.tDisplacement.value=z.textures[E.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=E.parameters.displacementBias,y.uDisplacementScale.value=E.parameters.displacementScale),y.diffuse.value.setHex(u),y.specular.value.setHex(N),y.ambient.value.setHex(w),y.shininess.value=J,E.parameters.opacity&&(y.opacity.value=
|
|
|
+E.parameters.opacity),p=new THREE.ShaderMaterial({fragmentShader:H.fragmentShader,vertexShader:H.vertexShader,uniforms:y,lights:!0,fog:!0})):p=new THREE[E.type](E.parameters);p.name=C;z.materials[C]=p}for(C in L.materials)if(E=L.materials[C],E.parameters.materials){D=[];for(u=0;u<E.parameters.materials.length;u++)D.push(z.materials[E.parameters.materials[u]]);z.materials[C].materials=D}e();z.cameras&&L.defaults.camera&&(z.currentCamera=z.cameras[L.defaults.camera]);z.fogs&&L.defaults.fog&&(z.scene.fog=
|
|
|
z.fogs[L.defaults.fog]);s.callbackSync(z);n()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){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);
|
|
@@ -304,11 +304,11 @@ THREE.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object
|
|
|
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=P.length;d<e;d++){var f=P[d];Za.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ba.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Za.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=ba.setFromMatrixPosition(f.matrixWorld),h=b.dot(ba.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Za.multiplyScalar(h)))))}}
|
|
|
-function c(a,b,c,d){s(b);u(c);t(d);p(a.getStyle());y.stroke();ia.expandByScalar(2*b)}function d(a){v(a.getStyle());y.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);Ma[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
+function c(a,b,c,d){s(b);r(c);t(d);p(a.getStyle());y.stroke();ia.expandByScalar(2*b)}function d(a){v(a.getStyle());y.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);Ma[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
function g(a,b,c,d,g,h,m,k,l,p,n,q,r){if(!(r instanceof THREE.DataTexture)){!1===r.hasEventListener("update",e)&&(void 0!==r.image&&0<r.image.width&&f(r),r.addEventListener("update",e));var s=Ma[r.id];if(void 0!==s){v(s);var s=r.offset.x/r.repeat.x,u=r.offset.y/r.repeat.y,t=r.image.width*r.repeat.x;r=r.image.height*r.repeat.y;m=(m+s)*t;k=(k+u)*r;c-=a;d-=b;g-=a;h-=b;l=(l+s)*t-m;p=(p+u)*r-k;n=(n+s)*t-m;q=(q+u)*r-k;r=l*q-n*p;0!==r&&(s=1/r,r=(q*c-p*g)*s,p=(q*d-p*h)*s,c=(l*g-n*c)*s,d=(l*h-n*d)*s,a=a-r*
|
|
|
m-c*k,b=b-p*m-d*k,y.save(),y.transform(r,p,c,d,a,b),y.fill(),y.restore())}else v("rgba(0,0,0,1)"),y.fill()}}function h(a,b,c,d,e,f,g,h,m,k,l,p,n){var r,q;r=n.width-1;q=n.height-1;g*=r;h*=q;c-=a;d-=b;e-=a;f-=b;m=m*r-g;k=k*q-h;l=l*r-g;p=p*q-h;q=1/(m*p-l*k);r=(p*c-k*e)*q;k=(p*d-k*f)*q;c=(m*e-l*c)*q;d=(m*f-l*d)*q;a=a-r*g-c*h;b=b-k*g-d*h;y.save();y.transform(r,k,c,d,a,b);y.clip();y.drawImage(n,0,0);y.restore()}function k(a,b,c,d){ta[0]=255*a.r|0;ta[1]=255*a.g|0;ta[2]=255*a.b|0;ta[4]=255*b.r|0;ta[5]=255*
|
|
|
b.g|0;ta[6]=255*b.b|0;ta[8]=255*c.r|0;ta[9]=255*c.g|0;ta[10]=255*c.b|0;ta[12]=255*d.r|0;ta[13]=255*d.g|0;ta[14]=255*d.b|0;Sa.putImageData(m,0,0);Oa.drawImage(Pa,0,0);return ab}function l(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 n(a){C!==a&&(C=y.globalAlpha=a)}function q(a){D!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
-(y.globalCompositeOperation="darker"),D=a)}function s(a){T!==a&&(T=y.lineWidth=a)}function u(a){ea!==a&&(ea=y.lineCap=a)}function t(a){Y!==a&&(Y=y.lineJoin=a)}function p(a){G!==a&&(G=y.strokeStyle=a)}function v(a){X!==a&&(X=y.fillStyle=a)}function w(a,b){if(la!==a||Q!==b)y.setLineDash([a,b]),la=a,Q=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var r=THREE.Math.smoothstep;a=a||{};var x=this,A,F,P,I=new THREE.Projector,z=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=z.width,L=
|
|
|
+(y.globalCompositeOperation="darker"),D=a)}function s(a){T!==a&&(T=y.lineWidth=a)}function r(a){ea!==a&&(ea=y.lineCap=a)}function t(a){Y!==a&&(Y=y.lineJoin=a)}function p(a){G!==a&&(G=y.strokeStyle=a)}function v(a){X!==a&&(X=y.fillStyle=a)}function w(a,b){if(la!==a||Q!==b)y.setLineDash([a,b]),la=a,Q=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var u=THREE.Math.smoothstep;a=a||{};var x=this,A,F,P,I=new THREE.Projector,z=void 0!==a.canvas?a.canvas:document.createElement("canvas"),B=z.width,L=
|
|
|
z.height,H=Math.floor(B/2),J=Math.floor(L/2),y=z.getContext("2d"),N=new THREE.Color(0),E=0,C=1,D=0,G=null,X=null,T=null,ea=null,Y=null,la=null,Q=0,ha,S,M,R;new THREE.RenderableVertex;new THREE.RenderableVertex;var ma,fa,Ka,U,aa,Ca,oa=new THREE.Color,xa=new THREE.Color,va=new THREE.Color,wa=new THREE.Color,Qa=new THREE.Color,Da=new THREE.Color,Xa=new THREE.Color,Za=new THREE.Color,Ma={},Ra,ya,za,ja,Ea,Fa,pa,Aa,Ba,$a,Na=new THREE.Box2,ga=new THREE.Box2,ia=new THREE.Box2,Ga=new THREE.Color,zb=new THREE.Color,
|
|
|
ua=new THREE.Color,ba=new THREE.Vector3,Pa,Sa,m,ta,ab,Oa,Ja=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;Sa=Pa.getContext("2d");Sa.fillStyle="rgba(0,0,0,1)";Sa.fillRect(0,0,2,2);m=Sa.getImageData(0,0,2,2);ta=m.data;ab=document.createElement("canvas");ab.width=ab.height=Ja;Oa=ab.getContext("2d");Oa.translate(-Ja/2,-Ja/2);Oa.scale(Ja,Ja);Ja--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});this.domElement=z;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){B=a*this.devicePixelRatio;L=b*this.devicePixelRatio;H=Math.floor(B/2);J=Math.floor(L/2);z.width=B;z.height=L;1!==this.devicePixelRatio&&!1!==c&&(z.style.width=a+"px",z.style.height=b+"px");Na.min.set(-H,
|
|
@@ -318,13 +318,13 @@ else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,H,J);x.info.rende
|
|
|
!1!==C.visible){ia.makeEmpty();if(D instanceof THREE.RenderableSprite){S=D;S.x*=H;S.y*=J;B=S;E=C;n(E.opacity);q(E.blending);var N=D.scale.x*H,D=D.scale.y*J,C=0.5*Math.sqrt(N*N+D*D);ia.min.set(B.x-C,B.y-C);ia.max.set(B.x+C,B.y+C);if(!1===Na.isIntersectionBox(ia))ia.makeEmpty();else if(E instanceof THREE.SpriteMaterial||E instanceof THREE.ParticleSystemMaterial){var G=E.map;if(null!==G){!1===G.hasEventListener("update",e)&&(void 0!==G.image&&0<G.image.width&&f(G),G.addEventListener("update",e));C=Ma[G.id];
|
|
|
void 0!==C?v(C):v("rgba( 0, 0, 0, 1 )");var Q=G.image,C=Q.width*G.offset.x,T=Q.height*G.offset.y,X=Q.width*G.repeat.x,G=Q.height*G.repeat.y,Q=N/X,Y=D/G;y.save();y.translate(B.x,B.y);0!==E.rotation&&y.rotate(E.rotation);y.translate(-N/2,-D/2);y.scale(Q,Y);y.translate(-C,-T);y.fillRect(C,T,X,G)}else v(E.color.getStyle()),y.save(),y.translate(B.x,B.y),0!==E.rotation&&y.rotate(E.rotation),y.scale(N,-D),y.fillRect(-0.5,-0.5,1,1);y.restore()}else E instanceof THREE.SpriteCanvasMaterial&&(p(E.color.getStyle()),
|
|
|
v(E.color.getStyle()),y.save(),y.translate(B.x,B.y),0!==E.rotation&&y.rotate(E.rotation),y.scale(N,D),E.program(y),y.restore())}else if(D instanceof THREE.RenderableLine){if(S=D.v1,M=D.v2,S.positionScreen.x*=H,S.positionScreen.y*=J,M.positionScreen.x*=H,M.positionScreen.y*=J,ia.setFromPoints([S.positionScreen,M.positionScreen]),!0===Na.isIntersectionBox(ia))if(B=S,E=M,N=D,D=C,n(D.opacity),q(D.blending),y.beginPath(),y.moveTo(B.positionScreen.x,B.positionScreen.y),y.lineTo(E.positionScreen.x,E.positionScreen.y),
|
|
|
-D instanceof THREE.LineBasicMaterial){s(D.linewidth);u(D.linecap);t(D.linejoin);if(D.vertexColors!==THREE.VertexColors)p(D.color.getStyle());else if(C=N.vertexColors[0].getStyle(),N=N.vertexColors[1].getStyle(),C===N)p(C);else{try{var ea=y.createLinearGradient(B.positionScreen.x,B.positionScreen.y,E.positionScreen.x,E.positionScreen.y);ea.addColorStop(0,C);ea.addColorStop(1,N)}catch(la){ea=C}p(ea)}y.stroke();ia.expandByScalar(2*D.linewidth)}else D instanceof THREE.LineDashedMaterial&&(s(D.linewidth),
|
|
|
-u(D.linecap),t(D.linejoin),p(D.color.getStyle()),w(D.dashSize,D.gapSize),y.stroke(),ia.expandByScalar(2*D.linewidth),w(null,null))}else if(D instanceof THREE.RenderableFace3){S=D.v1;M=D.v2;R=D.v3;if(-1>S.positionScreen.z||1<S.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;S.positionScreen.x*=H;S.positionScreen.y*=J;M.positionScreen.x*=H;M.positionScreen.y*=J;R.positionScreen.x*=H;R.positionScreen.y*=J;0<C.overdraw&&
|
|
|
+D instanceof THREE.LineBasicMaterial){s(D.linewidth);r(D.linecap);t(D.linejoin);if(D.vertexColors!==THREE.VertexColors)p(D.color.getStyle());else if(C=N.vertexColors[0].getStyle(),N=N.vertexColors[1].getStyle(),C===N)p(C);else{try{var ea=y.createLinearGradient(B.positionScreen.x,B.positionScreen.y,E.positionScreen.x,E.positionScreen.y);ea.addColorStop(0,C);ea.addColorStop(1,N)}catch(la){ea=C}p(ea)}y.stroke();ia.expandByScalar(2*D.linewidth)}else D instanceof THREE.LineDashedMaterial&&(s(D.linewidth),
|
|
|
+r(D.linecap),t(D.linejoin),p(D.color.getStyle()),w(D.dashSize,D.gapSize),y.stroke(),ia.expandByScalar(2*D.linewidth),w(null,null))}else if(D instanceof THREE.RenderableFace3){S=D.v1;M=D.v2;R=D.v3;if(-1>S.positionScreen.z||1<S.positionScreen.z)continue;if(-1>M.positionScreen.z||1<M.positionScreen.z)continue;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;S.positionScreen.x*=H;S.positionScreen.y*=J;M.positionScreen.x*=H;M.positionScreen.y*=J;R.positionScreen.x*=H;R.positionScreen.y*=J;0<C.overdraw&&
|
|
|
(l(S.positionScreen,M.positionScreen,C.overdraw),l(M.positionScreen,R.positionScreen,C.overdraw),l(R.positionScreen,S.positionScreen,C.overdraw));ia.setFromPoints([S.positionScreen,M.positionScreen,R.positionScreen]);if(!0===Na.isIntersectionBox(ia)){B=S;E=M;N=R;x.info.render.vertices+=3;x.info.render.faces++;n(C.opacity);q(C.blending);ma=B.positionScreen.x;fa=B.positionScreen.y;Ka=E.positionScreen.x;U=E.positionScreen.y;aa=N.positionScreen.x;Ca=N.positionScreen.y;var T=ma,X=fa,G=Ka,Q=U,Y=aa,ta=Ca;
|
|
|
y.beginPath();y.moveTo(T,X);y.lineTo(G,Q);y.lineTo(Y,ta);y.closePath();(C instanceof THREE.MeshLambertMaterial||C instanceof THREE.MeshPhongMaterial)&&null===C.map?(Da.copy(C.color),Xa.copy(C.emissive),C.vertexColors===THREE.FaceColors&&Da.multiply(D.color),!1===C.wireframe&&C.shading===THREE.SmoothShading&&3===D.vertexNormalsLength?(xa.copy(Ga),va.copy(Ga),wa.copy(Ga),b(D.v1.positionWorld,D.vertexNormalsModel[0],xa),b(D.v2.positionWorld,D.vertexNormalsModel[1],va),b(D.v3.positionWorld,D.vertexNormalsModel[2],
|
|
|
wa),xa.multiply(Da).add(Xa),va.multiply(Da).add(Xa),wa.multiply(Da).add(Xa),Qa.addColors(va,wa).multiplyScalar(0.5),za=k(xa,va,wa,Qa),h(ma,fa,Ka,U,aa,Ca,0,0,1,0,0,1,za)):(oa.copy(Ga),b(D.centroidModel,D.normalModel,oa),oa.multiply(Da).add(Xa),!0===C.wireframe?c(oa,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):d(oa))):C instanceof THREE.MeshBasicMaterial||C instanceof THREE.MeshLambertMaterial||C instanceof THREE.MeshPhongMaterial?null!==C.map?C.map.mapping instanceof THREE.UVMapping&&
|
|
|
(ja=D.uvs[0],g(ma,fa,Ka,U,aa,Ca,ja[0].x,ja[0].y,ja[1].x,ja[1].y,ja[2].x,ja[2].y,C.map)):null!==C.envMap?C.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ba.copy(D.vertexNormalsModelView[0]),Ea=0.5*ba.x+0.5,Fa=0.5*ba.y+0.5,ba.copy(D.vertexNormalsModelView[1]),pa=0.5*ba.x+0.5,Aa=0.5*ba.y+0.5,ba.copy(D.vertexNormalsModelView[2]),Ba=0.5*ba.x+0.5,$a=0.5*ba.y+0.5,g(ma,fa,Ka,U,aa,Ca,Ea,Fa,pa,Aa,Ba,$a,C.envMap)):(oa.copy(C.color),C.vertexColors===THREE.FaceColors&&oa.multiply(D.color),!0===
|
|
|
-C.wireframe?c(oa,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):d(oa)):C instanceof THREE.MeshDepthMaterial?(Ra=ha.near,ya=ha.far,xa.r=xa.g=xa.b=1-r(B.positionScreen.z*B.positionScreen.w,Ra,ya),va.r=va.g=va.b=1-r(E.positionScreen.z*E.positionScreen.w,Ra,ya),wa.r=wa.g=wa.b=1-r(N.positionScreen.z*N.positionScreen.w,Ra,ya),Qa.addColors(va,wa).multiplyScalar(0.5),za=k(xa,va,wa,Qa),h(ma,fa,Ka,U,aa,Ca,0,0,1,0,0,1,za)):C instanceof THREE.MeshNormalMaterial&&(B=void 0,C.shading===THREE.FlatShading?
|
|
|
+C.wireframe?c(oa,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):d(oa)):C instanceof THREE.MeshDepthMaterial?(Ra=ha.near,ya=ha.far,xa.r=xa.g=xa.b=1-u(B.positionScreen.z*B.positionScreen.w,Ra,ya),va.r=va.g=va.b=1-u(E.positionScreen.z*E.positionScreen.w,Ra,ya),wa.r=wa.g=wa.b=1-u(N.positionScreen.z*N.positionScreen.w,Ra,ya),Qa.addColors(va,wa).multiplyScalar(0.5),za=k(xa,va,wa,Qa),h(ma,fa,Ka,U,aa,Ca,0,0,1,0,0,1,za)):C instanceof THREE.MeshNormalMaterial&&(B=void 0,C.shading===THREE.FlatShading?
|
|
|
(B=D.normalModelView,oa.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===C.wireframe?c(oa,C.wireframeLinewidth,C.wireframeLinecap,C.wireframeLinejoin):d(oa)):C.shading===THREE.SmoothShading&&(B=D.vertexNormalsModelView[0],xa.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=D.vertexNormalsModelView[1],va.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=D.vertexNormalsModelView[2],wa.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),Qa.addColors(va,wa).multiplyScalar(0.5),
|
|
|
za=k(xa,va,wa,Qa),h(ma,fa,Ka,U,aa,Ca,0,0,1,0,0,1,za)))}}ga.union(ia)}}y.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",
|
|
@@ -378,7 +378,7 @@ function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,k=1*g.length,l=3*g.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 g(a,b,c,d){var e,f,g,k;for(f in b)g=b[f],e=c[f],0<=g&&(e?(k=e.itemSize,m.bindBuffer(m.ARRAY_BUFFER,e.buffer),h(g),m.vertexAttribPointer(g,
|
|
|
k,m.FLOAT,!1,0,d*k*4)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?m.vertexAttrib2fv(g,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&m.vertexAttrib3fv(g,a.defaultAttributeValues[f])))}function h(a){ga[a]||(m.enableVertexAttribArray(a),ga[a]=!0)}function k(){for(var a in ga)ga[a]&&(m.disableVertexAttribArray(a),ga[a]=!1)}function l(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function q(a,b,c){if(a.length)for(var d=0,e=a.length;d<
|
|
|
e;d++)Ca=fa=null,U=aa=wa=va=Ra=Ma=Qa=-1,Pa=!0,a[d].render(b,c,$a,Na),Ca=fa=null,U=aa=wa=va=Ra=Ma=Qa=-1,Pa=!0}function s(a,b,c,d,e,f,g,h){var m,k,l,p;b?(k=a.length-1,p=b=-1):(k=0,b=a.length,p=1);for(var n=k;n!==b;n+=p)if(m=a[n],m.render){k=m.object;l=m.buffer;if(h)m=h;else{m=m[c];if(!m)continue;g&&M.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst);M.setDepthTest(m.depthTest);M.setDepthWrite(m.depthWrite);L(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}M.setMaterialFaces(m);
|
|
|
-l instanceof THREE.BufferGeometry?M.renderBufferDirect(d,e,f,m,l,k):M.renderBuffer(d,e,f,m,l,k)}}function u(a,b,c,d,e,f,g){for(var h,m,k=0,l=a.length;k<l;k++)if(h=a[k],m=h.object,m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&M.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);M.setDepthTest(h.depthTest);M.setDepthWrite(h.depthWrite);L(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}M.renderImmediateObject(c,d,e,h,m)}}function t(a,d){var e,f,g,h;if(void 0===a.__webglInit&&
|
|
|
+l instanceof THREE.BufferGeometry?M.renderBufferDirect(d,e,f,m,l,k):M.renderBuffer(d,e,f,m,l,k)}}function r(a,b,c,d,e,f,g){for(var h,m,k=0,l=a.length;k<l;k++)if(h=a[k],m=h.object,m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&M.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);M.setDepthTest(h.depthTest);M.setDepthWrite(h.depthWrite);L(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}M.renderImmediateObject(c,d,e,h,m)}}function t(a,d){var e,f,g,h;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",Lb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var k,l;for(k in f.attributes)l="index"===k?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,h=f.attributes[k],h.buffer=m.createBuffer(),m.bindBuffer(l,h.buffer),m.bufferData(l,h.array,m.STATIC_DRAW)}else if(a instanceof THREE.Mesh){g=a.material;
|
|
|
if(void 0===f.geometryGroups){k=f;var n,r,q;l={};var s=k.morphTargets.length,u=k.morphNormals.length,t=g instanceof THREE.MeshFaceMaterial;k.geometryGroups={};g=0;for(n=k.faces.length;g<n;g++)r=k.faces[g],r=t?r.materialIndex:0,void 0===l[r]&&(l[r]={hash:r,counter:0}),q=l[r].hash+"_"+l[r].counter,void 0===k.geometryGroups[q]&&(k.geometryGroups[q]={faces3:[],materialIndex:r,vertices:0,numMorphTargets:s,numMorphNormals:u}),65535<k.geometryGroups[q].vertices+3&&(l[r].counter+=1,q=l[r].hash+"_"+l[r].counter,
|
|
|
void 0===k.geometryGroups[q]&&(k.geometryGroups[q]={faces3:[],materialIndex:r,vertices:0,numMorphTargets:s,numMorphNormals:u})),k.geometryGroups[q].faces3.push(g),k.geometryGroups[q].vertices+=3;k.geometryGroupsList=[];for(h in k.geometryGroups)k.geometryGroups[h].id=oa++,k.geometryGroupsList.push(k.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){k=h;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();k.__webglTangentBuffer=m.createBuffer();
|
|
@@ -386,7 +386,7 @@ k.__webglColorBuffer=m.createBuffer();k.__webglUVBuffer=m.createBuffer();k.__web
|
|
|
s;l++)k.__webglMorphNormalsBuffers.push(m.createBuffer());M.info.memory.geometries++;c(h,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||(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),h.__webglLineDistanceBuffer=m.createBuffer(),M.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=
|
|
|
new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__lineDistanceArray=new Float32Array(1*k),h.__webglLineCount=k,b(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),M.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__sortArray=[],h.__webglParticleCount=
|
|
|
k,b(h,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)p(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)h=f.geometryGroups[e],p(d.__webglObjects,h,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,p(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 p(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function r(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof
|
|
|
+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 p(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(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?x(b.__webglObjects,a):a instanceof THREE.Sprite?A(b.__webglSprites,a):a instanceof THREE.LensFlare?A(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function F(a,b,c,d,e){xa=0;d.needsUpdate&&(d.program&&Eb(d),M.initMaterial(d,b,c,e),d.needsUpdate=
|
|
|
!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,k=d.uniforms;g!==fa&&(m.useProgram(g),fa=g,f=!0);d.id!==U&&(U=d.id,f=!0);if(f||a!==Ca)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==Ca&&(Ca=a);if(d.skinning)if(yb&&e.useVertexTexture){if(null!==h.boneTexture){var l=P();m.uniform1i(h.boneTexture,l);M.setTexture(e.boneTexture,l)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,
|
|
|
e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(k.fogColor.value=c.color,c instanceof THREE.Fog?(k.fogNear.value=c.near,k.fogFar.value=c.far):c instanceof THREE.FogExp2&&(k.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Pa){var p,n=l=0,r=0,q,s,u,t=Sa,v=t.directional.colors,
|
|
@@ -452,13 +452,13 @@ l;g++)c=e.__webglCustomAttributesList[g],0<=a[c.buffer.belongsToAttribute]&&(m.b
|
|
|
e.__webglLineDistanceBuffer),h(a.lineDistance),m.vertexAttribPointer(a.lineDistance,1,m.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(B(d.wireframeLinewidth),b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,m.UNSIGNED_SHORT,0)):(b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,m.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=e.__webglFaceCount,M.info.render.faces+=
|
|
|
e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,B(d.linewidth),m.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),M.info.render.calls++,M.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,g,h,k=a.__lights,
|
|
|
n=a.fog;U=-1;Pa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ga.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);ia.setFromMatrix(Ga);this.autoUpdateObjects&&this.initWebGLObjects(a);q(this.renderPluginsPre,a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;M.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
-h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ia.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,r=p.buffer,t=void 0,v=t=void 0,v=p.object.material;if(v instanceof THREE.MeshFaceMaterial)t=r.materialIndex,t=v.materials[t],t.transparent?(p.transparent=t,p.opaque=
|
|
|
-null):(p.opaque=t,p.transparent=null);else if(t=v)t.transparent?(p.transparent=t,p.opaque=null):(p.opaque=t,p.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ua.setFromMatrixPosition(g.matrixWorld),ua.applyProjection(Ga),f.z=ua.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),
|
|
|
-g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,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),L(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,k,n,!0,d),u(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,k,n,!1,d),u(a.__webglObjectsImmediate,
|
|
|
-"opaque",b,k,n,!1,d),s(a.__webglObjects,!1,"transparent",b,k,n,!0,d),u(a.__webglObjectsImmediate,"transparent",b,k,n,!0,d));q(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,
|
|
|
-null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=F(a,b,c,d,e);aa=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,ia):e.render(function(a){M.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;)r(a.__objectsRemoved[0],
|
|
|
-a),a.__objectsRemoved.splice(0,1);for(var b=0,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&r(h,a),t(h,a));var k=h,l=k.geometry,p=void 0,q=void 0,s=void 0;if(l instanceof THREE.BufferGeometry){var u=m.DYNAMIC_DRAW,x=!l.dynamic,A=l.attributes,y=void 0,B=void 0;for(y in A)B=A[y],B.needsUpdate&&("index"===y?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,B.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,B.array,u)):(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-B.buffer),m.bufferData(m.ARRAY_BUFFER,B.array,u)),B.needsUpdate=!1),x&&!B.dynamic&&(B.array=null)}else if(k instanceof THREE.Mesh){for(var D=0,C=l.geometryGroupsList.length;D<C;D++)if(p=l.geometryGroupsList[D],s=d(k,p),l.buffersNeedUpdate&&c(p,k),q=s.attributes&&v(s),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||q){var z=p,E=k,F=m.DYNAMIC_DRAW,L=!l.dynamic,H=s;if(z.__inittedArrays){var I=e(H),P=
|
|
|
+h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.id=d,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ia.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,t=p.buffer,u=void 0,v=u=void 0,v=p.object.material;if(v instanceof THREE.MeshFaceMaterial)u=t.materialIndex,u=v.materials[u],u.transparent?(p.transparent=u,p.opaque=
|
|
|
+null):(p.opaque=u,p.transparent=null);else if(u=v)u.transparent?(p.transparent=u,p.opaque=null):(p.opaque=u,p.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ua.setFromMatrixPosition(g.matrixWorld),ua.applyProjection(Ga),f.z=ua.z))}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,g.matrixWorld),g._normalMatrix.getNormalMatrix(g._modelViewMatrix),
|
|
|
+g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,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),L(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,k,n,!0,d),r(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,k,n,!1,d),r(a.__webglObjectsImmediate,
|
|
|
+"opaque",b,k,n,!1,d),s(a.__webglObjects,!1,"transparent",b,k,n,!0,d),r(a.__webglObjectsImmediate,"transparent",b,k,n,!0,d));q(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,
|
|
|
+null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=F(a,b,c,d,e);aa=-1;M.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,ia):e.render(function(a){M.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,g=a.__webglObjects.length;b<g;b++){var h=a.__webglObjects[b].object;void 0===h.__webglInit&&(void 0!==h.__webglActive&&u(h,a),t(h,a));var k=h,l=k.geometry,p=void 0,r=void 0,q=void 0;if(l instanceof THREE.BufferGeometry){var s=m.DYNAMIC_DRAW,x=!l.dynamic,A=l.attributes,y=void 0,B=void 0;for(y in A)B=A[y],B.needsUpdate&&("index"===y?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,B.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,B.array,s)):(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
+B.buffer),m.bufferData(m.ARRAY_BUFFER,B.array,s)),B.needsUpdate=!1),x&&!B.dynamic&&(B.array=null)}else if(k instanceof THREE.Mesh){for(var D=0,C=l.geometryGroupsList.length;D<C;D++)if(p=l.geometryGroupsList[D],q=d(k,p),l.buffersNeedUpdate&&c(p,k),r=q.attributes&&v(q),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||r){var z=p,E=k,F=m.DYNAMIC_DRAW,L=!l.dynamic,H=q;if(z.__inittedArrays){var I=e(H),P=
|
|
|
H.vertexColors?H.vertexColors:!1,M=f(H),N=I===THREE.SmoothShading,G=void 0,R=void 0,Q=void 0,J=void 0,X=void 0,T=void 0,S=void 0,fa=void 0,aa=void 0,Y=void 0,ma=void 0,U=void 0,$=void 0,Z=void 0,oa=void 0,Ca=void 0,xa=void 0,ba=void 0,ea=void 0,ga=void 0,Ka=void 0,ha=void 0,ia=void 0,va=void 0,ja=void 0,la=void 0,wa=void 0,ta=void 0,za=void 0,La=void 0,Ea=void 0,Fa=void 0,Ja=void 0,Qa=void 0,pa=void 0,Na=void 0,ya=void 0,Da=void 0,Pa=void 0,Xa=void 0,Aa=0,Ba=0,Oa=0,Ra=0,Za=0,ib=0,Ya=0,Ma=0,fb=0,sa=
|
|
|
0,Ha=0,O=0,Wa=void 0,jb=z.__vertexArray,$a=z.__uvArray,ab=z.__uv2Array,Sa=z.__normalArray,bb=z.__tangentArray,kb=z.__colorArray,cb=z.__skinIndexArray,db=z.__skinWeightArray,xb=z.__morphTargetsArrays,yb=z.__morphNormalsArrays,tb=z.__webglCustomAttributesList,K=void 0,Ob=z.__faceArray,ub=z.__lineArray,Ta=E.geometry,Jb=Ta.elementsNeedUpdate,Cb=Ta.uvsNeedUpdate,Kb=Ta.normalsNeedUpdate,Lb=Ta.tangentsNeedUpdate,Mb=Ta.colorsNeedUpdate,Nb=Ta.morphTargetsNeedUpdate,dc=Ta.vertices,da=z.faces3,lb=Ta.faces,Db=
|
|
|
Ta.faceVertexUvs[0],Eb=Ta.faceVertexUvs[1],ec=Ta.skinIndices,Pb=Ta.skinWeights,Qb=Ta.morphTargets,jc=Ta.morphNormals;if(Ta.verticesNeedUpdate){G=0;for(R=da.length;G<R;G++)J=lb[da[G]],U=dc[J.a],$=dc[J.b],Z=dc[J.c],jb[Ba]=U.x,jb[Ba+1]=U.y,jb[Ba+2]=U.z,jb[Ba+3]=$.x,jb[Ba+4]=$.y,jb[Ba+5]=$.z,jb[Ba+6]=Z.x,jb[Ba+7]=Z.y,jb[Ba+8]=Z.z,Ba+=9;m.bindBuffer(m.ARRAY_BUFFER,z.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,jb,F)}if(Nb)for(pa=0,Na=Qb.length;pa<Na;pa++){G=Ha=0;for(R=da.length;G<R;G++)Pa=da[G],J=
|
|
@@ -474,20 +474,20 @@ K.type?["r","g","b"]:["x","y","z"];if(void 0===K.boundTo||"vertices"===K.boundTo
|
|
|
U[ra[2]],K.array[O+3]=$[ra[0]],K.array[O+4]=$[ra[1]],K.array[O+5]=$[ra[2]],K.array[O+6]=Z[ra[0]],K.array[O+7]=Z[ra[1]],K.array[O+8]=Z[ra[2]],O+=9;else if("faceVertices"===K.boundTo)for(G=0,R=da.length;G<R;G++)Wa=K.value[da[G]],U=Wa[0],$=Wa[1],Z=Wa[2],K.array[O]=U[ra[0]],K.array[O+1]=U[ra[1]],K.array[O+2]=U[ra[2]],K.array[O+3]=$[ra[0]],K.array[O+4]=$[ra[1]],K.array[O+5]=$[ra[2]],K.array[O+6]=Z[ra[0]],K.array[O+7]=Z[ra[1]],K.array[O+8]=Z[ra[2]],O+=9}else if(4===K.size)if(void 0===K.boundTo||"vertices"===
|
|
|
K.boundTo)for(G=0,R=da.length;G<R;G++)J=lb[da[G]],U=K.value[J.a],$=K.value[J.b],Z=K.value[J.c],K.array[O]=U.x,K.array[O+1]=U.y,K.array[O+2]=U.z,K.array[O+3]=U.w,K.array[O+4]=$.x,K.array[O+5]=$.y,K.array[O+6]=$.z,K.array[O+7]=$.w,K.array[O+8]=Z.x,K.array[O+9]=Z.y,K.array[O+10]=Z.z,K.array[O+11]=Z.w,O+=12;else if("faces"===K.boundTo)for(G=0,R=da.length;G<R;G++)Z=$=U=Wa=K.value[da[G]],K.array[O]=U.x,K.array[O+1]=U.y,K.array[O+2]=U.z,K.array[O+3]=U.w,K.array[O+4]=$.x,K.array[O+5]=$.y,K.array[O+6]=$.z,
|
|
|
K.array[O+7]=$.w,K.array[O+8]=Z.x,K.array[O+9]=Z.y,K.array[O+10]=Z.z,K.array[O+11]=Z.w,O+=12;else if("faceVertices"===K.boundTo)for(G=0,R=da.length;G<R;G++)Wa=K.value[da[G]],U=Wa[0],$=Wa[1],Z=Wa[2],K.array[O]=U.x,K.array[O+1]=U.y,K.array[O+2]=U.z,K.array[O+3]=U.w,K.array[O+4]=$.x,K.array[O+5]=$.y,K.array[O+6]=$.z,K.array[O+7]=$.w,K.array[O+8]=Z.x,K.array[O+9]=Z.y,K.array[O+10]=Z.z,K.array[O+11]=Z.w,O+=12;m.bindBuffer(m.ARRAY_BUFFER,K.buffer);m.bufferData(m.ARRAY_BUFFER,K.array,F)}L&&(delete z.__inittedArrays,
|
|
|
-delete z.__colorArray,delete z.__normalArray,delete z.__tangentArray,delete z.__uvArray,delete z.__uv2Array,delete z.__faceArray,delete z.__vertexArray,delete z.__lineArray,delete z.__skinIndexArray,delete z.__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;s.attributes&&w(s)}else if(k instanceof THREE.Line){s=d(k,l);q=s.attributes&&v(s);if(l.verticesNeedUpdate||
|
|
|
-l.colorsNeedUpdate||l.lineDistancesNeedUpdate||q){var eb=l,Rb=m.DYNAMIC_DRAW,Fb=void 0,Gb=void 0,Hb=void 0,Sb=void 0,qa=void 0,Tb=void 0,kc=eb.vertices,lc=eb.colors,mc=eb.lineDistances,Yb=kc.length,Zb=lc.length,$b=mc.length,Ub=eb.__vertexArray,Vb=eb.__colorArray,nc=eb.__lineDistanceArray,ac=eb.colorsNeedUpdate,bc=eb.lineDistancesNeedUpdate,fc=eb.__webglCustomAttributesList,Wb=void 0,oc=void 0,Ia=void 0,Ab=void 0,Ua=void 0,na=void 0;if(eb.verticesNeedUpdate){for(Fb=0;Fb<Yb;Fb++)Sb=kc[Fb],qa=3*Fb,Ub[qa]=
|
|
|
+delete z.__colorArray,delete z.__normalArray,delete z.__tangentArray,delete z.__uvArray,delete z.__uv2Array,delete z.__faceArray,delete z.__vertexArray,delete z.__lineArray,delete z.__skinIndexArray,delete z.__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;q.attributes&&w(q)}else if(k instanceof THREE.Line){q=d(k,l);r=q.attributes&&v(q);if(l.verticesNeedUpdate||
|
|
|
+l.colorsNeedUpdate||l.lineDistancesNeedUpdate||r){var eb=l,Rb=m.DYNAMIC_DRAW,Fb=void 0,Gb=void 0,Hb=void 0,Sb=void 0,qa=void 0,Tb=void 0,kc=eb.vertices,lc=eb.colors,mc=eb.lineDistances,Yb=kc.length,Zb=lc.length,$b=mc.length,Ub=eb.__vertexArray,Vb=eb.__colorArray,nc=eb.__lineDistanceArray,ac=eb.colorsNeedUpdate,bc=eb.lineDistancesNeedUpdate,fc=eb.__webglCustomAttributesList,Wb=void 0,oc=void 0,Ia=void 0,Ab=void 0,Ua=void 0,na=void 0;if(eb.verticesNeedUpdate){for(Fb=0;Fb<Yb;Fb++)Sb=kc[Fb],qa=3*Fb,Ub[qa]=
|
|
|
Sb.x,Ub[qa+1]=Sb.y,Ub[qa+2]=Sb.z;m.bindBuffer(m.ARRAY_BUFFER,eb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Ub,Rb)}if(ac){for(Gb=0;Gb<Zb;Gb++)Tb=lc[Gb],qa=3*Gb,Vb[qa]=Tb.r,Vb[qa+1]=Tb.g,Vb[qa+2]=Tb.b;m.bindBuffer(m.ARRAY_BUFFER,eb.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,Vb,Rb)}if(bc){for(Hb=0;Hb<$b;Hb++)nc[Hb]=mc[Hb];m.bindBuffer(m.ARRAY_BUFFER,eb.__webglLineDistanceBuffer);m.bufferData(m.ARRAY_BUFFER,nc,Rb)}if(fc)for(Wb=0,oc=fc.length;Wb<oc;Wb++)if(na=fc[Wb],na.needsUpdate&&(void 0===
|
|
|
na.boundTo||"vertices"===na.boundTo)){qa=0;Ab=na.value.length;if(1===na.size)for(Ia=0;Ia<Ab;Ia++)na.array[Ia]=na.value[Ia];else if(2===na.size)for(Ia=0;Ia<Ab;Ia++)Ua=na.value[Ia],na.array[qa]=Ua.x,na.array[qa+1]=Ua.y,qa+=2;else if(3===na.size)if("c"===na.type)for(Ia=0;Ia<Ab;Ia++)Ua=na.value[Ia],na.array[qa]=Ua.r,na.array[qa+1]=Ua.g,na.array[qa+2]=Ua.b,qa+=3;else for(Ia=0;Ia<Ab;Ia++)Ua=na.value[Ia],na.array[qa]=Ua.x,na.array[qa+1]=Ua.y,na.array[qa+2]=Ua.z,qa+=3;else if(4===na.size)for(Ia=0;Ia<Ab;Ia++)Ua=
|
|
|
-na.value[Ia],na.array[qa]=Ua.x,na.array[qa+1]=Ua.y,na.array[qa+2]=Ua.z,na.array[qa+3]=Ua.w,qa+=4;m.bindBuffer(m.ARRAY_BUFFER,na.buffer);m.bufferData(m.ARRAY_BUFFER,na.array,Rb)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;s.attributes&&w(s)}else if(k instanceof THREE.ParticleSystem){s=d(k,l);q=s.attributes&&v(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||k.sortParticles||q){var mb=l,gc=m.DYNAMIC_DRAW,Ib=k,Va=void 0,nb=void 0,ob=void 0,W=void 0,pb=void 0,sb=void 0,
|
|
|
+na.value[Ia],na.array[qa]=Ua.x,na.array[qa+1]=Ua.y,na.array[qa+2]=Ua.z,na.array[qa+3]=Ua.w,qa+=4;m.bindBuffer(m.ARRAY_BUFFER,na.buffer);m.bufferData(m.ARRAY_BUFFER,na.array,Rb)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;q.attributes&&w(q)}else if(k instanceof THREE.ParticleSystem){q=d(k,l);r=q.attributes&&v(q);if(l.verticesNeedUpdate||l.colorsNeedUpdate||k.sortParticles||r){var mb=l,gc=m.DYNAMIC_DRAW,Ib=k,Va=void 0,nb=void 0,ob=void 0,W=void 0,pb=void 0,sb=void 0,
|
|
|
Xb=mb.vertices,hc=Xb.length,ic=mb.colors,pc=ic.length,vb=mb.__vertexArray,wb=mb.__colorArray,qb=mb.__sortArray,qc=mb.verticesNeedUpdate,rc=mb.colorsNeedUpdate,rb=mb.__webglCustomAttributesList,gb=void 0,Bb=void 0,ca=void 0,hb=void 0,ka=void 0,V=void 0;if(Ib.sortParticles){zb.copy(Ga);zb.multiply(Ib.matrixWorld);for(Va=0;Va<hc;Va++)ob=Xb[Va],ua.copy(ob),ua.applyProjection(zb),qb[Va]=[ua.z,Va];qb.sort(n);for(Va=0;Va<hc;Va++)ob=Xb[qb[Va][1]],W=3*Va,vb[W]=ob.x,vb[W+1]=ob.y,vb[W+2]=ob.z;for(nb=0;nb<pc;nb++)W=
|
|
|
3*nb,sb=ic[qb[nb][1]],wb[W]=sb.r,wb[W+1]=sb.g,wb[W+2]=sb.b;if(rb)for(gb=0,Bb=rb.length;gb<Bb;gb++)if(V=rb[gb],void 0===V.boundTo||"vertices"===V.boundTo)if(W=0,hb=V.value.length,1===V.size)for(ca=0;ca<hb;ca++)pb=qb[ca][1],V.array[ca]=V.value[pb];else if(2===V.size)for(ca=0;ca<hb;ca++)pb=qb[ca][1],ka=V.value[pb],V.array[W]=ka.x,V.array[W+1]=ka.y,W+=2;else if(3===V.size)if("c"===V.type)for(ca=0;ca<hb;ca++)pb=qb[ca][1],ka=V.value[pb],V.array[W]=ka.r,V.array[W+1]=ka.g,V.array[W+2]=ka.b,W+=3;else for(ca=
|
|
|
0;ca<hb;ca++)pb=qb[ca][1],ka=V.value[pb],V.array[W]=ka.x,V.array[W+1]=ka.y,V.array[W+2]=ka.z,W+=3;else if(4===V.size)for(ca=0;ca<hb;ca++)pb=qb[ca][1],ka=V.value[pb],V.array[W]=ka.x,V.array[W+1]=ka.y,V.array[W+2]=ka.z,V.array[W+3]=ka.w,W+=4}else{if(qc)for(Va=0;Va<hc;Va++)ob=Xb[Va],W=3*Va,vb[W]=ob.x,vb[W+1]=ob.y,vb[W+2]=ob.z;if(rc)for(nb=0;nb<pc;nb++)sb=ic[nb],W=3*nb,wb[W]=sb.r,wb[W+1]=sb.g,wb[W+2]=sb.b;if(rb)for(gb=0,Bb=rb.length;gb<Bb;gb++)if(V=rb[gb],V.needsUpdate&&(void 0===V.boundTo||"vertices"===
|
|
|
V.boundTo))if(hb=V.value.length,W=0,1===V.size)for(ca=0;ca<hb;ca++)V.array[ca]=V.value[ca];else if(2===V.size)for(ca=0;ca<hb;ca++)ka=V.value[ca],V.array[W]=ka.x,V.array[W+1]=ka.y,W+=2;else if(3===V.size)if("c"===V.type)for(ca=0;ca<hb;ca++)ka=V.value[ca],V.array[W]=ka.r,V.array[W+1]=ka.g,V.array[W+2]=ka.b,W+=3;else for(ca=0;ca<hb;ca++)ka=V.value[ca],V.array[W]=ka.x,V.array[W+1]=ka.y,V.array[W+2]=ka.z,W+=3;else if(4===V.size)for(ca=0;ca<hb;ca++)ka=V.value[ca],V.array[W]=ka.x,V.array[W+1]=ka.y,V.array[W+
|
|
|
-2]=ka.z,V.array[W+3]=ka.w,W+=4}if(qc||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,vb,gc);if(rc||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,wb,gc);if(rb)for(gb=0,Bb=rb.length;gb<Bb;gb++)if(V=rb[gb],V.needsUpdate||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,V.buffer),m.bufferData(m.ARRAY_BUFFER,V.array,gc)}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;s.attributes&&w(s)}}};this.initMaterial=function(a,
|
|
|
-b,c,d){var e,f,g,h;a.addEventListener("dispose",Nb);var k,l,n,p,r;a instanceof THREE.MeshDepthMaterial?r="depth":a instanceof THREE.MeshNormalMaterial?r="normal":a instanceof THREE.MeshBasicMaterial?r="basic":a instanceof THREE.MeshLambertMaterial?r="lambert":a instanceof THREE.MeshPhongMaterial?r="phong":a instanceof THREE.LineBasicMaterial?r="basic":a instanceof THREE.LineDashedMaterial?r="dashed":a instanceof THREE.ParticleSystemMaterial&&(r="particle_basic");if(r){var q=THREE.ShaderLib[r];a.uniforms=
|
|
|
-THREE.UniformsUtils.clone(q.uniforms);a.vertexShader=q.vertexShader;a.fragmentShader=q.fragmentShader}var s=e=0,t=0,u=q=0;for(f=b.length;u<f;u++)g=b[u],g.onlyShadow||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&s++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&q++);f=s;g=t;h=q;t=q=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&q++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&q++);p=q;yb&&d&&d.useVertexTexture?
|
|
|
-n=1024:(b=m.getParameter(m.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)")),n=b);a:{t=a.fragmentShader;s=a.vertexShader;q=a.uniforms;b=a.attributes;u=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:n,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,
|
|
|
+2]=ka.z,V.array[W+3]=ka.w,W+=4}if(qc||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,vb,gc);if(rc||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,mb.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,wb,gc);if(rb)for(gb=0,Bb=rb.length;gb<Bb;gb++)if(V=rb[gb],V.needsUpdate||Ib.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,V.buffer),m.bufferData(m.ARRAY_BUFFER,V.array,gc)}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;q.attributes&&w(q)}}};this.initMaterial=function(a,
|
|
|
+b,c,d){var e,f,g,h;a.addEventListener("dispose",Nb);var k,l,p,n,r;a instanceof THREE.MeshDepthMaterial?r="depth":a instanceof THREE.MeshNormalMaterial?r="normal":a instanceof THREE.MeshBasicMaterial?r="basic":a instanceof THREE.MeshLambertMaterial?r="lambert":a instanceof THREE.MeshPhongMaterial?r="phong":a instanceof THREE.LineBasicMaterial?r="basic":a instanceof THREE.LineDashedMaterial?r="dashed":a instanceof THREE.ParticleSystemMaterial&&(r="particle_basic");if(r){var q=THREE.ShaderLib[r];a.uniforms=
|
|
|
+THREE.UniformsUtils.clone(q.uniforms);a.vertexShader=q.vertexShader;a.fragmentShader=q.fragmentShader}var s=e=0,t=0,u=q=0;for(f=b.length;u<f;u++)g=b[u],g.onlyShadow||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&s++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&q++);f=s;g=t;h=q;t=q=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&q++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&q++);n=q;yb&&d&&d.useVertexTexture?
|
|
|
+p=1024:(b=m.getParameter(m.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)")),p=b);a:{t=a.fragmentShader;s=a.vertexShader;q=a.uniforms;b=a.attributes;u=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:p,useVertexTexture:yb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,
|
|
|
shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide};d=a.index0AttributeName;var v,w,x;e=[];r?e.push(r):(e.push(t),e.push(s));for(w in u)e.push(w),e.push(u[w]);for(v in c)e.push(v),e.push(c[v]);r=e.join();v=0;for(w=R.length;v<w;v++)if(e=R[v],e.code===r){e.usedTimes++;l=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":c.shadowMapType===
|
|
|
THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e="#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+X+" float;","precision "+X+" int;",e,xb?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"","#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.wrapAround?"#define WRAP_AROUND":
|
|
@@ -511,8 +511,8 @@ this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlar
|
|
|
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.position=new THREE.Vector3;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,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,k=g.vertices,l=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var q=k.length;b<q;b++){var s=k[b].clone();d&&s.applyMatrix4(d);h.push(s)}b=0;for(q=n.length;b<q;b++){var s=n[b],u,t,p=s.vertexNormals,v=s.vertexColors;u=new THREE.Face3(s.a+
|
|
|
-f,s.b+f,s.c+f);u.normal.copy(s.normal);e&&u.normal.applyMatrix3(e).normalize();h=0;for(k=p.length;h<k;h++)t=p[h].clone(),e&&t.applyMatrix3(e).normalize(),u.vertexNormals.push(t);u.color.copy(s.color);h=0;for(k=v.length;h<k;h++)t=v[h],u.vertexColors.push(t.clone());u.materialIndex=s.materialIndex+c;u.centroid.copy(s.centroid);d&&u.centroid.applyMatrix4(d);l.push(u)}b=0;for(q=g.length;b<q;b++){c=g[b];d=[];h=0;for(k=c.length;h<k;h++)d.push(new THREE.Vector2(c[h].x,c[h].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,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,k=g.vertices,l=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var q=k.length;b<q;b++){var s=k[b].clone();d&&s.applyMatrix4(d);h.push(s)}b=0;for(q=n.length;b<q;b++){var s=n[b],r,t,p=s.vertexNormals,v=s.vertexColors;r=new THREE.Face3(s.a+
|
|
|
+f,s.b+f,s.c+f);r.normal.copy(s.normal);e&&r.normal.applyMatrix3(e).normalize();h=0;for(k=p.length;h<k;h++)t=p[h].clone(),e&&t.applyMatrix3(e).normalize(),r.vertexNormals.push(t);r.color.copy(s.color);h=0;for(k=v.length;h<k;h++)t=v[h],r.vertexColors.push(t.clone());r.materialIndex=s.materialIndex+c;r.centroid.copy(s.centroid);d&&r.centroid.applyMatrix4(d);l.push(r)}b=0;for(q=g.length;b<q;b++){c=g[b];d=[];h=0;for(k=c.length;h<k;h++)d.push(new THREE.Vector2(c[h].x,c[h].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(),g=THREE.Math.random16();1<f+g&&(f=1-f,g=1-g);var h=1-f-g;e.copy(b);e.multiplyScalar(f);a.copy(c);a.multiplyScalar(g);e.add(a);a.copy(d);a.multiplyScalar(h);e.add(a);return e}}(),randomPointInFace:function(a,b,c){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 l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,k=0,l=[],n,q,s;for(e=0;e<h;e++)d=f[e],n=g[d.a],q=g[d.b],s=g[d.c],d._area=THREE.GeometryUtils.triangleArea(n,q,s),k+=d._area,l[e]=k;d=[];for(e=0;e<b;e++)g=THREE.Math.random16()*k,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],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=[],g=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faces.length;b<c;b++)for(f.push(a.faces[b]),d=0,e=a.faceVertexUvs.length;d<e;d++)g[d].push(a.faceVertexUvs[d][b]);a.faces=f;a.faceVertexUvs=g;a.computeCentroids();
|
|
@@ -521,18 +521,18 @@ e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.
|
|
|
[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,h=a.length;g<h;++g){var k={};e[g]=k;var l=new XMLHttpRequest;l.onload=b(l,k);l.onerror=d;k=a[g];l.open("GET",k,!0);l.responseType=
|
|
|
"arraybuffer";l.send(null)}else l=new XMLHttpRequest,l.onload=function(){var a=THREE.ImageUtils.parseDDS(l.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},l.onerror=d,l.open("GET",a,!0),l.responseType="arraybuffer",l.send(null);return f},loadDDSTexture:function(a,
|
|
|
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 g=new XMLHttpRequest;g.onload=function(){var a=THREE.ImageUtils.parseDDS(g.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var n=0;n<a.mipmapCount;n++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+n]),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)};g.onerror=d;g.open("GET",a,!0);g.responseType="arraybuffer";g.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)}function d(a,b,c,d){var e=c*d*4;a=new Uint8Array(a,b,e);for(var e=new Uint8Array(e),f=b=0,g=0;g<d;g++)for(var h=0;h<c;h++){var k=a[f];f++;var l=a[f];f++;var n=a[f];f++;var q=a[f];f++;e[b]=n;b++;e[b]=l;b++;e[b]=k;b++;e[b]=q;b++}return e}
|
|
|
+f.mipmaps=a.mipmaps;f.format=a.format;f.needsUpdate=!0;c&&c(f)};g.onerror=d;g.open("GET",a,!0);g.responseType="arraybuffer";g.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)}function d(a,b,c,d){var e=c*d*4;a=new Uint8Array(a,b,e);for(var e=new Uint8Array(e),f=b=0,g=0;g<d;g++)for(var h=0;h<c;h++){var k=a[f];f++;var l=a[f];f++;var n=a[f];f++;var r=a[f];f++;e[b]=n;b++;e[b]=l;b++;e[b]=k;b++;e[b]=r;b++}return e}
|
|
|
var e={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},f=c("DXT1"),g=c("DXT3"),h=c("DXT5"),k=new Int32Array(a,0,31);if(542327876!==k[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),e;if(!k[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),e;var l=k[21],n=!1;switch(l){case f:f=8;e.format=THREE.RGB_S3TC_DXT1_Format;break;case g:f=16;e.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:f=16;e.format=THREE.RGBA_S3TC_DXT5_Format;
|
|
|
-break;default:if(32==k[22]&&k[23]&16711680&&k[24]&65280&&k[25]&255&&k[26]&4278190080)n=!0,f=64,e.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(l&255,l>>8&255,l>>16&255,l>>24&255)),e}e.mipmapCount=1;k[2]&131072&&!1!==b&&(e.mipmapCount=Math.max(1,k[7]));e.isCubemap=k[28]&512?!0:!1;e.width=k[4];e.height=k[3];for(var k=k[1]+4,g=e.width,h=e.height,l=e.isCubemap?6:1,q=0;q<l;q++){for(var s=0;s<e.mipmapCount;s++){if(n)var u=d(a,k,
|
|
|
-g,h),t=u.length;else t=Math.max(4,g)/4*Math.max(4,h)/4*f,u=new Uint8Array(a,k,t);e.mipmaps.push({data:u,width:g,height:h});k+=t;g=Math.max(0.5*g,1);h=Math.max(0.5*h,1)}g=e.width;h=e.height}return e},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|=1;var d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,
|
|
|
-e),l=k.data,n=0;n<d;n++)for(var q=0;q<e;q++){var s=0>q-1?0:q-1,u=q+1>e-1?e-1:q+1,t=0>n-1?0:n-1,p=n+1>d-1?d-1:n+1,v=[],w=[0,0,h[4*(q*d+n)]/255*b];v.push([-1,0,h[4*(q*d+t)]/255*b]);v.push([-1,-1,h[4*(s*d+t)]/255*b]);v.push([0,-1,h[4*(s*d+n)]/255*b]);v.push([1,-1,h[4*(s*d+p)]/255*b]);v.push([1,0,h[4*(q*d+p)]/255*b]);v.push([1,1,h[4*(u*d+p)]/255*b]);v.push([0,1,h[4*(u*d+n)]/255*b]);v.push([-1,1,h[4*(u*d+t)]/255*b]);s=[];t=v.length;for(u=0;u<t;u++){var p=v[u],r=v[(u+1)%t],p=[p[0]-w[0],p[1]-w[1],p[2]-w[2]],
|
|
|
-r=[r[0]-w[0],r[1]-w[1],r[2]-w[2]];s.push(c([p[1]*r[2]-p[2]*r[1],p[2]*r[0]-p[0]*r[2],p[0]*r[1]-p[1]*r[0]]))}v=[0,0,0];for(u=0;u<s.length;u++)v[0]+=s[u][0],v[1]+=s[u][1],v[2]+=s[u][2];v[0]/=s.length;v[1]/=s.length;v[2]/=s.length;w=4*(q*d+n);l[w]=(v[0]+1)/2*255|0;l[w+1]=(v[1]+1)/2*255|0;l[w+2]=255*v[2]|0;l[w+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*
|
|
|
+break;default:if(32==k[22]&&k[23]&16711680&&k[24]&65280&&k[25]&255&&k[26]&4278190080)n=!0,f=64,e.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(l&255,l>>8&255,l>>16&255,l>>24&255)),e}e.mipmapCount=1;k[2]&131072&&!1!==b&&(e.mipmapCount=Math.max(1,k[7]));e.isCubemap=k[28]&512?!0:!1;e.width=k[4];e.height=k[3];for(var k=k[1]+4,g=e.width,h=e.height,l=e.isCubemap?6:1,q=0;q<l;q++){for(var s=0;s<e.mipmapCount;s++){if(n)var r=d(a,k,
|
|
|
+g,h),t=r.length;else t=Math.max(4,g)/4*Math.max(4,h)/4*f,r=new Uint8Array(a,k,t);e.mipmaps.push({data:r,width:g,height:h});k+=t;g=Math.max(0.5*g,1);h=Math.max(0.5*h,1)}g=e.width;h=e.height}return e},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|=1;var d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,
|
|
|
+e),l=k.data,n=0;n<d;n++)for(var q=0;q<e;q++){var s=0>q-1?0:q-1,r=q+1>e-1?e-1:q+1,t=0>n-1?0:n-1,p=n+1>d-1?d-1:n+1,v=[],w=[0,0,h[4*(q*d+n)]/255*b];v.push([-1,0,h[4*(q*d+t)]/255*b]);v.push([-1,-1,h[4*(s*d+t)]/255*b]);v.push([0,-1,h[4*(s*d+n)]/255*b]);v.push([1,-1,h[4*(s*d+p)]/255*b]);v.push([1,0,h[4*(q*d+p)]/255*b]);v.push([1,1,h[4*(r*d+p)]/255*b]);v.push([0,1,h[4*(r*d+n)]/255*b]);v.push([-1,1,h[4*(r*d+t)]/255*b]);s=[];t=v.length;for(r=0;r<t;r++){var p=v[r],u=v[(r+1)%t],p=[p[0]-w[0],p[1]-w[1],p[2]-w[2]],
|
|
|
+u=[u[0]-w[0],u[1]-w[1],u[2]-w[2]];s.push(c([p[1]*u[2]-p[2]*u[1],p[2]*u[0]-p[0]*u[2],p[0]*u[1]-p[1]*u[0]]))}v=[0,0,0];for(r=0;r<s.length;r++)v[0]+=s[r][0],v[1]+=s[r][1],v[2]+=s[r][2];v[0]/=s.length;v[1]/=s.length;v[2]/=s.length;w=4*(q*d+n);l[w]=(v[0]+1)/2*255|0;l[w+1]=(v[1]+1)/2*255|0;l[w+2]=255*v[2]|0;l[w+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a,b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*
|
|
|
h]=f,e[3*h+1]=g,e[3*h+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){var b=this.getFace(),c=this.size/b.resolution,d=0,e=
|
|
|
-String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,l,n,q,s,u,t,p,v,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),l=b.length,a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;n=b[a++]*c;e.moveTo(k,n);break;case "l":k=b[a++]*c+d;n=b[a++]*c;e.lineTo(k,n);break;case "q":k=b[a++]*
|
|
|
-c+d;n=b[a++]*c;u=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(u,t,k,n);if(g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++){var r=g/h;THREE.Shape.Utils.b2(r,q,u,k);THREE.Shape.Utils.b2(r,s,t,n)}break;case "b":if(k=b[a++]*c+d,n=b[a++]*c,u=b[a++]*c+d,t=b[a++]*-c,p=b[a++]*c+d,v=b[a++]*-c,e.bezierCurveTo(k,n,u,t,p,v),g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++)r=g/h,THREE.Shape.Utils.b3(r,q,u,p,k),THREE.Shape.Utils.b3(r,s,t,v,n)}return{offset:w.ha*c,path:e}}}};
|
|
|
+String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,l,n,q,s,r,t,p,v,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),l=b.length,a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;n=b[a++]*c;e.moveTo(k,n);break;case "l":k=b[a++]*c+d;n=b[a++]*c;e.lineTo(k,n);break;case "q":k=b[a++]*
|
|
|
+c+d;n=b[a++]*c;r=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(r,t,k,n);if(g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,q,r,k);THREE.Shape.Utils.b2(u,s,t,n)}break;case "b":if(k=b[a++]*c+d,n=b[a++]*c,r=b[a++]*c+d,t=b[a++]*-c,p=b[a++]*c+d,v=b[a++]*-c,e.bezierCurveTo(k,n,r,t,p,v),g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++)u=g/h,THREE.Shape.Utils.b3(u,q,r,p,k),THREE.Shape.Utils.b3(u,s,t,v,n)}return{offset:w.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){b=b||{};var 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,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,l,n;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var q=2*e;for(l=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);n=l+1;e<=n&&(n=0);var s;a:{var u=s=void 0,t=void 0,p=void 0,v=void 0,w=void 0,r=void 0,x=void 0,A=
|
|
|
-void 0,u=a[g[k]].x,t=a[g[k]].y,p=a[g[l]].x,v=a[g[l]].y,w=a[g[n]].x,r=a[g[n]].y;if(1E-10>(p-u)*(r-t)-(v-t)*(w-u))s=!1;else{var F=void 0,P=void 0,I=void 0,z=void 0,B=void 0,L=void 0,H=void 0,J=void 0,y=void 0,N=void 0,y=J=H=A=x=void 0,F=w-p,P=r-v,I=u-w,z=t-r,B=p-u,L=v-t;for(s=0;s<e;s++)if(x=a[g[s]].x,A=a[g[s]].y,!(x===u&&A===t||x===p&&A===v||x===w&&A===r)&&(H=x-u,J=A-t,y=x-p,N=A-v,x-=w,A-=r,y=F*N-P*y,H=B*J-L*H,J=I*A-z*x,-1E-10<=y&&-1E-10<=J&&-1E-10<=H)){s=!1;break a}s=!0}}if(s){f.push([a[g[k]],a[g[l]],
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,l,n;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var q=2*e;for(l=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);n=l+1;e<=n&&(n=0);var s;a:{var r=s=void 0,t=void 0,p=void 0,v=void 0,w=void 0,u=void 0,x=void 0,A=
|
|
|
+void 0,r=a[g[k]].x,t=a[g[k]].y,p=a[g[l]].x,v=a[g[l]].y,w=a[g[n]].x,u=a[g[n]].y;if(1E-10>(p-r)*(u-t)-(v-t)*(w-r))s=!1;else{var F=void 0,P=void 0,I=void 0,z=void 0,B=void 0,L=void 0,H=void 0,J=void 0,y=void 0,N=void 0,y=J=H=A=x=void 0,F=w-p,P=u-v,I=r-w,z=t-u,B=p-r,L=v-t;for(s=0;s<e;s++)if(x=a[g[s]].x,A=a[g[s]].y,!(x===r&&A===t||x===p&&A===v||x===w&&A===u)&&(H=x-r,J=A-t,y=x-p,N=A-v,x-=w,A-=u,y=F*N-P*y,H=B*J-L*H,J=I*A-z*x,-1E-10<=y&&-1E-10<=J&&-1E-10<=H)){s=!1;break a}s=!0}}if(s){f.push([a[g[k]],a[g[l]],
|
|
|
a[g[n]]]);h.push([g[k],g[l],g[n]]);k=l;for(n=l+1;n<e;k++,n++)g[k]=g[n];e--;q=2*e}}return d?h: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(a){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 g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -553,13 +553,13 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=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 g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.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,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),k=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(k);k=k.getPoint(1);h.push(k.x);h.push(k.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,k,l,n,q,s,u,t,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){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:h=f[2];k=f[3];q=f[0];s=f[1];0<c.length?(g=c[c.length-1],u=g.x,
|
|
|
-t=g.y):(g=this.actions[d-1].args,u=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,u,q,h),p=THREE.Shape.Utils.b2(p,t,s,k),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];q=f[0];s=f[1];l=f[2];n=f[3];0<c.length?(g=c[c.length-1],u=g.x,t=g.y):(g=this.actions[d-1].args,u=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,u,q,l,h),p=THREE.Shape.Utils.b3(p,t,s,n,k),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
-this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];s=f[2];l=f[3];g=f[4];q=!!f[5];u=g-l;t=2*a;for(f=1;f<=t;f++)p=f/t,q||(p=1-p),p=l+p*u,g=h+s*Math.cos(p),p=k+s*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:for(h=f[0],k=f[1],s=f[2],n=f[3],l=f[4],g=f[5],q=!!f[6],u=g-l,t=2*a,f=1;f<=t;f++)p=f/t,q||
|
|
|
-(p=1-p),p=l+p*u,g=h+s*Math.cos(p),p=k+n*Math.sin(p),c.push(new THREE.Vector2(g,p))}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);a=a||12;var c=[],d,e,f,g,h,k,l,n,q,s,r,t,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){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:h=f[2];k=f[3];q=f[0];s=f[1];0<c.length?(g=c[c.length-1],r=g.x,
|
|
|
+t=g.y):(g=this.actions[d-1].args,r=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,r,q,h),p=THREE.Shape.Utils.b2(p,t,s,k),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];q=f[0];s=f[1];l=f[2];n=f[3];0<c.length?(g=c[c.length-1],r=g.x,t=g.y):(g=this.actions[d-1].args,r=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,r,q,l,h),p=THREE.Shape.Utils.b3(p,t,s,n,k),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
+this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];s=f[2];l=f[3];g=f[4];q=!!f[5];r=g-l;t=2*a;for(f=1;f<=t;f++)p=f/t,q||(p=1-p),p=l+p*r,g=h+s*Math.cos(p),p=k+s*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:for(h=f[0],k=f[1],s=f[2],n=f[3],l=f[4],g=f[5],q=!!f[6],r=g-l,t=2*a,f=1;f<=t;f++)p=f/t,q||
|
|
|
+(p=1-p),p=l+p*r,g=h+s*Math.cos(p),p=k+n*Math.sin(p),c.push(new THREE.Vector2(g,p))}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){function b(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(1E-10<Math.abs(l)){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var c,d,e,f,g=[],h=new THREE.Path;c=0;for(d=this.actions.length;c<d;c++)e=this.actions[c],f=e.args,e=e.action,e==
|
|
|
-THREE.PathActions.MOVE_TO&&0!=h.actions.length&&(g.push(h),h=new THREE.Path),h[e].apply(h,f);0!=h.actions.length&&g.push(h);if(0==g.length)return[];var k,l,n;f=[];if(1==g.length)return l=g[0],n=new THREE.Shape,n.actions=l.actions,n.curves=l.curves,f.push(n),f;var q=!THREE.Shape.Utils.isClockWise(g[0].getPoints()),q=a?!q:q;n=[];h=[];e=[];var s=0,u;h[s]=void 0;e[s]=[];c=0;for(d=g.length;c<d;c++)l=g[c],u=l.getPoints(),k=THREE.Shape.Utils.isClockWise(u),(k=a?!k:k)?(!q&&h[s]&&s++,h[s]={s:new THREE.Shape,
|
|
|
-p:u},h[s].s.actions=l.actions,h[s].s.curves=l.curves,q&&s++,e[s]=[]):e[s].push({h:l,p:u[0]});if(1<h.length){c=!1;d=[];a=0;for(g=h.length;a<g;a++)n[a]=[];a=0;for(g=h.length;a<g;a++)for(l=e[a],k=0;k<l.length;k++){q=l[k];s=!0;for(u=0;u<h.length;u++)b(q.p,h[u].p)&&(a!=u&&d.push({froms:a,tos:u,hole:k}),s?(s=!1,n[u].push(q)):c=!0);s&&n[a].push(q)}0<d.length&&(c||(e=n))}c=0;for(d=h.length;c<d;c++)for(n=h[c].s,f.push(n),a=e[c],g=0,l=a.length;g<l;g++)n.holes.push(a[g].h);return f};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.PathActions.MOVE_TO&&0!=h.actions.length&&(g.push(h),h=new THREE.Path),h[e].apply(h,f);0!=h.actions.length&&g.push(h);if(0==g.length)return[];var k,l,n;f=[];if(1==g.length)return l=g[0],n=new THREE.Shape,n.actions=l.actions,n.curves=l.curves,f.push(n),f;var q=!THREE.Shape.Utils.isClockWise(g[0].getPoints()),q=a?!q:q;n=[];h=[];e=[];var s=0,r;h[s]=void 0;e[s]=[];c=0;for(d=g.length;c<d;c++)l=g[c],r=l.getPoints(),k=THREE.Shape.Utils.isClockWise(r),(k=a?!k:k)?(!q&&h[s]&&s++,h[s]={s:new THREE.Shape,
|
|
|
+p:r},h[s].s.actions=l.actions,h[s].s.curves=l.curves,q&&s++,e[s]=[]):e[s].push({h:l,p:r[0]});if(1<h.length){c=!1;d=[];a=0;for(g=h.length;a<g;a++)n[a]=[];a=0;for(g=h.length;a<g;a++)for(l=e[a],k=0;k<l.length;k++){q=l[k];s=!0;for(r=0;r<h.length;r++)b(q.p,h[r].p)&&(a!=r&&d.push({froms:a,tos:r,hole:k}),s?(s=!1,n[r].push(q)):c=!0);s&&n[a].push(q)}0<d.length&&(c||(e=n))}c=0;for(d=h.length;c<d;c++)for(n=h[c].s,f.push(n),a=e[c],g=0,l=a.length;g<l;g++)n.holes.push(a[g].h);return f};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={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,q=a.y-d.y,I=h*k-g*l,z=h*n-g*q;if(1E-10<Math.abs(I)){if(0<I){if(0>z||z>I)return[];k=l*n-k*q;if(0>k||k>I)return[]}else{if(0<z||z<I)return[];k=l*n-k*q;if(0<k||k<I)return[]}if(0==k)return!f||0!=z&&z!=I?[a]:[];if(k==I)return!f||0!=z&&z!=I?[b]:[];if(0==z)return[d];
|
|
@@ -575,26 +575,23 @@ THREE.EllipseCurve.prototype.getPoint=function(a){var b;b=this.aEndAngle-this.aS
|
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,e);return b});THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){-1===a.indexOf(b)&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);-1!==b&&a.splice(b,1)},add:function(a){void 0!==b[a.name]&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(!0!==a.initialized){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++)if(0>a.hierarchy[c].keys[d].time&&
|
|
|
(a.hierarchy[c].keys[d].time=0),void 0!==a.hierarchy[c].keys[d].rot&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}if(a.hierarchy[c].keys.length&&void 0!==a.hierarchy[c].keys[0].morphTargets){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var k=0;k<a.hierarchy[c].keys[d].morphTargets.length;k++){var l=a.hierarchy[c].keys[d].morphTargets[k];h[l]=-1}a.hierarchy[c].usedMorphTargets=h;
|
|
|
for(d=0;d<a.hierarchy[c].keys.length;d++){var n={};for(l in h){for(k=0;k<a.hierarchy[c].keys[d].morphTargets.length;k++)if(a.hierarchy[c].keys[d].morphTargets[k]===l){n[l]=a.hierarchy[c].keys[d].morphTargetsInfluences[k];break}k===a.hierarchy[c].keys[d].morphTargets.length&&(n[l]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=n}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
|
|
|
-d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],
|
|
|
-b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
|
|
|
-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,g,h,k,l,n;for(n=this.currentTime+=a*this.timeScale;this.currentTime>this.data.length;)this.currentTime-=this.data.length;l=this.currentTime%=this.data.length;parseInt(Math.min(l*this.data.fps,this.data.length*this.data.fps),10);for(var q=0,s=this.hierarchy.length;q<s;q++){a=this.hierarchy[q];k=a.animationCache;for(var u=0;3>u;u++){c=b[u];g=k.prevKey[c];h=k.nextKey[c];if(h.time<=n){if(l<=n)if(this.loop)for(g=
|
|
|
-this.data.hierarchy[q].keys[0],h=this.getNextKeyWith(c,q,1);null!==h&&h.time<l&&h.index>g.index;)g=h,h=this.getNextKeyWith(c,q,h.index+1);else{this.stop();return}else{do g=h,h=this.getNextKeyWith(c,q,h.index+1);while(null!==h&&h.time<l&&h.index>g.index)}k.prevKey[c]=g;k.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(l-g.time)/(h.time-g.time);e=g[c];f=h[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+q),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",q,g.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",q,h.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)}}}};
|
|
|
+d}a.initialized=!0}},get:function(a){if("string"===typeof a){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=void 0!==c?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};THREE.Animation.prototype.play=function(a){this.currentTime=void 0!==a?a:0;!1===this.isPlaying&&(this.isPlaying=!0,this.reset(),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.reset=function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a];c.matrixAutoUpdate=!0;void 0===c.animationCache&&(c.animationCache={},c.animationCache.prevKey={pos:0,rot:0,scl:0},c.animationCache.nextKey={pos:0,rot:0,scl:0},c.animationCache.originalMatrix=c instanceof THREE.Bone?c.skinMatrix:c.matrix);var d=c.animationCache.prevKey,c=c.animationCache.nextKey;d.pos=this.data.hierarchy[a].keys[0];d.rot=this.data.hierarchy[a].keys[0];d.scl=this.data.hierarchy[a].keys[0];
|
|
|
+c.pos=this.getNextKeyWith("pos",a,1);c.rot=this.getNextKeyWith("rot",a,1);c.scl=this.getNextKeyWith("scl",a,1)}};
|
|
|
+THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){this.currentTime+=a*this.timeScale;var b;a=["pos","rot","scl"];var c=this.data.length,d=this.currentTime;!0===this.loop&&(d%=c);for(var d=Math.min(d,c),e=0,f=this.hierarchy.length;e<f;e++)for(var g=this.hierarchy[e],h=g.animationCache,k=0;3>k;k++){b=a[k];var l=h.prevKey[b],n=h.nextKey[b];if(n.time<=d){l=this.data.hierarchy[e].keys[0];for(n=this.getNextKeyWith(b,e,1);n.time<d&&n.index>l.index;)l=n,n=this.getNextKeyWith(b,e,n.index+
|
|
|
+1);h.prevKey[b]=l;h.nextKey[b]=n}g.matrixAutoUpdate=!0;g.matrixWorldNeedsUpdate=!0;var q=(d-l.time)/(n.time-l.time),s=l[b],r=n[b];0>q&&(q=0);1<q&&(q=1);if("pos"===b)if(b=g.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=s[0]+(r[0]-s[0])*q,b.y=s[1]+(r[1]-s[1])*q,b.z=s[2]+(r[2]-s[2])*q;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",e,l.index-1).pos,this.points[1]=
|
|
|
+s,this.points[2]=r,this.points[3]=this.getNextKeyWith("pos",e,n.index+1).pos,q=0.33*q+0.33,l=this.interpolateCatmullRom(this.points,q),b.x=l[0],b.y=l[1],b.z=l[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(q=this.interpolateCatmullRom(this.points,1.01*q),this.target.set(q[0],q[1],q[2]),this.target.sub(b),this.target.y=0,this.target.normalize(),b=Math.atan2(this.target.x,this.target.z),g.rotation.set(0,b,0))}else"rot"===b?THREE.Quaternion.slerp(s,r,g.quaternion,q):"scl"===
|
|
|
+b&&(b=g.scale,b.x=s[0]+(r[0]-s[0])*q,b.y=s[1]+(r[1]-s[1])*q,b.z=s[2]+(r[2]-s[2])*q)}this.currentTime>c&&(this.reset(),!1===this.loop&&this.stop())}};
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],e,f,g,h,k,l;e=(a.length-1)*b;f=Math.floor(e);e-=f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>a.length-2?f:f+1;c[3]=f>a.length-3?f:f+2;f=a[c[0]];h=a[c[1]];k=a[c[2]];l=a[c[3]];c=e*e;g=e*c;d[0]=this.interpolate(f[0],h[0],k[0],l[0],e,c,g);d[1]=this.interpolate(f[1],h[1],k[1],l[1],e,c,g);d[2]=this.interpolate(f[2],h[2],k[2],l[2],e,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]};
|
|
|
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=void 0!==c?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){c=this.data.hierarchy[a].sids;var d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
-d.matrixWorldNeedsUpdate=!0}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++)e=this.hierarchy[c],f=this.data.hierarchy[c],void 0===f.animationCache&&(f.animationCache={},f.animationCache.prevKey=null,f.animationCache.nextKey=null,f.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:e.matrix),e=this.data.hierarchy[c].keys,
|
|
|
-e.length&&(f.animationCache.prevKey=e[0],f.animationCache.nextKey=e[1],this.startTime=Math.min(e[0].time,this.startTime),this.endTime=Math.max(e[e.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
+THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]};THREE.KeyFrameAnimation=function(a,b){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;for(var c=0,d=this.hierarchy.length;c<d;c++){var e=this.data.hierarchy[c].sids,f=this.hierarchy[c];if(this.data.hierarchy[c].keys.length&&e){for(var g=0;g<e.length;g++){var h=e[g],k=this.getNextKeyWith(h,c,0);k&&k.apply(h)}f.matrixAutoUpdate=!1;this.data.hierarchy[c].node.updateMatrix();
|
|
|
+f.matrixWorldNeedsUpdate=!0}}};
|
|
|
+THREE.KeyFrameAnimation.prototype.play=function(a){this.currentTime=void 0!==a?a:0;if(!1===this.isPlaying){this.isPlaying=!0;var b=this.hierarchy.length,c,d;for(a=0;a<b;a++)c=this.hierarchy[a],d=this.data.hierarchy[a],void 0===d.animationCache&&(d.animationCache={},d.animationCache.prevKey=null,d.animationCache.nextKey=null,d.animationCache.originalMatrix=c instanceof THREE.Bone?c.skinMatrix:c.matrix),c=this.data.hierarchy[a].keys,c.length&&(d.animationCache.prevKey=c[0],d.animationCache.nextKey=
|
|
|
+c[1],this.startTime=Math.min(c[0].time,this.startTime),this.endTime=Math.max(c[c.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
|
|
|
-THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=this.data.JIT.hierarchy,g,h,k;h=this.currentTime+=a*this.timeScale;g=this.currentTime%=this.data.length;g<this.startTimeMs&&(g=this.currentTime=this.startTimeMs+g);e=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((k=g<h)&&!this.loop){a=0;for(var l=this.hierarchy.length;a<l;a++){var n=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=n.length-1;e=this.hierarchy[a];if(n.length){for(n=
|
|
|
-0;n<f.length;n++)g=f[n],(h=this.getPrevKeyWith(g,a,d))&&h.apply(g);this.data.hierarchy[a].node.updateMatrix();e.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(g<this.startTime)){a=0;for(l=this.hierarchy.length;a<l;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var n=b.keys,q=b.animationCache;if(this.JITCompile&&void 0!==f[a][e])d instanceof THREE.Bone?(d.skinMatrix=f[a][e],d.matrixWorldNeedsUpdate=!1):(d.matrix=f[a][e],d.matrixWorldNeedsUpdate=!0);else if(n.length){this.JITCompile&&q&&(d instanceof
|
|
|
-THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix);b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(k&&this.loop)for(b=n[0],c=n[1];c.time<g;)b=c,c=n[b.index+1];else if(!k)for(var s=n.length-1;c.time<g&&c.index!==s;)b=c,c=n[b.index+1];q.prevKey=b;q.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&void 0===f[0][e])for(this.hierarchy[0].updateMatrixWorld(!0),a=0;a<this.hierarchy.length;a++)f[a][e]=
|
|
|
-this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(!1!==this.isPlaying){this.currentTime+=a*this.timeScale;var b=this.data.length;a=this.currentTime;!0===this.loop&&(a%=b);a=Math.min(a,b);for(var b=0,c=this.hierarchy.length;b<c;b++){var d=this.hierarchy[b],e=this.data.hierarchy[b],f=e.keys,e=e.animationCache;if(f.length){var g=e.prevKey,h=e.nextKey;if(h.time<=a){for(;h.time<a&&h.index>g.index;)g=h,h=f[g.index+1];e.prevKey=g;e.nextKey=h}h.time>=a?g.interpolate(h,a):g.interpolate(h,h.time);this.data.hierarchy[b].node.updateMatrix();
|
|
|
+d.matrixWorldNeedsUpdate=!0}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
|
1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var k=new THREE.PerspectiveCamera(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new THREE.Vector3(0,0,-1));this.add(k);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,s=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
|
|
|
2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=s;c.activeCubeFace=5;a.render(b,k,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);
|
|
|
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=!0;this.inOrthographicMode=!1};
|
|
@@ -602,32 +599,32 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspe
|
|
|
THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())};
|
|
|
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.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,r=h.heightSegments,x=e/2,A=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",r=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var P=w+1,I=r+1,z=e/w,B=f/r,L=new THREE.Vector3;L[v]=0<g?1:-1;for(e=0;e<I;e++)for(f=0;f<P;f++){var H=new THREE.Vector3;H[a]=(f*z-x)*c;H[b]=(e*B-A)*d;H[v]=g;h.vertices.push(H)}for(e=
|
|
|
-0;e<r;e++)for(f=0;f<w;f++)A=f+P*e,a=f+P*(e+1),b=f+1+P*(e+1),c=f+1+P*e,d=new THREE.Vector2(f/w,1-e/r),g=new THREE.Vector2(f/w,1-(e+1)/r),v=new THREE.Vector2((f+1)/w,1-(e+1)/r),x=new THREE.Vector2((f+1)/w,1-e/r),A=new THREE.Face3(A+F,a+F,c+F),A.normal.copy(L),A.vertexNormals.push(L.clone(),L.clone(),L.clone()),A.materialIndex=p,h.faces.push(A),h.faceVertexUvs[0].push([d,g,x]),A=new THREE.Face3(a+F,b+F,c+F),A.normal.copy(L),A.vertexNormals.push(L.clone(),L.clone(),L.clone()),A.materialIndex=p,h.faces.push(A),
|
|
|
+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.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,u=h.heightSegments,x=e/2,A=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",u=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var P=w+1,I=u+1,z=e/w,B=f/u,L=new THREE.Vector3;L[v]=0<g?1:-1;for(e=0;e<I;e++)for(f=0;f<P;f++){var H=new THREE.Vector3;H[a]=(f*z-x)*c;H[b]=(e*B-A)*d;H[v]=g;h.vertices.push(H)}for(e=
|
|
|
+0;e<u;e++)for(f=0;f<w;f++)A=f+P*e,a=f+P*(e+1),b=f+1+P*(e+1),c=f+1+P*e,d=new THREE.Vector2(f/w,1-e/u),g=new THREE.Vector2(f/w,1-(e+1)/u),v=new THREE.Vector2((f+1)/w,1-(e+1)/u),x=new THREE.Vector2((f+1)/w,1-e/u),A=new THREE.Face3(A+F,a+F,c+F),A.normal.copy(L),A.vertexNormals.push(L.clone(),L.clone(),L.clone()),A.materialIndex=p,h.faces.push(A),h.faceVertexUvs[0].push([d,g,x]),A=new THREE.Face3(a+F,b+F,c+F),A.normal.copy(L),A.vertexNormals.push(L.clone(),L.clone(),L.clone()),A.materialIndex=p,h.faces.push(A),
|
|
|
h.faceVertexUvs[0].push([g.clone(),v,x.clone()])}THREE.Geometry.call(this);var h=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;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,
|
|
|
5);this.computeCentroids();this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);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 g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.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(),g.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=THREE.BoxGeometry;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 g=c/2,h,k,l=[],n=[];for(k=0;k<=e;k++){var q=[],s=[],u=k/e,t=u*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,v=new THREE.Vector3;v.x=t*Math.sin(p*Math.PI*2);v.y=-u*c+g;v.z=t*Math.cos(p*Math.PI*2);this.vertices.push(v);q.push(this.vertices.length-1);s.push(new THREE.Vector2(p,
|
|
|
-1-u))}l.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[l[0][h]].clone(),s=this.vertices[l[0][h+1]].clone()):(q=this.vertices[l[1][h]].clone(),s=this.vertices[l[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),k=0;k<e;k++){var u=l[k][h],t=l[k+1][h],p=l[k+1][h+1],v=l[k][h+1],w=q.clone(),r=q.clone(),x=s.clone(),A=s.clone(),F=n[k][h].clone(),P=n[k+1][h].clone(),I=n[k+1][h+1].clone(),z=n[k][h+1].clone();this.faces.push(new THREE.Face3(u,
|
|
|
-t,v,[w,r,A]));this.faceVertexUvs[0].push([F,P,z]);this.faces.push(new THREE.Face3(t,p,v,[r.clone(),x,A.clone()]));this.faceVertexUvs[0].push([P.clone(),I,z.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)u=l[0][h],t=l[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),F=n[0][h].clone(),P=n[0][h+1].clone(),I=new THREE.Vector2(P.x,0),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([F,
|
|
|
-P,I]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)u=l[k][h+1],t=l[k][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),F=n[k][h+1].clone(),P=n[k][h].clone(),I=new THREE.Vector2(P.x,1),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([F,P,I]);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(),g.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=THREE.BoxGeometry;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 g=c/2,h,k,l=[],n=[];for(k=0;k<=e;k++){var q=[],s=[],r=k/e,t=r*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,v=new THREE.Vector3;v.x=t*Math.sin(p*Math.PI*2);v.y=-r*c+g;v.z=t*Math.cos(p*Math.PI*2);this.vertices.push(v);q.push(this.vertices.length-1);s.push(new THREE.Vector2(p,
|
|
|
+1-r))}l.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[l[0][h]].clone(),s=this.vertices[l[0][h+1]].clone()):(q=this.vertices[l[1][h]].clone(),s=this.vertices[l[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),k=0;k<e;k++){var r=l[k][h],t=l[k+1][h],p=l[k+1][h+1],v=l[k][h+1],w=q.clone(),u=q.clone(),x=s.clone(),A=s.clone(),F=n[k][h].clone(),P=n[k+1][h].clone(),I=n[k+1][h+1].clone(),z=n[k][h+1].clone();this.faces.push(new THREE.Face3(r,
|
|
|
+t,v,[w,u,A]));this.faceVertexUvs[0].push([F,P,z]);this.faces.push(new THREE.Face3(t,p,v,[u.clone(),x,A.clone()]));this.faceVertexUvs[0].push([P.clone(),I,z.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)r=l[0][h],t=l[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),F=n[0][h].clone(),P=n[0][h+1].clone(),I=new THREE.Vector2(P.x,0),this.faces.push(new THREE.Face3(r,t,p,[w,u,x])),this.faceVertexUvs[0].push([F,
|
|
|
+P,I]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)r=l[k][h+1],t=l[k][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),F=n[k][h+1].clone(),P=n[k][h].clone(),I=new THREE.Vector2(P.x,1),this.faces.push(new THREE.Face3(r,t,p,[w,u,x])),this.faceVertexUvs[0].push([F,P,I]);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.Math.sign,e=1,e=a.x-b.x,f=a.y-b.y,g=c.x-a.x,h=c.y-a.y,k=e*e+f*f;if(1E-10<Math.abs(e*h-f*g)){var l=Math.sqrt(k),d=Math.sqrt(g*g+h*h),k=b.x-f/l;b=b.y+e/l;g=((c.x-h/d-k)*h-(c.y+g/d-b)*g)/(e*h-f*g);c=k+e*g-a.x;a=b+f*g-a.y;e=c*c+a*a;if(2>=e)return new THREE.Vector2(c,a);e=Math.sqrt(e/2)}else a=!1,1E-10<e?1E-10<g&&(a=!0):-1E-10>e?-1E-10>g&&
|
|
|
-(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(Q=c.length;0<=--Q;){e=Q;f=Q-1;0>f&&(f=c.length-1);for(var g=0,h=u+2*n,g=0;g<h;g++){var k=ea*g,l=ea*(g+1),p=d+e+k,k=d+f+k,q=d+f+l,l=d+e+l,s=c,t=g,v=h,w=e,y=f,p=p+J,k=k+J,q=q+J,l=l+J;H.faces.push(new THREE.Face3(p,k,l,null,null,r));H.faces.push(new THREE.Face3(k,q,l,null,null,r));p=x.generateSideWallUV(H,a,s,b,p,k,q,l,t,v,w,y);H.faceVertexUvs[0].push([p[0],p[1],
|
|
|
+(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(Q=c.length;0<=--Q;){e=Q;f=Q-1;0>f&&(f=c.length-1);for(var g=0,h=r+2*n,g=0;g<h;g++){var k=ea*g,l=ea*(g+1),p=d+e+k,k=d+f+k,q=d+f+l,l=d+e+l,s=c,t=g,v=h,w=e,y=f,p=p+J,k=k+J,q=q+J,l=l+J;H.faces.push(new THREE.Face3(p,k,l,null,null,u));H.faces.push(new THREE.Face3(k,q,l,null,null,u));p=x.generateSideWallUV(H,a,s,b,p,k,q,l,t,v,w,y);H.faceVertexUvs[0].push([p[0],p[1],
|
|
|
p[3]]);H.faceVertexUvs[0].push([p[1],p[2],p[3]])}}}function f(a,b,c){H.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=J;d+=J;e+=J;H.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?x.generateBottomUV(H,a,b,c,d,e):x.generateTopUV(H,a,b,c,d,e);H.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,s=
|
|
|
-void 0!==b.curveSegments?b.curveSegments:12,u=void 0!==b.steps?b.steps:1,t=b.extrudePath,p,v=!1,w=b.material,r=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,A,F,P,I;t&&(p=t.getSpacedPoints(u),v=!0,q=!1,A=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,u,!1),F=new THREE.Vector3,P=new THREE.Vector3,I=new THREE.Vector3);q||(l=k=n=0);var z,B,L,H=this,J=this.vertices.length,t=a.extractPoints(s),s=t.shape,y=t.holes;if(t=!THREE.Shape.Utils.isClockWise(s)){s=
|
|
|
+void 0!==b.curveSegments?b.curveSegments:12,r=void 0!==b.steps?b.steps:1,t=b.extrudePath,p,v=!1,w=b.material,u=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,A,F,P,I;t&&(p=t.getSpacedPoints(r),v=!0,q=!1,A=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,r,!1),F=new THREE.Vector3,P=new THREE.Vector3,I=new THREE.Vector3);q||(l=k=n=0);var z,B,L,H=this,J=this.vertices.length,t=a.extractPoints(s),s=t.shape,y=t.holes;if(t=!THREE.Shape.Utils.isClockWise(s)){s=
|
|
|
s.reverse();B=0;for(L=y.length;B<L;B++)z=y[B],THREE.Shape.Utils.isClockWise(z)&&(y[B]=z.reverse());t=!1}var N=THREE.Shape.Utils.triangulateShape(s,y),E=s;B=0;for(L=y.length;B<L;B++)z=y[B],s=s.concat(z);var C,D,G,X,T,ea=s.length,Y,la=N.length,t=[],Q=0;G=E.length;C=G-1;for(D=Q+1;Q<G;Q++,C++,D++)C===G&&(C=0),D===G&&(D=0),t[Q]=d(E[Q],E[C],E[D]);var ha=[],S,M=t.concat();B=0;for(L=y.length;B<L;B++){z=y[B];S=[];Q=0;G=z.length;C=G-1;for(D=Q+1;Q<G;Q++,C++,D++)C===G&&(C=0),D===G&&(D=0),S[Q]=d(z[Q],z[C],z[D]);
|
|
|
-ha.push(S);M=M.concat(S)}for(C=0;C<n;C++){G=C/n;X=k*(1-G);D=l*Math.sin(G*Math.PI/2);Q=0;for(G=E.length;Q<G;Q++)T=c(E[Q],t[Q],D),f(T.x,T.y,-X);B=0;for(L=y.length;B<L;B++)for(z=y[B],S=ha[B],Q=0,G=z.length;Q<G;Q++)T=c(z[Q],S[Q],D),f(T.x,T.y,-X)}D=l;for(Q=0;Q<ea;Q++)T=q?c(s[Q],M[Q],D):s[Q],v?(P.copy(A.normals[0]).multiplyScalar(T.x),F.copy(A.binormals[0]).multiplyScalar(T.y),I.copy(p[0]).add(P).add(F),f(I.x,I.y,I.z)):f(T.x,T.y,0);for(G=1;G<=u;G++)for(Q=0;Q<ea;Q++)T=q?c(s[Q],M[Q],D):s[Q],v?(P.copy(A.normals[G]).multiplyScalar(T.x),
|
|
|
-F.copy(A.binormals[G]).multiplyScalar(T.y),I.copy(p[G]).add(P).add(F),f(I.x,I.y,I.z)):f(T.x,T.y,h/u*G);for(C=n-1;0<=C;C--){G=C/n;X=k*(1-G);D=l*Math.sin(G*Math.PI/2);Q=0;for(G=E.length;Q<G;Q++)T=c(E[Q],t[Q],D),f(T.x,T.y,h+X);B=0;for(L=y.length;B<L;B++)for(z=y[B],S=ha[B],Q=0,G=z.length;Q<G;Q++)T=c(z[Q],S[Q],D),v?f(T.x,T.y+p[u-1].y,p[u-1].x+X):f(T.x,T.y,h+X)}(function(){if(q){var a;a=0*ea;for(Q=0;Q<la;Q++)Y=N[Q],g(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=u+2*n;a*=ea;for(Q=0;Q<la;Q++)Y=N[Q],g(Y[0]+a,Y[1]+a,Y[2]+a,
|
|
|
-!1)}else{for(Q=0;Q<la;Q++)Y=N[Q],g(Y[2],Y[1],Y[0],!0);for(Q=0;Q<la;Q++)Y=N[Q],g(Y[0]+ea*u,Y[1]+ea*u,Y[2]+ea*u,!1)}})();(function(){var a=0;e(E,a);a+=E.length;B=0;for(L=y.length;B<L;B++)z=y[B],e(z,a),a+=z.length})()};
|
|
|
+ha.push(S);M=M.concat(S)}for(C=0;C<n;C++){G=C/n;X=k*(1-G);D=l*Math.sin(G*Math.PI/2);Q=0;for(G=E.length;Q<G;Q++)T=c(E[Q],t[Q],D),f(T.x,T.y,-X);B=0;for(L=y.length;B<L;B++)for(z=y[B],S=ha[B],Q=0,G=z.length;Q<G;Q++)T=c(z[Q],S[Q],D),f(T.x,T.y,-X)}D=l;for(Q=0;Q<ea;Q++)T=q?c(s[Q],M[Q],D):s[Q],v?(P.copy(A.normals[0]).multiplyScalar(T.x),F.copy(A.binormals[0]).multiplyScalar(T.y),I.copy(p[0]).add(P).add(F),f(I.x,I.y,I.z)):f(T.x,T.y,0);for(G=1;G<=r;G++)for(Q=0;Q<ea;Q++)T=q?c(s[Q],M[Q],D):s[Q],v?(P.copy(A.normals[G]).multiplyScalar(T.x),
|
|
|
+F.copy(A.binormals[G]).multiplyScalar(T.y),I.copy(p[G]).add(P).add(F),f(I.x,I.y,I.z)):f(T.x,T.y,h/r*G);for(C=n-1;0<=C;C--){G=C/n;X=k*(1-G);D=l*Math.sin(G*Math.PI/2);Q=0;for(G=E.length;Q<G;Q++)T=c(E[Q],t[Q],D),f(T.x,T.y,h+X);B=0;for(L=y.length;B<L;B++)for(z=y[B],S=ha[B],Q=0,G=z.length;Q<G;Q++)T=c(z[Q],S[Q],D),v?f(T.x,T.y+p[r-1].y,p[r-1].x+X):f(T.x,T.y,h+X)}(function(){if(q){var a;a=0*ea;for(Q=0;Q<la;Q++)Y=N[Q],g(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=r+2*n;a*=ea;for(Q=0;Q<la;Q++)Y=N[Q],g(Y[0]+a,Y[1]+a,Y[2]+a,
|
|
|
+!1)}else{for(Q=0;Q<la;Q++)Y=N[Q],g(Y[2],Y[1],Y[0],!0);for(Q=0;Q<la;Q++)Y=N[Q],g(Y[0]+ea*r,Y[1]+ea*r,Y[2]+ea*r,!1)}})();(function(){var a=0;e(E,a);a+=E.length;B=0;for(L=y.length;B<L;B++)z=y[B],e(z,a),a+=z.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,g,h,k,l,n,q){b=a.vertices[e].x;c=a.vertices[e].y;e=a.vertices[e].z;d=a.vertices[f].x;k=a.vertices[f].y;f=a.vertices[f].z;l=a.vertices[g].x;
|
|
|
n=a.vertices[g].y;g=a.vertices[g].z;q=a.vertices[h].x;var s=a.vertices[h].y;a=a.vertices[h].z;return 0.01>Math.abs(c-k)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(l,1-g),new THREE.Vector2(q,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(k,1-f),new THREE.Vector2(n,1-g),new THREE.Vector2(s,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,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,l=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse(),e=0,f=l.length;e<f;e++)g=l[e],THREE.Shape.Utils.isClockWise(g)&&(l[e]=g.reverse());var n=THREE.Shape.Utils.triangulateShape(k,l);e=0;for(f=l.length;e<f;e++)g=l[e],
|
|
|
-k=k.concat(g);l=k.length;f=n.length;for(e=0;e<l;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)l=n[e],k=l[0]+h,g=l[1]+h,l=l[2]+h,this.faces.push(new THREE.Face3(k,g,l,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,k,g,l))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,l=Math.cos(k),n=Math.sin(k),k=0,q=a.length;k<q;k++){var s=a[k],u=new THREE.Vector3;u.x=l*s.x-n*s.y;u.y=n*s.x+l*s.y;u.z=s.z;this.vertices.push(u)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,q=a.length-1;k<q;k++){b=n=k+c*g;d=n+c;var l=n+1+c,n=n+1,s=g*f,u=k*e,t=s+f,p=u+e;this.faces.push(new THREE.Face3(b,d,n));this.faceVertexUvs[0].push([new THREE.Vector2(s,
|
|
|
-u),new THREE.Vector2(t,u),new THREE.Vector2(s,p)]);this.faces.push(new THREE.Face3(d,l,n));this.faceVertexUvs[0].push([new THREE.Vector2(t,u),new THREE.Vector2(t,p),new THREE.Vector2(s,p)])}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;var e=a/2,f=b/2;c=this.widthSegments;d=this.heightSegments;var g=c+1,h=d+1,k=this.width/c,l=this.height/d,n=new THREE.Vector3(0,0,1);for(a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*k-e,-(a*l-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var q=b+g*a,e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,k=new THREE.Vector2(b/c,1-a/d),l=new THREE.Vector2(b/c,1-(a+
|
|
|
-1)/d),s=new THREE.Vector2((b+1)/c,1-(a+1)/d),u=new THREE.Vector2((b+1)/c,1-a/d),q=new THREE.Face3(q,e,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([k,l,u]);q=new THREE.Face3(e,f,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([l.clone(),s,u.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);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;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,q=e+g/c*f;n.x=k*Math.cos(q);n.y=k*Math.sin(q);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)q=g+e,f=q+a,l=q+c+a,n=q+c+1+a,this.faces.push(new THREE.Face3(f,
|
|
|
-l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]),f=q+a,l=q+c+1+a,n=q+1+a,this.faces.push(new THREE.Face3(f,l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){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=g=void 0!==g?g:Math.PI;var h,k,l=[],n=[];for(k=0;k<=c;k++){var q=[],s=[];for(h=0;h<=b;h++){var u=h/b,t=k/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+u*e)*Math.sin(f+t*g);p.y=a*Math.cos(f+t*g);
|
|
|
-p.z=a*Math.sin(d+u*e)*Math.sin(f+t*g);this.vertices.push(p);q.push(this.vertices.length-1);s.push(new THREE.Vector2(u,1-t))}l.push(q);n.push(s)}for(k=0;k<this.heightSegments;k++)for(h=0;h<this.widthSegments;h++){b=l[k][h+1];c=l[k][h];d=l[k+1][h];e=l[k+1][h+1];f=this.vertices[b].clone().normalize();g=this.vertices[c].clone().normalize();var q=this.vertices[d].clone().normalize(),s=this.vertices[e].clone().normalize(),u=n[k][h+1].clone(),t=n[k][h].clone(),p=n[k+1][h].clone(),v=n[k+1][h+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
-this.radius?(u.x=(u.x+t.x)/2,this.faces.push(new THREE.Face3(b,d,e,[f,q,s])),this.faceVertexUvs[0].push([u,p,v])):Math.abs(this.vertices[d].y)===this.radius?(p.x=(p.x+v.x)/2,this.faces.push(new THREE.Face3(b,c,d,[f,g,q])),this.faceVertexUvs[0].push([u,t,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,g,s])),this.faceVertexUvs[0].push([u,t,v]),this.faces.push(new THREE.Face3(c,d,e,[g.clone(),q,s.clone()])),this.faceVertexUvs[0].push([t.clone(),p,v.clone()]))}this.computeCentroids();this.computeFaceNormals();
|
|
|
+k=k.concat(g);l=k.length;f=n.length;for(e=0;e<l;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)l=n[e],k=l[0]+h,g=l[1]+h,l=l[2]+h,this.faces.push(new THREE.Face3(k,g,l,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,k,g,l))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,l=Math.cos(k),n=Math.sin(k),k=0,q=a.length;k<q;k++){var s=a[k],r=new THREE.Vector3;r.x=l*s.x-n*s.y;r.y=n*s.x+l*s.y;r.z=s.z;this.vertices.push(r)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,q=a.length-1;k<q;k++){b=n=k+c*g;d=n+c;var l=n+1+c,n=n+1,s=g*f,r=k*e,t=s+f,p=r+e;this.faces.push(new THREE.Face3(b,d,n));this.faceVertexUvs[0].push([new THREE.Vector2(s,
|
|
|
+r),new THREE.Vector2(t,r),new THREE.Vector2(s,p)]);this.faces.push(new THREE.Face3(d,l,n));this.faceVertexUvs[0].push([new THREE.Vector2(t,r),new THREE.Vector2(t,p),new THREE.Vector2(s,p)])}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;var e=a/2,f=b/2;c=this.widthSegments;d=this.heightSegments;var g=c+1,h=d+1,k=this.width/c,l=this.height/d,n=new THREE.Vector3(0,0,1);for(a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*k-e,-(a*l-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var q=b+g*a,e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,k=new THREE.Vector2(b/c,1-a/d),l=new THREE.Vector2(b/c,1-(a+
|
|
|
+1)/d),s=new THREE.Vector2((b+1)/c,1-(a+1)/d),r=new THREE.Vector2((b+1)/c,1-a/d),q=new THREE.Face3(q,e,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([k,l,r]);q=new THREE.Face3(e,f,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([l.clone(),s,r.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);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;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,q=e+g/c*f;n.x=k*Math.cos(q);n.y=k*Math.sin(q);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)q=g+e,f=q+a,l=q+c+a,n=q+c+1+a,this.faces.push(new THREE.Face3(f,
|
|
|
+l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]),f=q+a,l=q+c+1+a,n=q+1+a,this.faces.push(new THREE.Face3(f,l,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[l].clone(),h[n].clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){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=g=void 0!==g?g:Math.PI;var h,k,l=[],n=[];for(k=0;k<=c;k++){var q=[],s=[];for(h=0;h<=b;h++){var r=h/b,t=k/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+r*e)*Math.sin(f+t*g);p.y=a*Math.cos(f+t*g);
|
|
|
+p.z=a*Math.sin(d+r*e)*Math.sin(f+t*g);this.vertices.push(p);q.push(this.vertices.length-1);s.push(new THREE.Vector2(r,1-t))}l.push(q);n.push(s)}for(k=0;k<this.heightSegments;k++)for(h=0;h<this.widthSegments;h++){b=l[k][h+1];c=l[k][h];d=l[k+1][h];e=l[k+1][h+1];f=this.vertices[b].clone().normalize();g=this.vertices[c].clone().normalize();var q=this.vertices[d].clone().normalize(),s=this.vertices[e].clone().normalize(),r=n[k][h+1].clone(),t=n[k][h].clone(),p=n[k+1][h].clone(),v=n[k+1][h+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
+this.radius?(r.x=(r.x+t.x)/2,this.faces.push(new THREE.Face3(b,d,e,[f,q,s])),this.faceVertexUvs[0].push([r,p,v])):Math.abs(this.vertices[d].y)===this.radius?(p.x=(p.x+v.x)/2,this.faces.push(new THREE.Face3(b,c,d,[f,g,q])),this.faceVertexUvs[0].push([r,t,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,g,s])),this.faceVertexUvs[0].push([r,t,v]),this.faces.push(new THREE.Face3(c,d,e,[g.clone(),q,s.clone()])),this.faceVertexUvs[0].push([t.clone(),p,v.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){b=b||{};var 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,g=c/this.radialSegments*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
|
|
|
Math.cos(g))*Math.sin(f);h.z=this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(h.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){e=(this.tubularSegments+1)*c+d-1;var f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,k=new THREE.Face3(e,f,h,[b[e].clone(),b[f].clone(),b[h].clone()]);this.faces.push(k);this.faceVertexUvs[0].push([a[e].clone(),
|
|
|
a[f].clone(),a[h].clone()]);k=new THREE.Face3(f,g,h,[b[f].clone(),b[g].clone(),b[h].clone()]);this.faces.push(k);this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids();this.computeFaceNormals()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=b/c;b=Math.cos(a);f*=d*(2+b)*0.5;g=d*(2+b)*g*0.5;d=e*d*Math.sin(a)*0.5;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=g||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)for(this.grid[a]=
|
|
@@ -639,10 +636,10 @@ c/this.radialSegments),g=new THREE.Vector2((b+1)/this.segments,(c+1)/this.radial
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var l,n,q;this.tangents=e;this.normals=f;this.binormals=g;for(l=0;l<b;l++)n=l/(b-1),e[l]=a.getTangentAt(n),e[l].normalize();f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);n=Math.abs(e[0].y);q=Math.abs(e[0].z);l<=a&&(a=l,d.set(1,0,0));n<=a&&(a=n,d.set(0,1,0));q<=a&&d.set(0,0,1);h.crossVectors(e[0],
|
|
|
d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(l=1;l<b;l++)f[l]=f[l-1].clone(),g[l]=g[l-1].clone(),h.crossVectors(e[l-1],e[l]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[l-1].dot(e[l]),-1,1)),f[l].applyMatrix4(k.makeRotationAxis(h,d))),g[l].crossVectors(e[l],f[l]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),l=1;l<b;l++)f[l].applyMatrix4(k.makeRotationAxis(e[l],d*l)),g[l].crossVectors(e[l],
|
|
|
f[l])};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.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);k.faces.push(d);d=d.centroid;d=Math.atan2(d.z,-d.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,
|
|
|
-c,d)])}function g(a,b){var c=Math.pow(2,b);Math.pow(4,b);for(var d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],n=0;n<=c;n++){l[n]=[];for(var q=e(d.clone().lerp(h,n/c)),s=e(g.clone().lerp(h,n/c)),t=c-n,u=0;u<=t;u++)l[n][u]=0==u&&n==c?q:e(q.clone().lerp(s,u/t))}for(n=0;n<c;n++)for(u=0;u<2*(c-n)-1;u++)d=Math.floor(u/2),0==u%2?f(l[n][d+1],l[n+1][d],l[n][d]):f(l[n][d+1],l[n+1][d+1],l[n+1][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);c=c||1;d=d||0;for(var k=this,l=0,n=a.length;l<n;l++)e(new THREE.Vector3(a[l][0],a[l][1],a[l][2]));a=this.vertices;for(var q=[],l=0,n=b.length;l<n;l++){var s=a[b[l][0]],u=a[b[l][1]],t=a[b[l][2]];q[l]=new THREE.Face3(s.index,u.index,t.index,[s.clone(),u.clone(),t.clone()])}l=0;for(n=q.length;l<n;l++)g(q[l],d);l=0;for(n=this.faceVertexUvs[0].length;l<n;l++)b=this.faceVertexUvs[0][l],d=b[0].x,a=b[1].x,q=b[2].x,s=Math.max(d,Math.max(a,q)),
|
|
|
-u=Math.min(d,Math.min(a,q)),0.9<s&&0.1>u&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));l=0;for(n=this.vertices.length;l<n;l++)this.vertices[l].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],g,h,k,l,n=b+1;for(g=0;g<=c;g++)for(l=g/c,h=0;h<=b;h++)k=h/b,k=a(k,l),d.push(k);var q,s,u,t;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*n+h,d=g*n+h+1,l=(g+1)*n+h+1,k=(g+1)*n+h,q=new THREE.Vector2(h/b,g/c),s=new THREE.Vector2((h+1)/b,g/c),u=new THREE.Vector2((h+1)/b,(g+1)/c),t=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a,d,k)),f.push([q,s,t]),e.push(new THREE.Face3(d,l,k)),
|
|
|
-f.push([s.clone(),u,t.clone()]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){a=a||1;var 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)};
|
|
|
+c,d)])}function g(a,b){var c=Math.pow(2,b);Math.pow(4,b);for(var d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],n=0;n<=c;n++){l[n]=[];for(var q=e(d.clone().lerp(h,n/c)),r=e(g.clone().lerp(h,n/c)),s=c-n,t=0;t<=s;t++)l[n][t]=0==t&&n==c?q:e(q.clone().lerp(r,t/s))}for(n=0;n<c;n++)for(t=0;t<2*(c-n)-1;t++)d=Math.floor(t/2),0==t%2?f(l[n][d+1],l[n+1][d],l[n][d]):f(l[n][d+1],l[n+1][d+1],l[n+1][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);c=c||1;d=d||0;for(var k=this,l=0,n=a.length;l<n;l++)e(new THREE.Vector3(a[l][0],a[l][1],a[l][2]));a=this.vertices;for(var q=[],l=0,n=b.length;l<n;l++){var s=a[b[l][0]],r=a[b[l][1]],t=a[b[l][2]];q[l]=new THREE.Face3(s.index,r.index,t.index,[s.clone(),r.clone(),t.clone()])}l=0;for(n=q.length;l<n;l++)g(q[l],d);l=0;for(n=this.faceVertexUvs[0].length;l<n;l++)b=this.faceVertexUvs[0][l],d=b[0].x,a=b[1].x,q=b[2].x,s=Math.max(d,Math.max(a,q)),
|
|
|
+r=Math.min(d,Math.min(a,q)),0.9<s&&0.1>r&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));l=0;for(n=this.vertices.length;l<n;l++)this.vertices[l].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],g,h,k,l,n=b+1;for(g=0;g<=c;g++)for(l=g/c,h=0;h<=b;h++)k=h/b,k=a(k,l),d.push(k);var q,s,r,t;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*n+h,d=g*n+h+1,l=(g+1)*n+h+1,k=(g+1)*n+h,q=new THREE.Vector2(h/b,g/c),s=new THREE.Vector2((h+1)/b,g/c),r=new THREE.Vector2((h+1)/b,(g+1)/c),t=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a,d,k)),f.push([q,s,t]),e.push(new THREE.Face3(d,l,k)),
|
|
|
+f.push([s.clone(),r,t.clone()]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){a=a||1;var 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);
|
|
@@ -653,7 +650,7 @@ 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,g,h,k){a.set(g,h,k);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d)for(g=0,h=d.length;g<h;g++)e.geometry.vertices[d[g]].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;b=b||1;var 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.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var l=k.vertices,k=k.faces,n=0,q=0,s=k.length;q<s;q++)for(var u=k[q],t=0;3>t;t++){d[0]=u[g[t]];d[1]=u[g[(t+1)%3]];d.sort(f);var p=d.toString();void 0===e[p]?(e[p]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[p].face2=q}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
+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},g=["a","b","c"],h=new THREE.BufferGeometry,k=a.geometry.clone();k.mergeVertices();k.computeFaceNormals();for(var l=k.vertices,k=k.faces,n=0,q=0,s=k.length;q<s;q++)for(var r=k[q],t=0;3>t;t++){d[0]=r[g[t]];d[1]=r[g[(t+1)%3]];d.sort(f);var p=d.toString();void 0===e[p]?(e[p]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[p].face2=q}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
f=0;for(p in e)if(g=e[p],void 0===g.face2||0.9999>k[g.face1].normal.dot(k[g.face2].normal))n=l[g.vert1],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z,n=l[g.vert2],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z;THREE.Line.call(this,h,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=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var 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(a){var b=new THREE.Vector3;return function(a){this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);a=this.geometry.vertices;for(var d=this.object.geometry.faces,e=this.object.matrixWorld,f=0,g=d.length;f<g;f++){var h=d[f];b.copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);var k=2*f;a[k].copy(h.centroid).applyMatrix4(e);a[k+1].addVectors(a[k],b)}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);
|
|
@@ -663,12 +660,12 @@ THREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;
|
|
|
THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-0.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update()};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};THREE.SpotLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){var c=this.light.distance?this.light.distance:1E4,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();THREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:16711680;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexNormals.length;g<h;g++)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.normalMatrix=new THREE.Matrix3;this.update()};
|
|
|
THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
-THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var n=f[k],q=0,s=n.vertexNormals.length;q<s;q++){var u=n.vertexNormals[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(u).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);
|
|
|
+THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var n=f[k],q=0,s=n.vertexNormals.length;q<s;q++){var r=n.vertexNormals[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(r).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);
|
|
|
b.add(d[h]);h+=1;d[h].copy(b);h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.VertexTangentsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:255;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexTangents.length;g<h;g++)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(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var n=f[k],q=0,s=n.vertexTangents.length;q<s;q++){var u=n.vertexTangents[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(u).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b);
|
|
|
-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},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,l=a.geometry.faces,n=0,q=new Uint32Array(6*l.length),s=0,u=l.length;s<u;s++)for(var t=l[s],p=0;3>p;p++){d[0]=t[g[p]];d[1]=t[g[(p+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
-s=0;for(u=n;s<u;s++)for(p=0;2>p;p++)n=k[q[2*s+p]],g=6*s+3*p,d[g+0]=n.x,d[g+1]=n.y,d[g+2]=n.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,u=a.geometry.attributes.index.array,l=a.geometry.offsets,n=0,q=new Uint32Array(2*u.length),t=0,w=l.length;t<w;++t)for(var p=l[t].start,v=l[t].count,g=l[t].index,s=p,r=p+v;s<r;s+=3)for(p=0;3>p;p++)d[0]=g+u[s+p],d[1]=g+u[s+(p+1)%3],d.sort(f),v=d.toString(),void 0===e[v]&&(q[2*
|
|
|
-n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;s=0;for(u=n;s<u;s++)for(p=0;2>p;p++)g=6*s+3*p,n=3*q[2*s+p],d[g+0]=k[n],d[g+1]=k[n+1],d[g+2]=k[n+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(k=a.geometry.attributes.position.array,n=k.length/3,q=n/3,h.addAttribute("position",Float32Array,2*n,3),d=h.attributes.position.array,s=0,u=q;s<u;s++)for(p=0;3>p;p++)g=18*s+6*p,q=9*s+3*p,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],n=9*s+(p+
|
|
|
+THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var n=f[k],q=0,s=n.vertexTangents.length;q<s;q++){var r=n.vertexTangents[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(r).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b);
|
|
|
+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},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,l=a.geometry.faces,n=0,q=new Uint32Array(6*l.length),s=0,r=l.length;s<r;s++)for(var t=l[s],p=0;3>p;p++){d[0]=t[g[p]];d[1]=t[g[(p+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
+s=0;for(r=n;s<r;s++)for(p=0;2>p;p++)n=k[q[2*s+p]],g=6*s+3*p,d[g+0]=n.x,d[g+1]=n.y,d[g+2]=n.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var k=a.geometry.attributes.position.array,r=a.geometry.attributes.index.array,l=a.geometry.offsets,n=0,q=new Uint32Array(2*r.length),t=0,w=l.length;t<w;++t)for(var p=l[t].start,v=l[t].count,g=l[t].index,s=p,u=p+v;s<u;s+=3)for(p=0;3>p;p++)d[0]=g+r[s+p],d[1]=g+r[s+(p+1)%3],d.sort(f),v=d.toString(),void 0===e[v]&&(q[2*
|
|
|
+n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;s=0;for(r=n;s<r;s++)for(p=0;2>p;p++)g=6*s+3*p,n=3*q[2*s+p],d[g+0]=k[n],d[g+1]=k[n+1],d[g+2]=k[n+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(k=a.geometry.attributes.position.array,n=k.length/3,q=n/3,h.addAttribute("position",Float32Array,2*n,3),d=h.attributes.position.array,s=0,r=q;s<r;s++)for(p=0;3>p;p++)g=18*s+6*p,q=9*s+3*p,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],n=9*s+(p+
|
|
|
1)%3*3,d[g+3]=k[n],d[g+4]=k[n+1],d[g+5]=k[n+2];THREE.Line.call(this,h,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(a){}};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=c.x*Math.PI*0.25,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);
|
|
@@ -678,36 +675,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),g=d.weight;
|
|
|
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,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*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};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,g,h,k,l,n,q,s,u;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;
|
|
|
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,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*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};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,g,h,k,l,n,q,s,r;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;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);k=b.createTexture();l=b.createTexture();b.bindTexture(b.TEXTURE_2D,k);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,l);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)?(n=!1,q=a(THREE.ShaderFlares.lensFlare,d)):(n=!0,q=a(THREE.ShaderFlares.lensFlareVertexTexture,d));s={};u={};s.vertex=b.getAttribLocation(q,"position");s.uv=b.getAttribLocation(q,"uv");u.renderType=b.getUniformLocation(q,"renderType");u.map=b.getUniformLocation(q,"map");u.occlusionMap=b.getUniformLocation(q,"occlusionMap");u.opacity=
|
|
|
-b.getUniformLocation(q,"opacity");u.color=b.getUniformLocation(q,"color");u.scale=b.getUniformLocation(q,"scale");u.rotation=b.getUniformLocation(q,"rotation");u.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var r=a.length;if(r){var x=new THREE.Vector3,A=f/e,F=0.5*e,P=0.5*f,I=16/f,z=new THREE.Vector2(I*A,I),B=new THREE.Vector3(1,1,0),L=new THREE.Vector2(1,1),H=u,I=s;b.useProgram(q);b.enableVertexAttribArray(s.vertex);b.enableVertexAttribArray(s.uv);
|
|
|
-b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var J,y,N,E,C;for(J=0;J<r;J++)if(I=16/f,z.set(I*A,I),E=a[J],x.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),B.copy(x),L.x=B.x*F+F,
|
|
|
+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)?(n=!1,q=a(THREE.ShaderFlares.lensFlare,d)):(n=!0,q=a(THREE.ShaderFlares.lensFlareVertexTexture,d));s={};r={};s.vertex=b.getAttribLocation(q,"position");s.uv=b.getAttribLocation(q,"uv");r.renderType=b.getUniformLocation(q,"renderType");r.map=b.getUniformLocation(q,"map");r.occlusionMap=b.getUniformLocation(q,"occlusionMap");r.opacity=
|
|
|
+b.getUniformLocation(q,"opacity");r.color=b.getUniformLocation(q,"color");r.scale=b.getUniformLocation(q,"scale");r.rotation=b.getUniformLocation(q,"rotation");r.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var u=a.length;if(u){var x=new THREE.Vector3,A=f/e,F=0.5*e,P=0.5*f,I=16/f,z=new THREE.Vector2(I*A,I),B=new THREE.Vector3(1,1,0),L=new THREE.Vector2(1,1),H=r,I=s;b.useProgram(q);b.enableVertexAttribArray(s.vertex);b.enableVertexAttribArray(s.uv);
|
|
|
+b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var J,y,N,E,C;for(J=0;J<u;J++)if(I=16/f,z.set(I*A,I),E=a[J],x.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),B.copy(x),L.x=B.x*F+F,
|
|
|
L.y=B.y*P+P,n||0<L.x&&L.x<e&&0<L.y&&L.y<f)for(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,k),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,L.x-8,L.y-8,16,16,0),b.uniform1i(H.renderType,0),b.uniform2f(H.scale,z.x,z.y),b.uniform3f(H.screenPosition,B.x,B.y,B.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,l),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,L.x-8,L.y-8,16,16,0),b.uniform1i(H.renderType,1),b.disable(b.DEPTH_TEST),
|
|
|
b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,k),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),E.positionScreen.copy(B),E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares(),b.uniform1i(H.renderType,2),b.enable(b.BLEND),y=0,N=E.lensFlares.length;y<N;y++)C=E.lensFlares[y],0.001<C.opacity&&0.001<C.scale&&(B.x=C.x,B.y=C.y,B.z=C.z,I=C.size*C.scale/f,z.x=I*A,z.y=I,b.uniform3f(H.screenPosition,B.x,B.y,B.z),b.uniform2f(H.scale,z.x,z.y),b.uniform1f(H.rotation,C.rotation),b.uniform1f(H.opacity,
|
|
|
C.opacity),b.uniform3f(H.color,C.color.r,C.color.g,C.color.b),c.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),c.setTexture(C.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,g=new THREE.Frustum,h=new THREE.Matrix4,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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(q,s){var u,t,p,v,w,r,x,A,F,P=[];v=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);u=0;for(t=q.__lights.length;u<t;u++)if(p=q.__lights[u],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var I;if(p.shadowCascadeArray[w])I=p.shadowCascadeArray[w];else{F=p;x=w;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=F.shadowCameraNear;I.shadowCameraFar=F.shadowCameraFar;I.shadowCameraLeft=F.shadowCameraLeft;I.shadowCameraRight=F.shadowCameraRight;
|
|
|
-I.shadowCameraBottom=F.shadowCameraBottom;I.shadowCameraTop=F.shadowCameraTop;I.shadowCameraVisible=F.shadowCameraVisible;I.shadowDarkness=F.shadowDarkness;I.shadowBias=F.shadowCascadeBias[x];I.shadowMapWidth=F.shadowCascadeWidth[x];I.shadowMapHeight=F.shadowCascadeHeight[x];I.pointsWorld=[];I.pointsFrustum=[];A=I.pointsWorld;r=I.pointsFrustum;for(var z=0;8>z;z++)A[z]=new THREE.Vector3,r[z]=new THREE.Vector3;A=F.shadowCascadeNearZ[x];F=F.shadowCascadeFarZ[x];r[0].set(-1,-1,A);r[1].set(1,-1,A);r[2].set(-1,
|
|
|
-1,A);r[3].set(1,1,A);r[4].set(-1,-1,F);r[5].set(1,-1,F);r[6].set(-1,1,F);r[7].set(1,1,F);I.originalCamera=s;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(I);r.add(I.target);s.add(r);p.shadowCascadeArray[w]=I;console.log("Created virtualLight",I)}x=p;A=w;F=x.shadowCascadeArray[A];F.position.copy(x.position);F.target.position.copy(x.target.position);F.lookAt(F.target);F.shadowCameraVisible=x.shadowCameraVisible;F.shadowDarkness=x.shadowDarkness;F.shadowBias=x.shadowCascadeBias[A];r=x.shadowCascadeNearZ[A];
|
|
|
-x=x.shadowCascadeFarZ[A];F=F.pointsFrustum;F[0].z=r;F[1].z=r;F[2].z=r;F[3].z=r;F[4].z=x;F[5].z=x;F[6].z=x;F[7].z=x;P[v]=I;v++}else P[v]=p,v++;u=0;for(t=P.length;u<t;u++){p=P[u];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+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(q,s){var r,t,p,v,w,u,x,A,F,P=[];v=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);r=0;for(t=q.__lights.length;r<t;r++)if(p=q.__lights[r],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var I;if(p.shadowCascadeArray[w])I=p.shadowCascadeArray[w];else{F=p;x=w;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=F.shadowCameraNear;I.shadowCameraFar=F.shadowCameraFar;I.shadowCameraLeft=F.shadowCameraLeft;I.shadowCameraRight=F.shadowCameraRight;
|
|
|
+I.shadowCameraBottom=F.shadowCameraBottom;I.shadowCameraTop=F.shadowCameraTop;I.shadowCameraVisible=F.shadowCameraVisible;I.shadowDarkness=F.shadowDarkness;I.shadowBias=F.shadowCascadeBias[x];I.shadowMapWidth=F.shadowCascadeWidth[x];I.shadowMapHeight=F.shadowCascadeHeight[x];I.pointsWorld=[];I.pointsFrustum=[];A=I.pointsWorld;u=I.pointsFrustum;for(var z=0;8>z;z++)A[z]=new THREE.Vector3,u[z]=new THREE.Vector3;A=F.shadowCascadeNearZ[x];F=F.shadowCascadeFarZ[x];u[0].set(-1,-1,A);u[1].set(1,-1,A);u[2].set(-1,
|
|
|
+1,A);u[3].set(1,1,A);u[4].set(-1,-1,F);u[5].set(1,-1,F);u[6].set(-1,1,F);u[7].set(1,1,F);I.originalCamera=s;u=new THREE.Gyroscope;u.position=p.shadowCascadeOffset;u.add(I);u.add(I.target);s.add(u);p.shadowCascadeArray[w]=I;console.log("Created virtualLight",I)}x=p;A=w;F=x.shadowCascadeArray[A];F.position.copy(x.position);F.target.position.copy(x.target.position);F.lookAt(F.target);F.shadowCameraVisible=x.shadowCameraVisible;F.shadowDarkness=x.shadowDarkness;F.shadowBias=x.shadowCascadeBias[A];u=x.shadowCascadeNearZ[A];
|
|
|
+x=x.shadowCascadeFarZ[A];F=F.pointsFrustum;F[0].z=u;F[1].z=u;F[2].z=u;F[3].z=u;F[4].z=x;F[5].z=x;F[6].z=x;F[7].z=x;P[v]=I;v++}else P[v]=p,v++;r=0;for(t=P.length;r<t;r++){p=P[r];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}q.add(p.shadowCamera);!0===q.autoUpdate&&q.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&I.originalCamera==s){w=s;v=p.shadowCamera;r=p.pointsFrustum;F=p.pointsWorld;k.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)A=F[x],A.copy(r[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(A,w),A.applyMatrix4(v.matrixWorldInverse),A.x<k.x&&(k.x=A.x),A.x>l.x&&(l.x=A.x),A.y<k.y&&(k.y=A.y),A.y>l.y&&(l.y=A.y),A.z<k.z&&(k.z=A.z),A.z>l.z&&
|
|
|
-(l.z=A.z);v.left=k.x;v.right=l.x;v.top=l.y;v.bottom=k.y;v.updateProjectionMatrix()}v=p.shadowMap;r=p.shadowMatrix;w=p.shadowCamera;w.position.setFromMatrixPosition(p.matrixWorld);n.setFromMatrixPosition(p.target.matrixWorld);w.lookAt(n);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.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(w.projectionMatrix);r.multiply(w.matrixWorldInverse);
|
|
|
-h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();F=q.__webglObjects;p=0;for(v=F.length;p<v;p++)x=F[p],r=x.object,x.render=!1,!r.visible||!r.castShadow||(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)&&r.frustumCulled&&!g.intersectsObject(r)||(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,r.matrixWorld),x.render=!0);p=0;for(v=F.length;p<v;p++)x=F[p],x.render&&(r=x.object,x=x.buffer,z=r.material instanceof THREE.MeshFaceMaterial?
|
|
|
-r.material.materials[0]:r.material,A=0<r.geometry.morphTargets.length&&z.morphTargets,z=r instanceof THREE.SkinnedMesh&&z.skinning,A=r.customDepthMaterial?r.customDepthMaterial:z?A?f:e:A?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(w,q.__lights,null,A,x,r):b.renderBuffer(w,q.__lights,null,A,x,r));F=q.__webglObjectsImmediate;p=0;for(v=F.length;p<v;p++)x=F[p],r=x.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,r.matrixWorld),b.renderImmediateObject(w,
|
|
|
-q.__lights,null,c,r))}u=b.getClearColor();t=b.getClearAlpha();a.clearColor(u.r,u.g,u.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,g,h,k,l,n,q,s,u,t,p,v;function w(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var r,x,A,F,P,I,z,B;this.init=function(w){r=w.context;x=w;F=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]);P=new Uint16Array([0,1,2,0,2,3]);I=r.createBuffer();z=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,I);r.bufferData(r.ARRAY_BUFFER,F,r.STATIC_DRAW);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,z);r.bufferData(r.ELEMENT_ARRAY_BUFFER,P,r.STATIC_DRAW);w=r.createProgram();
|
|
|
-var H=r.createShader(r.VERTEX_SHADER),J=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(H,["precision "+x.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(J,["precision "+x.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(H);r.compileShader(J);r.attachShader(w,H);r.attachShader(w,J);r.linkProgram(w);B=w;p=r.getAttribLocation(B,"position");v=r.getAttribLocation(B,"uv");a=r.getUniformLocation(B,"uvOffset");b=r.getUniformLocation(B,"uvScale");c=r.getUniformLocation(B,"rotation");d=r.getUniformLocation(B,"scale");e=r.getUniformLocation(B,"color");f=r.getUniformLocation(B,"map");g=r.getUniformLocation(B,"opacity");h=r.getUniformLocation(B,"modelViewMatrix");k=r.getUniformLocation(B,"projectionMatrix");l=
|
|
|
-r.getUniformLocation(B,"fogType");n=r.getUniformLocation(B,"fogDensity");q=r.getUniformLocation(B,"fogNear");s=r.getUniformLocation(B,"fogFar");u=r.getUniformLocation(B,"fogColor");t=r.getUniformLocation(B,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;H=w.getContext("2d");H.fillStyle="#ffffff";H.fillRect(0,0,w.width,w.height);A=new THREE.Texture(w);A.needsUpdate=!0};this.render=function(F,H,J,y){J=F.__webglSprites;if(y=J.length){r.useProgram(B);r.enableVertexAttribArray(p);
|
|
|
-r.enableVertexAttribArray(v);r.disable(r.CULL_FACE);r.enable(r.BLEND);r.bindBuffer(r.ARRAY_BUFFER,I);r.vertexAttribPointer(p,2,r.FLOAT,!1,16,0);r.vertexAttribPointer(v,2,r.FLOAT,!1,16,8);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,z);r.uniformMatrix4fv(k,!1,H.projectionMatrix.elements);r.activeTexture(r.TEXTURE0);r.uniform1i(f,0);var N=0,E=0,C=F.fog;C?(r.uniform3f(u,C.color.r,C.color.g,C.color.b),C instanceof THREE.Fog?(r.uniform1f(q,C.near),r.uniform1f(s,C.far),r.uniform1i(l,1),E=N=1):C instanceof THREE.FogExp2&&
|
|
|
-(r.uniform1f(n,C.density),r.uniform1i(l,2),E=N=2)):(r.uniform1i(l,0),E=N=0);for(var D,G=[],C=0;C<y;C++)D=J[C],!1!==D.visible&&(D._modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,D.matrixWorld),D.z=-D._modelViewMatrix.elements[14]);J.sort(w);for(C=0;C<y;C++)D=J[C],!1!==D.visible&&(H=D.material,r.uniform1f(t,H.alphaTest),r.uniformMatrix4fv(h,!1,D._modelViewMatrix.elements),G[0]=D.scale.x,G[1]=D.scale.y,D=F.fog&&H.fog?E:0,N!==D&&(r.uniform1i(l,D),N=D),null!==H.map?(r.uniform2f(a,H.map.offset.x,
|
|
|
-H.map.offset.y),r.uniform2f(b,H.map.repeat.x,H.map.repeat.y)):(r.uniform2f(a,0,0),r.uniform2f(b,1,1)),r.uniform1f(g,H.opacity),r.uniform3f(e,H.color.r,H.color.g,H.color.b),r.uniform1f(c,H.rotation),r.uniform2fv(d,G),x.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),x.setDepthTest(H.depthTest),x.setDepthWrite(H.depthWrite),H.map&&H.map.image&&H.map.image.width?x.setTexture(H.map,0):x.setTexture(A,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,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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(k,l){var n,q,s,u,t,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===k.autoUpdate&&k.updateMatrixWorld();l.matrixWorldInverse.getInverse(l.matrixWorld);h.multiplyMatrices(l.projectionMatrix,
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&I.originalCamera==s){w=s;v=p.shadowCamera;u=p.pointsFrustum;F=p.pointsWorld;k.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)A=F[x],A.copy(u[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(A,w),A.applyMatrix4(v.matrixWorldInverse),A.x<k.x&&(k.x=A.x),A.x>l.x&&(l.x=A.x),A.y<k.y&&(k.y=A.y),A.y>l.y&&(l.y=A.y),A.z<k.z&&(k.z=A.z),A.z>l.z&&
|
|
|
+(l.z=A.z);v.left=k.x;v.right=l.x;v.top=l.y;v.bottom=k.y;v.updateProjectionMatrix()}v=p.shadowMap;u=p.shadowMatrix;w=p.shadowCamera;w.position.setFromMatrixPosition(p.matrixWorld);n.setFromMatrixPosition(p.target.matrixWorld);w.lookAt(n);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(w.projectionMatrix);u.multiply(w.matrixWorldInverse);
|
|
|
+h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();F=q.__webglObjects;p=0;for(v=F.length;p<v;p++)x=F[p],u=x.object,x.render=!1,!u.visible||!u.castShadow||(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)&&u.frustumCulled&&!g.intersectsObject(u)||(u._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,u.matrixWorld),x.render=!0);p=0;for(v=F.length;p<v;p++)x=F[p],x.render&&(u=x.object,x=x.buffer,z=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
+u.material.materials[0]:u.material,A=0<u.geometry.morphTargets.length&&z.morphTargets,z=u instanceof THREE.SkinnedMesh&&z.skinning,A=u.customDepthMaterial?u.customDepthMaterial:z?A?f:e:A?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(w,q.__lights,null,A,x,u):b.renderBuffer(w,q.__lights,null,A,x,u));F=q.__webglObjectsImmediate;p=0;for(v=F.length;p<v;p++)x=F[p],u=x.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(w,
|
|
|
+q.__lights,null,c,u))}r=b.getClearColor();t=b.getClearAlpha();a.clearColor(r.r,r.g,r.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,g,h,k,l,n,q,s,r,t,p,v;function w(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var u,x,A,F,P,I,z,B;this.init=function(w){u=w.context;x=w;F=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]);P=new Uint16Array([0,1,2,0,2,3]);I=u.createBuffer();z=u.createBuffer();u.bindBuffer(u.ARRAY_BUFFER,I);u.bufferData(u.ARRAY_BUFFER,F,u.STATIC_DRAW);u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,z);u.bufferData(u.ELEMENT_ARRAY_BUFFER,P,u.STATIC_DRAW);w=u.createProgram();
|
|
|
+var H=u.createShader(u.VERTEX_SHADER),J=u.createShader(u.FRAGMENT_SHADER);u.shaderSource(H,["precision "+x.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"));
|
|
|
+u.shaderSource(J,["precision "+x.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"));
|
|
|
+u.compileShader(H);u.compileShader(J);u.attachShader(w,H);u.attachShader(w,J);u.linkProgram(w);B=w;p=u.getAttribLocation(B,"position");v=u.getAttribLocation(B,"uv");a=u.getUniformLocation(B,"uvOffset");b=u.getUniformLocation(B,"uvScale");c=u.getUniformLocation(B,"rotation");d=u.getUniformLocation(B,"scale");e=u.getUniformLocation(B,"color");f=u.getUniformLocation(B,"map");g=u.getUniformLocation(B,"opacity");h=u.getUniformLocation(B,"modelViewMatrix");k=u.getUniformLocation(B,"projectionMatrix");l=
|
|
|
+u.getUniformLocation(B,"fogType");n=u.getUniformLocation(B,"fogDensity");q=u.getUniformLocation(B,"fogNear");s=u.getUniformLocation(B,"fogFar");r=u.getUniformLocation(B,"fogColor");t=u.getUniformLocation(B,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;H=w.getContext("2d");H.fillStyle="#ffffff";H.fillRect(0,0,w.width,w.height);A=new THREE.Texture(w);A.needsUpdate=!0};this.render=function(F,H,J,y){J=F.__webglSprites;if(y=J.length){u.useProgram(B);u.enableVertexAttribArray(p);
|
|
|
+u.enableVertexAttribArray(v);u.disable(u.CULL_FACE);u.enable(u.BLEND);u.bindBuffer(u.ARRAY_BUFFER,I);u.vertexAttribPointer(p,2,u.FLOAT,!1,16,0);u.vertexAttribPointer(v,2,u.FLOAT,!1,16,8);u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,z);u.uniformMatrix4fv(k,!1,H.projectionMatrix.elements);u.activeTexture(u.TEXTURE0);u.uniform1i(f,0);var N=0,E=0,C=F.fog;C?(u.uniform3f(r,C.color.r,C.color.g,C.color.b),C instanceof THREE.Fog?(u.uniform1f(q,C.near),u.uniform1f(s,C.far),u.uniform1i(l,1),E=N=1):C instanceof THREE.FogExp2&&
|
|
|
+(u.uniform1f(n,C.density),u.uniform1i(l,2),E=N=2)):(u.uniform1i(l,0),E=N=0);for(var D,G=[],C=0;C<y;C++)D=J[C],!1!==D.visible&&(D._modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,D.matrixWorld),D.z=-D._modelViewMatrix.elements[14]);J.sort(w);for(C=0;C<y;C++)D=J[C],!1!==D.visible&&(H=D.material,u.uniform1f(t,H.alphaTest),u.uniformMatrix4fv(h,!1,D._modelViewMatrix.elements),G[0]=D.scale.x,G[1]=D.scale.y,D=F.fog&&H.fog?E:0,N!==D&&(u.uniform1i(l,D),N=D),null!==H.map?(u.uniform2f(a,H.map.offset.x,
|
|
|
+H.map.offset.y),u.uniform2f(b,H.map.repeat.x,H.map.repeat.y)):(u.uniform2f(a,0,0),u.uniform2f(b,1,1)),u.uniform1f(g,H.opacity),u.uniform3f(e,H.color.r,H.color.g,H.color.b),u.uniform1f(c,H.rotation),u.uniform2fv(d,G),x.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),x.setDepthTest(H.depthTest),x.setDepthWrite(H.depthWrite),H.map&&H.map.image&&H.map.image.width?x.setTexture(H.map,0):x.setTexture(A,0),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0));u.enable(u.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var 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(k,l){var n,q,s,r,t,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===k.autoUpdate&&k.updateMatrixWorld();l.matrixWorldInverse.getInverse(l.matrixWorld);h.multiplyMatrices(l.projectionMatrix,
|
|
|
l.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=k.__webglObjects;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,s.render=!1,!t.visible||(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)&&t.frustumCulled&&!g.intersectsObject(t)||(t._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,t.matrixWorld),s.render=!0);var v;n=0;for(q=p.length;n<q;n++)s=p[n],s.render&&(t=s.object,s=s.buffer,t instanceof THREE.ParticleSystem&&!t.customDepthMaterial||((v=
|
|
|
-t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),u=0<t.geometry.morphTargets.length&&v.morphTargets,v=t instanceof THREE.SkinnedMesh&&v.skinning,u=t.customDepthMaterial?t.customDepthMaterial:v?u?f:e:u?d:c,s instanceof THREE.BufferGeometry?b.renderBufferDirect(l,k.__lights,null,u,s,t):b.renderBuffer(l,k.__lights,null,u,s,t)));p=k.__webglObjectsImmediate;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,
|
|
|
+t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),r=0<t.geometry.morphTargets.length&&v.morphTargets,v=t instanceof THREE.SkinnedMesh&&v.skinning,r=t.customDepthMaterial?t.customDepthMaterial:v?r?f:e:r?d:c,s instanceof THREE.BufferGeometry?b.renderBufferDirect(l,k.__lights,null,r,s,t):b.renderBuffer(l,k.__lights,null,r,s,t)));p=k.__webglObjectsImmediate;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,
|
|
|
t.matrixWorld),b.renderImmediateObject(l,k.__lights,null,c,t));n=b.getClearColor();q=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,q);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}"}};
|