|
@@ -82,22 +82,22 @@ this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a
|
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,h,g,i){var k=this.elements;k[0]=a;k[3]=b;k[6]=c;k[1]=d;k[4]=e;k[7]=f;k[2]=h;k[5]=g;k[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
|
|
|
multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],h=a[5],g=a[6],i=a[7],a=a[8];return b*f*a-b*h*i-c*e*a+c*h*g+d*e*i-d*f*g},getInverse:function(a,
|
|
|
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
|
|
|
-c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,l,m,n,q,t,p){var s=this.elements=new Float32Array(16);s[0]=void 0!==a?a:1;s[4]=b||0;s[8]=c||0;s[12]=d||0;s[1]=e||0;s[5]=void 0!==f?f:1;s[9]=h||0;s[13]=g||0;s[2]=i||0;s[6]=k||0;s[10]=void 0!==l?l:1;s[14]=m||0;s[3]=n||0;s[7]=q||0;s[11]=t||0;s[15]=void 0!==p?p:1};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,l,m,n,q,t,p){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=e;s[5]=f;s[9]=h;s[13]=g;s[2]=i;s[6]=k;s[10]=l;s[14]=m;s[3]=n;s[7]=q;s[11]=t;s[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().");
|
|
|
+c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,l,m,n,t,s,p){var q=this.elements=new Float32Array(16);q[0]=void 0!==a?a:1;q[4]=b||0;q[8]=c||0;q[12]=d||0;q[1]=e||0;q[5]=void 0!==f?f:1;q[9]=h||0;q[13]=g||0;q[2]=i||0;q[6]=k||0;q[10]=void 0!==l?l:1;q[14]=m||0;q[3]=n||0;q[7]=t||0;q[11]=s||0;q[15]=void 0!==p?p:1};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,l,m,n,t,s,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=h;q[13]=g;q[2]=i;q[6]=k;q[10]=l;q[14]=m;q[3]=n;q[7]=t;q[11]=s;q[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,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){void 0===
|
|
|
typeof a.order&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e);if(void 0===a.order||"XYZ"===a.order){var a=f*g,i=f*e,k=c*g,l=c*e;b[0]=h*g;b[4]=-h*e;b[8]=d;b[1]=i+k*d;b[5]=a-l*d;b[9]=-c*h;b[2]=l-a*d;b[6]=k+i*d;b[10]=f*h}else"YXZ"===a.order?(a=h*g,i=h*e,k=d*g,l=d*e,b[0]=a+l*c,b[4]=
|
|
|
k*c-i,b[8]=f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=l+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,k=d*g,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=k+i*c,b[1]=i+k*c,b[5]=f*g,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*h):"ZYX"===a.order?(a=f*g,i=f*e,k=c*g,l=c*e,b[0]=h*g,b[4]=k*d-i,b[8]=a*d+l,b[1]=h*e,b[5]=l*d+a,b[9]=i*d-k,b[2]=-d,b[6]=c*h,b[10]=f*h):"YZX"===a.order?(a=f*h,i=f*d,k=c*h,l=c*d,b[0]=h*g,b[4]=l-a*e,b[8]=k*e+i,b[1]=e,b[5]=f*g,b[9]=-c*g,b[2]=-d*g,b[6]=i*e+k,b[10]=a-l*e):"XZY"===a.order&&(a=f*h,i=f*d,k=
|
|
|
c*h,l=c*d,b[0]=h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+l,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,
|
|
|
a=c*h,k=c*g,c=c*i,l=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(l+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,
|
|
|
-a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],l=c[5],m=c[9],n=c[13],q=c[2],t=c[6],p=c[10],s=c[14],r=c[3],v=c[7],
|
|
|
-y=c[11],c=c[15],J=d[0],B=d[4],H=d[8],I=d[12],C=d[1],z=d[5],M=d[9],E=d[13],F=d[2],S=d[6],x=d[10],D=d[14],A=d[3],T=d[7],K=d[11],d=d[15];e[0]=f*J+h*C+g*F+i*A;e[4]=f*B+h*z+g*S+i*T;e[8]=f*H+h*M+g*x+i*K;e[12]=f*I+h*E+g*D+i*d;e[1]=k*J+l*C+m*F+n*A;e[5]=k*B+l*z+m*S+n*T;e[9]=k*H+l*M+m*x+n*K;e[13]=k*I+l*E+m*D+n*d;e[2]=q*J+t*C+p*F+s*A;e[6]=q*B+t*z+p*S+s*T;e[10]=q*H+t*M+p*x+s*K;e[14]=q*I+t*E+p*D+s*d;e[3]=r*J+v*C+y*F+c*A;e[7]=r*B+v*z+y*S+c*T;e[11]=r*H+v*M+y*x+c*K;e[15]=r*I+v*E+y*D+c*d;return this},multiplyToArray:function(a,
|
|
|
+a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],l=c[5],m=c[9],n=c[13],t=c[2],s=c[6],p=c[10],q=c[14],r=c[3],u=c[7],
|
|
|
+w=c[11],c=c[15],E=d[0],C=d[4],F=d[8],z=d[12],D=d[1],y=d[5],O=d[9],x=d[13],B=d[2],I=d[6],v=d[10],A=d[14],G=d[3],R=d[7],J=d[11],d=d[15];e[0]=f*E+h*D+g*B+i*G;e[4]=f*C+h*y+g*I+i*R;e[8]=f*F+h*O+g*v+i*J;e[12]=f*z+h*x+g*A+i*d;e[1]=k*E+l*D+m*B+n*G;e[5]=k*C+l*y+m*I+n*R;e[9]=k*F+l*O+m*v+n*J;e[13]=k*z+l*x+m*A+n*d;e[2]=t*E+s*D+p*B+q*G;e[6]=t*C+s*y+p*I+q*R;e[10]=t*F+s*O+p*v+q*J;e[14]=t*z+s*x+p*A+q*d;e[3]=r*E+u*D+w*B+c*G;e[7]=r*C+u*y+w*I+c*R;e[11]=r*F+u*O+w*v+c*J;e[15]=r*z+u*x+w*A+c*d;return this},multiplyToArray:function(a,
|
|
|
b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],l=a[6],m=a[10],n=a[14];return a[3]*(+e*g*l-d*i*l-e*h*m+c*i*m+d*h*n-c*g*n)+a[7]*(+b*g*n-b*i*m+e*f*m-d*f*n+d*i*k-e*g*k)+a[11]*(+b*i*l-b*h*n-e*f*l+c*f*n+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*l+b*h*m+d*f*l-c*f*
|
|
|
m+c*g*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
|
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
|
|
|
-b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],l=d[9],m=d[13],n=d[2],q=d[6],t=d[10],p=d[14],s=d[3],r=d[7],v=d[11],d=d[15];c[0]=l*p*r-m*t*r+m*q*v-k*p*v-l*q*d+k*t*d;c[4]=g*t*r-h*p*r-g*q*v+f*p*v+h*q*d-f*t*d;c[8]=h*m*r-g*l*r+g*k*v-f*m*v-h*k*d+f*l*d;c[12]=g*l*q-h*m*q-g*k*t+f*m*t+h*k*p-f*l*p;c[1]=m*t*s-l*p*s-m*n*v+i*p*v+l*n*d-i*t*d;c[5]=h*p*s-g*t*s+g*n*v-e*p*v-h*n*d+e*t*d;c[9]=g*l*s-h*m*s-g*i*v+e*m*v+h*i*d-
|
|
|
-e*l*d;c[13]=h*m*n-g*l*n+g*i*t-e*m*t-h*i*p+e*l*p;c[2]=k*p*s-m*q*s+m*n*r-i*p*r-k*n*d+i*q*d;c[6]=g*q*s-f*p*s-g*n*r+e*p*r+f*n*d-e*q*d;c[10]=f*m*s-g*k*s+g*i*r-e*m*r-f*i*d+e*k*d;c[14]=g*k*n-f*m*n-g*i*q+e*m*q+f*i*p-e*k*p;c[3]=l*q*s-k*t*s-l*n*r+i*t*r+k*n*v-i*q*v;c[7]=f*t*s-h*q*s+h*n*r-e*t*r-f*n*v+e*q*v;c[11]=h*k*s-f*l*s-h*i*r+e*l*r+f*i*v-e*k*v;c[15]=f*l*n-h*k*n+h*i*q-e*l*q-f*i*t+e*k*t;c=e*c[0]+i*c[4]+n*c[8]+s*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
+b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],l=d[9],m=d[13],n=d[2],t=d[6],s=d[10],p=d[14],q=d[3],r=d[7],u=d[11],d=d[15];c[0]=l*p*r-m*s*r+m*t*u-k*p*u-l*t*d+k*s*d;c[4]=g*s*r-h*p*r-g*t*u+f*p*u+h*t*d-f*s*d;c[8]=h*m*r-g*l*r+g*k*u-f*m*u-h*k*d+f*l*d;c[12]=g*l*t-h*m*t-g*k*s+f*m*s+h*k*p-f*l*p;c[1]=m*s*q-l*p*q-m*n*u+i*p*u+l*n*d-i*s*d;c[5]=h*p*q-g*s*q+g*n*u-e*p*u-h*n*d+e*s*d;c[9]=g*l*q-h*m*q-g*i*u+e*m*u+h*i*d-
|
|
|
+e*l*d;c[13]=h*m*n-g*l*n+g*i*s-e*m*s-h*i*p+e*l*p;c[2]=k*p*q-m*t*q+m*n*r-i*p*r-k*n*d+i*t*d;c[6]=g*t*q-f*p*q-g*n*r+e*p*r+f*n*d-e*t*d;c[10]=f*m*q-g*k*q+g*i*r-e*m*r-f*i*d+e*k*d;c[14]=g*k*n-f*m*n-g*i*t+e*m*t+f*i*p-e*k*p;c[3]=l*t*q-k*s*q-l*n*r+i*s*r+k*n*u-i*t*u;c[7]=f*s*q-h*t*q+h*n*r-e*s*r-f*n*u+e*t*u;c[11]=h*k*q-f*l*q-h*i*r+e*l*r+f*i*u-e*k*u;c[15]=f*l*n-h*k*n+h*i*t-e*l*t-f*i*s+e*k*s;c=e*c[0]+i*c[4]+n*c[8]+q*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
|
|
|
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
|
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,g=a.z,i=e*f,k=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,k*h+c,k*g-d*f,0,i*g-d*h,k*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
@@ -113,8 +113,8 @@ g=this.origin.clone().sub(e),a=-this.direction.dot(f),b=g.dot(this.direction),i=
|
|
|
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a){for(var b,c=0,d=0,e=a.length;d<e;d++)b=a[d].lengthSq(),c=Math.max(c,b);this.center.set(0,0,0);this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
|
|
|
this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);
|
|
|
this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
|
|
|
-THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],l=c[8],m=c[9],n=c[10],q=c[11],t=c[12],p=c[13],s=c[14],c=c[15];b[0].setComponents(f-a,k-h,q-l,c-t).normalize();b[1].setComponents(f+
|
|
|
-a,k+h,q+l,c+t).normalize();b[2].setComponents(f+d,k+g,q+m,c+p).normalize();b[3].setComponents(f-d,k-g,q-m,c-p).normalize();b[4].setComponents(f-e,k-i,q-n,c-s).normalize();b[5].setComponents(f+e,k+i,q+n,c+s).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.geometry,b=b.matrixWorld;null===c.boundingSphere&&c.computeBoundingSphere();c=-c.boundingSphere.radius*b.getMaxScaleOnAxis();a.getPositionFromMatrix(b);for(var b=this.planes,d=0;6>d;d++)if(b[d].distanceToPoint(a)<
|
|
|
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],l=c[8],m=c[9],n=c[10],t=c[11],s=c[12],p=c[13],q=c[14],c=c[15];b[0].setComponents(f-a,k-h,t-l,c-s).normalize();b[1].setComponents(f+
|
|
|
+a,k+h,t+l,c+s).normalize();b[2].setComponents(f+d,k+g,t+m,c+p).normalize();b[3].setComponents(f-d,k-g,t-m,c-p).normalize();b[4].setComponents(f-e,k-i,t-n,c-q).normalize();b[5].setComponents(f+e,k+i,t+n,c+q).normalize();return this},intersectsObject:function(){var a=new THREE.Vector3;return function(b){var c=b.geometry,b=b.matrixWorld;null===c.boundingSphere&&c.computeBoundingSphere();c=-c.boundingSphere.radius*b.getMaxScaleOnAxis();a.getPositionFromMatrix(b);for(var b=this.planes,d=0;6>d;d++)if(b[d].distanceToPoint(a)<
|
|
|
c)return!1;return!0}}(),intersectsSphere:function(a){for(var b=this.planes,c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var h=f.distanceToPoint(a),
|
|
|
f=f.distanceToPoint(b);if(0>h&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
|
|
|
THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
|
|
@@ -137,11 +137,11 @@ 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,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=function(f,g,l){if(f instanceof a.Particle){d.getPositionFromMatrix(f.matrixWorld);var m=g.ray.distanceToPoint(d);if(m>f.scale.x)return l;l.push({distance:m,point:f.position,face:null,object:f})}else if(f instanceof a.LOD)d.getPositionFromMatrix(f.matrixWorld),
|
|
|
-m=g.ray.origin.distanceTo(d),h(f.getObjectForDistance(m),g,l);else if(f instanceof a.Mesh){var n=f.geometry;d.getPositionFromMatrix(f.matrixWorld);null===n.boundingSphere&&n.computeBoundingSphere();b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;var q=n.vertices;if(n instanceof a.BufferGeometry){var t=f.material;if(void 0===t||!1===n.dynamic)return l;var p,s,r=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);var v,
|
|
|
-q=!1;n.attributes.index&&(q=!0);v=new a.Vector3;for(var y=new a.Vector3,J=new a.Vector3,B=n.offsets,H=n.attributes.index.array,I=n.attributes.position.array,C=n.offsets.length,z=0;z<C;++z)for(var m=B[z].start,M=B[z].index,n=m,E=m+B[z].count;n<E;n+=3)if(q?(m=M+H[n],p=M+H[n+1],s=M+H[n+2]):(m=M,p=M+1,s=M+2),v.set(I[3*m],I[3*m+1],I[3*m+2]),y.set(I[3*p],I[3*p+1],I[3*p+2]),J.set(I[3*s],I[3*s+1],I[3*s+2]),p=a.Triangle.intersectionRay(c,v,y,J,t.side!==a.DoubleSide))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
|
|
|
-m<r||m<g.near||m>g.far||l.push({distance:m,point:p,face:null,faceIndex:null,object:f})}else if(n instanceof a.Geometry){y=f.material instanceof a.MeshFaceMaterial;J=!0===y?f.material.materials:null;r=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);B=0;for(v=n.faces.length;B<v;B++)if(H=n.faces[B],t=!0===y?J[H.materialIndex]:f.material,void 0!==t&&(m=q[H.a],p=q[H.b],s=q[H.c],p=a.Triangle.intersectionRay(c,m,p,s,t.side!==a.DoubleSide)))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
|
|
|
-m<r||m<g.near||m>g.far||l.push({distance:m,point:p,face:H,faceIndex:B,object:f})}}else if(f instanceof a.Line){r=g.linePrecision;t=r*r;n=f.geometry;null===n.boundingSphere&&n.computeBoundingSphere();d.getPositionFromMatrix(f.matrixWorld);b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);q=n.vertices;r=q.length;p=new a.Vector3;s=new a.Vector3;v=f.type===a.LineStrip?1:2;for(n=0;n<
|
|
|
-r-1;n+=v)c.distanceSqToSegment(q[n],q[n+1],s,p)<=t&&(m=c.origin.distanceTo(s),g.near<=m&&m<=g.far&&l.push({distance:m,point:p.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},g=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(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&&g(a,this,c);h(a,
|
|
|
+m=g.ray.origin.distanceTo(d),h(f.getObjectForDistance(m),g,l);else if(f instanceof a.Mesh){var n=f.geometry;d.getPositionFromMatrix(f.matrixWorld);null===n.boundingSphere&&n.computeBoundingSphere();b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;var t=n.vertices;if(n instanceof a.BufferGeometry){var s=f.material;if(void 0===s||!1===n.dynamic)return l;var p,q,r=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);var u,
|
|
|
+t=!1;n.attributes.index&&(t=!0);u=new a.Vector3;for(var w=new a.Vector3,E=new a.Vector3,C=n.offsets,F=n.attributes.index.array,z=n.attributes.position.array,D=n.offsets.length,y=0;y<D;++y)for(var m=C[y].start,O=C[y].index,n=m,x=m+C[y].count;n<x;n+=3)if(t?(m=O+F[n],p=O+F[n+1],q=O+F[n+2]):(m=O,p=O+1,q=O+2),u.set(z[3*m],z[3*m+1],z[3*m+2]),w.set(z[3*p],z[3*p+1],z[3*p+2]),E.set(z[3*q],z[3*q+1],z[3*q+2]),p=a.Triangle.intersectionRay(c,u,w,E,s.side!==a.DoubleSide))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
|
|
|
+m<r||m<g.near||m>g.far||l.push({distance:m,point:p,face:null,faceIndex:null,object:f})}else if(n instanceof a.Geometry){w=f.material instanceof a.MeshFaceMaterial;E=!0===w?f.material.materials:null;r=g.precision;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);C=0;for(u=n.faces.length;C<u;C++)if(F=n.faces[C],s=!0===w?E[F.materialIndex]:f.material,void 0!==s&&(m=t[F.a],p=t[F.b],q=t[F.c],p=a.Triangle.intersectionRay(c,m,p,q,s.side!==a.DoubleSide)))p.applyMatrix4(f.matrixWorld),m=g.ray.origin.distanceTo(p),
|
|
|
+m<r||m<g.near||m>g.far||l.push({distance:m,point:p,face:F,faceIndex:C,object:f})}}else if(f instanceof a.Line){r=g.linePrecision;s=r*r;n=f.geometry;null===n.boundingSphere&&n.computeBoundingSphere();d.getPositionFromMatrix(f.matrixWorld);b.set(d,n.boundingSphere.radius*f.matrixWorld.getMaxScaleOnAxis());if(!1===g.ray.isIntersectionSphere(b))return l;e.getInverse(f.matrixWorld);c.copy(g.ray).applyMatrix4(e);t=n.vertices;r=t.length;p=new a.Vector3;q=new a.Vector3;u=f.type===a.LineStrip?1:2;for(n=0;n<
|
|
|
+r-1;n+=u)c.distanceSqToSegment(t[n],t[n+1],q,p)<=s&&(m=c.origin.distanceTo(q),g.near<=m&&m<=g.far&&l.push({distance:m,point:p.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},g=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(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&&g(a,this,c);h(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++)h(a[d],this,c),!0===b&&g(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 eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},
|
|
@@ -155,17 +155,17 @@ e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's
|
|
|
this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);
|
|
|
a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());
|
|
|
return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===l){var a=new THREE.RenderableVertex;k.push(a);l++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
|
|
|
-0,g,i,k=[],l=0,m,n,q=[],t=0,p,s,r=[],v=0,y,J,B=[],H=0,I={objects:[],sprites:[],lights:[],elements:[]},C=new THREE.Vector3,z=new THREE.Vector4,M=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),E=new THREE.Box3,F=Array(3),S=new THREE.Matrix4,x=new THREE.Matrix4,D,A=new THREE.Matrix4,T=new THREE.Matrix3,K=new THREE.Matrix3,ia=new THREE.Vector3,ra=new THREE.Frustum,sa=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
-x.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(x)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);x.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(x)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var U=function(a){if(e===h){var b=new THREE.RenderableObject;
|
|
|
-f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(C.getPositionFromMatrix(a.matrixWorld),C.applyProjection(x),d.z=C.z);return d},ba=function(a){if(!1!==a.visible){a instanceof THREE.Light?I.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===ra.intersectsObject(a))&&I.objects.push(U(a)):(a instanceof THREE.Sprite||a instanceof THREE.Particle)&&I.sprites.push(U(a));for(var b=0,c=a.children.length;b<c;b++)ba(a.children[b])}};
|
|
|
-this.projectScene=function(d,f,h,l){var za=!1,C,U,ha,aa,ma,W,fa,ca,Ga,Ja,ta,ab,bb;J=s=n=0;I.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();S.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));x.multiplyMatrices(f.projectionMatrix,S);K.getNormalMatrix(S);ra.setFromMatrix(x);e=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;ba(d);!0===h&&I.objects.sort(b);d=0;for(h=I.objects.length;d<h;d++)if(ca=I.objects[d].object,D=ca.matrixWorld,i=
|
|
|
-0,ca instanceof THREE.Mesh){Ga=ca.geometry;ha=Ga.vertices;Ja=Ga.faces;Ga=Ga.faceVertexUvs;T.getNormalMatrix(D);ab=ca.material instanceof THREE.MeshFaceMaterial;bb=!0===ab?ca.material:null;C=0;for(U=ha.length;C<U;C++){g=a();g.positionWorld.copy(ha[C]).applyMatrix4(D);g.positionScreen.copy(g.positionWorld).applyMatrix4(x);var Oa=1/g.positionScreen.w;g.positionScreen.x*=Oa;g.positionScreen.y*=Oa;g.positionScreen.z*=Oa;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<
|
|
|
-g.positionScreen.y||-1>g.positionScreen.z||1<g.positionScreen.z)}ha=0;for(C=Ja.length;ha<C;ha++)if(U=Ja[ha],Oa=!0===ab?bb.materials[U.materialIndex]:ca.material,void 0!==Oa){W=Oa.side;if(U instanceof THREE.Face3)if(aa=k[U.a],ma=k[U.b],fa=k[U.c],F[0]=aa.positionScreen,F[1]=ma.positionScreen,F[2]=fa.positionScreen,!0===aa.visible||!0===ma.visible||!0===fa.visible||M.isIntersectionBox(E.setFromPoints(F)))if(za=0>(fa.positionScreen.x-aa.positionScreen.x)*(ma.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-
|
|
|
-aa.positionScreen.y)*(ma.positionScreen.x-aa.positionScreen.x),W===THREE.DoubleSide||za===(W===THREE.FrontSide))n===t?(ta=new THREE.RenderableFace3,q.push(ta),t++,n++,m=ta):m=q[n++],m.id=ca.id,m.v1.copy(aa),m.v2.copy(ma),m.v3.copy(fa);else continue;else continue;m.normalModel.copy(U.normal);!1===za&&(W===THREE.BackSide||W===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(T).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(K);m.centroidModel.copy(U.centroid).applyMatrix4(D);
|
|
|
-fa=U.vertexNormals;aa=0;for(ma=Math.min(fa.length,3);aa<ma;aa++)ta=m.vertexNormalsModel[aa],ta.copy(fa[aa]),!1===za&&(W===THREE.BackSide||W===THREE.DoubleSide)&&ta.negate(),ta.applyMatrix3(T).normalize(),m.vertexNormalsModelView[aa].copy(ta).applyMatrix3(K);m.vertexNormalsLength=fa.length;aa=0;for(ma=Math.min(Ga.length,3);aa<ma;aa++)if(ta=Ga[aa][ha],void 0!==ta){W=0;for(fa=ta.length;W<fa;W++)m.uvs[aa][W]=ta[W]}m.color=U.color;m.material=Oa;ia.copy(m.centroidModel).applyProjection(x);m.z=ia.z;I.elements.push(m)}}else if(ca instanceof
|
|
|
-THREE.Line){A.multiplyMatrices(x,D);ha=ca.geometry.vertices;aa=a();aa.positionScreen.copy(ha[0]).applyMatrix4(A);Ja=ca.type===THREE.LinePieces?2:1;C=1;for(U=ha.length;C<U;C++)aa=a(),aa.positionScreen.copy(ha[C]).applyMatrix4(A),0<(C+1)%Ja||(ma=k[i-2],sa.copy(aa.positionScreen),N.copy(ma.positionScreen),!0===c(sa,N)&&(sa.multiplyScalar(1/sa.w),N.multiplyScalar(1/N.w),s===v?(Ga=new THREE.RenderableLine,r.push(Ga),v++,s++,p=Ga):p=r[s++],p.id=ca.id,p.v1.positionScreen.copy(sa),p.v2.positionScreen.copy(N),
|
|
|
-p.z=Math.max(sa.z,N.z),p.material=ca.material,ca.material.vertexColors===THREE.VertexColors&&(p.vertexColors[0].copy(ca.geometry.colors[C]),p.vertexColors[1].copy(ca.geometry.colors[C-1])),I.elements.push(p)))}d=0;for(h=I.sprites.length;d<h;d++)ca=I.sprites[d].object,D=ca.matrixWorld,ca instanceof THREE.Particle&&(z.set(D.elements[12],D.elements[13],D.elements[14],1),z.applyMatrix4(x),Oa=1/z.w,z.z*=Oa,0<z.z&&1>z.z&&(J===H?(za=new THREE.RenderableParticle,B.push(za),H++,J++,y=za):y=B[J++],y.id=ca.id,
|
|
|
-y.x=z.x*Oa,y.y=z.y*Oa,y.z=z.z,y.object=ca,y.rotation=ca.rotation.z,y.scale.x=ca.scale.x*Math.abs(y.x-(z.x+f.projectionMatrix.elements[0])/(z.w+f.projectionMatrix.elements[12])),y.scale.y=ca.scale.y*Math.abs(y.y-(z.y+f.projectionMatrix.elements[5])/(z.w+f.projectionMatrix.elements[13])),y.material=ca.material,I.elements.push(y)));!0===l&&I.elements.sort(b);return I}};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};
|
|
|
+0,g,i,k=[],l=0,m,n,t=[],s=0,p,q,r=[],u=0,w,E,C=[],F=0,z={objects:[],sprites:[],lights:[],elements:[]},D=new THREE.Vector3,y=new THREE.Vector4,O=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),x=new THREE.Box3,B=Array(3),I=new THREE.Matrix4,v=new THREE.Matrix4,A,G=new THREE.Matrix4,R=new THREE.Matrix3,J=new THREE.Matrix3,ba=new THREE.Vector3,qa=new THREE.Frustum,ra=new THREE.Vector4,N=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+v.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(v)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);v.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(v)};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 M=function(a){if(e===h){var b=new THREE.RenderableObject;
|
|
|
+f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(D.getPositionFromMatrix(a.matrixWorld),D.applyProjection(v),d.z=D.z);return d},Q=function(a){if(!1!==a.visible){a instanceof THREE.Light?z.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===qa.intersectsObject(a))&&z.objects.push(M(a)):(a instanceof THREE.Sprite||a instanceof THREE.Particle)&&z.sprites.push(M(a));for(var b=0,c=a.children.length;b<c;b++)Q(a.children[b])}};
|
|
|
+this.projectScene=function(d,f,h,l){var ea=!1,D,M,fa,V,aa,P,T,ma,va,ja,Pa,Ja;E=q=n=0;z.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();I.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));v.multiplyMatrices(f.projectionMatrix,I);J.getNormalMatrix(I);qa.setFromMatrix(v);e=0;z.objects.length=0;z.sprites.length=0;z.lights.length=0;Q(d);!0===h&&z.objects.sort(b);d=0;for(h=z.objects.length;d<h;d++)if(T=z.objects[d].object,A=T.matrixWorld,i=0,T instanceof
|
|
|
+THREE.Mesh){ma=T.geometry;fa=ma.vertices;va=ma.faces;ma=ma.faceVertexUvs;R.getNormalMatrix(A);Pa=T.material instanceof THREE.MeshFaceMaterial;Ja=!0===Pa?T.material:null;D=0;for(M=fa.length;D<M;D++){g=a();g.positionWorld.copy(fa[D]).applyMatrix4(A);g.positionScreen.copy(g.positionWorld).applyMatrix4(v);var ga=1/g.positionScreen.w;g.positionScreen.x*=ga;g.positionScreen.y*=ga;g.positionScreen.z*=ga;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||
|
|
|
+-1>g.positionScreen.z||1<g.positionScreen.z)}fa=0;for(D=va.length;fa<D;fa++)if(M=va[fa],ga=!0===Pa?Ja.materials[M.materialIndex]:T.material,void 0!==ga&&(P=ga.side,V=k[M.a],aa=k[M.b],ja=k[M.c],B[0]=V.positionScreen,B[1]=aa.positionScreen,B[2]=ja.positionScreen,!0===V.visible||!0===aa.visible||!0===ja.visible||O.isIntersectionBox(x.setFromPoints(B))))if(ea=0>(ja.positionScreen.x-V.positionScreen.x)*(aa.positionScreen.y-V.positionScreen.y)-(ja.positionScreen.y-V.positionScreen.y)*(aa.positionScreen.x-
|
|
|
+V.positionScreen.x),P===THREE.DoubleSide||ea===(P===THREE.FrontSide)){if(n===s){var Ha=new THREE.RenderableFace3;t.push(Ha);s++;n++;m=Ha}else m=t[n++];m.id=T.id;m.v1.copy(V);m.v2.copy(aa);m.v3.copy(ja);m.normalModel.copy(M.normal);!1===ea&&(P===THREE.BackSide||P===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(R).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(J);m.centroidModel.copy(M.centroid).applyMatrix4(A);ja=M.vertexNormals;V=0;for(aa=Math.min(ja.length,
|
|
|
+3);V<aa;V++)Ha=m.vertexNormalsModel[V],Ha.copy(ja[V]),!1===ea&&(P===THREE.BackSide||P===THREE.DoubleSide)&&Ha.negate(),Ha.applyMatrix3(R).normalize(),m.vertexNormalsModelView[V].copy(Ha).applyMatrix3(J);m.vertexNormalsLength=ja.length;ea=0;for(V=Math.min(ma.length,3);ea<V;ea++)if(ja=ma[ea][fa],void 0!==ja){aa=0;for(P=ja.length;aa<P;aa++)m.uvs[ea][aa]=ja[aa]}m.color=M.color;m.material=ga;ba.copy(m.centroidModel).applyProjection(v);m.z=ba.z;z.elements.push(m)}}else if(T instanceof THREE.Line){G.multiplyMatrices(v,
|
|
|
+A);fa=T.geometry.vertices;V=a();V.positionScreen.copy(fa[0]).applyMatrix4(G);va=T.type===THREE.LinePieces?2:1;D=1;for(M=fa.length;D<M;D++)V=a(),V.positionScreen.copy(fa[D]).applyMatrix4(G),0<(D+1)%va||(aa=k[i-2],ra.copy(V.positionScreen),N.copy(aa.positionScreen),!0===c(ra,N)&&(ra.multiplyScalar(1/ra.w),N.multiplyScalar(1/N.w),q===u?(ma=new THREE.RenderableLine,r.push(ma),u++,q++,p=ma):p=r[q++],p.id=T.id,p.v1.positionScreen.copy(ra),p.v2.positionScreen.copy(N),p.z=Math.max(ra.z,N.z),p.material=T.material,
|
|
|
+T.material.vertexColors===THREE.VertexColors&&(p.vertexColors[0].copy(T.geometry.colors[D]),p.vertexColors[1].copy(T.geometry.colors[D-1])),z.elements.push(p)))}d=0;for(h=z.sprites.length;d<h;d++)T=z.sprites[d].object,A=T.matrixWorld,T instanceof THREE.Particle&&(y.set(A.elements[12],A.elements[13],A.elements[14],1),y.applyMatrix4(v),ga=1/y.w,y.z*=ga,0<y.z&&1>y.z&&(E===F?(va=new THREE.RenderableParticle,C.push(va),F++,E++,w=va):w=C[E++],w.id=T.id,w.x=y.x*ga,w.y=y.y*ga,w.z=y.z,w.object=T,w.rotation=
|
|
|
+T.rotation.z,w.scale.x=T.scale.x*Math.abs(w.x-(y.x+f.projectionMatrix.elements[0])/(y.w+f.projectionMatrix.elements[12])),w.scale.y=T.scale.y*Math.abs(w.y-(y.y+f.projectionMatrix.elements[5])/(y.w+f.projectionMatrix.elements[13])),w.material=T.material,z.elements.push(w)));!0===l&&z.elements.sort(b);return z}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,h){return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.normals=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=
|
|
|
this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
@@ -174,23 +174,22 @@ THREE.Sphere&&this.computeBoundingSphere()},computeCentroids:function(){var a,b,
|
|
|
h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,h,g=new THREE.Vector3,i=new THREE.Vector3;new THREE.Vector3;
|
|
|
new THREE.Vector3;new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g.subVectors(h,f),i.subVectors(a,f),g.cross(i),e[d.a].add(g),e[d.b].add(g),e[d.c].add(g)}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
|
|
|
d.vertexNormals[2].copy(e[d.c])},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=
|
|
|
-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=[];var h=this.morphNormals[a].faceNormals,g=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},
|
|
|
-h.push(i),g.push(k)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=h.faceNormals[c],k=h.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<
|
|
|
-d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,l,m,n,q,t,p,s,r=[],v=[];c=new THREE.Vector3;var y=new THREE.Vector3,J=new THREE.Vector3,B=new THREE.Vector3,H=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)r[a]=new THREE.Vector3,v[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,s=e.b,e=e.c,h=this.vertices[d],g=this.vertices[s],i=this.vertices[e],
|
|
|
-k=f[0],l=f[1],m=f[2],f=g.x-h.x,n=i.x-h.x,q=g.y-h.y,t=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,p=m.x-k.x,l=l.y-k.y,k=m.y-k.y,m=1/(i*k-p*l),c.set((k*f-l*n)*m,(k*q-l*t)*m,(k*g-l*h)*m),y.set((i*n-p*f)*m,(i*t-p*q)*m,(i*h-p*g)*m),r[d].add(c),r[s].add(c),r[e].add(c),v[d].add(y),v[s].add(y),v[e].add(y);y=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)H.copy(e.vertexNormals[c]),d=e[y[c]],s=r[d],J.copy(s),J.sub(H.multiplyScalar(H.dot(s))).normalize(),
|
|
|
-B.crossVectors(e.vertexNormals[c],s),d=B.dot(v[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(J.x,J.y,J.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
-this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=
|
|
|
-a.length-1;0<=f;f--){this.faces.splice(f,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(f,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},
|
|
|
-dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
|
+this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();
|
|
|
+c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,l,m,n,t,s,p,q,r=[],u=[];c=new THREE.Vector3;var w=new THREE.Vector3,E=new THREE.Vector3,C=new THREE.Vector3,F=new THREE.Vector3;
|
|
|
+a=0;for(b=this.vertices.length;a<b;a++)r[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,q=e.b,e=e.c,h=this.vertices[d],g=this.vertices[q],i=this.vertices[e],k=f[0],l=f[1],m=f[2],f=g.x-h.x,n=i.x-h.x,t=g.y-h.y,s=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=l.x-k.x,p=m.x-k.x,l=l.y-k.y,k=m.y-k.y,m=1/(i*k-p*l),c.set((k*f-l*n)*m,(k*t-l*s)*m,(k*g-l*h)*m),w.set((i*n-p*f)*m,(i*s-p*t)*m,(i*h-p*g)*m),r[d].add(c),r[q].add(c),r[e].add(c),u[d].add(w),
|
|
|
+u[q].add(w),u[e].add(w);w=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)F.copy(e.vertexNormals[c]),d=e[w[c]],q=r[d],E.copy(q),E.sub(F.multiplyScalar(F.dot(q))).normalize(),C.crossVectors(e.vertexNormals[c],q),d=C.dot(u[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(E.x,E.y,E.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=
|
|
|
+a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*
|
|
|
+e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){this.faces.splice(f,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(f,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<
|
|
|
+d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=
|
|
|
this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
|
|
|
new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;f<h;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=
|
|
|
-this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,l,m,n=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,p=new THREE.Vector3,s=new THREE.Vector3;if(this.attributes.index){var r=this.attributes.index.array,v=this.offsets;c=0;for(d=v.length;c<d;++c){b=v[c].start;h=v[c].count;var y=v[c].index;a=b;for(b+=h;a<b;a+=3)h=y+r[a],g=y+r[a+1],i=y+r[a+2],k=e[3*h],l=e[3*h+1],m=e[3*h+2],n.set(k,l,m),k=e[3*g],l=e[3*g+1],m=e[3*g+2],q.set(k,l,m),k=e[3*i],l=e[3*i+1],m=e[3*i+2],t.set(k,l,
|
|
|
-m),p.subVectors(t,q),s.subVectors(n,q),p.cross(s),f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],m=e[a+2],n.set(k,l,m),k=e[a+3],l=e[a+4],m=e[a+5],q.set(k,l,m),k=e[a+6],l=e[a+7],m=e[a+8],t.set(k,l,m),p.subVectors(t,q),s.subVectors(n,q),p.cross(s),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){ra.x=d[3*a];ra.y=d[3*a+1];ra.z=d[3*a+2];sa.copy(ra);U=g[a];K.copy(U);K.sub(ra.multiplyScalar(ra.dot(U))).normalize();ia.crossVectors(sa,U);ba=ia.dot(i[a]);N=0>ba?-1:1;h[4*a]=K.x;h[4*a+1]=K.y;h[4*a+2]=K.z;h[4*a+3]=N}if(void 0===this.attributes.index||void 0===this.attributes.position||
|
|
|
+this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,l,m,n=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3;if(this.attributes.index){var r=this.attributes.index.array,u=this.offsets;c=0;for(d=u.length;c<d;++c){b=u[c].start;h=u[c].count;var w=u[c].index;a=b;for(b+=h;a<b;a+=3)h=w+r[a],g=w+r[a+1],i=w+r[a+2],k=e[3*h],l=e[3*h+1],m=e[3*h+2],n.set(k,l,m),k=e[3*g],l=e[3*g+1],m=e[3*g+2],t.set(k,l,m),k=e[3*i],l=e[3*i+1],m=e[3*i+2],s.set(k,l,
|
|
|
+m),p.subVectors(s,t),q.subVectors(n,t),p.cross(q),f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],l=e[a+1],m=e[a+2],n.set(k,l,m),k=e[a+3],l=e[a+4],m=e[a+5],t.set(k,l,m),k=e[a+6],l=e[a+7],m=e[a+8],s.set(k,l,m),p.subVectors(s,t),q.subVectors(n,t),p.cross(q),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){qa.x=d[3*a];qa.y=d[3*a+1];qa.z=d[3*a+2];ra.copy(qa);M=g[a];J.copy(M);J.sub(qa.multiplyScalar(qa.dot(M))).normalize();ba.crossVectors(ra,M);Q=ba.dot(i[a]);N=0>Q?-1:1;h[4*a]=J.x;h[4*a+1]=J.y;h[4*a+2]=J.z;h[4*a+3]=N}if(void 0===this.attributes.index||void 0===this.attributes.position||
|
|
|
void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,
|
|
|
-i[k]=new THREE.Vector3;var l,m,n,q,t,p,s,r,v,y,J,B,H,I,C,f=new THREE.Vector3,k=new THREE.Vector3,z,M,E,F,S,x,D,A=this.offsets;E=0;for(F=A.length;E<F;++E){M=A[E].start;S=A[E].count;var T=A[E].index;z=M;for(M+=S;z<M;z+=3)S=T+b[z],x=T+b[z+1],D=T+b[z+2],l=c[3*S],m=c[3*S+1],n=c[3*S+2],q=c[3*x],t=c[3*x+1],p=c[3*x+2],s=c[3*D],r=c[3*D+1],v=c[3*D+2],y=e[2*S],J=e[2*S+1],B=e[2*x],H=e[2*x+1],I=e[2*D],C=e[2*D+1],q-=l,l=s-l,t-=m,m=r-m,p-=n,n=v-n,B-=y,y=I-y,H-=J,J=C-J,C=1/(B*J-y*H),f.set((J*q-H*l)*C,(J*t-H*m)*C,
|
|
|
-(J*p-H*n)*C),k.set((B*l-y*q)*C,(B*m-y*t)*C,(B*n-y*p)*C),g[S].add(f),g[x].add(f),g[D].add(f),i[S].add(k),i[x].add(k),i[D].add(k)}var K=new THREE.Vector3,ia=new THREE.Vector3,ra=new THREE.Vector3,sa=new THREE.Vector3,N,U,ba;E=0;for(F=A.length;E<F;++E){M=A[E].start;S=A[E].count;T=A[E].index;z=M;for(M+=S;z<M;z+=3)S=T+b[z],x=T+b[z+1],D=T+b[z+2],a(S),a(x),a(D)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
+i[k]=new THREE.Vector3;var l,m,n,t,s,p,q,r,u,w,E,C,F,z,D,f=new THREE.Vector3,k=new THREE.Vector3,y,O,x,B,I,v,A,G=this.offsets;x=0;for(B=G.length;x<B;++x){O=G[x].start;I=G[x].count;var R=G[x].index;y=O;for(O+=I;y<O;y+=3)I=R+b[y],v=R+b[y+1],A=R+b[y+2],l=c[3*I],m=c[3*I+1],n=c[3*I+2],t=c[3*v],s=c[3*v+1],p=c[3*v+2],q=c[3*A],r=c[3*A+1],u=c[3*A+2],w=e[2*I],E=e[2*I+1],C=e[2*v],F=e[2*v+1],z=e[2*A],D=e[2*A+1],t-=l,l=q-l,s-=m,m=r-m,p-=n,n=u-n,C-=w,w=z-w,F-=E,E=D-E,D=1/(C*E-w*F),f.set((E*t-F*l)*D,(E*s-F*m)*D,
|
|
|
+(E*p-F*n)*D),k.set((C*l-w*t)*D,(C*m-w*s)*D,(C*n-w*p)*D),g[I].add(f),g[v].add(f),g[A].add(f),i[I].add(k),i[v].add(k),i[A].add(k)}var J=new THREE.Vector3,ba=new THREE.Vector3,qa=new THREE.Vector3,ra=new THREE.Vector3,N,M,Q;x=0;for(B=G.length;x<B;++x){O=G[x].start;I=G[x].count;R=G[x].index;y=O;for(O+=I;y<O;y+=3)I=R+b[y],v=R+b[y+1],A=R+b[y+2],a(I),a(v),a(A)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=new THREE.Vector3(0,
|
|
|
0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
|
|
@@ -198,8 +197,8 @@ THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLig
|
|
|
this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,s){var r=/\.dds$/i.test(f),v=b+"/"+f;if(r){var y=THREE.ImageUtils.loadCompressedTexture(v);a[e]=y}else y=document.createElement("canvas"),a[e]=new THREE.Texture(y);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
-f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));s&&(a[e].anisotropy=s);if(!r){var J=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);J.image.width=a;J.image.height=b;J.image.getContext("2d").drawImage(this,0,0,a,b)}else J.image=this;J.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,q){var r=/\.dds$/i.test(f),u=b+"/"+f;if(r){var w=THREE.ImageUtils.loadCompressedTexture(u);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
|
|
|
+f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));q&&(a[e].anisotropy=q);if(!r){var E=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);E.image.width=a;E.image.height=b;E.image.getContext("2d").drawImage(this,0,0,a,b)}else E.image=this;E.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
@@ -209,11 +208,11 @@ THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){va
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a)},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
|
|
|
(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,l,m,n,q,t,p,s,r,v,y=a.faces;q=a.vertices;var J=a.normals,B=a.colors,H=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&H++;for(e=0;e<H;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[]}g=0;for(i=q.length;g<i;)k=new THREE.Vector3,k.x=q[g++]*d,k.y=q[g++]*d,k.z=q[g++]*d,c.vertices.push(k);g=0;for(i=y.length;g<i;){q=y[g++];k=q&1;h=q&2;e=q&4;f=q&8;m=q&16;l=q&32;t=q&64;q&=128;k?(p=
|
|
|
-new THREE.Face4,p.a=y[g++],p.b=y[g++],p.c=y[g++],p.d=y[g++],k=4):(p=new THREE.Face3,p.a=y[g++],p.b=y[g++],p.c=y[g++],k=3);h&&(h=y[g++],p.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<H;e++)s=a.uvs[e],n=y[g++],v=s[2*n],n=s[2*n+1],c.faceUvs[e][h]=new THREE.Vector2(v,n);if(f)for(e=0;e<H;e++){s=a.uvs[e];r=[];for(f=0;f<k;f++)n=y[g++],v=s[2*n],n=s[2*n+1],r[f]=new THREE.Vector2(v,n);c.faceVertexUvs[e][h]=r}m&&(m=3*y[g++],f=new THREE.Vector3,f.x=J[m++],f.y=J[m++],f.z=J[m],p.normal=f);if(l)for(e=0;e<k;e++)m=
|
|
|
-3*y[g++],f=new THREE.Vector3,f.x=J[m++],f.y=J[m++],f.z=J[m],p.vertexNormals.push(f);t&&(l=y[g++],l=new THREE.Color(B[l]),p.color=l);if(q)for(e=0;e<k;e++)l=y[g++],l=new THREE.Color(B[l]),p.vertexColors.push(l);c.faces.push(p)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)y=a.skinWeights[g],J=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(y,J,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<i;g+=2)y=a.skinIndices[g],J=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(y,
|
|
|
-J,0,0))}c.bones=a.bones;c.animation=a.animation;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];B=c.morphTargets[g].vertices;H=a.morphTargets[g].vertices;y=0;for(J=H.length;y<J;y+=3)q=new THREE.Vector3,q.x=H[y]*d,q.y=H[y+1]*d,q.z=H[y+2]*d,B.push(q)}}if(void 0!==a.morphColors){g=0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=
|
|
|
-[];J=c.morphColors[g].colors;B=a.morphColors[g].colors;d=0;for(y=B.length;d<y;d+=3)H=new THREE.Color(16755200),H.setRGB(B[d],B[d+1],B[d+2]),J.push(H)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,l,m,n,t,s,p,q,r,u,w=a.faces;t=a.vertices;var E=a.normals,C=a.colors,F=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&F++;for(e=0;e<F;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[]}g=0;for(i=t.length;g<i;)k=new THREE.Vector3,k.x=t[g++]*d,k.y=t[g++]*d,k.z=t[g++]*d,c.vertices.push(k);g=0;for(i=w.length;g<i;){t=w[g++];k=t&1;h=t&2;e=t&4;f=t&8;m=t&16;l=t&32;s=t&64;t&=128;k?(p=
|
|
|
+new THREE.Face4,p.a=w[g++],p.b=w[g++],p.c=w[g++],p.d=w[g++],k=4):(p=new THREE.Face3,p.a=w[g++],p.b=w[g++],p.c=w[g++],k=3);h&&(h=w[g++],p.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<F;e++)q=a.uvs[e],n=w[g++],u=q[2*n],n=q[2*n+1],c.faceUvs[e][h]=new THREE.Vector2(u,n);if(f)for(e=0;e<F;e++){q=a.uvs[e];r=[];for(f=0;f<k;f++)n=w[g++],u=q[2*n],n=q[2*n+1],r[f]=new THREE.Vector2(u,n);c.faceVertexUvs[e][h]=r}m&&(m=3*w[g++],f=new THREE.Vector3,f.x=E[m++],f.y=E[m++],f.z=E[m],p.normal=f);if(l)for(e=0;e<k;e++)m=
|
|
|
+3*w[g++],f=new THREE.Vector3,f.x=E[m++],f.y=E[m++],f.z=E[m],p.vertexNormals.push(f);s&&(l=w[g++],l=new THREE.Color(C[l]),p.color=l);if(t)for(e=0;e<k;e++)l=w[g++],l=new THREE.Color(C[l]),p.vertexColors.push(l);c.faces.push(p)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)w=a.skinWeights[g],E=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(w,E,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<i;g+=2)w=a.skinIndices[g],E=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(w,
|
|
|
+E,0,0))}c.bones=a.bones;c.animation=a.animation;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];C=c.morphTargets[g].vertices;F=a.morphTargets[g].vertices;w=0;for(E=F.length;w<E;w+=3)t=new THREE.Vector3,t.x=F[w]*d,t.y=F[w+1]*d,t.z=F[w+2]*d,C.push(t)}}if(void 0!==a.morphColors){g=0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=
|
|
|
+[];E=c.morphColors[g].colors;C=a.morphColors[g].colors;d=0;for(w=C.length;d<w;d+=3)F=new THREE.Color(16755200),F.setRGB(C[d],C[d+1],C[d+2]),E.push(F)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets,a=a.boundingSphere,e;for(e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
|
|
|
void 0!==a&&(b.boundingSphere=new THREE.Sphere(void 0,a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
|
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
|
|
@@ -225,28 +224,28 @@ g.phiStart,g.phiLength,g.thetaStart,g.thetaLength);break;case "IcosahedronGeomet
|
|
|
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;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==
|
|
|
b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
|
|
|
-THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,
|
|
|
-E.objects)}function f(a,b){var c,e,h,i,k,l,n;for(n in b){var s=z.objects[n],r=b[n];if(void 0===s){if(r.type&&r.type in m.hierarchyHandlers){if(void 0===r.loading){e={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};h={};for(var B in r)B in e||(h[B]=r[B]);t=z.materials[r.material];r.loading=!0;e=m.hierarchyHandlers[r.type].loaderObject;e.options?e.load(d(r.url,E.urlBaseType),g(n,a,t,r)):e.load(d(r.url,E.urlBaseType),g(n,
|
|
|
-a,t,r),h)}}else if(void 0!==r.geometry){if(q=z.geometries[r.geometry]){s=!1;t=z.materials[r.material];s=t instanceof THREE.ShaderMaterial;h=r.position;i=r.rotation;k=r.scale;c=r.matrix;l=r.quaternion;r.material||(t=new THREE.MeshFaceMaterial(z.face_materials[r.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(z.face_materials[r.geometry]));if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)s=s||t.materials[e]instanceof THREE.ShaderMaterial;
|
|
|
-s&&q.computeTangents();r.skin?s=new THREE.SkinnedMesh(q,t):r.morph?(s=new THREE.MorphAnimMesh(q,t),void 0!==r.duration&&(s.duration=r.duration),void 0!==r.time&&(s.time=r.time),void 0!==r.mirroredLoop&&(s.mirroredLoop=r.mirroredLoop),t.morphNormals&&q.computeMorphNormals()):s=new THREE.Mesh(q,t);s.name=n;c?(s.matrixAutoUpdate=!1,s.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])):(s.position.fromArray(h),l?s.quaternion.fromArray(l):s.rotation.fromArray(i),
|
|
|
-s.scale.fromArray(k));s.visible=r.visible;s.castShadow=r.castShadow;s.receiveShadow=r.receiveShadow;a.add(s);z.objects[n]=s}}else"DirectionalLight"===r.type||"PointLight"===r.type||"AmbientLight"===r.type?(y=void 0!==r.color?r.color:16777215,J=void 0!==r.intensity?r.intensity:1,"DirectionalLight"===r.type?(h=r.direction,v=new THREE.DirectionalLight(y,J),v.position.fromArray(h),r.target&&(M.push({object:v,targetName:r.target}),v.target=null)):"PointLight"===r.type?(h=r.position,e=r.distance,v=new THREE.PointLight(y,
|
|
|
-J,e),v.position.fromArray(h)):"AmbientLight"===r.type&&(v=new THREE.AmbientLight(y)),a.add(v),v.name=n,z.lights[n]=v,z.objects[n]=v):"PerspectiveCamera"===r.type||"OrthographicCamera"===r.type?(h=r.position,i=r.rotation,l=r.quaternion,"PerspectiveCamera"===r.type?p=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):"OrthographicCamera"===r.type&&(p=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),p.name=n,p.position.fromArray(h),void 0!==l?p.quaternion.fromArray(l):
|
|
|
-void 0!==i&&p.rotation.fromArray(i),a.add(p),z.cameras[n]=p,z.objects[n]=p):(h=r.position,i=r.rotation,k=r.scale,l=r.quaternion,s=new THREE.Object3D,s.name=n,s.position.fromArray(h),l?s.quaternion.fromArray(l):s.rotation.fromArray(i),s.scale.fromArray(k),s.visible=void 0!==r.visible?r.visible:!1,a.add(s),z.objects[n]=s,z.empties[n]=s);if(s){if(void 0!==r.userData)for(var C in r.userData)s.userData[C]=r.userData[C];if(void 0!==r.groups)for(e=0;e<r.groups.length;e++)h=r.groups[e],void 0===z.groups[h]&&
|
|
|
-(z.groups[h]=[]),z.groups[h].push(n)}}void 0!==s&&void 0!==r.children&&f(s,r.children)}}function h(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c;e();B-=1;m.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:
|
|
|
-!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;z.objects[a]=f;e();B-=1;m.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;z.geometries[a]=b;z.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:I,totalTextures:C,loadedModels:I-B,loadedTextures:C-H},z);m.onLoadProgress();if(0===B&&0===H){for(var a=0;a<M.length;a++){var c=M[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 l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),q,t,p,s,r,v,y,J,B,H,I,C,z,M=[],E=a,F;for(F in this.geometryHandlers)a=this.geometryHandlers[F].loaderClass,this.geometryHandlers[F].loaderObject=new a;for(F in this.hierarchyHandlers)a=this.hierarchyHandlers[F].loaderClass,this.hierarchyHandlers[F].loaderObject=new a;H=B=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
-objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(E.transform&&(F=E.transform.position,a=E.transform.rotation,c=E.transform.scale,F&&z.scene.position.fromArray(F),a&&z.scene.rotation.fromArray(a),c&&z.scene.scale.fromArray(c),F||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();F=function(a){return function(){H-=a;k();m.onLoadComplete()}};for(var S in E.fogs)a=E.fogs[S],"linear"===a.type?s=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(s=new THREE.FogExp2(0,a.density)),a=a.color,
|
|
|
-s.color.setRGB(a[0],a[1],a[2]),z.fogs[S]=s;for(var x in E.geometries)s=E.geometries[x],s.type in this.geometryHandlers&&(B+=1,m.onLoadStart());for(var D in E.objects)l(E.objects[D],function(a){a.type&&a.type in m.hierarchyHandlers&&(B+=1,m.onLoadStart())});I=B;for(x in E.geometries)if(s=E.geometries[x],"cube"===s.type)q=new THREE.CubeGeometry(s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments),q.name=x,z.geometries[x]=q;else if("plane"===s.type)q=new THREE.PlaneGeometry(s.width,
|
|
|
-s.height,s.widthSegments,s.heightSegments),q.name=x,z.geometries[x]=q;else if("sphere"===s.type)q=new THREE.SphereGeometry(s.radius,s.widthSegments,s.heightSegments),q.name=x,z.geometries[x]=q;else if("cylinder"===s.type)q=new THREE.CylinderGeometry(s.topRad,s.botRad,s.height,s.radSegs,s.heightSegs),q.name=x,z.geometries[x]=q;else if("torus"===s.type)q=new THREE.TorusGeometry(s.radius,s.tube,s.segmentsR,s.segmentsT),q.name=x,z.geometries[x]=q;else if("icosahedron"===s.type)q=new THREE.IcosahedronGeometry(s.radius,
|
|
|
-s.subdivisions),q.name=x,z.geometries[x]=q;else if(s.type in this.geometryHandlers){D={};for(r in s)"type"!==r&&"url"!==r&&(D[r]=s[r]);this.geometryHandlers[s.type].loaderObject.load(d(s.url,E.urlBaseType),h(x),D)}else"embedded"===s.type&&(D=E.embeds[s.id],D.metadata=E.metadata,D&&(D=this.geometryHandlers.ascii.loaderObject.parse(D,""),i(x)(D.geometry,D.materials)));for(var A in E.textures)if(x=E.textures[A],x.url instanceof Array){H+=x.url.length;for(r=0;r<x.url.length;r++)m.onLoadStart()}else H+=
|
|
|
-1,m.onLoadStart();C=H;for(A in E.textures){x=E.textures[A];void 0!==x.mapping&&void 0!==THREE[x.mapping]&&(x.mapping=new THREE[x.mapping]);if(x.url instanceof Array){D=x.url.length;s=[];for(r=0;r<D;r++)s[r]=d(x.url[r],E.urlBaseType);r=(r=/\.dds$/i.test(s[0]))?THREE.ImageUtils.loadCompressedTextureCube(s,x.mapping,F(D)):THREE.ImageUtils.loadTextureCube(s,x.mapping,F(D))}else r=/\.dds$/i.test(x.url),D=d(x.url,E.urlBaseType),s=F(1),r=r?THREE.ImageUtils.loadCompressedTexture(D,x.mapping,s):THREE.ImageUtils.loadTexture(D,
|
|
|
-x.mapping,s),void 0!==THREE[x.minFilter]&&(r.minFilter=THREE[x.minFilter]),void 0!==THREE[x.magFilter]&&(r.magFilter=THREE[x.magFilter]),x.anisotropy&&(r.anisotropy=x.anisotropy),x.repeat&&(r.repeat.set(x.repeat[0],x.repeat[1]),1!==x.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==x.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),x.offset&&r.offset.set(x.offset[0],x.offset[1]),x.wrap&&(D={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==D[x.wrap[0]]&&(r.wrapS=D[x.wrap[0]]),void 0!==
|
|
|
-D[x.wrap[1]]&&(r.wrapT=D[x.wrap[1]]));z.textures[A]=r}var T,K;for(T in E.materials){A=E.materials[T];for(K in A.parameters)"envMap"===K||"map"===K||"lightMap"===K||"bumpMap"===K?A.parameters[K]=z.textures[A.parameters[K]]:"shading"===K?A.parameters[K]="flat"===A.parameters[K]?THREE.FlatShading:THREE.SmoothShading:"side"===K?A.parameters[K]="double"==A.parameters[K]?THREE.DoubleSide:"back"==A.parameters[K]?THREE.BackSide:THREE.FrontSide:"blending"===K?A.parameters[K]=A.parameters[K]in THREE?THREE[A.parameters[K]]:
|
|
|
-THREE.NormalBlending:"combine"===K?A.parameters[K]=A.parameters[K]in THREE?THREE[A.parameters[K]]:THREE.MultiplyOperation:"vertexColors"===K?"face"==A.parameters[K]?A.parameters[K]=THREE.FaceColors:A.parameters[K]&&(A.parameters[K]=THREE.VertexColors):"wrapRGB"===K&&(F=A.parameters[K],A.parameters[K]=new THREE.Vector3(F[0],F[1],F[2]));void 0!==A.parameters.opacity&&1>A.parameters.opacity&&(A.parameters.transparent=!0);A.parameters.normalMap?(F=THREE.ShaderLib.normalmap,x=THREE.UniformsUtils.clone(F.uniforms),
|
|
|
-r=A.parameters.color,D=A.parameters.specular,s=A.parameters.ambient,S=A.parameters.shininess,x.tNormal.value=z.textures[A.parameters.normalMap],A.parameters.normalScale&&x.uNormalScale.value.set(A.parameters.normalScale[0],A.parameters.normalScale[1]),A.parameters.map&&(x.tDiffuse.value=A.parameters.map,x.enableDiffuse.value=!0),A.parameters.envMap&&(x.tCube.value=A.parameters.envMap,x.enableReflection.value=!0,x.uReflectivity.value=A.parameters.reflectivity),A.parameters.lightMap&&(x.tAO.value=A.parameters.lightMap,
|
|
|
-x.enableAO.value=!0),A.parameters.specularMap&&(x.tSpecular.value=z.textures[A.parameters.specularMap],x.enableSpecular.value=!0),A.parameters.displacementMap&&(x.tDisplacement.value=z.textures[A.parameters.displacementMap],x.enableDisplacement.value=!0,x.uDisplacementBias.value=A.parameters.displacementBias,x.uDisplacementScale.value=A.parameters.displacementScale),x.uDiffuseColor.value.setHex(r),x.uSpecularColor.value.setHex(D),x.uAmbientColor.value.setHex(s),x.uShininess.value=S,A.parameters.opacity&&
|
|
|
-(x.uOpacity.value=A.parameters.opacity),t=new THREE.ShaderMaterial({fragmentShader:F.fragmentShader,vertexShader:F.vertexShader,uniforms:x,lights:!0,fog:!0})):t=new THREE[A.type](A.parameters);t.name=T;z.materials[T]=t}for(T in E.materials)if(A=E.materials[T],A.parameters.materials){K=[];for(r=0;r<A.parameters.materials.length;r++)K.push(z.materials[A.parameters.materials[r]]);z.materials[T].materials=K}e();z.cameras&&E.defaults.camera&&(z.currentCamera=z.cameras[E.defaults.camera]);z.fogs&&E.defaults.fog&&
|
|
|
-(z.scene.fog=z.fogs[E.defaults.fog]);m.callbackSync(z);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
+THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(y.scene,
|
|
|
+x.objects)}function f(a,b){var c,e,h,i,k,l,n;for(n in b){var q=y.objects[n],r=b[n];if(void 0===q){if(r.type&&r.type in m.hierarchyHandlers){if(void 0===r.loading){e={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};h={};for(var C in r)C in e||(h[C]=r[C]);s=y.materials[r.material];r.loading=!0;e=m.hierarchyHandlers[r.type].loaderObject;e.options?e.load(d(r.url,x.urlBaseType),g(n,a,s,r)):e.load(d(r.url,x.urlBaseType),g(n,
|
|
|
+a,s,r),h)}}else if(void 0!==r.geometry){if(t=y.geometries[r.geometry]){q=!1;s=y.materials[r.material];q=s instanceof THREE.ShaderMaterial;h=r.position;i=r.rotation;k=r.scale;c=r.matrix;l=r.quaternion;r.material||(s=new THREE.MeshFaceMaterial(y.face_materials[r.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(y.face_materials[r.geometry]));if(s instanceof THREE.MeshFaceMaterial)for(e=0;e<s.materials.length;e++)q=q||s.materials[e]instanceof THREE.ShaderMaterial;
|
|
|
+q&&t.computeTangents();r.skin?q=new THREE.SkinnedMesh(t,s):r.morph?(q=new THREE.MorphAnimMesh(t,s),void 0!==r.duration&&(q.duration=r.duration),void 0!==r.time&&(q.time=r.time),void 0!==r.mirroredLoop&&(q.mirroredLoop=r.mirroredLoop),s.morphNormals&&t.computeMorphNormals()):q=new THREE.Mesh(t,s);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(h),l?q.quaternion.fromArray(l):q.rotation.fromArray(i),
|
|
|
+q.scale.fromArray(k));q.visible=r.visible;q.castShadow=r.castShadow;q.receiveShadow=r.receiveShadow;a.add(q);y.objects[n]=q}}else"DirectionalLight"===r.type||"PointLight"===r.type||"AmbientLight"===r.type?(w=void 0!==r.color?r.color:16777215,E=void 0!==r.intensity?r.intensity:1,"DirectionalLight"===r.type?(h=r.direction,u=new THREE.DirectionalLight(w,E),u.position.fromArray(h),r.target&&(O.push({object:u,targetName:r.target}),u.target=null)):"PointLight"===r.type?(h=r.position,e=r.distance,u=new THREE.PointLight(w,
|
|
|
+E,e),u.position.fromArray(h)):"AmbientLight"===r.type&&(u=new THREE.AmbientLight(w)),a.add(u),u.name=n,y.lights[n]=u,y.objects[n]=u):"PerspectiveCamera"===r.type||"OrthographicCamera"===r.type?(h=r.position,i=r.rotation,l=r.quaternion,"PerspectiveCamera"===r.type?p=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):"OrthographicCamera"===r.type&&(p=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),p.name=n,p.position.fromArray(h),void 0!==l?p.quaternion.fromArray(l):
|
|
|
+void 0!==i&&p.rotation.fromArray(i),a.add(p),y.cameras[n]=p,y.objects[n]=p):(h=r.position,i=r.rotation,k=r.scale,l=r.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(h),l?q.quaternion.fromArray(l):q.rotation.fromArray(i),q.scale.fromArray(k),q.visible=void 0!==r.visible?r.visible:!1,a.add(q),y.objects[n]=q,y.empties[n]=q);if(q){if(void 0!==r.userData)for(var D in r.userData)q.userData[D]=r.userData[D];if(void 0!==r.groups)for(e=0;e<r.groups.length;e++)h=r.groups[e],void 0===y.groups[h]&&
|
|
|
+(y.groups[h]=[]),y.groups[h].push(n)}}void 0!==q&&void 0!==r.children&&f(q,r.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();C-=1;m.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:
|
|
|
+!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;y.objects[a]=f;e();C-=1;m.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:z,totalTextures:D,loadedModels:z-C,loadedTextures:D-F},y);m.onLoadProgress();if(0===C&&0===F){for(var a=0;a<O.length;a++){var c=O[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=
|
|
|
+c.object}b(y)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),t,s,p,q,r,u,w,E,C,F,z,D,y,O=[],x=a,B;for(B in this.geometryHandlers)a=this.geometryHandlers[B].loaderClass,this.geometryHandlers[B].loaderObject=new a;for(B in this.hierarchyHandlers)a=this.hierarchyHandlers[B].loaderClass,this.hierarchyHandlers[B].loaderObject=new a;F=C=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
+objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(x.transform&&(B=x.transform.position,a=x.transform.rotation,c=x.transform.scale,B&&y.scene.position.fromArray(B),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),B||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();B=function(a){return function(){F-=a;k();m.onLoadComplete()}};for(var I in x.fogs)a=x.fogs[I],"linear"===a.type?q=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(q=new THREE.FogExp2(0,a.density)),a=a.color,
|
|
|
+q.color.setRGB(a[0],a[1],a[2]),y.fogs[I]=q;for(var v in x.geometries)q=x.geometries[v],q.type in this.geometryHandlers&&(C+=1,m.onLoadStart());for(var A in x.objects)l(x.objects[A],function(a){a.type&&a.type in m.hierarchyHandlers&&(C+=1,m.onLoadStart())});z=C;for(v in x.geometries)if(q=x.geometries[v],"cube"===q.type)t=new THREE.CubeGeometry(q.width,q.height,q.depth,q.widthSegments,q.heightSegments,q.depthSegments),t.name=v,y.geometries[v]=t;else if("plane"===q.type)t=new THREE.PlaneGeometry(q.width,
|
|
|
+q.height,q.widthSegments,q.heightSegments),t.name=v,y.geometries[v]=t;else if("sphere"===q.type)t=new THREE.SphereGeometry(q.radius,q.widthSegments,q.heightSegments),t.name=v,y.geometries[v]=t;else if("cylinder"===q.type)t=new THREE.CylinderGeometry(q.topRad,q.botRad,q.height,q.radSegs,q.heightSegs),t.name=v,y.geometries[v]=t;else if("torus"===q.type)t=new THREE.TorusGeometry(q.radius,q.tube,q.segmentsR,q.segmentsT),t.name=v,y.geometries[v]=t;else if("icosahedron"===q.type)t=new THREE.IcosahedronGeometry(q.radius,
|
|
|
+q.subdivisions),t.name=v,y.geometries[v]=t;else if(q.type in this.geometryHandlers){A={};for(r in q)"type"!==r&&"url"!==r&&(A[r]=q[r]);this.geometryHandlers[q.type].loaderObject.load(d(q.url,x.urlBaseType),h(v),A)}else"embedded"===q.type&&(A=x.embeds[q.id],A.metadata=x.metadata,A&&(A=this.geometryHandlers.ascii.loaderObject.parse(A,""),i(v)(A.geometry,A.materials)));for(var G in x.textures)if(v=x.textures[G],v.url instanceof Array){F+=v.url.length;for(r=0;r<v.url.length;r++)m.onLoadStart()}else F+=
|
|
|
+1,m.onLoadStart();D=F;for(G in x.textures){v=x.textures[G];void 0!==v.mapping&&void 0!==THREE[v.mapping]&&(v.mapping=new THREE[v.mapping]);if(v.url instanceof Array){A=v.url.length;q=[];for(r=0;r<A;r++)q[r]=d(v.url[r],x.urlBaseType);r=(r=/\.dds$/i.test(q[0]))?THREE.ImageUtils.loadCompressedTextureCube(q,v.mapping,B(A)):THREE.ImageUtils.loadTextureCube(q,v.mapping,B(A))}else r=/\.dds$/i.test(v.url),A=d(v.url,x.urlBaseType),q=B(1),r=r?THREE.ImageUtils.loadCompressedTexture(A,v.mapping,q):THREE.ImageUtils.loadTexture(A,
|
|
|
+v.mapping,q),void 0!==THREE[v.minFilter]&&(r.minFilter=THREE[v.minFilter]),void 0!==THREE[v.magFilter]&&(r.magFilter=THREE[v.magFilter]),v.anisotropy&&(r.anisotropy=v.anisotropy),v.repeat&&(r.repeat.set(v.repeat[0],v.repeat[1]),1!==v.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==v.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),v.offset&&r.offset.set(v.offset[0],v.offset[1]),v.wrap&&(A={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==A[v.wrap[0]]&&(r.wrapS=A[v.wrap[0]]),void 0!==
|
|
|
+A[v.wrap[1]]&&(r.wrapT=A[v.wrap[1]]));y.textures[G]=r}var R,J;for(R in x.materials){G=x.materials[R];for(J in G.parameters)"envMap"===J||"map"===J||"lightMap"===J||"bumpMap"===J?G.parameters[J]=y.textures[G.parameters[J]]:"shading"===J?G.parameters[J]="flat"===G.parameters[J]?THREE.FlatShading:THREE.SmoothShading:"side"===J?G.parameters[J]="double"==G.parameters[J]?THREE.DoubleSide:"back"==G.parameters[J]?THREE.BackSide:THREE.FrontSide:"blending"===J?G.parameters[J]=G.parameters[J]in THREE?THREE[G.parameters[J]]:
|
|
|
+THREE.NormalBlending:"combine"===J?G.parameters[J]=G.parameters[J]in THREE?THREE[G.parameters[J]]:THREE.MultiplyOperation:"vertexColors"===J?"face"==G.parameters[J]?G.parameters[J]=THREE.FaceColors:G.parameters[J]&&(G.parameters[J]=THREE.VertexColors):"wrapRGB"===J&&(B=G.parameters[J],G.parameters[J]=new THREE.Vector3(B[0],B[1],B[2]));void 0!==G.parameters.opacity&&1>G.parameters.opacity&&(G.parameters.transparent=!0);G.parameters.normalMap?(B=THREE.ShaderLib.normalmap,v=THREE.UniformsUtils.clone(B.uniforms),
|
|
|
+r=G.parameters.color,A=G.parameters.specular,q=G.parameters.ambient,I=G.parameters.shininess,v.tNormal.value=y.textures[G.parameters.normalMap],G.parameters.normalScale&&v.uNormalScale.value.set(G.parameters.normalScale[0],G.parameters.normalScale[1]),G.parameters.map&&(v.tDiffuse.value=G.parameters.map,v.enableDiffuse.value=!0),G.parameters.envMap&&(v.tCube.value=G.parameters.envMap,v.enableReflection.value=!0,v.uReflectivity.value=G.parameters.reflectivity),G.parameters.lightMap&&(v.tAO.value=G.parameters.lightMap,
|
|
|
+v.enableAO.value=!0),G.parameters.specularMap&&(v.tSpecular.value=y.textures[G.parameters.specularMap],v.enableSpecular.value=!0),G.parameters.displacementMap&&(v.tDisplacement.value=y.textures[G.parameters.displacementMap],v.enableDisplacement.value=!0,v.uDisplacementBias.value=G.parameters.displacementBias,v.uDisplacementScale.value=G.parameters.displacementScale),v.uDiffuseColor.value.setHex(r),v.uSpecularColor.value.setHex(A),v.uAmbientColor.value.setHex(q),v.uShininess.value=I,G.parameters.opacity&&
|
|
|
+(v.uOpacity.value=G.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:B.fragmentShader,vertexShader:B.vertexShader,uniforms:v,lights:!0,fog:!0})):s=new THREE[G.type](G.parameters);s.name=R;y.materials[R]=s}for(R in x.materials)if(G=x.materials[R],G.parameters.materials){J=[];for(r=0;r<G.parameters.materials.length;r++)J.push(y.materials[G.parameters.materials[r]]);y.materials[R].materials=J}e();y.cameras&&x.defaults.camera&&(y.currentCamera=y.cameras[x.defaults.camera]);y.fogs&&x.defaults.fog&&
|
|
|
+(y.scene.fog=y.fogs[x.defaults.fog]);m.callbackSync(y);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
|
|
|
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
|
|
|
THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
|
|
@@ -288,30 +287,30 @@ THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector
|
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
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)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
-THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=J.length;d<e;d++){var f=J[d];ta.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=wa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(ta.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=wa.getPositionFromMatrix(f.matrixWorld),g=b.dot(wa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(ta.multiplyScalar(g)))))}}
|
|
|
-function c(a,b,c,d){l(b);m(c);n(d);q(a.getStyle());E.stroke();Ka.expandByScalar(2*b)}function d(a){t(a.getStyle());E.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;ab[n.id]=E.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===ab[n.id]?t("rgba(0,0,0,1)"):
|
|
|
-t(ab[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,s=n.image.width*n.repeat.x,r=n.image.height*n.repeat.y,g=(g+p)*s,j=(1-j+q)*r,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*s-g,k=(1-k+q)*r-j,m=(m+p)*s-g,l=(1-l+q)*r-j,p=i*l-m*k;0===p?(void 0===bb[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),bb[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=bb[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
|
|
|
-aa.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(aa)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,E.save(),E.transform(n,k,c,e,a,g),E.fill(),E.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*n-h;i=i*p-g;k=k*n-h;m=m*p-g;p=1/(j*m-k*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;E.save();E.transform(n,i,c,d,a,b);E.clip();E.drawImage(l,0,0);E.restore()}function h(a,
|
|
|
-b,c,d){Ea[0]=255*a.r|0;Ea[1]=255*a.g|0;Ea[2]=255*a.b|0;Ea[4]=255*b.r|0;Ea[5]=255*b.g|0;Ea[6]=255*b.b|0;Ea[8]=255*c.r|0;Ea[9]=255*c.g|0;Ea[10]=255*c.b|0;Ea[12]=255*d.r|0;Ea[13]=255*d.g|0;Ea[14]=255*d.b|0;j.putImageData(lb,0,0);fb.drawImage(mb,0,0);return cb}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function i(a){x!==a&&(x=E.globalAlpha=a)}function k(a){D!==a&&(a===THREE.NormalBlending?E.globalCompositeOperation="source-over":
|
|
|
-a===THREE.AdditiveBlending?E.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(E.globalCompositeOperation="darker"),D=a)}function l(a){K!==a&&(K=E.lineWidth=a)}function m(a){ia!==a&&(ia=E.lineCap=a)}function n(a){ra!==a&&(ra=E.lineJoin=a)}function q(a){A!==a&&(A=E.strokeStyle=a)}function t(a){T!==a&&(T=E.fillStyle=a)}function p(a,b){if(sa!==a||N!==b)E.setLineDash([a,b]),sa=a,N=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var s=THREE.Math.smoothstep,a=a||{},r=this,v,y,J,B=
|
|
|
-new THREE.Projector,H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),I,C,z,M,E=H.getContext("2d"),F=new THREE.Color(0),S=0,x=1,D=0,A=null,T=null,K=null,ia=null,ra=null,sa=null,N=0,U,ba,L,ga;new THREE.RenderableVertex;new THREE.RenderableVertex;var Ia,Qa,za,Na,Fa,ha,aa=new THREE.Color,ma=new THREE.Color,W=new THREE.Color,fa=new THREE.Color,ca=new THREE.Color,Ga=new THREE.Color,Ja=new THREE.Color,ta=new THREE.Color,ab={},bb={},Oa,vb,db,nb,wb,Jb,Db,Kb,Qb,Rb,Ta=new THREE.Box2,na=new THREE.Box2,
|
|
|
-Ka=new THREE.Box2,xb=new THREE.Color,La=new THREE.Color,ja=new THREE.Color,wa=new THREE.Vector3,mb,j,lb,Ea,cb,fb,sb=16;mb=document.createElement("canvas");mb.width=mb.height=2;j=mb.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);lb=j.getImageData(0,0,2,2);Ea=lb.data;cb=document.createElement("canvas");cb.width=cb.height=sb;fb=cb.getContext("2d");fb.translate(-sb/2,-sb/2);fb.scale(sb,sb);sb--;void 0===E.setLineDash&&(E.setLineDash=void 0!==E.mozDash?function(a){E.mozDash=null!==a[0]?
|
|
|
-a:null}:function(){});this.domElement=H;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.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){I=a*this.devicePixelRatio;C=b*this.devicePixelRatio;z=Math.floor(I/2);M=Math.floor(C/2);H.width=I;H.height=C;1!==this.devicePixelRatio&&!1!==
|
|
|
-c&&(H.style.width=a+"px",H.style.height=b+"px");Ta.set(new THREE.Vector2(-z,-M),new THREE.Vector2(z,M));na.set(new THREE.Vector2(-z,-M),new THREE.Vector2(z,M));x=1;D=0;ra=ia=K=T=A=null};this.setClearColor=function(a,b){F.set(a);S=void 0!==b?b:1;na.set(new THREE.Vector2(-z,-M),new THREE.Vector2(z,M))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};
|
|
|
-this.clear=function(){E.setTransform(1,0,0,-1,z,M);!1===na.empty()&&(na.intersect(Ta),na.expandByScalar(2),1>S&&E.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<S&&(k(THREE.NormalBlending),i(1),t("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+S+")"),E.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{!0===this.autoClear&&this.clear();E.setTransform(1,0,0,-1,z,M);r.info.render.vertices=0;r.info.render.faces=0;v=B.projectScene(a,j,this.sortObjects,this.sortElements);y=v.elements;J=v.lights;U=j;xb.setRGB(0,0,0);La.setRGB(0,0,0);ja.setRGB(0,0,0);for(var C=0,I=J.length;C<I;C++){var A=J[C],H=A.color;A instanceof THREE.AmbientLight?xb.add(H):A instanceof THREE.DirectionalLight?La.add(H):A instanceof THREE.PointLight&&ja.add(H)}C=0;for(I=y.length;C<I;C++){var x=y[C],D=x.material;if(!(void 0===D||
|
|
|
-!1===D.visible)){Ka.makeEmpty();if(x instanceof THREE.RenderableParticle){ba=x;ba.x*=z;ba.y*=M;var A=ba,H=x,K=D;i(K.opacity);k(K.blending);var N=D=x=void 0,F=void 0,S=void 0,T=void 0,ta=void 0;K instanceof THREE.ParticleBasicMaterial?null===K.map?(N=H.object.scale.x,F=H.object.scale.y,N*=H.scale.x*z,F*=H.scale.y*M,Ka.min.set(A.x-N,A.y-F),Ka.max.set(A.x+N,A.y+F),!1===Ta.isIntersectionBox(Ka)?Ka.makeEmpty():(t(K.color.getStyle()),E.save(),E.translate(A.x,A.y),E.rotate(-H.rotation),E.scale(N,F),E.fillRect(-1,
|
|
|
--1,2,2),E.restore())):(S=K.map.image,T=S.width>>1,ta=S.height>>1,N=H.scale.x*z,F=H.scale.y*M,x=N*T,D=F*ta,Ka.min.set(A.x-x,A.y-D),Ka.max.set(A.x+x,A.y+D),!1===Ta.isIntersectionBox(Ka)?Ka.makeEmpty():(E.save(),E.translate(A.x,A.y),E.rotate(-H.rotation),E.scale(N,-F),E.translate(-T,-ta),E.drawImage(S,0,0),E.restore())):K instanceof THREE.ParticleCanvasMaterial&&(x=H.scale.x*z,D=H.scale.y*M,Ka.min.set(A.x-x,A.y-D),Ka.max.set(A.x+x,A.y+D),!1===Ta.isIntersectionBox(Ka)?Ka.makeEmpty():(q(K.color.getStyle()),
|
|
|
-t(K.color.getStyle()),E.save(),E.translate(A.x,A.y),E.rotate(-H.rotation),E.scale(x,D),K.program(E),E.restore()))}else if(x instanceof THREE.RenderableLine){if(ba=x.v1,L=x.v2,ba.positionScreen.x*=z,ba.positionScreen.y*=M,L.positionScreen.x*=z,L.positionScreen.y*=M,Ka.setFromPoints([ba.positionScreen,L.positionScreen]),!0===Ta.isIntersectionBox(Ka))if(A=ba,H=L,K=x,x=D,i(x.opacity),k(x.blending),E.beginPath(),E.moveTo(A.positionScreen.x,A.positionScreen.y),E.lineTo(H.positionScreen.x,H.positionScreen.y),
|
|
|
-x instanceof THREE.LineBasicMaterial){l(x.linewidth);m(x.linecap);n(x.linejoin);if(x.vertexColors!==THREE.VertexColors)q(x.color.getStyle());else if(D=K.vertexColors[0].getStyle(),K=K.vertexColors[1].getStyle(),D===K)q(D);else{try{var ia=E.createLinearGradient(A.positionScreen.x,A.positionScreen.y,H.positionScreen.x,H.positionScreen.y);ia.addColorStop(0,D);ia.addColorStop(1,K)}catch(ra){ia=D}q(ia)}E.stroke();Ka.expandByScalar(2*x.linewidth)}else x instanceof THREE.LineDashedMaterial&&(l(x.linewidth),
|
|
|
-m(x.linecap),n(x.linejoin),q(x.color.getStyle()),p(x.dashSize,x.gapSize),E.stroke(),Ka.expandByScalar(2*x.linewidth),p(null,null))}else if(x instanceof THREE.RenderableFace3){ba=x.v1;L=x.v2;ga=x.v3;if(-1>ba.positionScreen.z||1<ba.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>ga.positionScreen.z||1<ga.positionScreen.z)continue;ba.positionScreen.x*=z;ba.positionScreen.y*=M;L.positionScreen.x*=z;L.positionScreen.y*=M;ga.positionScreen.x*=z;ga.positionScreen.y*=
|
|
|
-M;0<D.overdraw&&(g(ba.positionScreen,L.positionScreen,D.overdraw),g(L.positionScreen,ga.positionScreen,D.overdraw),g(ga.positionScreen,ba.positionScreen,D.overdraw));Ka.setFromPoints([ba.positionScreen,L.positionScreen,ga.positionScreen]);if(!0===Ta.isIntersectionBox(Ka)){A=ba;H=L;K=ga;r.info.render.vertices+=3;r.info.render.faces++;i(D.opacity);k(D.blending);Ia=A.positionScreen.x;Qa=A.positionScreen.y;za=H.positionScreen.x;Na=H.positionScreen.y;Fa=K.positionScreen.x;ha=K.positionScreen.y;var N=Ia,
|
|
|
-F=Qa,S=za,T=Na,ta=Fa,sa=ha;E.beginPath();E.moveTo(N,F);E.lineTo(S,T);E.lineTo(ta,sa);E.closePath();(D instanceof THREE.MeshLambertMaterial||D instanceof THREE.MeshPhongMaterial)&&null===D.map?(Ga.copy(D.color),Ja.copy(D.emissive),D.vertexColors===THREE.FaceColors&&Ga.multiply(x.color),!1===D.wireframe&&D.shading==THREE.SmoothShading&&3==x.vertexNormalsLength?(ma.copy(xb),W.copy(xb),fa.copy(xb),b(x.v1.positionWorld,x.vertexNormalsModel[0],ma),b(x.v2.positionWorld,x.vertexNormalsModel[1],W),b(x.v3.positionWorld,
|
|
|
-x.vertexNormalsModel[2],fa),ma.multiply(Ga).add(Ja),W.multiply(Ga).add(Ja),fa.multiply(Ga).add(Ja),ca.addColors(W,fa).multiplyScalar(0.5),db=h(ma,W,fa,ca),f(Ia,Qa,za,Na,Fa,ha,0,0,1,0,0,1,db)):(aa.copy(xb),b(x.centroidModel,x.normalModel,aa),aa.multiply(Ga).add(Ja),!0===D.wireframe?c(aa,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(aa))):D instanceof THREE.MeshBasicMaterial||D instanceof THREE.MeshLambertMaterial||D instanceof THREE.MeshPhongMaterial?null!==D.map?D.map.mapping instanceof
|
|
|
-THREE.UVMapping&&(nb=x.uvs[0],e(Ia,Qa,za,Na,Fa,ha,nb[0].x,nb[0].y,nb[1].x,nb[1].y,nb[2].x,nb[2].y,D.map)):null!==D.envMap?D.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(wa.copy(x.vertexNormalsModelView[0]),wb=0.5*wa.x+0.5,Jb=0.5*wa.y+0.5,wa.copy(x.vertexNormalsModelView[1]),Db=0.5*wa.x+0.5,Kb=0.5*wa.y+0.5,wa.copy(x.vertexNormalsModelView[2]),Qb=0.5*wa.x+0.5,Rb=0.5*wa.y+0.5,e(Ia,Qa,za,Na,Fa,ha,wb,Jb,Db,Kb,Qb,Rb,D.envMap)):(aa.copy(D.color),D.vertexColors===THREE.FaceColors&&aa.multiply(x.color),
|
|
|
-!0===D.wireframe?c(aa,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(aa)):D instanceof THREE.MeshDepthMaterial?(Oa=U.near,vb=U.far,ma.r=ma.g=ma.b=1-s(A.positionScreen.z*A.positionScreen.w,Oa,vb),W.r=W.g=W.b=1-s(H.positionScreen.z*H.positionScreen.w,Oa,vb),fa.r=fa.g=fa.b=1-s(K.positionScreen.z*K.positionScreen.w,Oa,vb),ca.addColors(W,fa).multiplyScalar(0.5),db=h(ma,W,fa,ca),f(Ia,Qa,za,Na,Fa,ha,0,0,1,0,0,1,db)):D instanceof THREE.MeshNormalMaterial&&(A=void 0,D.shading==THREE.FlatShading?
|
|
|
-(A=x.normalModelView,aa.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),!0===D.wireframe?c(aa,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(aa)):D.shading==THREE.SmoothShading&&(A=x.vertexNormalsModelView[0],ma.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),A=x.vertexNormalsModelView[1],W.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),A=x.vertexNormalsModelView[2],fa.setRGB(A.x,A.y,A.z).multiplyScalar(0.5).addScalar(0.5),ca.addColors(W,fa).multiplyScalar(0.5),
|
|
|
-db=h(ma,W,fa,ca),f(Ia,Qa,za,Na,Fa,ha,0,0,1,0,0,1,db)))}}na.union(Ka)}}E.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",
|
|
|
+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=E.length;d<e;d++){var f=E[d];Pa.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=wa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Pa.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=wa.getPositionFromMatrix(f.matrixWorld),g=b.dot(wa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Pa.multiplyScalar(g)))))}}
|
|
|
+function c(a,b,c,d){l(b);m(c);n(d);t(a.getStyle());x.stroke();ta.expandByScalar(2*b)}function d(a){s(a.getStyle());x.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Ja[n.id]=x.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ja[n.id]?s("rgba(0,0,0,1)"):
|
|
|
+s(Ja[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,t=n.image.width*n.repeat.x,r=n.image.height*n.repeat.y,g=(g+p)*t,j=(1-j+q)*r,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*t-g,k=(1-k+q)*r-j,m=(m+p)*t-g,l=(1-l+q)*r-j,p=i*l-m*k;0===p?(void 0===ga[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ga[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ga[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
|
|
|
+V.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(V)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,x.save(),x.transform(n,k,c,e,a,g),x.fill(),x.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*n-h;i=i*p-g;k=k*n-h;m=m*p-g;p=1/(j*m-k*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;x.save();x.transform(n,i,c,d,a,b);x.clip();x.drawImage(l,0,0);x.restore()}function h(a,
|
|
|
+b,c,d){xa[0]=255*a.r|0;xa[1]=255*a.g|0;xa[2]=255*a.b|0;xa[4]=255*b.r|0;xa[5]=255*b.g|0;xa[6]=255*b.b|0;xa[8]=255*c.r|0;xa[9]=255*c.g|0;xa[10]=255*c.b|0;xa[12]=255*d.r|0;xa[13]=255*d.g|0;xa[14]=255*d.b|0;j.putImageData(Wa,0,0);Ia.drawImage(Ra,0,0);return ya}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function i(a){v!==a&&(v=x.globalAlpha=a)}function k(a){A!==a&&(a===THREE.NormalBlending?x.globalCompositeOperation="source-over":
|
|
|
+a===THREE.AdditiveBlending?x.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(x.globalCompositeOperation="darker"),A=a)}function l(a){J!==a&&(J=x.lineWidth=a)}function m(a){ba!==a&&(ba=x.lineCap=a)}function n(a){qa!==a&&(qa=x.lineJoin=a)}function t(a){G!==a&&(G=x.strokeStyle=a)}function s(a){R!==a&&(R=x.fillStyle=a)}function p(a,b){if(ra!==a||N!==b)x.setLineDash([a,b]),ra=a,N=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var q=THREE.Math.smoothstep,a=a||{},r=this,u,w,E,C=
|
|
|
+new THREE.Projector,F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),z,D,y,O,x=F.getContext("2d"),B=new THREE.Color(0),I=0,v=1,A=0,G=null,R=null,J=null,ba=null,qa=null,ra=null,N=0,M,Q,K,da;new THREE.RenderableVertex;new THREE.RenderableVertex;var za,Fa,ea,Ea,Z,fa,V=new THREE.Color,aa=new THREE.Color,P=new THREE.Color,T=new THREE.Color,ma=new THREE.Color,va=new THREE.Color,ja=new THREE.Color,Pa=new THREE.Color,Ja={},ga={},Ha,Xa,Sa,Aa,hb,ib,tb,ub,vb,jb,Ka=new THREE.Box2,na=new THREE.Box2,
|
|
|
+ta=new THREE.Box2,kb=new THREE.Color,ua=new THREE.Color,ha=new THREE.Color,wa=new THREE.Vector3,Ra,j,Wa,xa,ya,Ia,Ta=16;Ra=document.createElement("canvas");Ra.width=Ra.height=2;j=Ra.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Wa=j.getImageData(0,0,2,2);xa=Wa.data;ya=document.createElement("canvas");ya.width=ya.height=Ta;Ia=ya.getContext("2d");Ia.translate(-Ta/2,-Ta/2);Ia.scale(Ta,Ta);Ta--;void 0===x.setLineDash&&(x.setLineDash=void 0!==x.mozDash?function(a){x.mozDash=null!==a[0]?
|
|
|
+a:null}:function(){});this.domElement=F;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.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){z=a*this.devicePixelRatio;D=b*this.devicePixelRatio;y=Math.floor(z/2);O=Math.floor(D/2);F.width=z;F.height=D;1!==this.devicePixelRatio&&!1!==
|
|
|
+c&&(F.style.width=a+"px",F.style.height=b+"px");Ka.set(new THREE.Vector2(-y,-O),new THREE.Vector2(y,O));na.set(new THREE.Vector2(-y,-O),new THREE.Vector2(y,O));v=1;A=0;qa=ba=J=R=G=null};this.setClearColor=function(a,b){B.set(a);I=void 0!==b?b:1;na.set(new THREE.Vector2(-y,-O),new THREE.Vector2(y,O))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};
|
|
|
+this.clear=function(){x.setTransform(1,0,0,-1,y,O);!1===na.empty()&&(na.intersect(Ka),na.expandByScalar(2),1>I&&x.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<I&&(k(THREE.NormalBlending),i(1),s("rgba("+Math.floor(255*B.r)+","+Math.floor(255*B.g)+","+Math.floor(255*B.b)+","+I+")"),x.fillRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0)),na.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{!0===this.autoClear&&this.clear();x.setTransform(1,0,0,-1,y,O);r.info.render.vertices=0;r.info.render.faces=0;u=C.projectScene(a,j,this.sortObjects,this.sortElements);w=u.elements;E=u.lights;M=j;kb.setRGB(0,0,0);ua.setRGB(0,0,0);ha.setRGB(0,0,0);for(var D=0,G=E.length;D<G;D++){var z=E[D],F=z.color;z instanceof THREE.AmbientLight?kb.add(F):z instanceof THREE.DirectionalLight?ua.add(F):z instanceof THREE.PointLight&&ha.add(F)}D=0;for(G=w.length;D<G;D++){var v=w[D],A=v.material;if(!(void 0===A||
|
|
|
+!1===A.visible)){ta.makeEmpty();if(v instanceof THREE.RenderableParticle){Q=v;Q.x*=y;Q.y*=O;var z=Q,F=v,J=A;i(J.opacity);k(J.blending);var N=A=v=void 0,B=void 0,I=void 0,R=void 0,ba=void 0;J instanceof THREE.ParticleBasicMaterial?null===J.map?(N=F.object.scale.x,B=F.object.scale.y,N*=F.scale.x*y,B*=F.scale.y*O,ta.min.set(z.x-N,z.y-B),ta.max.set(z.x+N,z.y+B),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(s(J.color.getStyle()),x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(N,B),x.fillRect(-1,
|
|
|
+-1,2,2),x.restore())):(I=J.map.image,R=I.width>>1,ba=I.height>>1,N=F.scale.x*y,B=F.scale.y*O,v=N*R,A=B*ba,ta.min.set(z.x-v,z.y-A),ta.max.set(z.x+v,z.y+A),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(N,-B),x.translate(-R,-ba),x.drawImage(I,0,0),x.restore())):J instanceof THREE.ParticleCanvasMaterial&&(v=F.scale.x*y,A=F.scale.y*O,ta.min.set(z.x-v,z.y-A),ta.max.set(z.x+v,z.y+A),!1===Ka.isIntersectionBox(ta)?ta.makeEmpty():(t(J.color.getStyle()),
|
|
|
+s(J.color.getStyle()),x.save(),x.translate(z.x,z.y),x.rotate(-F.rotation),x.scale(v,A),J.program(x),x.restore()))}else if(v instanceof THREE.RenderableLine){if(Q=v.v1,K=v.v2,Q.positionScreen.x*=y,Q.positionScreen.y*=O,K.positionScreen.x*=y,K.positionScreen.y*=O,ta.setFromPoints([Q.positionScreen,K.positionScreen]),!0===Ka.isIntersectionBox(ta))if(z=Q,F=K,J=v,v=A,i(v.opacity),k(v.blending),x.beginPath(),x.moveTo(z.positionScreen.x,z.positionScreen.y),x.lineTo(F.positionScreen.x,F.positionScreen.y),
|
|
|
+v instanceof THREE.LineBasicMaterial){l(v.linewidth);m(v.linecap);n(v.linejoin);if(v.vertexColors!==THREE.VertexColors)t(v.color.getStyle());else if(A=J.vertexColors[0].getStyle(),J=J.vertexColors[1].getStyle(),A===J)t(A);else{try{var ga=x.createLinearGradient(z.positionScreen.x,z.positionScreen.y,F.positionScreen.x,F.positionScreen.y);ga.addColorStop(0,A);ga.addColorStop(1,J)}catch(qa){ga=A}t(ga)}x.stroke();ta.expandByScalar(2*v.linewidth)}else v instanceof THREE.LineDashedMaterial&&(l(v.linewidth),
|
|
|
+m(v.linecap),n(v.linejoin),t(v.color.getStyle()),p(v.dashSize,v.gapSize),x.stroke(),ta.expandByScalar(2*v.linewidth),p(null,null))}else if(v instanceof THREE.RenderableFace3){Q=v.v1;K=v.v2;da=v.v3;if(-1>Q.positionScreen.z||1<Q.positionScreen.z)continue;if(-1>K.positionScreen.z||1<K.positionScreen.z)continue;if(-1>da.positionScreen.z||1<da.positionScreen.z)continue;Q.positionScreen.x*=y;Q.positionScreen.y*=O;K.positionScreen.x*=y;K.positionScreen.y*=O;da.positionScreen.x*=y;da.positionScreen.y*=O;
|
|
|
+0<A.overdraw&&(g(Q.positionScreen,K.positionScreen,A.overdraw),g(K.positionScreen,da.positionScreen,A.overdraw),g(da.positionScreen,Q.positionScreen,A.overdraw));ta.setFromPoints([Q.positionScreen,K.positionScreen,da.positionScreen]);if(!0===Ka.isIntersectionBox(ta)){z=Q;F=K;J=da;r.info.render.vertices+=3;r.info.render.faces++;i(A.opacity);k(A.blending);za=z.positionScreen.x;Fa=z.positionScreen.y;ea=F.positionScreen.x;Ea=F.positionScreen.y;Z=J.positionScreen.x;fa=J.positionScreen.y;var N=za,B=Fa,
|
|
|
+I=ea,R=Ea,ba=Z,ra=fa;x.beginPath();x.moveTo(N,B);x.lineTo(I,R);x.lineTo(ba,ra);x.closePath();(A instanceof THREE.MeshLambertMaterial||A instanceof THREE.MeshPhongMaterial)&&null===A.map?(va.copy(A.color),ja.copy(A.emissive),A.vertexColors===THREE.FaceColors&&va.multiply(v.color),!1===A.wireframe&&A.shading==THREE.SmoothShading&&3==v.vertexNormalsLength?(aa.copy(kb),P.copy(kb),T.copy(kb),b(v.v1.positionWorld,v.vertexNormalsModel[0],aa),b(v.v2.positionWorld,v.vertexNormalsModel[1],P),b(v.v3.positionWorld,
|
|
|
+v.vertexNormalsModel[2],T),aa.multiply(va).add(ja),P.multiply(va).add(ja),T.multiply(va).add(ja),ma.addColors(P,T).multiplyScalar(0.5),Sa=h(aa,P,T,ma),f(za,Fa,ea,Ea,Z,fa,0,0,1,0,0,1,Sa)):(V.copy(kb),b(v.centroidModel,v.normalModel,V),V.multiply(va).add(ja),!0===A.wireframe?c(V,A.wireframeLinewidth,A.wireframeLinecap,A.wireframeLinejoin):d(V))):A instanceof THREE.MeshBasicMaterial||A instanceof THREE.MeshLambertMaterial||A instanceof THREE.MeshPhongMaterial?null!==A.map?A.map.mapping instanceof THREE.UVMapping&&
|
|
|
+(Aa=v.uvs[0],e(za,Fa,ea,Ea,Z,fa,Aa[0].x,Aa[0].y,Aa[1].x,Aa[1].y,Aa[2].x,Aa[2].y,A.map)):null!==A.envMap?A.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(wa.copy(v.vertexNormalsModelView[0]),hb=0.5*wa.x+0.5,ib=0.5*wa.y+0.5,wa.copy(v.vertexNormalsModelView[1]),tb=0.5*wa.x+0.5,ub=0.5*wa.y+0.5,wa.copy(v.vertexNormalsModelView[2]),vb=0.5*wa.x+0.5,jb=0.5*wa.y+0.5,e(za,Fa,ea,Ea,Z,fa,hb,ib,tb,ub,vb,jb,A.envMap)):(V.copy(A.color),A.vertexColors===THREE.FaceColors&&V.multiply(v.color),!0===A.wireframe?
|
|
|
+c(V,A.wireframeLinewidth,A.wireframeLinecap,A.wireframeLinejoin):d(V)):A instanceof THREE.MeshDepthMaterial?(Ha=M.near,Xa=M.far,aa.r=aa.g=aa.b=1-q(z.positionScreen.z*z.positionScreen.w,Ha,Xa),P.r=P.g=P.b=1-q(F.positionScreen.z*F.positionScreen.w,Ha,Xa),T.r=T.g=T.b=1-q(J.positionScreen.z*J.positionScreen.w,Ha,Xa),ma.addColors(P,T).multiplyScalar(0.5),Sa=h(aa,P,T,ma),f(za,Fa,ea,Ea,Z,fa,0,0,1,0,0,1,Sa)):A instanceof THREE.MeshNormalMaterial&&(z=void 0,A.shading==THREE.FlatShading?(z=v.normalModelView,
|
|
|
+V.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),!0===A.wireframe?c(V,A.wireframeLinewidth,A.wireframeLinecap,A.wireframeLinejoin):d(V)):A.shading==THREE.SmoothShading&&(z=v.vertexNormalsModelView[0],aa.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),z=v.vertexNormalsModelView[1],P.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),z=v.vertexNormalsModelView[2],T.setRGB(z.x,z.y,z.z).multiplyScalar(0.5).addScalar(0.5),ma.addColors(P,T).multiplyScalar(0.5),Sa=h(aa,P,T,ma),f(za,Fa,
|
|
|
+ea,Ea,Z,fa,0,0,1,0,0,1,Sa)))}}na.union(ta)}}x.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -362,160 +361,148 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
|
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
|
|
|
depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
|
-function c(a,b){var c=b.geometry,h=a.faces3,g=a.faces4,i=3*h.length+4*g.length,k=1*h.length+2*g.length,g=3*h.length+4*g.length,h=d(b,a),m=f(h),l=e(h),n=h.vertexColors?h.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);l&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&(a.__colorArray=new Float32Array(3*i));if(m){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=
|
|
|
-new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*k);a.__lineArray=new Uint16Array(2*g);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<m;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*
|
|
|
-i))}a.__webglFaceCount=3*k;a.__webglLineCount=2*g;if(h.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var k=h.attributes[p],c={},q;for(q in k)c[q]=k[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,g=1,"v2"===c.type?g=2:"v3"===c.type?g=3:"v4"===c.type?g=4:"c"===c.type&&(g=3),c.size=g,c.array=new Float32Array(i*g),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=
|
|
|
-!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){Ta[a]||(j.enableVertexAttribArray(a),Ta[a]=!0)}
|
|
|
-function g(){for(var a in Ta)Ta[a]&&(j.disableVertexAttribArray(a),Ta[a]=!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ha=Qa=null,Na=Fa=fa=W=bb=ab=ca=-1,wa=!0,a[d].render(b,c,Qb,Rb),ha=Qa=null,Na=Fa=fa=W=bb=ab=ca=-1,wa=!0}function m(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;
|
|
|
-h&&L.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);L.setDepthTest(j.depthTest);L.setDepthWrite(j.depthWrite);z(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.setMaterialFaces(j);k instanceof THREE.BufferGeometry?L.renderBufferDirect(d,e,f,j,k,i):L.renderBuffer(d,e,f,j,k,i)}}function n(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&L.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);
|
|
|
-L.setDepthTest(g.depthTest);L.setDepthWrite(g.depthWrite);z(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,g,j)}}function q(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",cc)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k=
|
|
|
-"index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n,p,q;k={};var s=i.morphTargets.length,r=i.morphNormals.length,v=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],n=v?l.materialIndex:0,void 0===k[n]&&(k[n]=
|
|
|
-{hash:n,counter:0}),q=k[n].hash+"_"+k[n].counter,void 0===i.geometryGroups[q]&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:n,vertices:0,numMorphTargets:s,numMorphNormals:r}),p=l instanceof THREE.Face3?3:4,65535<i.geometryGroups[q].vertices+p&&(k[n].counter+=1,q=k[n].hash+"_"+k[n].counter,void 0===i.geometryGroups[q]&&(i.geometryGroups[q]={faces3:[],faces4:[],materialIndex:n,vertices:0,numMorphTargets:s,numMorphNormals:r})),l instanceof THREE.Face3?i.geometryGroups[q].faces3.push(h):i.geometryGroups[q].faces4.push(h),
|
|
|
-i.geometryGroups[q].vertices+=p;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=aa++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();
|
|
|
-i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();s=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];k=0;for(s=i.numMorphTargets;k<s;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(s=i.numMorphNormals;k<s;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}L.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=
|
|
|
-!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglNormalBuffer=j.createBuffer(),L.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__normalArray=new Float32Array(3*i),g.__webglVertexCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
|
|
|
-!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),L.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&
|
|
|
-!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),L.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)t(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=
|
|
|
-f.geometryGroups[e],t(d.__webglObjects,g,a)}else a instanceof THREE.Ribbon||a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,t(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function t(a,b,c){a.push({id:null,buffer:b,object:c,
|
|
|
-opaque:null,transparent:null,z:0})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(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 THREE.Ribbon||a instanceof THREE.Line?v(b.__webglObjects,a):a instanceof THREE.Sprite?y(b.__webglSprites,a):a instanceof THREE.LensFlare?y(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&
|
|
|
-v(b.__webglObjectsImmediate,a);delete a.__webglActive}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function y(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function J(a,b,c,d,e){ma=0;d.needsUpdate&&(d.program&&nc(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Qa&&(j.useProgram(g),Qa=g,f=!0);
|
|
|
-d.id!==Na&&(Na=d.id,f=!0);if(f||a!==ha)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ha&&(ha=a);if(d.skinning)if(Ob&&e.useVertexTexture){if(null!==h.boneTexture){var k=B();j.uniform1i(h.boneTexture,k);L.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=
|
|
|
-c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(wa){for(var m,l=k=0,n=0,p,q,s,r=mb,t=r.directional.colors,v=r.directional.positions,y=r.point.colors,x=r.point.positions,z=r.point.distances,E=r.spot.colors,C=r.spot.positions,J=r.spot.distances,G=r.spot.directions,K=r.spot.anglesCos,N=r.spot.exponents,O=r.hemi.skyColors,M=r.hemi.groundColors,S=r.hemi.positions,aa=0,U=0,T=0,Ia=0,za=0,Q=0,R=0,P=0,Z=m=0,c=s=Z=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||
|
|
|
-(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(L.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(za+=1,m.visible&&(ja.getPositionFromMatrix(m.matrixWorld),La.getPositionFromMatrix(m.target.matrixWorld),ja.sub(La),ja.normalize(),0===ja.x&&0===ja.y&&0===ja.z||(m=3*aa,v[m]=ja.x,v[m+1]=ja.y,v[m+2]=ja.z,L.gammaInput?H(t,m,p,q*q):I(t,m,p,q),aa+=1))):m instanceof THREE.PointLight?(Q+=1,m.visible&&(Z=3*U,L.gammaInput?
|
|
|
-H(y,Z,p,q*q):I(y,Z,p,q),La.getPositionFromMatrix(m.matrixWorld),x[Z]=La.x,x[Z+1]=La.y,x[Z+2]=La.z,z[U]=s,U+=1)):m instanceof THREE.SpotLight?(R+=1,m.visible&&(Z=3*T,L.gammaInput?H(E,Z,p,q*q):I(E,Z,p,q),La.getPositionFromMatrix(m.matrixWorld),C[Z]=La.x,C[Z+1]=La.y,C[Z+2]=La.z,J[T]=s,ja.copy(La),La.getPositionFromMatrix(m.target.matrixWorld),ja.sub(La),ja.normalize(),G[Z]=ja.x,G[Z+1]=ja.y,G[Z+2]=ja.z,K[T]=Math.cos(m.angle),N[T]=m.exponent,T+=1)):m instanceof THREE.HemisphereLight&&(P+=1,m.visible&&
|
|
|
-(ja.getPositionFromMatrix(m.matrixWorld),ja.normalize(),0===ja.x&&0===ja.y&&0===ja.z||(s=3*Ia,S[s]=ja.x,S[s+1]=ja.y,S[s+2]=ja.z,p=m.color,m=m.groundColor,L.gammaInput?(q*=q,H(O,s,p,q),H(M,s,m,q)):(I(O,s,p,q),I(M,s,m,q)),Ia+=1))));c=3*aa;for(f=Math.max(t.length,3*za);c<f;c++)t[c]=0;c=3*U;for(f=Math.max(y.length,3*Q);c<f;c++)y[c]=0;c=3*T;for(f=Math.max(E.length,3*R);c<f;c++)E[c]=0;c=3*Ia;for(f=Math.max(O.length,3*P);c<f;c++)O[c]=0;c=3*Ia;for(f=Math.max(M.length,3*P);c<f;c++)M[c]=0;r.directional.length=
|
|
|
-aa;r.point.length=U;r.spot.length=T;r.hemi.length=Ia;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;wa=!1}c=mb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;
|
|
|
-i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=
|
|
|
-d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var W;d.map?W=d.map:d.specularMap?W=d.specularMap:d.normalMap?W=d.normalMap:d.bumpMap&&(W=d.bumpMap);void 0!==W&&(c=W.offset,W=W.repeat,i.offsetRepeat.value.set(c.x,c.y,W.x,W.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
|
-1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?
|
|
|
-(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=A.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
|
|
|
-(L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=W=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
|
|
|
-THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[W]=k.shadowMap,i.shadowMapSize.value[W]=k.shadowMapSize,i.shadowMatrix.value[W]=k.shadowMatrix,i.shadowDarkness.value[W]=k.shadowDarkness,i.shadowBias.value[W]=k.shadowBias,W++}b=d.uniformsList;i=0;for(W=b.length;i<W;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
|
|
|
-k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
|
|
|
-k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
|
|
|
-new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=B(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Pb),c.image.__webglTextureCube=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
|
|
|
-j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)L.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],y=Fc,t.width<=y&&t.height<=y||(x=Math.max(t.width,t.height),v=Math.floor(t.width*y/x),y=Math.floor(t.height*y/x),x=document.createElement("canvas"),x.width=v,x.height=y,x.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,y),t=x),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=D(c.format);t=D(c.type);F(j.TEXTURE_CUBE_MAP,
|
|
|
-c,n);for(l=0;6>l;l++)if(f){y=k[l].mipmaps;x=0;for(z=y.length;x<z;x++)v=y[x],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,x,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+
|
|
|
-k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=B();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&L.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)La.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,
|
|
|
-La.x,La.y,La.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function B(){var a=ma;a>=Zb&&console.warn("WebGLRenderer: trying to use "+
|
|
|
-a+" texture units while this GPU supports only "+Zb);ma+=1;return a}function H(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function I(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function C(a){a!==nb&&(j.lineWidth(a),nb=a)}function z(a,b,c){Oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Oa=a);if(a&&(vb!==b||db!==c))j.polygonOffset(b,c),vb=b,db=c}function M(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function E(a,
|
|
|
-b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(M(b)),null):c}function F(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,D(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,D(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,D(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,D(b.minFilter))):(j.texParameteri(a,
|
|
|
-j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,x(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,x(b.minFilter)));if(cb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,cb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,$b)),b.__oldAnisotropy=b.anisotropy}function S(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,
|
|
|
-b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function x(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function D(a){if(a===
|
|
|
-THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;
|
|
|
-if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;
|
|
|
-if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;
|
|
|
-if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==fb){if(a===THREE.RGB_S3TC_DXT1_Format)return fb.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
-if(a===THREE.RGBA_S3TC_DXT1_Format)return fb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return fb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return fb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},A=void 0!==a.canvas?a.canvas:document.createElement("canvas"),T=void 0!==a.precision?a.precision:"highp",K=void 0!==a.alpha?a.alpha:!0,ia=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ra=void 0!==a.antialias?
|
|
|
-a.antialias:!1,sa=void 0!==a.stencil?a.stencil:!0,N=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,U=new THREE.Color(0),ba=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),U.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),ba=a.clearAlpha);this.domElement=A;this.context=
|
|
|
-null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=
|
|
|
-8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var L=this,ga=[],Ia=0,Qa=null,za=null,Na=-1,Fa=null,ha=null,aa=0,ma=0,W=-1,fa=-1,ca=-1,Ga=-1,Ja=-1,ta=-1,ab=-1,bb=-1,Oa=null,vb=null,db=null,nb=null,wb=0,Jb=0,Db=0,Kb=0,Qb=0,Rb=0,Ta={},na=new THREE.Frustum,Ka=new THREE.Matrix4,xb=new THREE.Matrix4,La=new THREE.Vector3,ja=new THREE.Vector3,wa=!0,mb=
|
|
|
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,lb,Ea,cb,fb;try{if(!(j=A.getContext("experimental-webgl",{alpha:K,premultipliedAlpha:ia,antialias:ra,stencil:sa,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";}catch(sb){console.error(sb)}lb=j.getExtension("OES_texture_float");
|
|
|
-j.getExtension("OES_texture_float_linear");Ea=j.getExtension("OES_standard_derivatives");cb=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");fb=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");lb||console.log("THREE.WebGLRenderer: Float textures not supported.");Ea||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
|
|
|
-cb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");fb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,
|
|
|
-j.ONE_MINUS_SRC_ALPHA);j.clearColor(U.r,U.g,U.b,ba);this.context=j;var Zb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),Ec=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var Fc=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),$b=cb?j.getParameter(cb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,ac=0<Ec,Ob=ac&&lb;fb&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var Gc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),Hc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);
|
|
|
-j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var Ic=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),Jc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
|
|
|
-j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var Xc=0<Gc.precision&&0<Ic.precision,bc=0<Hc.precision&&0<Jc.precision;"highp"===T&&!Xc&&(bc?(T="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(T="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===T&&!bc&&(T="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return ac};
|
|
|
-this.supportsFloatTextures=function(){return lb};this.supportsStandardDerivatives=function(){return Ea};this.supportsCompressedTextureS3TC=function(){return fb};this.getMaxAnisotropy=function(){return $b};this.getPrecision=function(){return T};this.setSize=function(a,b,c){A.width=a*this.devicePixelRatio;A.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(A.style.width=a+"px",A.style.height=b+"px");this.setViewport(0,0,A.width,A.height)};this.setViewport=function(a,b,c,d){wb=void 0!==
|
|
|
-a?a:0;Jb=void 0!==b?b:0;Db=void 0!==c?c:A.width;Kb=void 0!==d?d:A.height;j.viewport(wb,Jb,Db,Kb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){U.set(a);ba=void 0!==b?b:1;j.clearColor(U.r,U.g,U.b,ba)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=
|
|
|
-function(){return U};this.getClearAlpha=function(){return ba};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Qa=null;Na=
|
|
|
-Fa=bb=ab=ca=-1;wa=!0;fa=W=-1;this.shadowMapPlugin.update(a,b)};var cc=function(a){a=a.target;a.removeEventListener("dispose",cc);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer)}else{if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=
|
|
|
-0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}mc(c)}mc(a)}L.info.memory.geometries--},Pb=function(a){a=a.target;a.removeEventListener("dispose",Pb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));L.info.memory.textures--},kc=function(a){a=a.target;a.removeEventListener("dispose",kc);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=
|
|
|
-0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},lc=function(a){a=a.target;a.removeEventListener("dispose",lc);nc(a)},mc=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);
|
|
|
-void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&
|
|
|
-j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)},nc=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=ga.length;a<c;a++)if(d=ga[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=ga.length;a<c;a++)d=ga[a],d.program!==b&&e.push(d);ga=e;j.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=
|
|
|
-function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,
|
|
|
-3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,m,l,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],m=n[p+5],h=n[p+6],k=n[p+7],l=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,
|
|
|
-3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,
|
|
|
-0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,k,m,l;i=J(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==Fa&&(Fa=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(d=a.index){e=e.offsets;1<e.length&&(c=!0);for(var f=0,n=e.length;f<n;f++){var p=e[f].index;if(c){for(k in a)"index"!==k&&(m=b[k],i=a[k],l=i.itemSize,0<=m&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(m),j.vertexAttribPointer(m,l,j.FLOAT,!1,0,4*p*l)));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
-d.buffer)}j.drawElements(j.TRIANGLES,e[f].count,j.UNSIGNED_SHORT,2*e[f].start);L.info.render.calls++;L.info.render.vertices+=e[f].count;L.info.render.faces+=e[f].count/3}}else{if(c)for(k in a)"index"!==k&&(m=b[k],i=a[k],l=i.itemSize,0<=m&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(m),j.vertexAttribPointer(m,l,j.FLOAT,!1,0,0)));a=e.attributes.position;j.drawArrays(j.TRIANGLES,0,a.numItems/3);L.info.render.calls++;L.info.render.vertices+=a.numItems/3;L.info.render.faces+=a.numItems/3/3}else if(f instanceof
|
|
|
-THREE.ParticleSystem){if(c){for(k in a)m=b[k],i=a[k],l=i.itemSize,0<=m&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(m),j.vertexAttribPointer(m,l,j.FLOAT,!1,0,0));a=a.position;j.drawArrays(j.POINTS,0,a.numItems/3);L.info.render.calls++;L.info.render.points+=a.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in a)m=b[k],i=a[k],l=i.itemSize,0<=m&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(m),j.vertexAttribPointer(m,l,j.FLOAT,!1,0,0));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;C(d.linewidth);a=a.position;
|
|
|
-j.drawArrays(k,0,a.numItems/3);L.info.render.calls++;L.info.render.points+=a.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,m,c=J(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Fa&&(Fa=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var l=0;m=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;l<d.numSupportedMorphTargets&&l<m.length;)0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m[l]]),
|
|
|
-h(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m[l]]),h(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=i[m[l]],l++}else{m=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)l=i[n],0<l&&m.push([l,n]);m.length>d.numSupportedMorphTargets?(m.sort(k),m.length=d.numSupportedMorphTargets):m.length>
|
|
|
-d.numSupportedMorphNormals?m.sort(k):0===m.length&&m.push([0,0]);for(l=0;l<d.numSupportedMorphTargets;)m[l]?(n=m[l][1],0<=c["morphTarget"+l]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),h(c["morphTarget"+l]),j.vertexAttribPointer(c["morphTarget"+l],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+l]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+l]),j.vertexAttribPointer(c["morphNormal"+l],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[l]=
|
|
|
-i[n]):f.__webglMorphTargetInfluences[l]=0,l++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){i=0;for(m=e.__webglCustomAttributesList.length;i<m;i++)c=e.__webglCustomAttributesList[i],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&
|
|
|
-(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,
|
|
|
-1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(C(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:
|
|
|
-j.LINES,C(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),L.info.render.calls++)}};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,p=a.fog;Na=-1;wa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ka.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);na.setFromMatrix(Ka);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,
|
|
|
-this.autoClearStencil);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||na.intersectsObject(g))){var q=g;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,s=q.buffer,r=void 0,t=r=void 0,t=q.object.material;if(t instanceof THREE.MeshFaceMaterial)r=s.materialIndex,r=t.materials[r],r.transparent?
|
|
|
-(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);else if(r=t)r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(La.getPositionFromMatrix(g.matrixWorld),La.applyProjection(Ka),f.z=La.z))}this.sortObjects&&h.sort(i);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),z(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,k,p,!0,d),n(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(a.__webglObjects,!0,"opaque",b,k,p,!1,d),n(a.__webglObjectsImmediate,
|
|
|
-"opaque",b,k,p,!1,d),m(a.__webglObjects,!1,"transparent",b,k,p,!0,d),n(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
|
|
|
-null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=J(a,b,c,d,e);Fa=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,na):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)q(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),q(h,a));var i=h,l=i.geometry,m=void 0,n=void 0,t=void 0;if(l instanceof THREE.BufferGeometry){var v=j.DYNAMIC_DRAW,y=!l.dynamic,x=l.attributes,A=void 0,z=void 0;for(A in x)z=x[A],z.needsUpdate&&("index"===A?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,z.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,z.array,v)):(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-z.buffer),j.bufferData(j.ARRAY_BUFFER,z.array,v)),z.needsUpdate=!1),y&&!z.dynamic&&(z.array=null)}else if(i instanceof THREE.Mesh){for(var D=0,E=l.geometryGroupsList.length;D<E;D++)if(m=l.geometryGroupsList[D],t=d(i,m),l.buffersNeedUpdate&&c(m,i),n=t.attributes&&p(t),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||n){var B=m,H=i,C=j.DYNAMIC_DRAW,J=!l.dynamic,I=t;if(B.__inittedArrays){var K=e(I),L=
|
|
|
-I.vertexColors?I.vertexColors:!1,N=f(I),M=K===THREE.SmoothShading,G=void 0,F=void 0,S=void 0,O=void 0,aa=void 0,W=void 0,T=void 0,U=void 0,Ia=void 0,za=void 0,ma=void 0,Q=void 0,R=void 0,P=void 0,Z=void 0,ba=void 0,ca=void 0,Qa=void 0,fa=void 0,ha=void 0,Na=void 0,Fa=void 0,ta=void 0,ga=void 0,ia=void 0,ja=void 0,Ga=void 0,na=void 0,ra=void 0,sa=void 0,Oa=void 0,wa=void 0,Ja=void 0,Ea=void 0,ab=void 0,oa=void 0,fb=void 0,Ta=void 0,bb=void 0,cb=void 0,Ua=void 0,nb=void 0,Ra=void 0,Sa=void 0,db=void 0,
|
|
|
-Eb=void 0,Ha=0,Pa=0,Fb=0,Gb=0,ob=0,Za=0,ua=0,eb=0,Ma=0,X=0,da=0,w=0,pa=void 0,Va=B.__vertexArray,lb=B.__uvArray,mb=B.__uv2Array,pb=B.__normalArray,Aa=B.__tangentArray,Wa=B.__colorArray,Ba=B.__skinIndexArray,Ca=B.__skinWeightArray,sb=B.__morphTargetsArrays,vb=B.__morphNormalsArrays,wb=B.__webglCustomAttributesList,u=void 0,yb=B.__faceArray,kb=B.__lineArray,gb=H.geometry,Jb=gb.elementsNeedUpdate,Db=gb.uvsNeedUpdate,Kb=gb.normalsNeedUpdate,Qb=gb.tangentsNeedUpdate,Rb=gb.colorsNeedUpdate,ac=gb.morphTargetsNeedUpdate,
|
|
|
-Sb=gb.vertices,ka=B.faces3,la=B.faces4,$a=gb.faces,Ob=gb.faceVertexUvs[0],Pb=gb.faceVertexUvs[1],Tb=gb.skinIndices,Lb=gb.skinWeights,Mb=gb.morphTargets,oc=gb.morphNormals;if(gb.verticesNeedUpdate){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],Q=Sb[O.a],R=Sb[O.b],P=Sb[O.c],Va[Pa]=Q.x,Va[Pa+1]=Q.y,Va[Pa+2]=Q.z,Va[Pa+3]=R.x,Va[Pa+4]=R.y,Va[Pa+5]=R.z,Va[Pa+6]=P.x,Va[Pa+7]=P.y,Va[Pa+8]=P.z,Pa+=9;G=0;for(F=la.length;G<F;G++)O=$a[la[G]],Q=Sb[O.a],R=Sb[O.b],P=Sb[O.c],Z=Sb[O.d],Va[Pa]=Q.x,Va[Pa+1]=Q.y,Va[Pa+2]=
|
|
|
-Q.z,Va[Pa+3]=R.x,Va[Pa+4]=R.y,Va[Pa+5]=R.z,Va[Pa+6]=P.x,Va[Pa+7]=P.y,Va[Pa+8]=P.z,Va[Pa+9]=Z.x,Va[Pa+10]=Z.y,Va[Pa+11]=Z.z,Pa+=12;j.bindBuffer(j.ARRAY_BUFFER,B.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Va,C)}if(ac){Ua=0;for(nb=Mb.length;Ua<nb;Ua++){G=da=0;for(F=ka.length;G<F;G++)db=ka[G],O=$a[db],Q=Mb[Ua].vertices[O.a],R=Mb[Ua].vertices[O.b],P=Mb[Ua].vertices[O.c],Ra=sb[Ua],Ra[da]=Q.x,Ra[da+1]=Q.y,Ra[da+2]=Q.z,Ra[da+3]=R.x,Ra[da+4]=R.y,Ra[da+5]=R.z,Ra[da+6]=P.x,Ra[da+7]=P.y,Ra[da+8]=P.z,I.morphNormals&&
|
|
|
-(M?(Eb=oc[Ua].vertexNormals[db],ha=Eb.a,Na=Eb.b,Fa=Eb.c):Fa=Na=ha=oc[Ua].faceNormals[db],Sa=vb[Ua],Sa[da]=ha.x,Sa[da+1]=ha.y,Sa[da+2]=ha.z,Sa[da+3]=Na.x,Sa[da+4]=Na.y,Sa[da+5]=Na.z,Sa[da+6]=Fa.x,Sa[da+7]=Fa.y,Sa[da+8]=Fa.z),da+=9;G=0;for(F=la.length;G<F;G++)db=la[G],O=$a[db],Q=Mb[Ua].vertices[O.a],R=Mb[Ua].vertices[O.b],P=Mb[Ua].vertices[O.c],Z=Mb[Ua].vertices[O.d],Ra=sb[Ua],Ra[da]=Q.x,Ra[da+1]=Q.y,Ra[da+2]=Q.z,Ra[da+3]=R.x,Ra[da+4]=R.y,Ra[da+5]=R.z,Ra[da+6]=P.x,Ra[da+7]=P.y,Ra[da+8]=P.z,Ra[da+9]=
|
|
|
-Z.x,Ra[da+10]=Z.y,Ra[da+11]=Z.z,I.morphNormals&&(M?(Eb=oc[Ua].vertexNormals[db],ha=Eb.a,Na=Eb.b,Fa=Eb.c,ta=Eb.d):ta=Fa=Na=ha=oc[Ua].faceNormals[db],Sa=vb[Ua],Sa[da]=ha.x,Sa[da+1]=ha.y,Sa[da+2]=ha.z,Sa[da+3]=Na.x,Sa[da+4]=Na.y,Sa[da+5]=Na.z,Sa[da+6]=Fa.x,Sa[da+7]=Fa.y,Sa[da+8]=Fa.z,Sa[da+9]=ta.x,Sa[da+10]=ta.y,Sa[da+11]=ta.z),da+=12;j.bindBuffer(j.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[Ua]);j.bufferData(j.ARRAY_BUFFER,sb[Ua],C);I.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,B.__webglMorphNormalsBuffers[Ua]),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,vb[Ua],C))}}if(Lb.length){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],na=Lb[O.a],ra=Lb[O.b],sa=Lb[O.c],Ca[X]=na.x,Ca[X+1]=na.y,Ca[X+2]=na.z,Ca[X+3]=na.w,Ca[X+4]=ra.x,Ca[X+5]=ra.y,Ca[X+6]=ra.z,Ca[X+7]=ra.w,Ca[X+8]=sa.x,Ca[X+9]=sa.y,Ca[X+10]=sa.z,Ca[X+11]=sa.w,wa=Tb[O.a],Ja=Tb[O.b],Ea=Tb[O.c],Ba[X]=wa.x,Ba[X+1]=wa.y,Ba[X+2]=wa.z,Ba[X+3]=wa.w,Ba[X+4]=Ja.x,Ba[X+5]=Ja.y,Ba[X+6]=Ja.z,Ba[X+7]=Ja.w,Ba[X+8]=Ea.x,Ba[X+9]=Ea.y,Ba[X+10]=Ea.z,Ba[X+11]=Ea.w,X+=12;G=0;for(F=la.length;G<F;G++)O=
|
|
|
-$a[la[G]],na=Lb[O.a],ra=Lb[O.b],sa=Lb[O.c],Oa=Lb[O.d],Ca[X]=na.x,Ca[X+1]=na.y,Ca[X+2]=na.z,Ca[X+3]=na.w,Ca[X+4]=ra.x,Ca[X+5]=ra.y,Ca[X+6]=ra.z,Ca[X+7]=ra.w,Ca[X+8]=sa.x,Ca[X+9]=sa.y,Ca[X+10]=sa.z,Ca[X+11]=sa.w,Ca[X+12]=Oa.x,Ca[X+13]=Oa.y,Ca[X+14]=Oa.z,Ca[X+15]=Oa.w,wa=Tb[O.a],Ja=Tb[O.b],Ea=Tb[O.c],ab=Tb[O.d],Ba[X]=wa.x,Ba[X+1]=wa.y,Ba[X+2]=wa.z,Ba[X+3]=wa.w,Ba[X+4]=Ja.x,Ba[X+5]=Ja.y,Ba[X+6]=Ja.z,Ba[X+7]=Ja.w,Ba[X+8]=Ea.x,Ba[X+9]=Ea.y,Ba[X+10]=Ea.z,Ba[X+11]=Ea.w,Ba[X+12]=ab.x,Ba[X+13]=ab.y,Ba[X+14]=
|
|
|
-ab.z,Ba[X+15]=ab.w,X+=16;0<X&&(j.bindBuffer(j.ARRAY_BUFFER,B.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Ba,C),j.bindBuffer(j.ARRAY_BUFFER,B.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Ca,C))}if(Rb&&L){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],T=O.vertexColors,U=O.color,3===T.length&&L===THREE.VertexColors?(ga=T[0],ia=T[1],ja=T[2]):ja=ia=ga=U,Wa[Ma]=ga.r,Wa[Ma+1]=ga.g,Wa[Ma+2]=ga.b,Wa[Ma+3]=ia.r,Wa[Ma+4]=ia.g,Wa[Ma+5]=ia.b,Wa[Ma+6]=ja.r,Wa[Ma+7]=ja.g,Wa[Ma+8]=ja.b,Ma+=9;G=0;for(F=
|
|
|
-la.length;G<F;G++)O=$a[la[G]],T=O.vertexColors,U=O.color,4===T.length&&L===THREE.VertexColors?(ga=T[0],ia=T[1],ja=T[2],Ga=T[3]):Ga=ja=ia=ga=U,Wa[Ma]=ga.r,Wa[Ma+1]=ga.g,Wa[Ma+2]=ga.b,Wa[Ma+3]=ia.r,Wa[Ma+4]=ia.g,Wa[Ma+5]=ia.b,Wa[Ma+6]=ja.r,Wa[Ma+7]=ja.g,Wa[Ma+8]=ja.b,Wa[Ma+9]=Ga.r,Wa[Ma+10]=Ga.g,Wa[Ma+11]=Ga.b,Ma+=12;0<Ma&&(j.bindBuffer(j.ARRAY_BUFFER,B.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,C))}if(Qb&&gb.hasTangents){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],Ia=O.vertexTangents,ba=Ia[0],
|
|
|
-ca=Ia[1],Qa=Ia[2],Aa[ua]=ba.x,Aa[ua+1]=ba.y,Aa[ua+2]=ba.z,Aa[ua+3]=ba.w,Aa[ua+4]=ca.x,Aa[ua+5]=ca.y,Aa[ua+6]=ca.z,Aa[ua+7]=ca.w,Aa[ua+8]=Qa.x,Aa[ua+9]=Qa.y,Aa[ua+10]=Qa.z,Aa[ua+11]=Qa.w,ua+=12;G=0;for(F=la.length;G<F;G++)O=$a[la[G]],Ia=O.vertexTangents,ba=Ia[0],ca=Ia[1],Qa=Ia[2],fa=Ia[3],Aa[ua]=ba.x,Aa[ua+1]=ba.y,Aa[ua+2]=ba.z,Aa[ua+3]=ba.w,Aa[ua+4]=ca.x,Aa[ua+5]=ca.y,Aa[ua+6]=ca.z,Aa[ua+7]=ca.w,Aa[ua+8]=Qa.x,Aa[ua+9]=Qa.y,Aa[ua+10]=Qa.z,Aa[ua+11]=Qa.w,Aa[ua+12]=fa.x,Aa[ua+13]=fa.y,Aa[ua+14]=fa.z,
|
|
|
-Aa[ua+15]=fa.w,ua+=16;j.bindBuffer(j.ARRAY_BUFFER,B.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Aa,C)}if(Kb&&K){G=0;for(F=ka.length;G<F;G++)if(O=$a[ka[G]],aa=O.vertexNormals,W=O.normal,3===aa.length&&M)for(oa=0;3>oa;oa++)Ta=aa[oa],pb[Za]=Ta.x,pb[Za+1]=Ta.y,pb[Za+2]=Ta.z,Za+=3;else for(oa=0;3>oa;oa++)pb[Za]=W.x,pb[Za+1]=W.y,pb[Za+2]=W.z,Za+=3;G=0;for(F=la.length;G<F;G++)if(O=$a[la[G]],aa=O.vertexNormals,W=O.normal,4===aa.length&&M)for(oa=0;4>oa;oa++)Ta=aa[oa],pb[Za]=Ta.x,pb[Za+1]=Ta.y,pb[Za+
|
|
|
-2]=Ta.z,Za+=3;else for(oa=0;4>oa;oa++)pb[Za]=W.x,pb[Za+1]=W.y,pb[Za+2]=W.z,Za+=3;j.bindBuffer(j.ARRAY_BUFFER,B.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,pb,C)}if(Db&&Ob&&N){G=0;for(F=ka.length;G<F;G++)if(S=ka[G],za=Ob[S],void 0!==za)for(oa=0;3>oa;oa++)bb=za[oa],lb[Fb]=bb.x,lb[Fb+1]=bb.y,Fb+=2;G=0;for(F=la.length;G<F;G++)if(S=la[G],za=Ob[S],void 0!==za)for(oa=0;4>oa;oa++)bb=za[oa],lb[Fb]=bb.x,lb[Fb+1]=bb.y,Fb+=2;0<Fb&&(j.bindBuffer(j.ARRAY_BUFFER,B.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-lb,C))}if(Db&&Pb&&N){G=0;for(F=ka.length;G<F;G++)if(S=ka[G],ma=Pb[S],void 0!==ma)for(oa=0;3>oa;oa++)cb=ma[oa],mb[Gb]=cb.x,mb[Gb+1]=cb.y,Gb+=2;G=0;for(F=la.length;G<F;G++)if(S=la[G],ma=Pb[S],void 0!==ma)for(oa=0;4>oa;oa++)cb=ma[oa],mb[Gb]=cb.x,mb[Gb+1]=cb.y,Gb+=2;0<Gb&&(j.bindBuffer(j.ARRAY_BUFFER,B.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,mb,C))}if(Jb){G=0;for(F=ka.length;G<F;G++)yb[ob]=Ha,yb[ob+1]=Ha+1,yb[ob+2]=Ha+2,ob+=3,kb[eb]=Ha,kb[eb+1]=Ha+1,kb[eb+2]=Ha,kb[eb+3]=Ha+2,kb[eb+4]=Ha+1,kb[eb+
|
|
|
-5]=Ha+2,eb+=6,Ha+=3;G=0;for(F=la.length;G<F;G++)yb[ob]=Ha,yb[ob+1]=Ha+1,yb[ob+2]=Ha+3,yb[ob+3]=Ha+1,yb[ob+4]=Ha+2,yb[ob+5]=Ha+3,ob+=6,kb[eb]=Ha,kb[eb+1]=Ha+1,kb[eb+2]=Ha,kb[eb+3]=Ha+3,kb[eb+4]=Ha+1,kb[eb+5]=Ha+2,kb[eb+6]=Ha+2,kb[eb+7]=Ha+3,eb+=8,Ha+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,yb,C);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,kb,C)}if(wb){oa=0;for(fb=wb.length;oa<fb;oa++)if(u=wb[oa],
|
|
|
-u.__original.needsUpdate){w=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],u.array[w]=u.value[O.a],u.array[w+1]=u.value[O.b],u.array[w+2]=u.value[O.c],w+=3;G=0;for(F=la.length;G<F;G++)O=$a[la[G]],u.array[w]=u.value[O.a],u.array[w+1]=u.value[O.b],u.array[w+2]=u.value[O.c],u.array[w+3]=u.value[O.d],w+=4}else{if("faces"===u.boundTo){G=0;for(F=ka.length;G<F;G++)pa=u.value[ka[G]],u.array[w]=pa,u.array[w+1]=pa,u.array[w+2]=pa,w+=3;G=0;for(F=la.length;G<
|
|
|
-F;G++)pa=u.value[la[G]],u.array[w]=pa,u.array[w+1]=pa,u.array[w+2]=pa,u.array[w+3]=pa,w+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],Q=u.value[O.a],R=u.value[O.b],P=u.value[O.c],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=R.x,u.array[w+3]=R.y,u.array[w+4]=P.x,u.array[w+5]=P.y,w+=6;G=0;for(F=la.length;G<F;G++)O=$a[la[G]],Q=u.value[O.a],R=u.value[O.b],P=u.value[O.c],Z=u.value[O.d],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=R.x,u.array[w+
|
|
|
-3]=R.y,u.array[w+4]=P.x,u.array[w+5]=P.y,u.array[w+6]=Z.x,u.array[w+7]=Z.y,w+=8}else{if("faces"===u.boundTo){G=0;for(F=ka.length;G<F;G++)P=R=Q=pa=u.value[ka[G]],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=R.x,u.array[w+3]=R.y,u.array[w+4]=P.x,u.array[w+5]=P.y,w+=6;G=0;for(F=la.length;G<F;G++)Z=P=R=Q=pa=u.value[la[G]],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=R.x,u.array[w+3]=R.y,u.array[w+4]=P.x,u.array[w+5]=P.y,u.array[w+6]=Z.x,u.array[w+7]=Z.y,w+=8}}else if(3===u.size){var V;V="c"===u.type?
|
|
|
-["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){G=0;for(F=ka.length;G<F;G++)O=$a[ka[G]],Q=u.value[O.a],R=u.value[O.b],P=u.value[O.c],u.array[w]=Q[V[0]],u.array[w+1]=Q[V[1]],u.array[w+2]=Q[V[2]],u.array[w+3]=R[V[0]],u.array[w+4]=R[V[1]],u.array[w+5]=R[V[2]],u.array[w+6]=P[V[0]],u.array[w+7]=P[V[1]],u.array[w+8]=P[V[2]],w+=9;G=0;for(F=la.length;G<F;G++)O=$a[la[G]],Q=u.value[O.a],R=u.value[O.b],P=u.value[O.c],Z=u.value[O.d],u.array[w]=Q[V[0]],u.array[w+1]=Q[V[1]],u.array[w+
|
|
|
-2]=Q[V[2]],u.array[w+3]=R[V[0]],u.array[w+4]=R[V[1]],u.array[w+5]=R[V[2]],u.array[w+6]=P[V[0]],u.array[w+7]=P[V[1]],u.array[w+8]=P[V[2]],u.array[w+9]=Z[V[0]],u.array[w+10]=Z[V[1]],u.array[w+11]=Z[V[2]],w+=12}else if("faces"===u.boundTo){G=0;for(F=ka.length;G<F;G++)P=R=Q=pa=u.value[ka[G]],u.array[w]=Q[V[0]],u.array[w+1]=Q[V[1]],u.array[w+2]=Q[V[2]],u.array[w+3]=R[V[0]],u.array[w+4]=R[V[1]],u.array[w+5]=R[V[2]],u.array[w+6]=P[V[0]],u.array[w+7]=P[V[1]],u.array[w+8]=P[V[2]],w+=9;G=0;for(F=la.length;G<
|
|
|
-F;G++)Z=P=R=Q=pa=u.value[la[G]],u.array[w]=Q[V[0]],u.array[w+1]=Q[V[1]],u.array[w+2]=Q[V[2]],u.array[w+3]=R[V[0]],u.array[w+4]=R[V[1]],u.array[w+5]=R[V[2]],u.array[w+6]=P[V[0]],u.array[w+7]=P[V[1]],u.array[w+8]=P[V[2]],u.array[w+9]=Z[V[0]],u.array[w+10]=Z[V[1]],u.array[w+11]=Z[V[2]],w+=12}else if("faceVertices"===u.boundTo){G=0;for(F=ka.length;G<F;G++)pa=u.value[ka[G]],Q=pa[0],R=pa[1],P=pa[2],u.array[w]=Q[V[0]],u.array[w+1]=Q[V[1]],u.array[w+2]=Q[V[2]],u.array[w+3]=R[V[0]],u.array[w+4]=R[V[1]],u.array[w+
|
|
|
-5]=R[V[2]],u.array[w+6]=P[V[0]],u.array[w+7]=P[V[1]],u.array[w+8]=P[V[2]],w+=9;G=0;for(F=la.length;G<F;G++)pa=u.value[la[G]],Q=pa[0],R=pa[1],P=pa[2],Z=pa[3],u.array[w]=Q[V[0]],u.array[w+1]=Q[V[1]],u.array[w+2]=Q[V[2]],u.array[w+3]=R[V[0]],u.array[w+4]=R[V[1]],u.array[w+5]=R[V[2]],u.array[w+6]=P[V[0]],u.array[w+7]=P[V[1]],u.array[w+8]=P[V[2]],u.array[w+9]=Z[V[0]],u.array[w+10]=Z[V[1]],u.array[w+11]=Z[V[2]],w+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){G=0;for(F=ka.length;G<
|
|
|
-F;G++)O=$a[ka[G]],Q=u.value[O.a],R=u.value[O.b],P=u.value[O.c],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=Q.z,u.array[w+3]=Q.w,u.array[w+4]=R.x,u.array[w+5]=R.y,u.array[w+6]=R.z,u.array[w+7]=R.w,u.array[w+8]=P.x,u.array[w+9]=P.y,u.array[w+10]=P.z,u.array[w+11]=P.w,w+=12;G=0;for(F=la.length;G<F;G++)O=$a[la[G]],Q=u.value[O.a],R=u.value[O.b],P=u.value[O.c],Z=u.value[O.d],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=Q.z,u.array[w+3]=Q.w,u.array[w+4]=R.x,u.array[w+5]=R.y,u.array[w+6]=R.z,u.array[w+7]=
|
|
|
-R.w,u.array[w+8]=P.x,u.array[w+9]=P.y,u.array[w+10]=P.z,u.array[w+11]=P.w,u.array[w+12]=Z.x,u.array[w+13]=Z.y,u.array[w+14]=Z.z,u.array[w+15]=Z.w,w+=16}else if("faces"===u.boundTo){G=0;for(F=ka.length;G<F;G++)P=R=Q=pa=u.value[ka[G]],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=Q.z,u.array[w+3]=Q.w,u.array[w+4]=R.x,u.array[w+5]=R.y,u.array[w+6]=R.z,u.array[w+7]=R.w,u.array[w+8]=P.x,u.array[w+9]=P.y,u.array[w+10]=P.z,u.array[w+11]=P.w,w+=12;G=0;for(F=la.length;G<F;G++)Z=P=R=Q=pa=u.value[la[G]],u.array[w]=
|
|
|
-Q.x,u.array[w+1]=Q.y,u.array[w+2]=Q.z,u.array[w+3]=Q.w,u.array[w+4]=R.x,u.array[w+5]=R.y,u.array[w+6]=R.z,u.array[w+7]=R.w,u.array[w+8]=P.x,u.array[w+9]=P.y,u.array[w+10]=P.z,u.array[w+11]=P.w,u.array[w+12]=Z.x,u.array[w+13]=Z.y,u.array[w+14]=Z.z,u.array[w+15]=Z.w,w+=16}else if("faceVertices"===u.boundTo){G=0;for(F=ka.length;G<F;G++)pa=u.value[ka[G]],Q=pa[0],R=pa[1],P=pa[2],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=Q.z,u.array[w+3]=Q.w,u.array[w+4]=R.x,u.array[w+5]=R.y,u.array[w+6]=R.z,u.array[w+
|
|
|
-7]=R.w,u.array[w+8]=P.x,u.array[w+9]=P.y,u.array[w+10]=P.z,u.array[w+11]=P.w,w+=12;G=0;for(F=la.length;G<F;G++)pa=u.value[la[G]],Q=pa[0],R=pa[1],P=pa[2],Z=pa[3],u.array[w]=Q.x,u.array[w+1]=Q.y,u.array[w+2]=Q.z,u.array[w+3]=Q.w,u.array[w+4]=R.x,u.array[w+5]=R.y,u.array[w+6]=R.z,u.array[w+7]=R.w,u.array[w+8]=P.x,u.array[w+9]=P.y,u.array[w+10]=P.z,u.array[w+11]=P.w,u.array[w+12]=Z.x,u.array[w+13]=Z.y,u.array[w+14]=Z.z,u.array[w+15]=Z.w,w+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-u.array,C)}}J&&(delete B.__inittedArrays,delete B.__colorArray,delete B.__normalArray,delete B.__tangentArray,delete B.__uvArray,delete B.__uv2Array,delete B.__faceArray,delete B.__vertexArray,delete B.__lineArray,delete B.__skinIndexArray,delete B.__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;t.attributes&&s(t)}else if(i instanceof THREE.Ribbon){t=
|
|
|
-d(i,l);n=t.attributes&&p(t);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.normalsNeedUpdate||n){var qb=l,pc=j.DYNAMIC_DRAW,dc=void 0,ec=void 0,fc=void 0,qc=void 0,qa=void 0,rc=void 0,sc=void 0,tc=void 0,Zb=void 0,Xa=void 0,Wb=void 0,xa=void 0,hb=void 0,$b=qb.vertices,bc=qb.colors,cc=qb.normals,kc=$b.length,lc=bc.length,mc=cc.length,uc=qb.__vertexArray,vc=qb.__colorArray,wc=qb.__normalArray,nc=qb.colorsNeedUpdate,Ec=qb.normalsNeedUpdate,Kc=qb.__webglCustomAttributesList;if(qb.verticesNeedUpdate){for(dc=
|
|
|
-0;dc<kc;dc++)qc=$b[dc],qa=3*dc,uc[qa]=qc.x,uc[qa+1]=qc.y,uc[qa+2]=qc.z;j.bindBuffer(j.ARRAY_BUFFER,qb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,uc,pc)}if(nc){for(ec=0;ec<lc;ec++)rc=bc[ec],qa=3*ec,vc[qa]=rc.r,vc[qa+1]=rc.g,vc[qa+2]=rc.b;j.bindBuffer(j.ARRAY_BUFFER,qb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,vc,pc)}if(Ec){for(fc=0;fc<mc;fc++)sc=cc[fc],qa=3*fc,wc[qa]=sc.x,wc[qa+1]=sc.y,wc[qa+2]=sc.z;j.bindBuffer(j.ARRAY_BUFFER,qb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,wc,pc)}if(Kc){tc=
|
|
|
-0;for(Zb=Kc.length;tc<Zb;tc++)if(xa=Kc[tc],xa.needsUpdate&&(void 0===xa.boundTo||"vertices"===xa.boundTo)){qa=0;Wb=xa.value.length;if(1===xa.size)for(Xa=0;Xa<Wb;Xa++)xa.array[Xa]=xa.value[Xa];else if(2===xa.size)for(Xa=0;Xa<Wb;Xa++)hb=xa.value[Xa],xa.array[qa]=hb.x,xa.array[qa+1]=hb.y,qa+=2;else if(3===xa.size)if("c"===xa.type)for(Xa=0;Xa<Wb;Xa++)hb=xa.value[Xa],xa.array[qa]=hb.r,xa.array[qa+1]=hb.g,xa.array[qa+2]=hb.b,qa+=3;else for(Xa=0;Xa<Wb;Xa++)hb=xa.value[Xa],xa.array[qa]=hb.x,xa.array[qa+1]=
|
|
|
-hb.y,xa.array[qa+2]=hb.z,qa+=3;else if(4===xa.size)for(Xa=0;Xa<Wb;Xa++)hb=xa.value[Xa],xa.array[qa]=hb.x,xa.array[qa+1]=hb.y,xa.array[qa+2]=hb.z,xa.array[qa+3]=hb.w,qa+=4;j.bindBuffer(j.ARRAY_BUFFER,xa.buffer);j.bufferData(j.ARRAY_BUFFER,xa.array,pc)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.normalsNeedUpdate=!1;t.attributes&&s(t)}else if(i instanceof THREE.Line){t=d(i,l);n=t.attributes&&p(t);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||n){var rb=l,xc=j.DYNAMIC_DRAW,
|
|
|
-gc=void 0,hc=void 0,ic=void 0,yc=void 0,Da=void 0,zc=void 0,Pc=rb.vertices,Qc=rb.colors,Rc=rb.lineDistances,Fc=Pc.length,Gc=Qc.length,Hc=Rc.length,Ac=rb.__vertexArray,Bc=rb.__colorArray,Sc=rb.__lineDistanceArray,Ic=rb.colorsNeedUpdate,Jc=rb.lineDistancesNeedUpdate,Lc=rb.__webglCustomAttributesList,Cc=void 0,Tc=void 0,Ya=void 0,Xb=void 0,ib=void 0,ya=void 0;if(rb.verticesNeedUpdate){for(gc=0;gc<Fc;gc++)yc=Pc[gc],Da=3*gc,Ac[Da]=yc.x,Ac[Da+1]=yc.y,Ac[Da+2]=yc.z;j.bindBuffer(j.ARRAY_BUFFER,rb.__webglVertexBuffer);
|
|
|
-j.bufferData(j.ARRAY_BUFFER,Ac,xc)}if(Ic){for(hc=0;hc<Gc;hc++)zc=Qc[hc],Da=3*hc,Bc[Da]=zc.r,Bc[Da+1]=zc.g,Bc[Da+2]=zc.b;j.bindBuffer(j.ARRAY_BUFFER,rb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Bc,xc)}if(Jc){for(ic=0;ic<Hc;ic++)Sc[ic]=Rc[ic];j.bindBuffer(j.ARRAY_BUFFER,rb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,xc)}if(Lc){Cc=0;for(Tc=Lc.length;Cc<Tc;Cc++)if(ya=Lc[Cc],ya.needsUpdate&&(void 0===ya.boundTo||"vertices"===ya.boundTo)){Da=0;Xb=ya.value.length;if(1===ya.size)for(Ya=
|
|
|
-0;Ya<Xb;Ya++)ya.array[Ya]=ya.value[Ya];else if(2===ya.size)for(Ya=0;Ya<Xb;Ya++)ib=ya.value[Ya],ya.array[Da]=ib.x,ya.array[Da+1]=ib.y,Da+=2;else if(3===ya.size)if("c"===ya.type)for(Ya=0;Ya<Xb;Ya++)ib=ya.value[Ya],ya.array[Da]=ib.r,ya.array[Da+1]=ib.g,ya.array[Da+2]=ib.b,Da+=3;else for(Ya=0;Ya<Xb;Ya++)ib=ya.value[Ya],ya.array[Da]=ib.x,ya.array[Da+1]=ib.y,ya.array[Da+2]=ib.z,Da+=3;else if(4===ya.size)for(Ya=0;Ya<Xb;Ya++)ib=ya.value[Ya],ya.array[Da]=ib.x,ya.array[Da+1]=ib.y,ya.array[Da+2]=ib.z,ya.array[Da+
|
|
|
-3]=ib.w,Da+=4;j.bindBuffer(j.ARRAY_BUFFER,ya.buffer);j.bufferData(j.ARRAY_BUFFER,ya.array,xc)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;t.attributes&&s(t)}else if(i instanceof THREE.ParticleSystem){t=d(i,l);n=t.attributes&&p(t);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||n){var zb=l,Mc=j.DYNAMIC_DRAW,jc=i,jb=void 0,Ab=void 0,Bb=void 0,$=void 0,Cb=void 0,Nb=void 0,Dc=zb.vertices,Nc=Dc.length,Oc=zb.colors,Uc=Oc.length,Ub=zb.__vertexArray,Vb=zb.__colorArray,
|
|
|
-Hb=zb.__sortArray,Vc=zb.verticesNeedUpdate,Wc=zb.colorsNeedUpdate,Ib=zb.__webglCustomAttributesList,tb=void 0,Yb=void 0,ea=void 0,ub=void 0,va=void 0,Y=void 0;if(jc.sortParticles){xb.copy(Ka);xb.multiply(jc.matrixWorld);for(jb=0;jb<Nc;jb++)Bb=Dc[jb],La.copy(Bb),La.applyProjection(xb),Hb[jb]=[La.z,jb];Hb.sort(k);for(jb=0;jb<Nc;jb++)Bb=Dc[Hb[jb][1]],$=3*jb,Ub[$]=Bb.x,Ub[$+1]=Bb.y,Ub[$+2]=Bb.z;for(Ab=0;Ab<Uc;Ab++)$=3*Ab,Nb=Oc[Hb[Ab][1]],Vb[$]=Nb.r,Vb[$+1]=Nb.g,Vb[$+2]=Nb.b;if(Ib){tb=0;for(Yb=Ib.length;tb<
|
|
|
-Yb;tb++)if(Y=Ib[tb],void 0===Y.boundTo||"vertices"===Y.boundTo)if($=0,ub=Y.value.length,1===Y.size)for(ea=0;ea<ub;ea++)Cb=Hb[ea][1],Y.array[ea]=Y.value[Cb];else if(2===Y.size)for(ea=0;ea<ub;ea++)Cb=Hb[ea][1],va=Y.value[Cb],Y.array[$]=va.x,Y.array[$+1]=va.y,$+=2;else if(3===Y.size)if("c"===Y.type)for(ea=0;ea<ub;ea++)Cb=Hb[ea][1],va=Y.value[Cb],Y.array[$]=va.r,Y.array[$+1]=va.g,Y.array[$+2]=va.b,$+=3;else for(ea=0;ea<ub;ea++)Cb=Hb[ea][1],va=Y.value[Cb],Y.array[$]=va.x,Y.array[$+1]=va.y,Y.array[$+2]=
|
|
|
-va.z,$+=3;else if(4===Y.size)for(ea=0;ea<ub;ea++)Cb=Hb[ea][1],va=Y.value[Cb],Y.array[$]=va.x,Y.array[$+1]=va.y,Y.array[$+2]=va.z,Y.array[$+3]=va.w,$+=4}}else{if(Vc)for(jb=0;jb<Nc;jb++)Bb=Dc[jb],$=3*jb,Ub[$]=Bb.x,Ub[$+1]=Bb.y,Ub[$+2]=Bb.z;if(Wc)for(Ab=0;Ab<Uc;Ab++)Nb=Oc[Ab],$=3*Ab,Vb[$]=Nb.r,Vb[$+1]=Nb.g,Vb[$+2]=Nb.b;if(Ib){tb=0;for(Yb=Ib.length;tb<Yb;tb++)if(Y=Ib[tb],Y.needsUpdate&&(void 0===Y.boundTo||"vertices"===Y.boundTo))if(ub=Y.value.length,$=0,1===Y.size)for(ea=0;ea<ub;ea++)Y.array[ea]=Y.value[ea];
|
|
|
-else if(2===Y.size)for(ea=0;ea<ub;ea++)va=Y.value[ea],Y.array[$]=va.x,Y.array[$+1]=va.y,$+=2;else if(3===Y.size)if("c"===Y.type)for(ea=0;ea<ub;ea++)va=Y.value[ea],Y.array[$]=va.r,Y.array[$+1]=va.g,Y.array[$+2]=va.b,$+=3;else for(ea=0;ea<ub;ea++)va=Y.value[ea],Y.array[$]=va.x,Y.array[$+1]=va.y,Y.array[$+2]=va.z,$+=3;else if(4===Y.size)for(ea=0;ea<ub;ea++)va=Y.value[ea],Y.array[$]=va.x,Y.array[$+1]=va.y,Y.array[$+2]=va.z,Y.array[$+3]=va.w,$+=4}}if(Vc||jc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,zb.__webglVertexBuffer),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,Ub,Mc);if(Wc||jc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,zb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Vb,Mc);if(Ib){tb=0;for(Yb=Ib.length;tb<Yb;tb++)if(Y=Ib[tb],Y.needsUpdate||jc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,Y.buffer),j.bufferData(j.ARRAY_BUFFER,Y.array,Mc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;t.attributes&&s(t)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",lc);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?
|
|
|
-n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=
|
|
|
-e=0,r=0;f=p=0;for(var s=b.length;f<s;f++)g=b[f],g.onlyShadow||(g instanceof THREE.DirectionalLight&&e++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&r++,g instanceof THREE.HemisphereLight&&p++);f=q;g=r;h=p;r=p=0;for(q=b.length;r<q;r++)s=b[r],s.castShadow&&(s instanceof THREE.SpotLight&&p++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&p++);m=p;Ob&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof
|
|
|
-THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,
|
|
|
-skinning:a.skinning,maxBones:l,useVertexTexture:Ob&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,
|
|
|
-alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,y,d=[];n?d.push(n):(d.push(r),d.push(q));for(v in s)d.push(v),d.push(s[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=ga.length;t<v;t++)if(d=ga[t],d.code===n){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");
|
|
|
-v=[];for(y in s)d=s[y],!1!==d&&(d="#define "+y+" "+d,v.push(d));d=v.join("\n");y=j.createProgram();v=["precision "+T+" float;","precision "+T+" int;",d,ac?"#define VERTEX_TEXTURES":"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+
|
|
|
-c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+
|
|
|
-c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
|
|
|
-"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-t=["precision "+T+" float;","precision "+T+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",L.gammaInput?"#define GAMMA_INPUT":"",L.gammaOutput?"#define GAMMA_OUTPUT":"",L.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
+function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.length,h=d(b,a),m=f(h),l=e(h),n=h.vertexColors?h.vertexColors:!1;a.__vertexArray=new Float32Array(3*g);l&&(a.__normalArray=new Float32Array(3*g));c.hasTangents&&(a.__tangentArray=new Float32Array(4*g));n&&(a.__colorArray=new Float32Array(3*g));if(m){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*g);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*g)}b.geometry.skinWeights.length&&
|
|
|
+b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*g),a.__skinWeightArray=new Float32Array(4*g));a.__faceArray=new Uint16Array(3*i);a.__lineArray=new Uint16Array(2*k);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<m;c++)a.__morphTargetsArrays.push(new Float32Array(3*g))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*g))}a.__webglFaceCount=3*i;a.__webglLineCount=2*k;
|
|
|
+if(h.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=
|
|
|
+!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){Ka[a]||(j.enableVertexAttribArray(a),Ka[a]=!0)}
|
|
|
+function g(){for(var a in Ka)Ka[a]&&(j.disableVertexAttribArray(a),Ka[a]=!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)fa=Fa=null,Ea=Z=T=P=ga=Ja=ma=-1,wa=!0,a[d].render(b,c,vb,jb),fa=Fa=null,Ea=Z=T=P=ga=Ja=ma=-1,wa=!0}function m(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;
|
|
|
+h&&K.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);K.setDepthTest(j.depthTest);K.setDepthWrite(j.depthWrite);y(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}K.setMaterialFaces(j);k instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,j,k,i):K.renderBuffer(d,e,f,j,k,i)}}function n(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&K.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);
|
|
|
+K.setDepthTest(g.depthTest);K.setDepthWrite(g.depthWrite);y(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}K.renderImmediateObject(c,d,e,g,j)}}function t(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Jb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k=
|
|
|
+"index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,t=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=t?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,
|
|
|
+counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=
|
|
|
+V++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=
|
|
|
+j.createBuffer();p=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(p=i.numMorphNormals;k<p;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}K.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=
|
|
|
+!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglNormalBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__normalArray=new Float32Array(3*i),g.__webglVertexCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
|
|
|
+j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
|
|
|
+K.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)s(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],s(d.__webglObjects,g,a)}else a instanceof THREE.Ribbon||a instanceof
|
|
|
+THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,s(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 s(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
|
|
|
+return!1}function q(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function r(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof THREE.Line?u(b.__webglObjects,a):a instanceof THREE.Sprite?w(b.__webglSprites,a):a instanceof THREE.LensFlare?w(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&u(b.__webglObjectsImmediate,a);delete a.__webglActive}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===
|
|
|
+b&&a.splice(c,1)}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function E(a,b,c,d,e){aa=0;d.needsUpdate&&(d.program&&Ob(d),K.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Fa&&(j.useProgram(g),Fa=g,f=!0);d.id!==Ea&&(Ea=d.id,f=!0);if(f||a!==fa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==
|
|
|
+fa&&(fa=a);if(d.skinning)if(Eb&&e.useVertexTexture){if(null!==h.boneTexture){var k=C();j.uniform1i(h.boneTexture,k);K.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(wa){for(var m,
|
|
|
+l=k=0,n=0,p,q,t,r=Ra,s=r.directional.colors,u=r.directional.positions,w=r.point.colors,v=r.point.positions,y=r.point.distances,E=r.spot.colors,x=r.spot.positions,D=r.spot.distances,J=r.spot.directions,N=r.spot.anglesCos,O=r.spot.exponents,I=r.hemi.skyColors,V=r.hemi.groundColors,R=r.hemi.positions,M=0,T=0,ea=0,za=0,P=0,wc=0,X=0,W=0,Q=m=0,c=t=Q=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,t=m.distance,m instanceof THREE.AmbientLight?m.visible&&(K.gammaInput?(k+=p.r*p.r,l+=p.g*
|
|
|
+p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(P+=1,m.visible&&(ha.getPositionFromMatrix(m.matrixWorld),ua.getPositionFromMatrix(m.target.matrixWorld),ha.sub(ua),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(m=3*M,u[m]=ha.x,u[m+1]=ha.y,u[m+2]=ha.z,K.gammaInput?F(s,m,p,q*q):z(s,m,p,q),M+=1))):m instanceof THREE.PointLight?(wc+=1,m.visible&&(Q=3*T,K.gammaInput?F(w,Q,p,q*q):z(w,Q,p,q),ua.getPositionFromMatrix(m.matrixWorld),v[Q]=ua.x,v[Q+1]=ua.y,v[Q+2]=ua.z,y[T]=t,T+=1)):
|
|
|
+m instanceof THREE.SpotLight?(X+=1,m.visible&&(Q=3*ea,K.gammaInput?F(E,Q,p,q*q):z(E,Q,p,q),ua.getPositionFromMatrix(m.matrixWorld),x[Q]=ua.x,x[Q+1]=ua.y,x[Q+2]=ua.z,D[ea]=t,ha.copy(ua),ua.getPositionFromMatrix(m.target.matrixWorld),ha.sub(ua),ha.normalize(),J[Q]=ha.x,J[Q+1]=ha.y,J[Q+2]=ha.z,N[ea]=Math.cos(m.angle),O[ea]=m.exponent,ea+=1)):m instanceof THREE.HemisphereLight&&(W+=1,m.visible&&(ha.getPositionFromMatrix(m.matrixWorld),ha.normalize(),0===ha.x&&0===ha.y&&0===ha.z||(t=3*za,R[t]=ha.x,R[t+
|
|
|
+1]=ha.y,R[t+2]=ha.z,p=m.color,m=m.groundColor,K.gammaInput?(q*=q,F(I,t,p,q),F(V,t,m,q)):(z(I,t,p,q),z(V,t,m,q)),za+=1))));c=3*M;for(f=Math.max(s.length,3*P);c<f;c++)s[c]=0;c=3*T;for(f=Math.max(w.length,3*wc);c<f;c++)w[c]=0;c=3*ea;for(f=Math.max(E.length,3*X);c<f;c++)E[c]=0;c=3*za;for(f=Math.max(I.length,3*W);c<f;c++)I[c]=0;c=3*za;for(f=Math.max(V.length,3*W);c<f;c++)V[c]=0;r.directional.length=M;r.point.length=T;r.spot.length=ea;r.hemi.length=za;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;wa=!1}c=
|
|
|
+Ra;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=
|
|
|
+c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=
|
|
|
+d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;
|
|
|
+i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=G.height/2,i.map.value=
|
|
|
+d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(K.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):
|
|
|
+(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Z]=k.shadowMap,i.shadowMapSize.value[Z]=
|
|
|
+k.shadowMapSize,i.shadowMatrix.value[Z]=k.shadowMatrix,i.shadowDarkness.value[Z]=k.shadowDarkness,i.shadowBias.value[Z]=k.shadowBias,Z++}b=d.uniformsList;i=0;for(Z=b.length;i<Z;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,
|
|
|
+k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===
|
|
|
+c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===
|
|
|
+l){if(r=k,k=C(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Kb),c.image.__webglTextureCube=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(n=k,r=l,s=c.image[l],
|
|
|
+w=qc,s.width<=w&&s.height<=w||(v=Math.max(s.width,s.height),u=Math.floor(s.width*w/v),w=Math.floor(s.height*w/v),v=document.createElement("canvas"),v.width=u,v.height=w,v.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,w),s=v),n[r]=s):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=A(c.format);s=A(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){w=k[l].mipmaps;v=0;for(y=w.length;v<y;v++)u=w[v],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,v,r,
|
|
|
+u.width,u.height,0,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,s,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):K.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=
|
|
|
+c.value.length;l<n;l++)c._array[l]=C();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&K.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ua.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,ua.x,ua.y,ua.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||
|
|
|
+d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function C(){var a=aa;a>=Wb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Wb);aa+=1;return a}function F(a,b,c,d){a[b]=
|
|
|
+c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function z(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function D(a){a!==Aa&&(j.lineWidth(a),Aa=a)}function y(a,b,c){Ha!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Ha=a);if(a&&(Xa!==b||Sa!==c))j.polygonOffset(b,c),Xa=b,Sa=c}function O(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function x(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));
|
|
|
+j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(O(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,A(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,A(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,
|
|
|
+j.TEXTURE_MAG_FILTER,v(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,v(b.minFilter)));if(ya&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,ya.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Xb)),b.__oldAnisotropy=b.anisotropy}function I(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,
|
|
|
+a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function v(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function A(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;
|
|
|
+if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;
|
|
|
+if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===
|
|
|
+THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===
|
|
|
+THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Ia){if(a===THREE.RGB_S3TC_DXT1_Format)return Ia.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
|
+if(a===THREE.RGBA_S3TC_DXT3_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Ia.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),R=void 0!==a.precision?a.precision:"highp",J=void 0!==a.alpha?a.alpha:!0,ba=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,qa=void 0!==a.antialias?a.antialias:!1,ra=void 0!==a.stencil?a.stencil:!0,N=void 0!==a.preserveDrawingBuffer?
|
|
|
+a.preserveDrawingBuffer:!1,M=new THREE.Color(0),Q=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),M.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),Q=a.clearAlpha);this.domElement=G;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==
|
|
|
+window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
|
|
|
+[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var K=this,da=[],za=0,Fa=null,ea=null,Ea=-1,Z=null,fa=null,V=0,aa=0,P=-1,T=-1,ma=-1,va=-1,ja=-1,Pa=-1,Ja=-1,ga=-1,Ha=null,Xa=null,Sa=null,Aa=null,hb=0,ib=0,tb=0,ub=0,vb=0,jb=0,Ka={},na=new THREE.Frustum,ta=new THREE.Matrix4,kb=new THREE.Matrix4,ua=new THREE.Vector3,ha=new THREE.Vector3,wa=!0,Ra={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,
|
|
|
+colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Wa,xa,ya,Ia;try{if(!(j=G.getContext("experimental-webgl",{alpha:J,premultipliedAlpha:ba,antialias:qa,stencil:ra,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";}catch(Ta){console.error(Ta)}Wa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");xa=j.getExtension("OES_standard_derivatives");
|
|
|
+ya=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Ia=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Wa||console.log("THREE.WebGLRenderer: Float textures not supported.");xa||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");ya||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
|
|
|
+Ia||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(M.r,M.g,M.b,Q);this.context=j;var Wb=
|
|
|
+j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),pc=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var qc=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Xb=ya?j.getParameter(ya.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Ib=0<pc,Eb=Ib&&Wa;Ia&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var rc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),sc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var tc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
|
|
|
+j.HIGH_FLOAT),uc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var vc=0<rc.precision&&0<tc.precision,
|
|
|
+Yb=0<sc.precision&&0<uc.precision;"highp"===R&&!vc&&(Yb?(R="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(R="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===R&&!Yb&&(R="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Ib};this.supportsFloatTextures=function(){return Wa};this.supportsStandardDerivatives=function(){return xa};
|
|
|
+this.supportsCompressedTextureS3TC=function(){return Ia};this.getMaxAnisotropy=function(){return Xb};this.getPrecision=function(){return R};this.setSize=function(a,b,c){G.width=a*this.devicePixelRatio;G.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(G.style.width=a+"px",G.style.height=b+"px");this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){hb=void 0!==a?a:0;ib=void 0!==b?b:0;tb=void 0!==c?c:G.width;ub=void 0!==d?d:G.height;j.viewport(hb,ib,tb,ub)};this.setScissor=
|
|
|
+function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){M.set(a);Q=void 0!==b?b:1;j.clearColor(M.r,M.g,M.b,Q)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return M};this.getClearAlpha=function(){return Q};this.clear=function(a,b,c){var d=0;if(void 0===a||
|
|
|
+a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Fa=null;Ea=Z=ga=Ja=ma=-1;wa=!0;T=P=-1;this.shadowMapPlugin.update(a,b)};var Jb=function(a){a=a.target;a.removeEventListener("dispose",
|
|
|
+Jb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer)}else{if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Nb(c)}Nb(a)}K.info.memory.geometries--},
|
|
|
+Kb=function(a){a=a.target;a.removeEventListener("dispose",Kb);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));K.info.memory.textures--},Lb=function(a){a=a.target;a.removeEventListener("dispose",Lb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
|
|
|
+else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);K.info.memory.textures--},Mb=function(a){a=a.target;a.removeEventListener("dispose",Mb);Ob(a)},Nb=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
|
|
|
+j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer)},
|
|
|
+Ob=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=da.length;a<c;a++)if(d=da[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=da.length;a<c;a++)d=da[a],d.program!==b&&e.push(d);da=e;j.deleteProgram(b);K.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());
|
|
|
+a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,
|
|
|
+k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],l=n[p+5],h=n[p+6],k=n[p+7],m=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
+a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,
|
|
|
+k,l,m;i=E(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==Z&&(Z=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(d=a.index){e=e.offsets;1<e.length&&(c=!0);for(var f=0,n=e.length;f<n;f++){var p=e[f].index;if(c){for(k in a)"index"!==k&&(l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,4*p*m)));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,d.buffer)}j.drawElements(j.TRIANGLES,e[f].count,j.UNSIGNED_SHORT,2*
|
|
|
+e[f].start);K.info.render.calls++;K.info.render.vertices+=e[f].count;K.info.render.faces+=e[f].count/3}}else{if(c)for(k in a)"index"!==k&&(l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)));a=e.attributes.position;j.drawArrays(j.TRIANGLES,0,a.numItems/3);K.info.render.calls++;K.info.render.vertices+=a.numItems/3;K.info.render.faces+=a.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(k in a)l=b[k],i=a[k],m=i.itemSize,
|
|
|
+0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0));a=a.position;j.drawArrays(j.POINTS,0,a.numItems/3);K.info.render.calls++;K.info.render.points+=a.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in a)l=b[k],i=a[k],m=i.itemSize,0<=l&&(j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;D(d.linewidth);a=a.position;j.drawArrays(k,0,a.numItems/3);K.info.render.calls++;K.info.render.points+=
|
|
|
+a.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=E(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Z&&(Z=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
|
+h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;l=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<l.length;)0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[m]]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,
|
|
|
+!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[m]]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[l[m]],m++}else{l=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)m=i[n],0<m&&l.push([m,n]);l.length>d.numSupportedMorphTargets?(l.sort(k),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<
|
|
|
+d.numSupportedMorphTargets;)l[m]?(n=l[m][1],0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[n]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&
|
|
|
+j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){i=0;for(l=e.__webglCustomAttributesList.length;i<l;i++)c=e.__webglCustomAttributesList[i],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),j.vertexAttribPointer(a.color,
|
|
|
+3,j.FLOAT,!1,0,0));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0));0<=a.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0));
|
|
|
+d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(D(d.wireframeLinewidth),
|
|
|
+b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),K.info.render.calls++,K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,D(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):
|
|
|
+f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),K.info.render.calls++,K.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),K.info.render.calls++)}};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,p=a.fog;Ea=-1;wa=!0;!0===a.autoUpdate&&a.updateMatrixWorld();
|
|
|
+void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);ta.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);na.setFromMatrix(ta);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);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||na.intersectsObject(g))){var q=g;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,t=q.buffer,r=void 0,s=r=void 0,s=q.object.material;if(s instanceof THREE.MeshFaceMaterial)r=t.materialIndex,r=s.materials[r],r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);else if(r=
|
|
|
+s)r.transparent?(q.transparent=r,q.opaque=null):(q.opaque=r,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ua.getPositionFromMatrix(g.matrixWorld),ua.applyProjection(ta),f.z=ua.z))}this.sortObjects&&h.sort(i);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),y(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,k,p,!0,d),n(a.__webglObjectsImmediate,"",b,k,p,!1,d)):(d=null,this.setBlending(THREE.NoBlending),m(a.__webglObjects,!0,"opaque",b,k,p,!1,d),n(a.__webglObjectsImmediate,"opaque",
|
|
|
+b,k,p,!1,d),m(a.__webglObjects,!1,"transparent",b,k,p,!0,d),n(a.__webglObjectsImmediate,"transparent",b,k,p,!0,d));l(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
|
|
|
+null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=E(a,b,c,d,e);Z=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,na):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)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 i=h,l=i.geometry,m=void 0,n=void 0,s=void 0;if(l instanceof THREE.BufferGeometry){var u=j.DYNAMIC_DRAW,w=!l.dynamic,v=l.attributes,z=void 0,y=void 0;for(z in v)y=v[z],y.needsUpdate&&("index"===z?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,y.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,y.array,u)):(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+y.buffer),j.bufferData(j.ARRAY_BUFFER,y.array,u)),y.needsUpdate=!1),w&&!y.dynamic&&(y.array=null)}else if(i instanceof THREE.Mesh){for(var E=0,A=l.geometryGroupsList.length;E<A;E++)if(m=l.geometryGroupsList[E],s=d(i,m),l.buffersNeedUpdate&&c(m,i),n=s.attributes&&p(s),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||n){var x=m,F=i,C=j.DYNAMIC_DRAW,D=!l.dynamic,G=s;if(x.__inittedArrays){var J=e(G),K=
|
|
|
+G.vertexColors?G.vertexColors:!1,N=f(G),O=J===THREE.SmoothShading,B=void 0,I=void 0,V=void 0,M=void 0,R=void 0,Q=void 0,T=void 0,ea=void 0,za=void 0,Z=void 0,aa=void 0,P=void 0,X=void 0,W=void 0,Fa=void 0,fa=void 0,Ea=void 0,ba=void 0,da=void 0,ja=void 0,ga=void 0,ha=void 0,ma=void 0,na=void 0,qa=void 0,ra=void 0,va=void 0,wa=void 0,xa=void 0,Ga=void 0,Ha=void 0,Ja=void 0,Ia=void 0,Pa=void 0,Ua=void 0,Ka=void 0,ya=void 0,Aa=void 0,Sa=void 0,Wa=void 0,fb=0,gb=0,Ra=0,Ta=0,Xa=0,lb=0,Va=0,yb=0,cb=0,sa=
|
|
|
+0,Ba=0,L=0,Qa=void 0,mb=x.__vertexArray,hb=x.__uvArray,ib=x.__uv2Array,Ab=x.__normalArray,Ya=x.__tangentArray,nb=x.__colorArray,Za=x.__skinIndexArray,$a=x.__skinWeightArray,tb=x.__morphTargetsArrays,ub=x.__morphNormalsArrays,vb=x.__webglCustomAttributesList,H=void 0,jb=x.__faceArray,Bb=x.__lineArray,La=F.geometry,Ib=La.elementsNeedUpdate,Eb=La.uvsNeedUpdate,Kb=La.normalsNeedUpdate,Wb=La.tangentsNeedUpdate,Xb=La.colorsNeedUpdate,Yb=La.morphTargetsNeedUpdate,xc=La.vertices,$=x.faces3,ob=La.faces,Jb=
|
|
|
+La.faceVertexUvs[0],Lb=La.faceVertexUvs[1],yc=La.skinIndices,Zb=La.skinWeights,$b=La.morphTargets,Mb=La.morphNormals;if(La.verticesNeedUpdate){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=xc[M.a],X=xc[M.b],W=xc[M.c],mb[gb]=P.x,mb[gb+1]=P.y,mb[gb+2]=P.z,mb[gb+3]=X.x,mb[gb+4]=X.y,mb[gb+5]=X.z,mb[gb+6]=W.x,mb[gb+7]=W.y,mb[gb+8]=W.z,gb+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,mb,C)}if(Yb){Ua=0;for(Ka=$b.length;Ua<Ka;Ua++){B=Ba=0;for(I=$.length;B<I;B++)Sa=$[B],M=ob[Sa],
|
|
|
+P=$b[Ua].vertices[M.a],X=$b[Ua].vertices[M.b],W=$b[Ua].vertices[M.c],ya=tb[Ua],ya[Ba]=P.x,ya[Ba+1]=P.y,ya[Ba+2]=P.z,ya[Ba+3]=X.x,ya[Ba+4]=X.y,ya[Ba+5]=X.z,ya[Ba+6]=W.x,ya[Ba+7]=W.y,ya[Ba+8]=W.z,G.morphNormals&&(O?(Wa=Mb[Ua].vertexNormals[Sa],ba=Wa.a,da=Wa.b,ja=Wa.c):ja=da=ba=Mb[Ua].faceNormals[Sa],Aa=ub[Ua],Aa[Ba]=ba.x,Aa[Ba+1]=ba.y,Aa[Ba+2]=ba.z,Aa[Ba+3]=da.x,Aa[Ba+4]=da.y,Aa[Ba+5]=da.z,Aa[Ba+6]=ja.x,Aa[Ba+7]=ja.y,Aa[Ba+8]=ja.z),Ba+=9;j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphTargetsBuffers[Ua]);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,tb[Ua],C);G.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglMorphNormalsBuffers[Ua]),j.bufferData(j.ARRAY_BUFFER,ub[Ua],C))}}if(Zb.length){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],na=Zb[M.a],qa=Zb[M.b],ra=Zb[M.c],$a[sa]=na.x,$a[sa+1]=na.y,$a[sa+2]=na.z,$a[sa+3]=na.w,$a[sa+4]=qa.x,$a[sa+5]=qa.y,$a[sa+6]=qa.z,$a[sa+7]=qa.w,$a[sa+8]=ra.x,$a[sa+9]=ra.y,$a[sa+10]=ra.z,$a[sa+11]=ra.w,va=yc[M.a],wa=yc[M.b],xa=yc[M.c],Za[sa]=va.x,Za[sa+1]=va.y,Za[sa+2]=va.z,Za[sa+3]=va.w,Za[sa+
|
|
|
+4]=wa.x,Za[sa+5]=wa.y,Za[sa+6]=wa.z,Za[sa+7]=wa.w,Za[sa+8]=xa.x,Za[sa+9]=xa.y,Za[sa+10]=xa.z,Za[sa+11]=xa.w,sa+=12;0<sa&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Za,C),j.bindBuffer(j.ARRAY_BUFFER,x.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,$a,C))}if(Xb&&K){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],T=M.vertexColors,ea=M.color,3===T.length&&K===THREE.VertexColors?(ga=T[0],ha=T[1],ma=T[2]):ma=ha=ga=ea,nb[cb]=ga.r,nb[cb+1]=ga.g,nb[cb+2]=ga.b,nb[cb+3]=
|
|
|
+ha.r,nb[cb+4]=ha.g,nb[cb+5]=ha.b,nb[cb+6]=ma.r,nb[cb+7]=ma.g,nb[cb+8]=ma.b,cb+=9;0<cb&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,nb,C))}if(Wb&&La.hasTangents){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],za=M.vertexTangents,Fa=za[0],fa=za[1],Ea=za[2],Ya[Va]=Fa.x,Ya[Va+1]=Fa.y,Ya[Va+2]=Fa.z,Ya[Va+3]=Fa.w,Ya[Va+4]=fa.x,Ya[Va+5]=fa.y,Ya[Va+6]=fa.z,Ya[Va+7]=fa.w,Ya[Va+8]=Ea.x,Ya[Va+9]=Ea.y,Ya[Va+10]=Ea.z,Ya[Va+11]=Ea.w,Va+=12;j.bindBuffer(j.ARRAY_BUFFER,x.__webglTangentBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,Ya,C)}if(Kb&&J){B=0;for(I=$.length;B<I;B++)if(M=ob[$[B]],R=M.vertexNormals,Q=M.normal,3===R.length&&O)for(Ga=0;3>Ga;Ga++)Ja=R[Ga],Ab[lb]=Ja.x,Ab[lb+1]=Ja.y,Ab[lb+2]=Ja.z,lb+=3;else for(Ga=0;3>Ga;Ga++)Ab[lb]=Q.x,Ab[lb+1]=Q.y,Ab[lb+2]=Q.z,lb+=3;j.bindBuffer(j.ARRAY_BUFFER,x.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ab,C)}if(Eb&&Jb&&N){B=0;for(I=$.length;B<I;B++)if(V=$[B],Z=Jb[V],void 0!==Z)for(Ga=0;3>Ga;Ga++)Ia=Z[Ga],hb[Ra]=Ia.x,hb[Ra+1]=Ia.y,Ra+=2;0<Ra&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+x.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,hb,C))}if(Eb&&Lb&&N){B=0;for(I=$.length;B<I;B++)if(V=$[B],aa=Lb[V],void 0!==aa)for(Ga=0;3>Ga;Ga++)Pa=aa[Ga],ib[Ta]=Pa.x,ib[Ta+1]=Pa.y,Ta+=2;0<Ta&&(j.bindBuffer(j.ARRAY_BUFFER,x.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,ib,C))}if(Ib){B=0;for(I=$.length;B<I;B++)jb[Xa]=fb,jb[Xa+1]=fb+1,jb[Xa+2]=fb+2,Xa+=3,Bb[yb]=fb,Bb[yb+1]=fb+1,Bb[yb+2]=fb,Bb[yb+3]=fb+2,Bb[yb+4]=fb+1,Bb[yb+5]=fb+2,yb+=6,fb+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglFaceBuffer);
|
|
|
+j.bufferData(j.ELEMENT_ARRAY_BUFFER,jb,C);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,x.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Bb,C)}if(vb){Ga=0;for(Ha=vb.length;Ga<Ha;Ga++)if(H=vb[Ga],H.__original.needsUpdate){L=0;if(1===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],H.array[L]=H.value[M.a],H.array[L+1]=H.value[M.b],H.array[L+2]=H.value[M.c],L+=3}else{if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],H.array[L]=Qa,H.array[L+1]=
|
|
|
+Qa,H.array[L+2]=Qa,L+=3}}else if(2===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}else{if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=X.x,H.array[L+3]=X.y,H.array[L+4]=W.x,H.array[L+5]=W.y,L+=6}}else if(3===H.size){var pa;pa="c"===H.type?
|
|
|
+["r","g","b"]:["x","y","z"];if(void 0===H.boundTo||"vertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}else if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],
|
|
|
+H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}else if("faceVertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],P=Qa[0],X=Qa[1],W=Qa[2],H.array[L]=P[pa[0]],H.array[L+1]=P[pa[1]],H.array[L+2]=P[pa[2]],H.array[L+3]=X[pa[0]],H.array[L+4]=X[pa[1]],H.array[L+5]=X[pa[2]],H.array[L+6]=W[pa[0]],H.array[L+7]=W[pa[1]],H.array[L+8]=W[pa[2]],L+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){B=
|
|
|
+0;for(I=$.length;B<I;B++)M=ob[$[B]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faces"===H.boundTo){B=0;for(I=$.length;B<I;B++)W=X=P=Qa=H.value[$[B]],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,
|
|
|
+H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}else if("faceVertices"===H.boundTo){B=0;for(I=$.length;B<I;B++)Qa=H.value[$[B]],P=Qa[0],X=Qa[1],W=Qa[2],H.array[L]=P.x,H.array[L+1]=P.y,H.array[L+2]=P.z,H.array[L+3]=P.w,H.array[L+4]=X.x,H.array[L+5]=X.y,H.array[L+6]=X.z,H.array[L+7]=X.w,H.array[L+8]=W.x,H.array[L+9]=W.y,H.array[L+10]=W.z,H.array[L+11]=W.w,L+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,C)}}D&&(delete x.__inittedArrays,delete x.__colorArray,
|
|
|
+delete x.__normalArray,delete x.__tangentArray,delete x.__uvArray,delete x.__uv2Array,delete x.__faceArray,delete x.__vertexArray,delete x.__lineArray,delete x.__skinIndexArray,delete x.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=!1;l.buffersNeedUpdate=!1;s.attributes&&q(s)}else if(i instanceof THREE.Ribbon){s=d(i,l);n=s.attributes&&p(s);if(l.verticesNeedUpdate||
|
|
|
+l.colorsNeedUpdate||l.normalsNeedUpdate||n){var ab=l,ac=j.DYNAMIC_DRAW,Pb=void 0,Qb=void 0,Rb=void 0,bc=void 0,ca=void 0,cc=void 0,dc=void 0,ec=void 0,Nb=void 0,Ca=void 0,Fb=void 0,ka=void 0,Ma=void 0,Ob=ab.vertices,Ec=ab.colors,Fc=ab.normals,pc=Ob.length,qc=Ec.length,rc=Fc.length,fc=ab.__vertexArray,gc=ab.__colorArray,hc=ab.__normalArray,sc=ab.colorsNeedUpdate,tc=ab.normalsNeedUpdate,zc=ab.__webglCustomAttributesList;if(ab.verticesNeedUpdate){for(Pb=0;Pb<pc;Pb++)bc=Ob[Pb],ca=3*Pb,fc[ca]=bc.x,fc[ca+
|
|
|
+1]=bc.y,fc[ca+2]=bc.z;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,fc,ac)}if(sc){for(Qb=0;Qb<qc;Qb++)cc=Ec[Qb],ca=3*Qb,gc[ca]=cc.r,gc[ca+1]=cc.g,gc[ca+2]=cc.b;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,gc,ac)}if(tc){for(Rb=0;Rb<rc;Rb++)dc=Fc[Rb],ca=3*Rb,hc[ca]=dc.x,hc[ca+1]=dc.y,hc[ca+2]=dc.z;j.bindBuffer(j.ARRAY_BUFFER,ab.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,hc,ac)}if(zc){ec=0;for(Nb=zc.length;ec<Nb;ec++)if(ka=zc[ec],
|
|
|
+ka.needsUpdate&&(void 0===ka.boundTo||"vertices"===ka.boundTo)){ca=0;Fb=ka.value.length;if(1===ka.size)for(Ca=0;Ca<Fb;Ca++)ka.array[Ca]=ka.value[Ca];else if(2===ka.size)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ca+=2;else if(3===ka.size)if("c"===ka.type)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.r,ka.array[ca+1]=Ma.g,ka.array[ca+2]=Ma.b,ca+=3;else for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ka.array[ca+2]=Ma.z,ca+=3;else if(4===
|
|
|
+ka.size)for(Ca=0;Ca<Fb;Ca++)Ma=ka.value[Ca],ka.array[ca]=Ma.x,ka.array[ca+1]=Ma.y,ka.array[ca+2]=Ma.z,ka.array[ca+3]=Ma.w,ca+=4;j.bindBuffer(j.ARRAY_BUFFER,ka.buffer);j.bufferData(j.ARRAY_BUFFER,ka.array,ac)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.normalsNeedUpdate=!1;s.attributes&&q(s)}else if(i instanceof THREE.Line){s=d(i,l);n=s.attributes&&p(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||n){var bb=l,ic=j.DYNAMIC_DRAW,Sb=void 0,Tb=void 0,Ub=void 0,jc=void 0,
|
|
|
+oa=void 0,kc=void 0,Gc=bb.vertices,Hc=bb.colors,Ic=bb.lineDistances,uc=Gc.length,vc=Hc.length,Oc=Ic.length,lc=bb.__vertexArray,mc=bb.__colorArray,Jc=bb.__lineDistanceArray,Pc=bb.colorsNeedUpdate,Qc=bb.lineDistancesNeedUpdate,Ac=bb.__webglCustomAttributesList,nc=void 0,Kc=void 0,Da=void 0,Gb=void 0,Na=void 0,la=void 0;if(bb.verticesNeedUpdate){for(Sb=0;Sb<uc;Sb++)jc=Gc[Sb],oa=3*Sb,lc[oa]=jc.x,lc[oa+1]=jc.y,lc[oa+2]=jc.z;j.bindBuffer(j.ARRAY_BUFFER,bb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
+lc,ic)}if(Pc){for(Tb=0;Tb<vc;Tb++)kc=Hc[Tb],oa=3*Tb,mc[oa]=kc.r,mc[oa+1]=kc.g,mc[oa+2]=kc.b;j.bindBuffer(j.ARRAY_BUFFER,bb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,mc,ic)}if(Qc){for(Ub=0;Ub<Oc;Ub++)Jc[Ub]=Ic[Ub];j.bindBuffer(j.ARRAY_BUFFER,bb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,Jc,ic)}if(Ac){nc=0;for(Kc=Ac.length;nc<Kc;nc++)if(la=Ac[nc],la.needsUpdate&&(void 0===la.boundTo||"vertices"===la.boundTo)){oa=0;Gb=la.value.length;if(1===la.size)for(Da=0;Da<Gb;Da++)la.array[Da]=
|
|
|
+la.value[Da];else if(2===la.size)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,oa+=2;else if(3===la.size)if("c"===la.type)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.r,la.array[oa+1]=Na.g,la.array[oa+2]=Na.b,oa+=3;else for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,la.array[oa+2]=Na.z,oa+=3;else if(4===la.size)for(Da=0;Da<Gb;Da++)Na=la.value[Da],la.array[oa]=Na.x,la.array[oa+1]=Na.y,la.array[oa+2]=Na.z,la.array[oa+3]=Na.w,oa+=4;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+la.buffer);j.bufferData(j.ARRAY_BUFFER,la.array,ic)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;s.attributes&&q(s)}else if(i instanceof THREE.ParticleSystem){s=d(i,l);n=s.attributes&&p(s);if(l.verticesNeedUpdate||l.colorsNeedUpdate||i.sortParticles||n){var pb=l,Bc=j.DYNAMIC_DRAW,Vb=i,Oa=void 0,qb=void 0,rb=void 0,U=void 0,sb=void 0,zb=void 0,oc=pb.vertices,Cc=oc.length,Dc=pb.colors,Lc=Dc.length,Cb=pb.__vertexArray,Db=pb.__colorArray,wb=pb.__sortArray,Mc=pb.verticesNeedUpdate,
|
|
|
+Nc=pb.colorsNeedUpdate,xb=pb.__webglCustomAttributesList,db=void 0,Hb=void 0,Y=void 0,eb=void 0,ia=void 0,S=void 0;if(Vb.sortParticles){kb.copy(ta);kb.multiply(Vb.matrixWorld);for(Oa=0;Oa<Cc;Oa++)rb=oc[Oa],ua.copy(rb),ua.applyProjection(kb),wb[Oa]=[ua.z,Oa];wb.sort(k);for(Oa=0;Oa<Cc;Oa++)rb=oc[wb[Oa][1]],U=3*Oa,Cb[U]=rb.x,Cb[U+1]=rb.y,Cb[U+2]=rb.z;for(qb=0;qb<Lc;qb++)U=3*qb,zb=Dc[wb[qb][1]],Db[U]=zb.r,Db[U+1]=zb.g,Db[U+2]=zb.b;if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],void 0===S.boundTo||
|
|
|
+"vertices"===S.boundTo)if(U=0,eb=S.value.length,1===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],S.array[Y]=S.value[sb];else if(2===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,U+=2;else if(3===S.size)if("c"===S.type)for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.r,S.array[U+1]=ia.g,S.array[U+2]=ia.b,U+=3;else for(Y=0;Y<eb;Y++)sb=wb[Y][1],ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,U+=3;else if(4===S.size)for(Y=0;Y<eb;Y++)sb=wb[Y][1],
|
|
|
+ia=S.value[sb],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,S.array[U+3]=ia.w,U+=4}}else{if(Mc)for(Oa=0;Oa<Cc;Oa++)rb=oc[Oa],U=3*Oa,Cb[U]=rb.x,Cb[U+1]=rb.y,Cb[U+2]=rb.z;if(Nc)for(qb=0;qb<Lc;qb++)zb=Dc[qb],U=3*qb,Db[U]=zb.r,Db[U+1]=zb.g,Db[U+2]=zb.b;if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],S.needsUpdate&&(void 0===S.boundTo||"vertices"===S.boundTo))if(eb=S.value.length,U=0,1===S.size)for(Y=0;Y<eb;Y++)S.array[Y]=S.value[Y];else if(2===S.size)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=
|
|
|
+ia.x,S.array[U+1]=ia.y,U+=2;else if(3===S.size)if("c"===S.type)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.r,S.array[U+1]=ia.g,S.array[U+2]=ia.b,U+=3;else for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,U+=3;else if(4===S.size)for(Y=0;Y<eb;Y++)ia=S.value[Y],S.array[U]=ia.x,S.array[U+1]=ia.y,S.array[U+2]=ia.z,S.array[U+3]=ia.w,U+=4}}if(Mc||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,pb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,Cb,Bc);if(Nc||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+pb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,Db,Bc);if(xb){db=0;for(Hb=xb.length;db<Hb;db++)if(S=xb[db],S.needsUpdate||Vb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,S.buffer),j.bufferData(j.ARRAY_BUFFER,S.array,Bc)}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;s.attributes&&q(s)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Mb);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?
|
|
|
+n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0;f=p=0;for(var t=b.length;f<t;f++)g=b[f],g.onlyShadow||(g instanceof THREE.DirectionalLight&&
|
|
|
+e++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&r++,g instanceof THREE.HemisphereLight&&p++);f=q;g=r;h=p;r=p=0;for(q=b.length;r<q;r++)t=b[r],t.castShadow&&(t instanceof THREE.SpotLight&&p++,t instanceof THREE.DirectionalLight&&!t.shadowCascade&&p++);m=p;Eb&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+
|
|
|
+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,t=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:Eb&&d&&d.useVertexTexture,boneTextureWidth:d&&
|
|
|
+d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,
|
|
|
+doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},s,u,w,d=[];n?d.push(n):(d.push(r),d.push(q));for(u in t)d.push(u),d.push(t[u]);for(s in c)d.push(s),d.push(c[s]);n=d.join();s=0;for(u=da.length;s<u;s++)if(d=da[s],d.code===n){d.usedTimes++;k=d.program;break a}s="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?s="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(s="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(w in t)d=t[w],!1!==d&&(d="#define "+w+" "+d,u.push(d));
|
|
|
+d=u.join("\n");w=j.createProgram();u=["precision "+R+" float;","precision "+R+" int;",d,Ib?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,
|
|
|
+c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?
|
|
|
+"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+s=["precision "+R+" float;","precision "+R+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":
|
|
|
"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=E("vertex",v+q);t=E("fragment",t+r);j.attachShader(y,v);j.attachShader(y,t);j.linkProgram(y);j.getProgramParameter(y,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(y,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
-j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(y)));j.deleteShader(t);j.deleteShader(v);y.uniforms={};y.attributes={};var x;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(x in p)t.push(x);x=t;t=0;for(v=x.length;t<v;t++)p=x[t],y.uniforms[p]=j.getUniformLocation(y,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
|
|
|
-for(x=0;x<c.maxMorphTargets;x++)t.push("morphTarget"+x);for(x=0;x<c.maxMorphNormals;x++)t.push("morphNormal"+x);for(k in b)t.push(k);k=t;x=0;for(b=k.length;x<b;x++)t=k[x],y.attributes[t]=j.getAttribLocation(y,t);y.id=Ia++;ga.push({program:y,code:n,usedTimes:1});L.info.memory.programs=ga.length;k=y}a.program=k;x=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)y=b+k,0<=x[y]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
|
-0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)y=b+k,0<=x[y]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=
|
|
|
-a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;W!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),W=b);fa!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),fa=a)};this.setDepthTest=function(a){ab!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),ab=a)};this.setDepthWrite=function(a){bb!==a&&(j.depthMask(a),bb=a)};this.setBlending=function(a,b,c,d){a!==ca&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,
|
|
|
-j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ca=a);if(a===THREE.CustomBlending){if(b!==Ga&&(j.blendEquation(D(b)),Ga=b),
|
|
|
-c!==Ja||d!==ta)j.blendFunc(D(c),D(d)),Ja=c,ta=d}else ta=Ja=Ga=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Pb),a.__webglTexture=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===
|
|
|
-(c.width&c.width-1)&&0===(c.height&c.height-1),e=D(a.format),f=D(a.type);F(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+s:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=x("vertex",u+q);s=x("fragment",s+r);j.attachShader(w,u);j.attachShader(w,s);j.linkProgram(w);j.getProgramParameter(w,j.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(w,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
+j.getError()+"]"),console.error("Program Info Log: "+j.getProgramInfoLog(w)));j.deleteShader(s);j.deleteShader(u);w.uniforms={};w.attributes={};var v;s="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?s.push("boneTexture"):s.push("boneGlobalMatrices");for(v in p)s.push(v);v=s;s=0;for(u=v.length;s<u;s++)p=v[s],w.uniforms[p]=j.getUniformLocation(w,p);s="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
|
|
|
+for(v=0;v<c.maxMorphTargets;v++)s.push("morphTarget"+v);for(v=0;v<c.maxMorphNormals;v++)s.push("morphNormal"+v);for(k in b)s.push(k);k=s;v=0;for(b=k.length;v<b;v++)s=k[v],w.attributes[s]=j.getAttribLocation(w,s);w.id=za++;da.push({program:w,code:n,usedTimes:1});K.info.memory.programs=da.length;k=w}a.program=k;v=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=v[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=
|
|
|
+0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)w=b+k,0<=v[w]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=
|
|
|
+a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;P!==b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),P=b);T!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),T=a)};this.setDepthTest=function(a){Ja!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Ja=a)};this.setDepthWrite=function(a){ga!==a&&(j.depthMask(a),ga=a)};this.setBlending=function(a,b,c,d){a!==ma&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,
|
|
|
+j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ma=a);if(a===THREE.CustomBlending){if(b!==va&&(j.blendEquation(A(b)),va=b),
|
|
|
+c!==ja||d!==Pa)j.blendFunc(A(c),A(d)),ja=c,Pa=d}else Pa=ja=va=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Kb),a.__webglTexture=j.createTexture(),K.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===
|
|
|
+(c.width&c.width-1)&&0===(c.height&c.height-1),e=A(a.format),f=A(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<
|
|
|
g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&
|
|
|
-(a.stencilBuffer=!0);a.addEventListener("dispose",kc);a.__webglTexture=j.createTexture();L.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);F(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,
|
|
|
-a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);S(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),F(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,
|
|
|
-0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):S(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);
|
|
|
-b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Db,a=Kb,d=wb,e=Jb);b!==za&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),za=b);Qb=c;Rb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
|
+(a.stencilBuffer=!0);a.addEventListener("dispose",Lb);a.__webglTexture=j.createTexture();K.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=A(a.format),e=A(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,
|
|
|
+a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);I(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,
|
|
|
+0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):I(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);
|
|
|
+b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=tb,a=ub,d=hb,e=ib);b!==ea&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),ea=b);vb=c;jb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;
|
|
|
return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=
|
|
|
-0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableParticle=function(){this.id=0;this.object=null;this.z=this.y=this.x=0;this.rotation=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,k=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,m=i.length;b<m;b++){var n=i[b].clone();d&&n.applyMatrix4(d);g.push(n)}b=0;for(m=l.length;b<m;b++){var n=l[b],q,t,p=n.vertexNormals,s=n.vertexColors;q=new THREE.Face3(n.a+
|
|
|
-f,n.b+f,n.c+f);q.normal.copy(n.normal);e&&q.normal.applyMatrix3(e).normalize();g=0;for(i=p.length;g<i;g++)t=p[g].clone(),e&&t.applyMatrix3(e).normalize(),q.vertexNormals.push(t);q.color.copy(n.color);g=0;for(i=s.length;g<i;g++)t=s[g],q.vertexColors.push(t.clone());q.materialIndex=n.materialIndex+c;q.centroid.copy(n.centroid);d&&q.centroid.applyMatrix4(d);k.push(q)}b=0;for(m=h.length;b<m;b++){c=h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},removeMaterials:function(a,
|
|
|
+0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableParticle=function(){this.id=0;this.object=null;this.z=this.y=this.x=0;this.rotation=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,k=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,m=i.length;b<m;b++){var n=i[b].clone();d&&n.applyMatrix4(d);g.push(n)}b=0;for(m=l.length;b<m;b++){var n=l[b],t,s,p=n.vertexNormals,q=n.vertexColors;t=new THREE.Face3(n.a+
|
|
|
+f,n.b+f,n.c+f);t.normal.copy(n.normal);e&&t.normal.applyMatrix3(e).normalize();g=0;for(i=p.length;g<i;g++)s=p[g].clone(),e&&s.applyMatrix3(e).normalize(),t.vertexNormals.push(s);t.color.copy(n.color);g=0;for(i=q.length;g<i;g++)s=q[g],t.vertexColors.push(s.clone());t.materialIndex=n.materialIndex+c;t.centroid.copy(n.centroid);d&&t.centroid.applyMatrix4(d);k.push(t)}b=0;for(m=h.length;b<m;b++){c=h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},removeMaterials:function(a,
|
|
|
b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,h=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||h.push(f);a.faces=h},randomPointInTriangle:function(){var a=new THREE.Vector3;return function(b,c,d){var e=new THREE.Vector3,f=THREE.Math.random16(),h=THREE.Math.random16();1<f+h&&(f=1-f,h=1-h);var g=1-f-h;e.copy(b);e.multiplyScalar(f);a.copy(c);a.multiplyScalar(h);e.add(a);a.copy(d);a.multiplyScalar(g);e.add(a);return e}}(),randomPointInFace:function(a,b){return THREE.GeometryUtils.randomPointInTriangle(b.vertices[a.a],
|
|
|
b.vertices[a.b],b.vertices[a.c])},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,h=a.vertices,g=f.length,i=0,k=[],l,m,n;for(e=0;e<g;e++)d=f[e],l=h[d.a],m=h[d.b],n=h[d.c],d._area=THREE.GeometryUtils.triangleArea(l,m,n),i+=d._area,k[e]=i;d=[];for(e=0;e<b;e++)h=THREE.Math.random16()*i,h=c(h),d[e]=THREE.GeometryUtils.randomPointInFace(f[h],a,!0);return d},triangleArea:function(){var a=
|
|
|
new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){a.subVectors(d,c);b.subVectors(e,c);a.cross(b);return 0.5*a.length()}}(),center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},triangulateQuads:function(a){var b,c,d,e,f=[],h=[],g=[];b=0;for(c=a.faceUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)g[b]=
|
|
@@ -526,14 +513,14 @@ i,!0);k.responseType="arraybuffer";k.send(null)}else k=new XMLHttpRequest,k.onlo
|
|
|
b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;
|
|
|
break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,k=0;k<i;k++){for(var l=0;l<d.mipmapCount;l++){var m=Math.max(4,f)/
|
|
|
4*Math.max(4,h)/4*e,n={data:new Uint8Array(a,g,m),width:f,height:h};d.mipmaps.push(n);g+=m;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),k=i.data,l=0;l<d;l++)for(var m=
|
|
|
-0;m<e;m++){var n=0>m-1?0:m-1,q=m+1>e-1?e-1:m+1,t=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,s=[],r=[0,0,g[4*(m*d+l)]/255*b];s.push([-1,0,g[4*(m*d+t)]/255*b]);s.push([-1,-1,g[4*(n*d+t)]/255*b]);s.push([0,-1,g[4*(n*d+l)]/255*b]);s.push([1,-1,g[4*(n*d+p)]/255*b]);s.push([1,0,g[4*(m*d+p)]/255*b]);s.push([1,1,g[4*(q*d+p)]/255*b]);s.push([0,1,g[4*(q*d+l)]/255*b]);s.push([-1,1,g[4*(q*d+t)]/255*b]);n=[];t=s.length;for(q=0;q<t;q++){var p=s[q],v=s[(q+1)%t],p=[p[0]-r[0],p[1]-r[1],p[2]-r[2]],v=[v[0]-r[0],v[1]-r[1],v[2]-r[2]];
|
|
|
-n.push(c([p[1]*v[2]-p[2]*v[1],p[2]*v[0]-p[0]*v[2],p[0]*v[1]-p[1]*v[0]]))}s=[0,0,0];for(q=0;q<n.length;q++)s[0]+=n[q][0],s[1]+=n[q][1],s[2]+=n[q][2];s[0]/=n.length;s[1]/=n.length;s[2]/=n.length;r=4*(m*d+l);k[r]=255*((s[0]+1)/2)|0;k[r+1]=255*((s[1]+1)/2)|0;k[r+2]=255*s[2]|0;k[r+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,
|
|
|
+0;m<e;m++){var n=0>m-1?0:m-1,t=m+1>e-1?e-1:m+1,s=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,q=[],r=[0,0,g[4*(m*d+l)]/255*b];q.push([-1,0,g[4*(m*d+s)]/255*b]);q.push([-1,-1,g[4*(n*d+s)]/255*b]);q.push([0,-1,g[4*(n*d+l)]/255*b]);q.push([1,-1,g[4*(n*d+p)]/255*b]);q.push([1,0,g[4*(m*d+p)]/255*b]);q.push([1,1,g[4*(t*d+p)]/255*b]);q.push([0,1,g[4*(t*d+l)]/255*b]);q.push([-1,1,g[4*(t*d+s)]/255*b]);n=[];s=q.length;for(t=0;t<s;t++){var p=q[t],u=q[(t+1)%s],p=[p[0]-r[0],p[1]-r[1],p[2]-r[2]],u=[u[0]-r[0],u[1]-r[1],u[2]-r[2]];
|
|
|
+n.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]]))}q=[0,0,0];for(t=0;t<n.length;t++)q[0]+=n[t][0],q[1]+=n[t][1],q[2]+=n[t][2];q[0]/=n.length;q[1]/=n.length;q[2]/=n.length;r=4*(m*d+l);k[r]=255*((q[0]+1)/2)|0;k[r+1]=255*((q[1]+1)/2)|0;k[r+2]=255*q[2]|0;k[r+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,
|
|
|
a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,l,m,n,q,t,p,s,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
-c+d;l=b[a++]*c;q=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(q,t,i,l);if(h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var v=h/g;THREE.Shape.Utils.b2(v,m,q,i);THREE.Shape.Utils.b2(v,n,t,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,q=b[a++]*c+d,t=b[a++]*-c,p=b[a++]*c+d,s=b[a++]*-c,e.bezierCurveTo(i,l,q,t,p,s),h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)v=h/g,THREE.Shape.Utils.b3(v,m,q,p,i),THREE.Shape.Utils.b3(v,n,t,s,l)}}}return{offset:r.ha*c,path:e}}}};
|
|
|
+0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,k,l,m,n,t,s,p,q,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
+c+d;l=b[a++]*c;t=b[a++]*c+d;s=b[a++]*c;e.quadraticCurveTo(t,s,i,l);if(h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var u=h/g;THREE.Shape.Utils.b2(u,m,t,i);THREE.Shape.Utils.b2(u,n,s,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,t=b[a++]*c+d,s=b[a++]*-c,p=b[a++]*c+d,q=b[a++]*-c,e.bezierCurveTo(i,l,t,s,p,q),h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)u=h/g,THREE.Shape.Utils.b3(u,m,t,p,i),THREE.Shape.Utils.b3(u,n,s,q,l)}}}return{offset:r.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var m=2*e;for(k=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{var q=n=void 0,t=void 0,p=void 0,s=void 0,r=void 0,v=void 0,y=void 0,J=
|
|
|
-void 0,q=a[h[i]].x,t=a[h[i]].y,p=a[h[k]].x,s=a[h[k]].y,r=a[h[l]].x,v=a[h[l]].y;if(1E-10>(p-q)*(v-t)-(s-t)*(r-q))n=!1;else{var B=void 0,H=void 0,I=void 0,C=void 0,z=void 0,M=void 0,E=void 0,F=void 0,S=void 0,x=void 0,S=F=E=J=y=void 0,B=r-p,H=v-s,I=q-r,C=t-v,z=p-q,M=s-t;for(n=0;n<e;n++)if(!(n===i||n===k||n===l))if(y=a[h[n]].x,J=a[h[n]].y,E=y-q,F=J-t,S=y-p,x=J-s,y-=r,J-=v,S=B*x-H*S,E=z*F-M*E,F=I*J-C*y,0<=S&&0<=F&&0<=E){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],h[k],h[l]]);
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,k,l;if(0<b(a))for(k=0;k<e;k++)h[k]=k;else for(k=0;k<e;k++)h[k]=e-1-k;var m=2*e;for(k=e-1;2<e;){if(0>=m--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);l=k+1;e<=l&&(l=0);var n;a:{var t=n=void 0,s=void 0,p=void 0,q=void 0,r=void 0,u=void 0,w=void 0,E=
|
|
|
+void 0,t=a[h[i]].x,s=a[h[i]].y,p=a[h[k]].x,q=a[h[k]].y,r=a[h[l]].x,u=a[h[l]].y;if(1E-10>(p-t)*(u-s)-(q-s)*(r-t))n=!1;else{var C=void 0,F=void 0,z=void 0,D=void 0,y=void 0,O=void 0,x=void 0,B=void 0,I=void 0,v=void 0,I=B=x=E=w=void 0,C=r-p,F=u-q,z=t-r,D=s-u,y=p-t,O=q-s;for(n=0;n<e;n++)if(!(n===i||n===k||n===l))if(w=a[h[n]].x,E=a[h[n]].y,x=w-t,B=E-s,I=w-p,v=E-q,w-=r,E-=u,I=C*v-F*I,x=y*B-O*x,B=z*E-D*w,0<=I&&0<=B&&0<=x){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[k]],a[h[l]]]);g.push([h[i],h[k],h[l]]);
|
|
|
i=k;for(l=k+1;l<e;i++,l++)h[i]=h[l];e--;m=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -554,17 +541,17 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var h=Array.prototype.s
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var h=this.actions[this.actions.length-1].args;this.absarc(a+h[h.length-2],b+h[h.length-1],c,d,e,f)};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,h){var g=this.actions[this.actions.length-1].args;this.absellipse(a+g[g.length-2],b+g[g.length-1],c,d,e,f,h)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,h){var g=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,h);this.curves.push(i);i=i.getPoint(h?1:0);g.push(i.x);g.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:g})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);var a=a||12,c=[],d,e,f,h,g,i,k,l,m,n,q,t,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];m=f[0];n=f[1];0<c.length?(h=c[c.length-1],q=h.x,
|
|
|
-t=h.y):(h=this.actions[d-1].args,q=h[h.length-2],t=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b2(p,q,m,g),p=THREE.Shape.Utils.b2(p,t,n,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];m=f[0];n=f[1];k=f[2];l=f[3];0<c.length?(h=c[c.length-1],q=h.x,t=h.y):(h=this.actions[d-1].args,q=h[h.length-2],t=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b3(p,q,m,k,g),p=THREE.Shape.Utils.b3(p,t,n,l,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.CSPLINE_THRU:h=
|
|
|
-this.actions[d-1].args;p=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=h;f++)c.push(p.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];n=f[2];k=f[3];h=f[4];m=!!f[5];q=h-k;t=2*a;for(f=1;f<=t;f++)p=f/t,m||(p=1-p),p=k+p*q,h=g+n*Math.cos(p),p=i+n*Math.sin(p),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];n=f[2];l=f[3];k=f[4];h=f[5];m=!!f[6];q=h-k;t=2*a;for(f=1;f<=t;f++)p=f/t,m||
|
|
|
-(p=1-p),p=k+p*q,h=g+n*Math.cos(p),p=i+l*Math.sin(p),c.push(new THREE.Vector2(h,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);var a=a||12,c=[],d,e,f,h,g,i,k,l,m,n,t,s,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],h=f.action,f=f.args,h){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:g=f[2];i=f[3];m=f[0];n=f[1];0<c.length?(h=c[c.length-1],t=h.x,
|
|
|
+s=h.y):(h=this.actions[d-1].args,t=h[h.length-2],s=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b2(p,t,m,g),p=THREE.Shape.Utils.b2(p,s,n,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.BEZIER_CURVE_TO:g=f[4];i=f[5];m=f[0];n=f[1];k=f[2];l=f[3];0<c.length?(h=c[c.length-1],t=h.x,s=h.y):(h=this.actions[d-1].args,t=h[h.length-2],s=h[h.length-1]);for(f=1;f<=a;f++)p=f/a,h=THREE.Shape.Utils.b3(p,t,m,k,g),p=THREE.Shape.Utils.b3(p,s,n,l,i),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.CSPLINE_THRU:h=
|
|
|
+this.actions[d-1].args;p=[new THREE.Vector2(h[h.length-2],h[h.length-1])];h=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=h;f++)c.push(p.getPointAt(f/h));break;case THREE.PathActions.ARC:g=f[0];i=f[1];n=f[2];k=f[3];h=f[4];m=!!f[5];t=h-k;s=2*a;for(f=1;f<=s;f++)p=f/s,m||(p=1-p),p=k+p*t,h=g+n*Math.cos(p),p=i+n*Math.sin(p),c.push(new THREE.Vector2(h,p));break;case THREE.PathActions.ELLIPSE:g=f[0];i=f[1];n=f[2];l=f[3];k=f[4];h=f[5];m=!!f[6];t=h-k;s=2*a;for(f=1;f<=s;f++)p=f/s,m||
|
|
|
+(p=1-p),p=k+p*t,h=g+n*Math.cos(p),p=i+l*Math.sin(p),c.push(new THREE.Vector2(h,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){var b,c,d,e,f=[],h=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)d=this.actions[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=h.actions.length&&(f.push(h),h=new THREE.Path),h[d].apply(h,e);0!=h.actions.length&&f.push(h);if(0==f.length)return[];var g;e=[];if(1==f.length)return d=f[0],g=new THREE.Shape,g.actions=d.actions,g.curves=d.curves,e.push(g),e;b=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(a?!b:b){g=new THREE.Shape;b=0;for(c=
|
|
|
f.length;b<c;b++)d=f[b],h=THREE.Shape.Utils.isClockWise(d.getPoints()),(h=a?!h:h)?(g.actions=d.actions,g.curves=d.curves,e.push(g),g=new THREE.Shape):g.holes.push(d)}else{g=void 0;b=0;for(c=f.length;b<c;b++)d=f[b],h=THREE.Shape.Utils.isClockWise(d.getPoints()),(h=a?!h:h)?(g&&e.push(g),g=new THREE.Shape,g.actions=d.actions,g.curves=d.curves):g.holes.push(d);e.push(g)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,k,l,m,n,q,t=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];q=[];for(m=0;m<c.length;m++)l=c[m],l=n.distanceToSquared(l),q.push(l),l<f&&(f=l,h=e,g=m)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;var p=[k[h],c[g],c[e]];m=THREE.FontUtils.Triangulate.area(p);var s=[k[h],k[f],c[g]];n=THREE.FontUtils.Triangulate.area(s);q=g;l=h;g+=1;h+=-1;0>
|
|
|
-g&&(g+=c.length);g%=c.length;0>h&&(h+=k.length);h%=k.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;p=[k[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(p);s=[k[h],k[f],c[g]];s=THREE.FontUtils.Triangulate.area(s);m+n>p+s&&(g=q,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=k.length),h%=k.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:k.length-1);m=c.slice(0,g);n=c.slice(g);q=k.slice(h);l=k.slice(0,h);f=[k[h],k[f],c[g]];t.push([k[h],c[g],c[e]]);t.push(f);c=m.concat(q).concat(l).concat(n)}return{shape:c,
|
|
|
-isolatedPts:t,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,k={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,h,g,i,k,l,m,n,t,s=[];for(i=0;i<b.length;i++){k=b[i];Array.prototype.push.apply(d,k);f=Number.POSITIVE_INFINITY;for(e=0;e<k.length;e++){n=k[e];t=[];for(m=0;m<c.length;m++)l=c[m],l=n.distanceToSquared(l),t.push(l),l<f&&(f=l,h=e,g=m)}e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;var p=[k[h],c[g],c[e]];m=THREE.FontUtils.Triangulate.area(p);var q=[k[h],k[f],c[g]];n=THREE.FontUtils.Triangulate.area(q);t=g;l=h;g+=1;h+=-1;0>
|
|
|
+g&&(g+=c.length);g%=c.length;0>h&&(h+=k.length);h%=k.length;e=0<=g-1?g-1:c.length-1;f=0<=h-1?h-1:k.length-1;p=[k[h],c[g],c[e]];p=THREE.FontUtils.Triangulate.area(p);q=[k[h],k[f],c[g]];q=THREE.FontUtils.Triangulate.area(q);m+n>p+q&&(g=t,h=l,0>g&&(g+=c.length),g%=c.length,0>h&&(h+=k.length),h%=k.length,e=0<=g-1?g-1:c.length-1,f=0<=h-1?h-1:k.length-1);m=c.slice(0,g);n=c.slice(g);t=k.slice(h);l=k.slice(0,h);f=[k[h],k[f],c[g]];s.push([k[h],c[g],c[e]]);s.push(f);c=m.concat(t).concat(l).concat(n)}return{shape:c,
|
|
|
+isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),f,h,g,i,k={};f=0;for(h=d.length;f<h;f++)i=d[f].x+":"+d[f].y,void 0!==k[i]&&console.log("Duplicate point",i),k[i]=f;f=0;for(h=c.length;f<h;f++){g=c[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}f=0;for(h=e.length;f<h;f++){g=e[f];for(d=0;3>d;d++)i=g[d].x+":"+g[d].y,i=k[i],void 0!==i&&(g[d]=i)}return c.concat(e)},
|
|
|
isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone().sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};
|
|
|
THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};
|
|
@@ -577,7 +564,7 @@ b)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation
|
|
|
THREE.Animation.prototype.play=function(a,b){if(!1===this.isPlaying){this.isPlaying=!0;this.loop=void 0!==a?a:!0;this.currentTime=void 0!==b?b:0;var c,d=this.hierarchy.length,e;for(c=0;c<d;c++){e=this.hierarchy[c];e.matrixAutoUpdate=!0;void 0===e.animationCache&&(e.animationCache={},e.animationCache.prevKey={pos:0,rot:0,scl:0},e.animationCache.nextKey={pos:0,rot:0,scl:0},e.animationCache.originalMatrix=e instanceof THREE.Bone?e.skinMatrix:e.matrix);var f=e.animationCache.prevKey;e=e.animationCache.nextKey;
|
|
|
f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.Animation.prototype.pause=function(){!0===this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this)};
|
|
|
-THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,h,g,i,k,l;l=this.currentTime+=a*this.timeScale;k=this.currentTime%=this.data.length;parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,n=this.hierarchy.length;m<n;m++){a=this.hierarchy[m];i=a.animationCache;for(var q=0;3>q;q++){c=b[q];h=i.prevKey[c];g=i.nextKey[c];if(g.time<=l){if(k<l)if(this.loop){h=this.data.hierarchy[m].keys[0];for(g=this.getNextKeyWith(c,m,1);g.time<
|
|
|
+THREE.Animation.prototype.update=function(a){if(!1!==this.isPlaying){var b=["pos","rot","scl"],c,d,e,f,h,g,i,k,l;l=this.currentTime+=a*this.timeScale;k=this.currentTime%=this.data.length;parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,n=this.hierarchy.length;m<n;m++){a=this.hierarchy[m];i=a.animationCache;for(var t=0;3>t;t++){c=b[t];h=i.prevKey[c];g=i.nextKey[c];if(g.time<=l){if(k<l)if(this.loop){h=this.data.hierarchy[m].keys[0];for(g=this.getNextKeyWith(c,m,1);g.time<
|
|
|
k;)h=g,g=this.getNextKeyWith(c,m,g.index+1)}else{this.stop();return}else{do h=g,g=this.getNextKeyWith(c,m,g.index+1);while(g.time<k)}i.prevKey[c]=h;i.nextKey[c]=g}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(k-h.time)/(g.time-h.time);e=h[c];f=g[c];if(0>d||1<d)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m),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",m,h.index-1).pos,this.points[1]=e,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",m,g.index+1).pos,d=0.33*d+0.33,e=this.interpolateCatmullRom(this.points,d),c.x=e[0],c.y=e[1],c.z=e[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(d=this.interpolateCatmullRom(this.points,1.01*d),
|
|
|
this.target.set(d[0],d[1],d[2]),this.target.sub(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0))}else"rot"===c?THREE.Quaternion.slerp(e,f,a.quaternion,d):"scl"===c&&(c=a.scale,c.x=e[0]+(f[0]-e[0])*d,c.y=e[1]+(f[1]-e[1])*d,c.z=e[2]+(f[2]-e[2])*d)}}}};
|
|
@@ -600,46 +587,46 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
|
|
|
-f[e+1],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,p){var s,r=g.widthSegments,v=g.heightSegments,y=e/2,J=f/2,B=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)s="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)s="y",v=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)s="x",r=g.depthSegments;var H=r+1,I=v+1,C=e/r,z=f/v,M=new THREE.Vector3;M[s]=0<h?1:-1;for(e=0;e<I;e++)for(f=0;f<H;f++){var E=new THREE.Vector3;E[a]=(f*C-y)*c;E[b]=(e*z-J)*d;E[s]=h;g.vertices.push(E)}for(e=
|
|
|
-0;e<v;e++)for(f=0;f<r;f++)a=f+H*e,b=f+1+H*(e+1),c=f+1+H*e,d=new THREE.Face3(a+B,f+H*(e+1)+B,b+B),d.normal.copy(M),d.vertexNormals.push(M.clone(),M.clone(),M.clone()),d.materialIndex=p,g.faces.push(d),g.faceVertexUvs[0].push([new THREE.Vector2(f/r,1-e/v),new THREE.Vector2(f/r,1-(e+1)/v),new THREE.Vector2((f+1)/r,1-(e+1)/v)]),d=new THREE.Face3(a+B,b+B,c+B),d.normal.copy(M),d.vertexNormals.push(M.clone(),M.clone(),M.clone()),d.materialIndex=p,g.faces.push(d),g.faceVertexUvs[0].push([new THREE.Vector2(f/
|
|
|
-r,1-e/v),new THREE.Vector2((f+1)/r,1-(e+1)/v),new THREE.Vector2((f+1)/r,1-e/v)])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",
|
|
|
--1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],q=i/e,t=q*(b-a)+a;for(g=0;g<=d;g++){var p=g/d,s=new THREE.Vector3;s.x=t*Math.sin(2*p*Math.PI);s.y=-q*c+h;s.z=t*Math.cos(2*p*Math.PI);this.vertices.push(s);m.push(this.vertices.length-1);n.push(new THREE.Vector2(p,
|
|
|
-1-q))}k.push(m);l.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(m=this.vertices[k[0][g]].clone(),n=this.vertices[k[0][g+1]].clone()):(m=this.vertices[k[1][g]].clone(),n=this.vertices[k[1][g+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var q=k[i][g],t=k[i+1][g],p=k[i+1][g+1],s=k[i][g+1],r=m.clone(),v=m.clone(),y=n.clone(),J=n.clone(),B=l[i][g].clone(),H=l[i+1][g].clone(),I=l[i+1][g+1].clone(),C=l[i][g+1].clone();this.faces.push(new THREE.Face3(q,
|
|
|
-t,p,[r,v,y]));this.faceVertexUvs[0].push([B,H,I]);this.faces.push(new THREE.Face3(q,p,s,[r,y,J]));this.faceVertexUvs[0].push([B,I,C])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)q=k[0][g],t=k[0][g+1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),B=l[0][g].clone(),H=l[0][g+1].clone(),I=new THREE.Vector2(H.u,0),this.faces.push(new THREE.Face3(q,t,p,[r,v,y])),this.faceVertexUvs[0].push([B,H,I])}if(!1===f&&0<
|
|
|
-b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)q=k[i][g+1],t=k[i][g],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),B=l[i][g+1].clone(),H=l[i][g].clone(),I=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(q,t,p,[r,v,y])),this.faceVertexUvs[0].push([B,H,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)};
|
|
|
+f[e+1],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,p){var q,r=g.widthSegments,u=g.heightSegments,w=e/2,E=f/2,C=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)q="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)q="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)q="x",r=g.depthSegments;var F=r+1,z=u+1,D=e/r,y=f/u,O=new THREE.Vector3;O[q]=0<h?1:-1;for(e=0;e<z;e++)for(f=0;f<F;f++){var x=new THREE.Vector3;x[a]=(f*D-w)*c;x[b]=(e*y-E)*d;x[q]=h;g.vertices.push(x)}for(e=
|
|
|
+0;e<u;e++)for(f=0;f<r;f++)E=f+F*e,a=f+F*(e+1),b=f+1+F*(e+1),c=f+1+F*e,d=new THREE.Vector2(f/r,1-e/u),h=new THREE.Vector2(f/r,1-(e+1)/u),q=new THREE.Vector2((f+1)/r,1-(e+1)/u),w=new THREE.Vector2((f+1)/r,1-e/u),E=new THREE.Face3(E+C,a+C,c+C),E.normal.copy(O),E.vertexNormals.push(O.clone(),O.clone(),O.clone()),E.materialIndex=p,g.faces.push(E),g.faceVertexUvs[0].push([d,h,w]),E=new THREE.Face3(a+C,b+C,c+C),E.normal.copy(O),E.vertexNormals.push(O.clone(),O.clone(),O.clone()),E.materialIndex=p,g.faces.push(E),
|
|
|
+g.faceVertexUvs[0].push([h,q,w])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();
|
|
|
+this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,k=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],t=i/e,s=t*(b-a)+a;for(g=0;g<=d;g++){var p=g/d,q=new THREE.Vector3;q.x=s*Math.sin(2*p*Math.PI);q.y=-t*c+h;q.z=s*Math.cos(2*p*Math.PI);this.vertices.push(q);m.push(this.vertices.length-1);n.push(new THREE.Vector2(p,
|
|
|
+1-t))}k.push(m);l.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(m=this.vertices[k[0][g]].clone(),n=this.vertices[k[0][g+1]].clone()):(m=this.vertices[k[1][g]].clone(),n=this.vertices[k[1][g+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var t=k[i][g],s=k[i+1][g],p=k[i+1][g+1],q=k[i][g+1],r=m.clone(),u=m.clone(),w=n.clone(),E=n.clone(),C=l[i][g].clone(),F=l[i+1][g].clone(),z=l[i+1][g+1].clone(),D=l[i][g+1].clone();this.faces.push(new THREE.Face3(t,
|
|
|
+s,q,[r,u,E]));this.faceVertexUvs[0].push([C,F,D]);this.faces.push(new THREE.Face3(s,p,q,[u,w,E]));this.faceVertexUvs[0].push([F,z,D])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)t=k[0][g],s=k[0][g+1],p=this.vertices.length-1,r=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),C=l[0][g].clone(),F=l[0][g+1].clone(),z=new THREE.Vector2(F.u,0),this.faces.push(new THREE.Face3(t,s,p,[r,u,w])),this.faceVertexUvs[0].push([C,F,z])}if(!1===f&&0<
|
|
|
+b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)t=k[i][g+1],s=k[i][g],p=this.vertices.length-1,r=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),C=l[i][g+1].clone(),F=l[i][g].clone(),z=new THREE.Vector2(F.u,1),this.faces.push(new THREE.Face3(t,s,p,[r,u,w])),this.faceVertexUvs[0].push([C,F,z])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(N=c.length;0<=--N;){e=N;f=N-1;0>f&&(f=c.length-1);for(var g=0,h=q+2*l,
|
|
|
-g=0;g<h;g++){var i=ia*g,k=ia*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,r=g,s=h,t=e,x=f,m=m+F,i=i+F,n=n+F,k=k+F;E.faces.push(new THREE.Face4(m,i,n,k,null,null,v));m=y.generateSideWallUV(E,a,p,b,m,i,n,k,r,s,t,x);E.faceVertexUvs[0].push(m)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=F;d+=F;e+=F;E.faces.push(new THREE.Face3(c,d,e,null,null,r));c=f?y.generateBottomUV(E,a,b,c,d,e):y.generateTopUV(E,a,b,c,d,e);E.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
|
|
|
-100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,t=b.extrudePath,p,s=!1,r=b.material,v=b.extrudeMaterial,y=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,J,B,H,I;t&&(p=t.getSpacedPoints(q),s=!0,m=!1,J=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,q,
|
|
|
-!1),B=new THREE.Vector3,H=new THREE.Vector3,I=new THREE.Vector3);m||(k=i=l=0);var C,z,M,E=this,F=this.vertices.length,n=a.extractPoints(n),S=n.shape,n=n.holes;if(t=!THREE.Shape.Utils.isClockWise(S)){S=S.reverse();z=0;for(M=n.length;z<M;z++)C=n[z],THREE.Shape.Utils.isClockWise(C)&&(n[z]=C.reverse());t=!1}var x=THREE.Shape.Utils.triangulateShape(S,n),t=S;z=0;for(M=n.length;z<M;z++)C=n[z],S=S.concat(C);var D,A,T,K,ia=S.length,ra=x.length,sa=[],N=0,U=t.length;D=U-1;for(A=N+1;N<U;N++,D++,A++)D===U&&(D=
|
|
|
-0),A===U&&(A=0),sa[N]=d(t[N],t[D],t[A]);var ba=[],L,ga=sa.concat();z=0;for(M=n.length;z<M;z++){C=n[z];L=[];N=0;U=C.length;D=U-1;for(A=N+1;N<U;N++,D++,A++)D===U&&(D=0),A===U&&(A=0),L[N]=d(C[N],C[D],C[A]);ba.push(L);ga=ga.concat(L)}for(D=0;D<l;D++){C=D/l;T=i*(1-C);A=k*Math.sin(C*Math.PI/2);N=0;for(U=t.length;N<U;N++)K=c(t[N],sa[N],A),f(K.x,K.y,-T);z=0;for(M=n.length;z<M;z++){C=n[z];L=ba[z];N=0;for(U=C.length;N<U;N++)K=c(C[N],L[N],A),f(K.x,K.y,-T)}}A=k;for(N=0;N<ia;N++)K=m?c(S[N],ga[N],A):S[N],s?(H.copy(J.normals[0]).multiplyScalar(K.x),
|
|
|
-B.copy(J.binormals[0]).multiplyScalar(K.y),I.copy(p[0]).add(H).add(B),f(I.x,I.y,I.z)):f(K.x,K.y,0);for(C=1;C<=q;C++)for(N=0;N<ia;N++)K=m?c(S[N],ga[N],A):S[N],s?(H.copy(J.normals[C]).multiplyScalar(K.x),B.copy(J.binormals[C]).multiplyScalar(K.y),I.copy(p[C]).add(H).add(B),f(I.x,I.y,I.z)):f(K.x,K.y,g/q*C);for(D=l-1;0<=D;D--){C=D/l;T=i*(1-C);A=k*Math.sin(C*Math.PI/2);N=0;for(U=t.length;N<U;N++)K=c(t[N],sa[N],A),f(K.x,K.y,g+T);z=0;for(M=n.length;z<M;z++){C=n[z];L=ba[z];N=0;for(U=C.length;N<U;N++)K=c(C[N],
|
|
|
-L[N],A),s?f(K.x,K.y+p[q-1].y,p[q-1].x+T):f(K.x,K.y,g+T)}}if(m){i=0*ia;for(N=0;N<ra;N++)g=x[N],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ia*(q+2*l);for(N=0;N<ra;N++)g=x[N],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(N=0;N<ra;N++)g=x[N],h(g[2],g[1],g[0],!0);for(N=0;N<ra;N++)g=x[N],h(g[0]+ia*q,g[1]+ia*q,g[2]+ia*q,!1)}g=0;e(t,g);g+=t.length;z=0;for(M=n.length;z<M;z++)C=n[z],e(C,g),g+=C.length};
|
|
|
+h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(N=c.length;0<=--N;){e=N;f=N-1;0>f&&(f=c.length-1);for(var g=0,h=t+2*l,
|
|
|
+g=0;g<h;g++){var i=ba*g,k=ba*(g+1),m=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,s=e,v=f,m=m+B,i=i+B,n=n+B,k=k+B;x.faces.push(new THREE.Face4(m,i,n,k,null,null,u));m=w.generateSideWallUV(x,a,p,b,m,i,n,k,q,r,s,v);x.faceVertexUvs[0].push(m)}}}function f(a,b,c){x.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=B;d+=B;e+=B;x.faces.push(new THREE.Face3(c,d,e,null,null,r));c=f?w.generateBottomUV(x,a,b,c,d,e):w.generateTopUV(x,a,b,c,d,e);x.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
|
|
|
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,s=b.extrudePath,p,q=!1,r=b.material,u=b.extrudeMaterial,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,E,C,F,z;s&&(p=s.getSpacedPoints(t),q=!0,m=!1,E=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(s,t,
|
|
|
+!1),C=new THREE.Vector3,F=new THREE.Vector3,z=new THREE.Vector3);m||(k=i=l=0);var D,y,O,x=this,B=this.vertices.length,n=a.extractPoints(n),I=n.shape,n=n.holes;if(s=!THREE.Shape.Utils.isClockWise(I)){I=I.reverse();y=0;for(O=n.length;y<O;y++)D=n[y],THREE.Shape.Utils.isClockWise(D)&&(n[y]=D.reverse());s=!1}var v=THREE.Shape.Utils.triangulateShape(I,n),s=I;y=0;for(O=n.length;y<O;y++)D=n[y],I=I.concat(D);var A,G,R,J,ba=I.length,qa=v.length,ra=[],N=0,M=s.length;A=M-1;for(G=N+1;N<M;N++,A++,G++)A===M&&(A=
|
|
|
+0),G===M&&(G=0),ra[N]=d(s[N],s[A],s[G]);var Q=[],K,da=ra.concat();y=0;for(O=n.length;y<O;y++){D=n[y];K=[];N=0;M=D.length;A=M-1;for(G=N+1;N<M;N++,A++,G++)A===M&&(A=0),G===M&&(G=0),K[N]=d(D[N],D[A],D[G]);Q.push(K);da=da.concat(K)}for(A=0;A<l;A++){D=A/l;R=i*(1-D);G=k*Math.sin(D*Math.PI/2);N=0;for(M=s.length;N<M;N++)J=c(s[N],ra[N],G),f(J.x,J.y,-R);y=0;for(O=n.length;y<O;y++){D=n[y];K=Q[y];N=0;for(M=D.length;N<M;N++)J=c(D[N],K[N],G),f(J.x,J.y,-R)}}G=k;for(N=0;N<ba;N++)J=m?c(I[N],da[N],G):I[N],q?(F.copy(E.normals[0]).multiplyScalar(J.x),
|
|
|
+C.copy(E.binormals[0]).multiplyScalar(J.y),z.copy(p[0]).add(F).add(C),f(z.x,z.y,z.z)):f(J.x,J.y,0);for(D=1;D<=t;D++)for(N=0;N<ba;N++)J=m?c(I[N],da[N],G):I[N],q?(F.copy(E.normals[D]).multiplyScalar(J.x),C.copy(E.binormals[D]).multiplyScalar(J.y),z.copy(p[D]).add(F).add(C),f(z.x,z.y,z.z)):f(J.x,J.y,g/t*D);for(A=l-1;0<=A;A--){D=A/l;R=i*(1-D);G=k*Math.sin(D*Math.PI/2);N=0;for(M=s.length;N<M;N++)J=c(s[N],ra[N],G),f(J.x,J.y,g+R);y=0;for(O=n.length;y<O;y++){D=n[y];K=Q[y];N=0;for(M=D.length;N<M;N++)J=c(D[N],
|
|
|
+K[N],G),q?f(J.x,J.y+p[t-1].y,p[t-1].x+R):f(J.x,J.y,g+R)}}if(m){i=0*ba;for(N=0;N<qa;N++)g=v[N],h(g[2]+i,g[1]+i,g[0]+i,!0);i=ba*(t+2*l);for(N=0;N<qa;N++)g=v[N],h(g[0]+i,g[1]+i,g[2]+i,!1)}else{for(N=0;N<qa;N++)g=v[N],h(g[2],g[1],g[0],!0);for(N=0;N<qa;N++)g=v[N],h(g[0]+ba*t,g[1]+ba*t,g[2]+ba*t,!1)}g=0;e(s,g);g+=s.length;y=0;for(O=n.length;y<O;y++)D=n[y],e(D,g),g+=D.length};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,h,g){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[h].x,
|
|
|
l=a.vertices[h].y,h=a.vertices[h].z,m=a.vertices[g].x,n=a.vertices[g].y,a=a.vertices[g].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-h),new THREE.Vector2(m,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(l,1-h),new THREE.Vector2(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
|
THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,h,g=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var i=e.shape,k=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=k.length;e<f;e++)h=k[e],THREE.Shape.Utils.isClockWise(h)&&(k[e]=h.reverse())}var l=THREE.Shape.Utils.triangulateShape(i,k);e=0;for(f=k.length;e<f;e++)h=k[e],
|
|
|
-i=i.concat(h);k=i.length;f=l.length;for(e=0;e<k;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+g,h=k[1]+g,k=k[2]+g,this.faces.push(new THREE.Face3(i,h,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,k=Math.cos(i),l=Math.sin(i),i=0,m=a.length;i<m;i++){var n=a[i],q=new THREE.Vector3;q.x=k*n.x-l*n.y;q.y=l*n.x+k*n.y;q.z=n.z;this.vertices.push(q)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(m=a.length-1;i<m;i++){var b=l=i+c*h,d=l+c,k=l+1+c,l=l+1,n=h*f,q=i*e,t=n+f,p=q+e;this.faces.push(new THREE.Face3(b,d,k));this.faceVertexUvs[0].push([new THREE.Vector2(n,
|
|
|
-q),new THREE.Vector2(t,q),new THREE.Vector2(t,p)]);this.faces.push(new THREE.Face3(b,k,l));this.faceVertexUvs[0].push([new THREE.Vector2(n,q),new THREE.Vector2(t,p),new THREE.Vector2(n,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;for(var e=a/2,f=b/2,c=this.widthSegments,d=this.heightSegments,h=c+1,g=d+1,i=this.width/c,k=this.height/d,l=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++)e=b+h*a,f=b+1+h*(a+1),g=b+1+h*a,i=new THREE.Face3(e,b+h*(a+1),f),i.normal.copy(l),i.vertexNormals.push(l.clone(),
|
|
|
-l.clone(),l.clone()),this.faces.push(i),this.faceVertexUvs[0].push([new THREE.Vector2(b/c,1-a/d),new THREE.Vector2(b/c,1-(a+1)/d),new THREE.Vector2((b+1)/c,1-(a+1)/d)]),i=new THREE.Face3(e,f,g),i.normal.copy(l),i.vertexNormals.push(l.clone(),l.clone(),l.clone()),this.faces.push(i),this.faceVertexUvs[0].push([new THREE.Vector2(b/c,1-a/d),new THREE.Vector2((b+1)/c,1-(a+1)/d),new THREE.Vector2((b+1)/c,1-a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,h=[],g=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var k=new THREE.Vector3,l=e+b/c*f;k.x=g*Math.cos(l);k.y=g*Math.sin(l);this.vertices.push(k);h.push(new THREE.Vector2((k.x/g+1)/2,-(k.y/g+1)/2+1))}g+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var l=b+f,i=l+a,k=l+c+a,m=l+c+1+a;this.faces.push(new THREE.Face3(i,
|
|
|
-k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]]);i=l+a;k=l+c+1+a;m=l+1+a;this.faces.push(new THREE.Face3(i,k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,g)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,k=[],l=[];for(i=0;i<=c;i++){var m=[],n=[];for(g=0;g<=b;g++){var q=g/b,t=i/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+q*e)*Math.sin(f+t*h);p.y=a*Math.cos(f+t*h);
|
|
|
-p.z=a*Math.sin(d+q*e)*Math.sin(f+t*h);this.vertices.push(p);m.push(this.vertices.length-1);n.push(new THREE.Vector2(q,1-t))}k.push(m);l.push(n)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=k[i][g+1],c=k[i][g],d=k[i+1][g],e=k[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),m=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),q=l[i][g+1].clone(),t=l[i][g].clone(),p=l[i+1][g].clone(),s=l[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
-this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,m,n])),this.faceVertexUvs[0].push([q,p,s])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,h,m])),this.faceVertexUvs[0].push([q,t,p])):(this.faces.push(new THREE.Face3(b,c,d,[f,h,m])),this.faceVertexUvs[0].push([q,t,p]),this.faces.push(new THREE.Face3(b,d,e,[f,m,n])),this.faceVertexUvs[0].push([q,p,s]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,
|
|
|
+i=i.concat(h);k=i.length;f=l.length;for(e=0;e<k;e++)h=i[e],this.vertices.push(new THREE.Vector3(h.x,h.y,0));for(e=0;e<f;e++)k=l[e],i=k[0]+g,h=k[1]+g,k=k[2]+g,this.faces.push(new THREE.Face3(i,h,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,h,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var b=b||12,c=c||0,d=d||2*Math.PI,e=1/(a.length-1),f=1/b,h=0,g=b;h<=g;h++)for(var i=c+h*f*d,k=Math.cos(i),l=Math.sin(i),i=0,m=a.length;i<m;i++){var n=a[i],t=new THREE.Vector3;t.x=k*n.x-l*n.y;t.y=l*n.x+k*n.y;t.z=n.z;this.vertices.push(t)}c=a.length;h=0;for(g=b;h<g;h++){i=0;for(m=a.length-1;i<m;i++){var b=l=i+c*h,d=l+c,k=l+1+c,l=l+1,n=h*f,t=i*e,s=n+f,p=t+e;this.faces.push(new THREE.Face3(b,d,l));this.faceVertexUvs[0].push([new THREE.Vector2(n,
|
|
|
+t),new THREE.Vector2(s,t),new THREE.Vector2(n,p)]);this.faces.push(new THREE.Face3(d,k,l));this.faceVertexUvs[0].push([new THREE.Vector2(s,t),new THREE.Vector2(s,p),new THREE.Vector2(n,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;for(var e=a/2,f=b/2,c=this.widthSegments,d=this.heightSegments,h=c+1,g=d+1,i=this.width/c,k=this.height/d,l=new THREE.Vector3(0,0,1),a=0;a<g;a++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vector3(b*i-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var m=b+h*a,e=b+h*(a+1),f=b+1+h*(a+1),g=b+1+h*a,i=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+1)/
|
|
|
+d),n=new THREE.Vector2((b+1)/c,1-(a+1)/d),t=new THREE.Vector2((b+1)/c,1-a/d),m=new THREE.Face3(m,e,g);m.normal.copy(l);m.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(m);this.faceVertexUvs[0].push([i,k,t]);m=new THREE.Face3(e,f,g);m.normal.copy(l);m.vertexNormals.push(l.clone(),l.clone(),l.clone());this.faces.push(m);this.faceVertexUvs[0].push([k,n,t])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);for(var a=a||0,b=b||50,e=void 0!==e?e:0,f=void 0!==f?f:2*Math.PI,c=void 0!==c?Math.max(3,c):8,d=void 0!==d?Math.max(3,d):8,h=[],g=a,i=(b-a)/d,a=0;a<=d;a++){for(b=0;b<=c;b++){var k=new THREE.Vector3,l=e+b/c*f;k.x=g*Math.cos(l);k.y=g*Math.sin(l);this.vertices.push(k);h.push(new THREE.Vector2((k.x/g+1)/2,-(k.y/g+1)/2+1))}g+=i}e=new THREE.Vector3(0,0,1);for(a=0;a<d;a++){f=a*c;for(b=0;b<=c;b++){var l=b+f,i=l+a,k=l+c+a,m=l+c+1+a;this.faces.push(new THREE.Face3(i,
|
|
|
+k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]]);i=l+a;k=l+c+1+a;m=l+1+a;this.faces.push(new THREE.Face3(i,k,m,[e,e,e]));this.faceVertexUvs[0].push([h[i],h[k],h[m]])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,g)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,h){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=h=void 0!==h?h:Math.PI;var g,i,k=[],l=[];for(i=0;i<=c;i++){var m=[],n=[];for(g=0;g<=b;g++){var t=g/b,s=i/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+t*e)*Math.sin(f+s*h);p.y=a*Math.cos(f+s*h);
|
|
|
+p.z=a*Math.sin(d+t*e)*Math.sin(f+s*h);this.vertices.push(p);m.push(this.vertices.length-1);n.push(new THREE.Vector2(t,1-s))}k.push(m);l.push(n)}for(i=0;i<this.heightSegments;i++)for(g=0;g<this.widthSegments;g++){var b=k[i][g+1],c=k[i][g],d=k[i+1][g],e=k[i+1][g+1],f=this.vertices[b].clone().normalize(),h=this.vertices[c].clone().normalize(),m=this.vertices[d].clone().normalize(),n=this.vertices[e].clone().normalize(),t=l[i][g+1].clone(),s=l[i][g].clone(),p=l[i+1][g].clone(),q=l[i+1][g+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
+this.radius?(this.faces.push(new THREE.Face3(b,d,e,[f,m,n])),this.faceVertexUvs[0].push([t,p,q])):Math.abs(this.vertices[d].y)===this.radius?(this.faces.push(new THREE.Face3(b,c,d,[f,h,m])),this.faceVertexUvs[0].push([t,s,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,h,n])),this.faceVertexUvs[0].push([t,s,q]),this.faces.push(new THREE.Face3(c,d,e,[h,m,n])),this.faceVertexUvs[0].push([s,p,q]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,
|
|
|
a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){var b=b||{},c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,h=2*c/this.radialSegments*Math.PI;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var g=new THREE.Vector3;g.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);g.y=(this.radius+this.tube*
|
|
|
-Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(g.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,h=(this.tubularSegments+1)*(c-1)+d,g=(this.tubularSegments+1)*c+d,i=new THREE.Face3(e,f,h,[b[e],b[f],b[h]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[h]);i.normal.normalize();
|
|
|
-this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[h].clone()]);i=new THREE.Face3(e,h,g,[b[e],b[h],b[g]]);i.normal.add(b[e]);i.normal.add(b[h]);i.normal.add(b[g]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a),a=b/c*a,b=Math.cos(a),f=0.5*(d*(2+b))*f,g=0.5*d*(2+b)*g,d=0.5*e*d*Math.sin(a);return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
+Math.cos(h))*Math.sin(f);g.z=this.tube*Math.sin(h);this.vertices.push(g);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(g.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,h=(this.tubularSegments+1)*(c-1)+d,g=(this.tubularSegments+1)*c+d,i=new THREE.Face3(e,f,g,[b[e],b[f],b[g]]);i.normal.add(b[e]);i.normal.add(b[f]);i.normal.add(b[g]);i.normal.normalize();
|
|
|
+this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone()]);i=new THREE.Face3(f,h,g,[b[f],b[h],b[g]]);i.normal.add(b[f]);i.normal.add(b[h]);i.normal.add(b[g]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[g].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,h){function g(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a),a=b/c*a,b=Math.cos(a),f=0.5*(d*(2+b))*f,g=0.5*d*(2+b)*g,d=0.5*e*d*Math.sin(a);return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
|
Array(this.tubularSegments);b=2*(a/this.radialSegments)*this.p*Math.PI;f=g(b,this.q,this.p,this.radius,this.heightScale);b=g(b+0.01,this.q,this.p,this.radius,this.heightScale);c.subVectors(b,f);d.addVectors(b,f);e.crossVectors(c,d);d.crossVectors(e,c);e.normalize();d.normalize();for(b=0;b<this.tubularSegments;++b){var i=2*(b/this.tubularSegments)*Math.PI,h=-this.tube*Math.cos(i),i=this.tube*Math.sin(i),k=new THREE.Vector3;k.x=f.x+h*d.x+i*e.x;k.y=f.y+h*d.y+i*e.y;k.z=f.z+h*d.z+i*e.z;this.grid[a][b]=
|
|
|
this.vertices.push(k)-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.Vector2(a/this.radialSegments,b/this.tubularSegments),i=new THREE.Vector2((a+1)/this.radialSegments,b/this.tubularSegments),k=new THREE.Vector2((a+1)/this.radialSegments,(b+1)/this.tubularSegments),l=new THREE.Vector2(a/this.radialSegments,(b+1)/this.tubularSegments);
|
|
|
-this.faces.push(new THREE.Face3(c,d,e));this.faceVertexUvs[0].push([h,i,k]);this.faces.push(new THREE.Face3(c,e,f));this.faceVertexUvs[0].push([h,k,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radialSegments=d||8;this.closed=e||!1;this.grid=[];var f,h,d=this.segments+1,g,i,k,e=new THREE.Vector3,l,m,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);l=b.normals;m=b.binormals;this.tangents=b.tangents;this.normals=l;this.binormals=m;for(b=0;b<d;b++){this.grid[b]=[];c=b/(d-1);k=a.getPointAt(c);f=l[b];h=m[b];for(c=0;c<this.radialSegments;c++)g=2*(c/this.radialSegments)*
|
|
|
+this.faces.push(new THREE.Face3(c,d,f));this.faceVertexUvs[0].push([h,i,l]);this.faces.push(new THREE.Face3(d,e,f));this.faceVertexUvs[0].push([i,k,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radialSegments=d||8;this.closed=e||!1;this.grid=[];var f,h,d=this.segments+1,g,i,k,e=new THREE.Vector3,l,m,b=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed);l=b.normals;m=b.binormals;this.tangents=b.tangents;this.normals=l;this.binormals=m;for(b=0;b<d;b++){this.grid[b]=[];c=b/(d-1);k=a.getPointAt(c);f=l[b];h=m[b];for(c=0;c<this.radialSegments;c++)g=2*(c/this.radialSegments)*
|
|
|
Math.PI,i=-this.radius*Math.cos(g),g=this.radius*Math.sin(g),e.copy(k),e.x+=i*f.x+g*h.x,e.y+=i*f.y+g*h.y,e.z+=i*f.z+g*h.z,this.grid[b][c]=this.vertices.push(new THREE.Vector3(e.x,e.y,e.z))-1}for(b=0;b<this.segments;b++)for(c=0;c<this.radialSegments;c++)e=this.closed?(b+1)%this.segments:b+1,l=(c+1)%this.radialSegments,a=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][l],l=this.grid[b][l],m=new THREE.Vector2(b/this.segments,c/this.radialSegments),f=new THREE.Vector2((b+1)/this.segments,c/this.radialSegments),
|
|
|
-h=new THREE.Vector2((b+1)/this.segments,(c+1)/this.radialSegments),i=new THREE.Vector2(b/this.segments,(c+1)/this.radialSegments),this.faces.push(new THREE.Face4(a,d,e,l)),this.faceVertexUvs[0].push([m,f,h,i]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+h=new THREE.Vector2((b+1)/this.segments,(c+1)/this.radialSegments),i=new THREE.Vector2(b/this.segments,(c+1)/this.radialSegments),this.faces.push(new THREE.Face3(a,d,l)),this.faceVertexUvs[0].push([m,f,i]),this.faces.push(new THREE.Face3(d,e,l)),this.faceVertexUvs[0].push([f,h,i]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var e=[],f=[],h=[],g=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,k,l,m;this.tangents=e;this.normals=f;this.binormals=h;for(k=0;k<b;k++)l=k/(b-1),e[k]=a.getTangentAt(l),e[k].normalize();f[0]=new THREE.Vector3;h[0]=new THREE.Vector3;a=Number.MAX_VALUE;k=Math.abs(e[0].x);l=Math.abs(e[0].y);m=Math.abs(e[0].z);k<=a&&(a=k,d.set(1,0,0));l<=a&&(a=l,d.set(0,1,0));m<=a&&d.set(0,0,1);g.crossVectors(e[0],
|
|
|
d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),h[k]=h[k-1].clone(),g.crossVectors(e[k-1],e[k]),1E-4<g.length()&&(g.normalize(),d=Math.acos(THREE.Math.clamp(e[k-1].dot(e[k]),-1,1)),f[k].applyMatrix4(i.makeRotationAxis(g,d))),h[k].crossVectors(e[k],f[k]);if(c){d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(k=1;k<b;k++)f[k].applyMatrix4(i.makeRotationAxis(e[k],d*k)),h[k].crossVectors(e[k],
|
|
|
f[k])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
|
|
|
-h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,k=a.length;i<k;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=this.vertices,a=[],i=0,k=b.length;i<k;i++){var m=l[b[i][0]],n=l[b[i][1]],q=l[b[i][2]];a[i]=new THREE.Face3(m.index,n.index,q.index,[m.clone(),n.clone(),q.clone()])}i=0;for(k=a.length;i<k;i++){n=a[i];l=d;b=Math.pow(2,
|
|
|
-l);Math.pow(4,l);for(var l=e(g.vertices[n.a]),m=e(g.vertices[n.b]),t=e(g.vertices[n.c]),n=[],q=0;q<=b;q++){n[q]=[];for(var p=e(l.clone().lerp(t,q/b)),s=e(m.clone().lerp(t,q/b)),r=b-q,v=0;v<=r;v++)n[q][v]=0==v&&q==b?p:e(p.clone().lerp(s,v/r))}for(q=0;q<b;q++)for(v=0;v<2*(b-q)-1;v++)l=Math.floor(v/2),0==v%2?f(n[q][l+1],n[q+1][l],n[q][l]):f(n[q][l+1],n[q+1][l+1],n[q+1][l])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,m=Math.max(a,Math.max(b,l)),
|
|
|
-n=Math.min(a,Math.min(b,l)),0.9<m&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,h=this.faceVertexUvs[0],d=void 0===d?!1:d,g,i,k,l,m=b+1;for(g=0;g<=c;g++){l=g/c;for(i=0;i<=b;i++)k=i/b,k=a(k,l),e.push(k)}var n,q,t,p;for(g=0;g<c;g++)for(i=0;i<b;i++)a=g*m+i,e=g*m+i+1,l=(g+1)*m+i,k=(g+1)*m+i+1,n=new THREE.Vector2(i/b,g/c),q=new THREE.Vector2((i+1)/b,g/c),t=new THREE.Vector2(i/b,(g+1)/c),p=new THREE.Vector2((i+1)/b,(g+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,
|
|
|
-k,l)),h.push([n,q,t]),h.push([q,p,t])):(f.push(new THREE.Face4(a,e,k,l)),h.push([n,q,p,t]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
+h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,k=a.length;i<k;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=this.vertices,a=[],i=0,k=b.length;i<k;i++){var m=l[b[i][0]],n=l[b[i][1]],t=l[b[i][2]];a[i]=new THREE.Face3(m.index,n.index,t.index,[m.clone(),n.clone(),t.clone()])}i=0;for(k=a.length;i<k;i++){n=a[i];l=d;b=Math.pow(2,
|
|
|
+l);Math.pow(4,l);for(var l=e(g.vertices[n.a]),m=e(g.vertices[n.b]),s=e(g.vertices[n.c]),n=[],t=0;t<=b;t++){n[t]=[];for(var p=e(l.clone().lerp(s,t/b)),q=e(m.clone().lerp(s,t/b)),r=b-t,u=0;u<=r;u++)n[t][u]=0==u&&t==b?p:e(p.clone().lerp(q,u/r))}for(t=0;t<b;t++)for(u=0;u<2*(b-t)-1;u++)l=Math.floor(u/2),0==u%2?f(n[t][l+1],n[t+1][l],n[t][l]):f(n[t][l+1],n[t+1][l+1],n[t+1][l])}i=0;for(k=this.faceVertexUvs[0].length;i<k;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,m=Math.max(a,Math.max(b,l)),
|
|
|
+n=Math.min(a,Math.min(b,l)),0.9<m&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(k=this.vertices.length;i<k;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],h,g,i,k,l=b+1;for(h=0;h<=c;h++){k=h/c;for(g=0;g<=b;g++)i=g/b,i=a(i,k),d.push(i)}var m,n,t,s;for(h=0;h<c;h++)for(g=0;g<b;g++)a=h*l+g,d=h*l+g+1,k=(h+1)*l+g+1,i=(h+1)*l+g,m=new THREE.Vector2(g/b,h/c),n=new THREE.Vector2((g+1)/b,h/c),t=new THREE.Vector2((g+1)/b,(h+1)/c),s=new THREE.Vector2(g/b,(h+1)/c),e.push(new THREE.Face3(a,d,i)),f.push([m,n,s]),e.push(new THREE.Face3(d,k,i)),
|
|
|
+f.push([n,t,s]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);this.position=b;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.05,0.25,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,0.875,0));this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));
|
|
|
this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c)};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){this.scale.set(a,a,a)};
|
|
|
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);
|
|
@@ -669,38 +656,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),h=d.weight;
|
|
|
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,k,l,m,n,q;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1;
|
|
|
-e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*h,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*h;this.morphTargetInfluences[d.lastFrame]=(1-e)*h}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,h,g,i,k,l,m,n,t;this.init=function(s){b=s.context;c=s;d=s.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);s=0;e[s++]=-1;e[s++]=-1;
|
|
|
+e[s++]=0;e[s++]=0;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=1;e[s++]=-1;e[s++]=1;e[s++]=0;e[s++]=1;s=0;f[s++]=0;f[s++]=1;f[s++]=2;f[s++]=0;f[s++]=2;f[s++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,m=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};q={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");q.renderType=b.getUniformLocation(m,"renderType");q.map=b.getUniformLocation(m,"map");q.occlusionMap=b.getUniformLocation(m,"occlusionMap");q.opacity=
|
|
|
-b.getUniformLocation(m,"opacity");q.color=b.getUniformLocation(m,"color");q.scale=b.getUniformLocation(m,"scale");q.rotation=b.getUniformLocation(m,"rotation");q.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var y=new THREE.Vector3,J=f/e,B=0.5*e,H=0.5*f,I=16/f,C=new THREE.Vector2(I*J,I),z=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1),E=q,I=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
-b.uniform1i(E.occlusionMap,0);b.uniform1i(E.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);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,g);b.disable(b.CULL_FACE);b.depthMask(!1);var F,S,x,D,A;for(F=0;F<v;F++)if(I=16/f,C.set(I*J,I),D=a[F],y.set(D.matrixWorld.elements[12],D.matrixWorld.elements[13],D.matrixWorld.elements[14]),y.applyMatrix4(d.matrixWorldInverse),y.applyProjection(d.projectionMatrix),z.copy(y),M.x=z.x*B+B,
|
|
|
-M.y=z.y*H+H,l||0<M.x&&M.x<e&&0<M.y&&M.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,M.x-8,M.y-8,16,16,0);b.uniform1i(E.renderType,0);b.uniform2f(E.scale,C.x,C.y);b.uniform3f(E.screenPosition,z.x,z.y,z.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,M.x-8,M.y-8,16,16,0);b.uniform1i(E.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);D.positionScreen.copy(z);D.customUpdateCallback?D.customUpdateCallback(D):D.updateLensFlares();b.uniform1i(E.renderType,2);b.enable(b.BLEND);S=0;for(x=D.lensFlares.length;S<x;S++)A=D.lensFlares[S],0.001<A.opacity&&0.001<A.scale&&(z.x=A.x,z.y=A.y,z.z=A.z,I=A.size*A.scale/f,C.x=I*J,C.y=I,b.uniform3f(E.screenPosition,z.x,z.y,z.z),b.uniform2f(E.scale,C.x,C.y),b.uniform1f(E.rotation,A.rotation),b.uniform1f(E.opacity,
|
|
|
-A.opacity),b.uniform3f(E.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),c.setTexture(A.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var q,t,p,s,r,v,y,J,B,H=[];s=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);q=0;for(t=m.__lights.length;q<t;q++)if(p=m.__lights[q],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(r=0;r<p.shadowCascadeCount;r++){var I;if(p.shadowCascadeArray[r])I=p.shadowCascadeArray[r];else{B=p;y=r;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=B.shadowCameraNear;I.shadowCameraFar=B.shadowCameraFar;I.shadowCameraLeft=B.shadowCameraLeft;I.shadowCameraRight=B.shadowCameraRight;
|
|
|
-I.shadowCameraBottom=B.shadowCameraBottom;I.shadowCameraTop=B.shadowCameraTop;I.shadowCameraVisible=B.shadowCameraVisible;I.shadowDarkness=B.shadowDarkness;I.shadowBias=B.shadowCascadeBias[y];I.shadowMapWidth=B.shadowCascadeWidth[y];I.shadowMapHeight=B.shadowCascadeHeight[y];I.pointsWorld=[];I.pointsFrustum=[];J=I.pointsWorld;v=I.pointsFrustum;for(var C=0;8>C;C++)J[C]=new THREE.Vector3,v[C]=new THREE.Vector3;J=B.shadowCascadeNearZ[y];B=B.shadowCascadeFarZ[y];v[0].set(-1,-1,J);v[1].set(1,-1,J);v[2].set(-1,
|
|
|
-1,J);v[3].set(1,1,J);v[4].set(-1,-1,B);v[5].set(1,-1,B);v[6].set(-1,1,B);v[7].set(1,1,B);I.originalCamera=n;v=new THREE.Gyroscope;v.position=p.shadowCascadeOffset;v.add(I);v.add(I.target);n.add(v);p.shadowCascadeArray[r]=I;console.log("Created virtualLight",I)}y=p;J=r;B=y.shadowCascadeArray[J];B.position.copy(y.position);B.target.position.copy(y.target.position);B.lookAt(B.target);B.shadowCameraVisible=y.shadowCameraVisible;B.shadowDarkness=y.shadowDarkness;B.shadowBias=y.shadowCascadeBias[J];v=y.shadowCascadeNearZ[J];
|
|
|
-y=y.shadowCascadeFarZ[J];B=B.pointsFrustum;B[0].z=v;B[1].z=v;B[2].z=v;B[3].z=v;B[4].z=y;B[5].z=y;B[6].z=y;B[7].z=y;H[s]=I;s++}else H[s]=p,s++;q=0;for(t=H.length;q<t;q++){p=H[q];p.shadowMap||(r=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(r=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:r,magFilter:r,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,m=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};t={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");t.renderType=b.getUniformLocation(m,"renderType");t.map=b.getUniformLocation(m,"map");t.occlusionMap=b.getUniformLocation(m,"occlusionMap");t.opacity=
|
|
|
+b.getUniformLocation(m,"opacity");t.color=b.getUniformLocation(m,"color");t.scale=b.getUniformLocation(m,"scale");t.rotation=b.getUniformLocation(m,"rotation");t.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var w=new THREE.Vector3,E=f/e,C=0.5*e,F=0.5*f,z=16/f,D=new THREE.Vector2(z*E,z),y=new THREE.Vector3(1,1,0),O=new THREE.Vector2(1,1),x=t,z=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
+b.uniform1i(x.occlusionMap,0);b.uniform1i(x.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(z.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(z.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var B,I,v,A,G;for(B=0;B<u;B++)if(z=16/f,D.set(z*E,z),A=a[B],w.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),w.applyMatrix4(d.matrixWorldInverse),w.applyProjection(d.projectionMatrix),y.copy(w),O.x=y.x*C+C,
|
|
|
+O.y=y.y*F+F,l||0<O.x&&O.x<e&&0<O.y&&O.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,O.x-8,O.y-8,16,16,0);b.uniform1i(x.renderType,0);b.uniform2f(x.scale,D.x,D.y);b.uniform3f(x.screenPosition,y.x,y.y,y.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,O.x-8,O.y-8,16,16,0);b.uniform1i(x.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(y);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(x.renderType,2);b.enable(b.BLEND);I=0;for(v=A.lensFlares.length;I<v;I++)G=A.lensFlares[I],0.001<G.opacity&&0.001<G.scale&&(y.x=G.x,y.y=G.y,y.z=G.z,z=G.size*G.scale/f,D.x=z*E,D.y=z,b.uniform3f(x.screenPosition,y.x,y.y,y.z),b.uniform2f(x.scale,D.x,D.y),b.uniform1f(x.rotation,G.rotation),b.uniform1f(x.opacity,
|
|
|
+G.opacity),b.uniform3f(x.color,G.color.r,G.color.g,G.color.b),c.setBlending(G.blending,G.blendEquation,G.blendSrc,G.blendDst),c.setTexture(G.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var t,s,p,q,r,u,w,E,C,F=[];q=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);t=0;for(s=m.__lights.length;t<s;t++)if(p=m.__lights[t],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(r=0;r<p.shadowCascadeCount;r++){var z;if(p.shadowCascadeArray[r])z=p.shadowCascadeArray[r];else{C=p;w=r;z=new THREE.DirectionalLight;z.isVirtual=!0;z.onlyShadow=!0;z.castShadow=!0;z.shadowCameraNear=C.shadowCameraNear;z.shadowCameraFar=C.shadowCameraFar;z.shadowCameraLeft=C.shadowCameraLeft;z.shadowCameraRight=C.shadowCameraRight;
|
|
|
+z.shadowCameraBottom=C.shadowCameraBottom;z.shadowCameraTop=C.shadowCameraTop;z.shadowCameraVisible=C.shadowCameraVisible;z.shadowDarkness=C.shadowDarkness;z.shadowBias=C.shadowCascadeBias[w];z.shadowMapWidth=C.shadowCascadeWidth[w];z.shadowMapHeight=C.shadowCascadeHeight[w];z.pointsWorld=[];z.pointsFrustum=[];E=z.pointsWorld;u=z.pointsFrustum;for(var D=0;8>D;D++)E[D]=new THREE.Vector3,u[D]=new THREE.Vector3;E=C.shadowCascadeNearZ[w];C=C.shadowCascadeFarZ[w];u[0].set(-1,-1,E);u[1].set(1,-1,E);u[2].set(-1,
|
|
|
+1,E);u[3].set(1,1,E);u[4].set(-1,-1,C);u[5].set(1,-1,C);u[6].set(-1,1,C);u[7].set(1,1,C);z.originalCamera=n;u=new THREE.Gyroscope;u.position=p.shadowCascadeOffset;u.add(z);u.add(z.target);n.add(u);p.shadowCascadeArray[r]=z;console.log("Created virtualLight",z)}w=p;E=r;C=w.shadowCascadeArray[E];C.position.copy(w.position);C.target.position.copy(w.target.position);C.lookAt(C.target);C.shadowCameraVisible=w.shadowCameraVisible;C.shadowDarkness=w.shadowDarkness;C.shadowBias=w.shadowCascadeBias[E];u=w.shadowCascadeNearZ[E];
|
|
|
+w=w.shadowCascadeFarZ[E];C=C.pointsFrustum;C[0].z=u;C[1].z=u;C[2].z=u;C[3].z=u;C[4].z=w;C[5].z=w;C[6].z=w;C[7].z=w;F[q]=z;q++}else F[q]=p,q++;t=0;for(s=F.length;t<s;t++){p=F[t];p.shadowMap||(r=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(r=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:r,magFilter:r,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}m.add(p.shadowCamera);!0===m.autoUpdate&&m.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&I.originalCamera==n){r=n;s=p.shadowCamera;v=p.pointsFrustum;B=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(y=0;8>y;y++)J=B[y],J.copy(v[y]),THREE.ShadowMapPlugin.__projector.unprojectVector(J,r),J.applyMatrix4(s.matrixWorldInverse),J.x<i.x&&(i.x=J.x),J.x>k.x&&(k.x=J.x),J.y<i.y&&(i.y=J.y),J.y>k.y&&(k.y=J.y),J.z<i.z&&(i.z=J.z),J.z>k.z&&
|
|
|
-(k.z=J.z);s.left=i.x;s.right=k.x;s.top=k.y;s.bottom=i.y;s.updateProjectionMatrix()}s=p.shadowMap;v=p.shadowMatrix;r=p.shadowCamera;r.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);r.lookAt(l);r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiply(r.projectionMatrix);v.multiply(r.matrixWorldInverse);
|
|
|
-g.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(s);b.clear();B=m.__webglObjects;p=0;for(s=B.length;p<s;p++)if(y=B[p],v=y.object,y.render=!1,v.visible&&v.castShadow&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||h.intersectsObject(v)))v._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,v.matrixWorld),y.render=!0;p=0;for(s=B.length;p<s;p++)y=B[p],y.render&&(v=y.object,y=y.buffer,C=v.material instanceof THREE.MeshFaceMaterial?
|
|
|
-v.material.materials[0]:v.material,J=0<v.geometry.morphTargets.length&&C.morphTargets,C=v instanceof THREE.SkinnedMesh&&C.skinning,J=v.customDepthMaterial?v.customDepthMaterial:C?J?f:e:J?d:c,y instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,J,y,v):b.renderBuffer(r,m.__lights,null,J,y,v));B=m.__webglObjectsImmediate;p=0;for(s=B.length;p<s;p++)y=B[p],v=y.object,v.visible&&v.castShadow&&(v._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,v.matrixWorld),b.renderImmediateObject(r,
|
|
|
-m.__lights,null,c,v))}q=b.getClearColor();t=b.getClearAlpha();a.clearColor(q.r,q.g,q.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
|
|
|
-e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),q=b.createShader(b.FRAGMENT_SHADER),t=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(q,p+a.fragmentShader);b.shaderSource(t,p+a.vertexShader);b.compileShader(q);b.compileShader(t);b.attachShader(n,q);b.attachShader(n,t);b.linkProgram(n);i=n;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&z.originalCamera==n){r=n;q=p.shadowCamera;u=p.pointsFrustum;C=p.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(w=0;8>w;w++)E=C[w],E.copy(u[w]),THREE.ShadowMapPlugin.__projector.unprojectVector(E,r),E.applyMatrix4(q.matrixWorldInverse),E.x<i.x&&(i.x=E.x),E.x>k.x&&(k.x=E.x),E.y<i.y&&(i.y=E.y),E.y>k.y&&(k.y=E.y),E.z<i.z&&(i.z=E.z),E.z>k.z&&
|
|
|
+(k.z=E.z);q.left=i.x;q.right=k.x;q.top=k.y;q.bottom=i.y;q.updateProjectionMatrix()}q=p.shadowMap;u=p.shadowMatrix;r=p.shadowCamera;r.position.getPositionFromMatrix(p.matrixWorld);l.getPositionFromMatrix(p.target.matrixWorld);r.lookAt(l);r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.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(r.projectionMatrix);u.multiply(r.matrixWorldInverse);
|
|
|
+g.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(q);b.clear();C=m.__webglObjects;p=0;for(q=C.length;p<q;p++)if(w=C[p],u=w.object,w.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,u.matrixWorld),w.render=!0;p=0;for(q=C.length;p<q;p++)w=C[p],w.render&&(u=w.object,w=w.buffer,D=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
+u.material.materials[0]:u.material,E=0<u.geometry.morphTargets.length&&D.morphTargets,D=u instanceof THREE.SkinnedMesh&&D.skinning,E=u.customDepthMaterial?u.customDepthMaterial:D?E?f:e:E?d:c,w instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,E,w,u):b.renderBuffer(r,m.__lights,null,E,w,u));C=m.__webglObjectsImmediate;p=0;for(q=C.length;p<q;p++)w=C[p],u=w.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(r,
|
|
|
+m.__lights,null,c,u))}t=b.getClearColor();s=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,s);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,k,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
|
|
|
+e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),t=b.createShader(b.FRAGMENT_SHADER),s=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(t,p+a.fragmentShader);b.shaderSource(s,p+a.vertexShader);b.compileShader(t);b.compileShader(s);b.attachShader(n,t);b.attachShader(n,s);b.linkProgram(n);i=n;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
|
|
|
"uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
|
|
|
-"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,t){var p=d.__webglSprites,s=p.length;if(s){var r=k,v=l,y=t/
|
|
|
-f,f=0.5*f,J=0.5*t;b.useProgram(i);b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(v.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(v.map,0);var B=r=0,H=d.fog;H?(b.uniform3f(v.fogColor,H.color.r,H.color.g,H.color.b),
|
|
|
-H instanceof THREE.Fog?(b.uniform1f(v.fogNear,H.near),b.uniform1f(v.fogFar,H.far),b.uniform1i(v.fogType,1),B=r=1):H instanceof THREE.FogExp2&&(b.uniform1f(v.fogDensity,H.density),b.uniform1i(v.fogType,2),B=r=2)):(b.uniform1i(v.fogType,0),B=r=0);for(var I,C,z=[],H=0;H<s;H++)I=p[H],C=I.material,I.visible&&0!==C.opacity&&(C.useScreenCoordinates?I.z=-I.position.z:(I._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,I.matrixWorld),I.z=-I._modelViewMatrix.elements[14]));p.sort(a);for(H=0;H<s;H++)I=
|
|
|
-p[H],C=I.material,I.visible&&0!==C.opacity&&(C.map&&C.map.image&&C.map.image.width)&&(b.uniform1f(v.alphaTest,C.alphaTest),!0===C.useScreenCoordinates?(b.uniform1i(v.useScreenCoordinates,1),b.uniform3f(v.screenPosition,(I.position.x*c.devicePixelRatio-f)/f,(J-I.position.y*c.devicePixelRatio)/J,Math.max(0,Math.min(1,I.position.z))),z[0]=c.devicePixelRatio,z[1]=c.devicePixelRatio):(b.uniform1i(v.useScreenCoordinates,0),b.uniform1i(v.sizeAttenuation,C.sizeAttenuation?1:0),b.uniformMatrix4fv(v.modelViewMatrix,
|
|
|
-!1,I._modelViewMatrix.elements),z[0]=1,z[1]=1),e=d.fog&&C.fog?B:0,r!==e&&(b.uniform1i(v.fogType,e),r=e),e=1/(C.scaleByViewport?t:1),z[0]*=e*y*I.scale.x,z[1]*=e*I.scale.y,b.uniform2f(v.uvScale,C.uvScale.x,C.uvScale.y),b.uniform2f(v.uvOffset,C.uvOffset.x,C.uvOffset.y),b.uniform2f(v.alignment,C.alignment.x,C.alignment.y),b.uniform1f(v.opacity,C.opacity),b.uniform3f(v.color,C.color.r,C.color.g,C.color.b),b.uniform1f(v.rotation,I.rotation),b.uniform2fv(v.scale,z),c.setBlending(C.blending,C.blendEquation,
|
|
|
-C.blendSrc,C.blendDst),c.setDepthTest(C.depthTest),c.setDepthWrite(C.depthWrite),c.setTexture(C.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,m,n,q,t,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
|
|
|
-k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(m=p.length;l<m;l++)if(n=p[l],t=n.object,n.render=!1,t.visible&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||h.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,t.matrixWorld),n.render=!0;var s;l=0;for(m=p.length;l<m;l++)if(n=p[l],n.render&&(t=n.object,n=n.buffer,!(t instanceof THREE.ParticleSystem)||t.customDepthMaterial))(s=
|
|
|
-t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),q=0<t.geometry.morphTargets.length&&s.morphTargets,s=t instanceof THREE.SkinnedMesh&&s.skinning,q=t.customDepthMaterial?t.customDepthMaterial:s?q?f:e:q?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,q,n,t):b.renderBuffer(k,i.__lights,null,q,n,t);p=i.__webglObjectsImmediate;l=0;for(m=p.length;l<m;l++)n=p[l],t=n.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
-t.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,t));l=b.getClearColor();m=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,m);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}",
|
|
|
+"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,s){var p=d.__webglSprites,q=p.length;if(q){var r=k,u=l,w=s/
|
|
|
+f,f=0.5*f,E=0.5*s;b.useProgram(i);b.enableVertexAttribArray(r.position);b.enableVertexAttribArray(r.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(r.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var C=r=0,F=d.fog;F?(b.uniform3f(u.fogColor,F.color.r,F.color.g,F.color.b),
|
|
|
+F instanceof THREE.Fog?(b.uniform1f(u.fogNear,F.near),b.uniform1f(u.fogFar,F.far),b.uniform1i(u.fogType,1),C=r=1):F instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,F.density),b.uniform1i(u.fogType,2),C=r=2)):(b.uniform1i(u.fogType,0),C=r=0);for(var z,D,y=[],F=0;F<q;F++)z=p[F],D=z.material,z.visible&&0!==D.opacity&&(D.useScreenCoordinates?z.z=-z.position.z:(z._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,z.matrixWorld),z.z=-z._modelViewMatrix.elements[14]));p.sort(a);for(F=0;F<q;F++)z=
|
|
|
+p[F],D=z.material,z.visible&&0!==D.opacity&&(D.map&&D.map.image&&D.map.image.width)&&(b.uniform1f(u.alphaTest,D.alphaTest),!0===D.useScreenCoordinates?(b.uniform1i(u.useScreenCoordinates,1),b.uniform3f(u.screenPosition,(z.position.x*c.devicePixelRatio-f)/f,(E-z.position.y*c.devicePixelRatio)/E,Math.max(0,Math.min(1,z.position.z))),y[0]=c.devicePixelRatio,y[1]=c.devicePixelRatio):(b.uniform1i(u.useScreenCoordinates,0),b.uniform1i(u.sizeAttenuation,D.sizeAttenuation?1:0),b.uniformMatrix4fv(u.modelViewMatrix,
|
|
|
+!1,z._modelViewMatrix.elements),y[0]=1,y[1]=1),e=d.fog&&D.fog?C:0,r!==e&&(b.uniform1i(u.fogType,e),r=e),e=1/(D.scaleByViewport?s:1),y[0]*=e*w*z.scale.x,y[1]*=e*z.scale.y,b.uniform2f(u.uvScale,D.uvScale.x,D.uvScale.y),b.uniform2f(u.uvOffset,D.uvOffset.x,D.uvOffset.y),b.uniform2f(u.alignment,D.alignment.x,D.alignment.y),b.uniform1f(u.opacity,D.opacity),b.uniform3f(u.color,D.color.r,D.color.g,D.color.b),b.uniform1f(u.rotation,z.rotation),b.uniform2fv(u.scale,y),c.setBlending(D.blending,D.blendEquation,
|
|
|
+D.blendSrc,D.blendDst),c.setDepthTest(D.depthTest),c.setDepthWrite(D.depthWrite),c.setTexture(D.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var l,m,n,t,s,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);g.multiplyMatrices(k.projectionMatrix,
|
|
|
+k.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;l=0;for(m=p.length;l<m;l++)if(n=p[l],s=n.object,n.render=!1,s.visible&&(!(s instanceof THREE.Mesh||s instanceof THREE.ParticleSystem)||!s.frustumCulled||h.intersectsObject(s)))s._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,s.matrixWorld),n.render=!0;var q;l=0;for(m=p.length;l<m;l++)if(n=p[l],n.render&&(s=n.object,n=n.buffer,!(s instanceof THREE.ParticleSystem)||s.customDepthMaterial))(q=
|
|
|
+s.material instanceof THREE.MeshFaceMaterial?s.material.materials[0]:s.material)&&b.setMaterialFaces(s.material),t=0<s.geometry.morphTargets.length&&q.morphTargets,q=s instanceof THREE.SkinnedMesh&&q.skinning,t=s.customDepthMaterial?s.customDepthMaterial:q?t?f:e:t?d:c,n instanceof THREE.BufferGeometry?b.renderBufferDirect(k,i.__lights,null,t,n,s):b.renderBuffer(k,i.__lights,null,t,n,s);p=i.__webglObjectsImmediate;l=0;for(m=p.length;l<m;l++)n=p[l],s=n.object,s.visible&&(s._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
+s.matrixWorld),b.renderImmediateObject(k,i.__lights,null,c,s));l=b.getClearColor();m=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,m);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}"}};THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
|
|
|
fragmentShader:"uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"}};
|