|
@@ -88,22 +88,22 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,
|
|
|
multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],l=a[7],a=a[8];return b*f*a-b*g*l-c*e*a+c*g*h+d*e*l-d*f*h},getInverse:function(a,
|
|
|
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
|
|
|
c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],
|
|
|
-a[6],a[7],a[8]]},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,k,n,q,s,t,u,p){var v=this.elements=new Float32Array(16);v[0]=void 0!==a?a:1;v[4]=b||0;v[8]=c||0;v[12]=d||0;v[1]=e||0;v[5]=void 0!==f?f:1;v[9]=g||0;v[13]=h||0;v[2]=l||0;v[6]=k||0;v[10]=void 0!==n?n:1;v[14]=q||0;v[3]=s||0;v[7]=t||0;v[11]=u||0;v[15]=void 0!==p?p:1};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,k,n,q,s,t,u,p){var v=this.elements;v[0]=a;v[4]=b;v[8]=c;v[12]=d;v[1]=e;v[5]=f;v[9]=g;v[13]=h;v[2]=l;v[6]=k;v[10]=n;v[14]=q;v[3]=s;v[7]=t;v[11]=u;v[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
+a[6],a[7],a[8]]},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,l,k,n,q,s,u,t,p){var v=this.elements=new Float32Array(16);v[0]=void 0!==a?a:1;v[4]=b||0;v[8]=c||0;v[12]=d||0;v[1]=e||0;v[5]=void 0!==f?f:1;v[9]=g||0;v[13]=h||0;v[2]=l||0;v[6]=k||0;v[10]=void 0!==n?n:1;v[14]=q||0;v[3]=s||0;v[7]=u||0;v[11]=t||0;v[15]=void 0!==p?p:1};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,l,k,n,q,s,u,t,p){var v=this.elements;v[0]=a;v[4]=b;v[8]=c;v[12]=d;v[1]=e;v[5]=f;v[9]=g;v[13]=h;v[2]=l;v[6]=k;v[10]=n;v[14]=q;v[3]=s;v[7]=u;v[11]=t;v[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
|
|
|
return this.copyPosition(a)},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements;b=b.elements;var d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){!1===
|
|
|
a instanceof THREE.Euler&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var l=f*e,k=c*h,n=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=l+k*d;b[5]=a-n*d;b[9]=-c*g;b[2]=n-a*d;b[6]=k+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,k=d*h,n=d*e,b[0]=a+n*c,b[4]=k*c-l,b[8]=
|
|
|
f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-k,b[6]=n+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,k=d*h,n=d*e,b[0]=a-n*c,b[4]=-f*e,b[8]=k+l*c,b[1]=l+k*c,b[5]=f*h,b[9]=n-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,k=c*h,n=c*e,b[0]=g*h,b[4]=k*d-l,b[8]=a*d+n,b[1]=g*e,b[5]=n*d+a,b[9]=l*d-k,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,k=c*g,n=c*d,b[0]=g*h,b[4]=n-a*e,b[8]=k*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+k,b[10]=a-n*e):"XZY"===a.order&&(a=f*g,l=f*d,k=c*g,n=c*d,b[0]=
|
|
|
g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+n,b[5]=f*h,b[9]=l*e-k,b[2]=k*e-l,b[6]=c*h,b[10]=n*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,l=e+e;a=c*g;var k=c*
|
|
|
h,c=c*l,n=d*h,d=d*l,e=e*l,g=f*g,h=f*h,f=f*l;b[0]=1-(n+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+n);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);g[0]=
|
|
|
-a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],l=c[12],k=c[1],n=c[5],q=c[9],s=c[13],t=c[2],u=c[6],p=c[10],v=c[14],w=c[3],r=c[7],x=c[11],
|
|
|
-c=c[15],z=d[0],G=d[4],J=d[8],H=d[12],B=d[1],A=d[5],K=d[9],C=d[13],Q=d[2],y=d[6],L=d[10],E=d[14],D=d[3],F=d[7],S=d[11],d=d[15];e[0]=f*z+g*B+h*Q+l*D;e[4]=f*G+g*A+h*y+l*F;e[8]=f*J+g*K+h*L+l*S;e[12]=f*H+g*C+h*E+l*d;e[1]=k*z+n*B+q*Q+s*D;e[5]=k*G+n*A+q*y+s*F;e[9]=k*J+n*K+q*L+s*S;e[13]=k*H+n*C+q*E+s*d;e[2]=t*z+u*B+p*Q+v*D;e[6]=t*G+u*A+p*y+v*F;e[10]=t*J+u*K+p*L+v*S;e[14]=t*H+u*C+p*E+v*d;e[3]=w*z+r*B+x*Q+c*D;e[7]=w*G+r*A+x*y+c*F;e[11]=w*J+r*K+x*L+c*S;e[15]=w*H+r*C+x*E+c*d;return this},multiplyToArray:function(a,
|
|
|
+a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],l=c[12],k=c[1],n=c[5],q=c[9],s=c[13],u=c[2],t=c[6],p=c[10],v=c[14],w=c[3],r=c[7],x=c[11],
|
|
|
+c=c[15],z=d[0],F=d[4],P=d[8],B=d[12],C=d[1],A=d[5],I=d[9],H=d[13],N=d[2],y=d[6],K=d[10],E=d[14],D=d[3],G=d[7],T=d[11],d=d[15];e[0]=f*z+g*C+h*N+l*D;e[4]=f*F+g*A+h*y+l*G;e[8]=f*P+g*I+h*K+l*T;e[12]=f*B+g*H+h*E+l*d;e[1]=k*z+n*C+q*N+s*D;e[5]=k*F+n*A+q*y+s*G;e[9]=k*P+n*I+q*K+s*T;e[13]=k*B+n*H+q*E+s*d;e[2]=u*z+t*C+p*N+v*D;e[6]=u*F+t*A+p*y+v*G;e[10]=u*P+t*I+p*K+v*T;e[14]=u*B+t*H+p*E+v*d;e[3]=w*z+r*C+x*N+c*D;e[7]=w*F+r*A+x*y+c*G;e[11]=w*P+r*I+x*K+c*T;e[15]=w*B+r*H+x*E+c*d;return this},multiplyToArray:function(a,
|
|
|
b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],l=a[13],k=a[2],n=a[6],q=a[10],s=a[14];return a[3]*(+e*h*n-d*l*n-e*g*q+c*l*q+d*g*s-c*h*s)+a[7]*(+b*h*s-b*l*q+e*f*q-d*f*s+d*l*k-e*h*k)+a[11]*(+b*l*n-b*g*s-e*f*n+c*f*s+e*g*k-c*l*k)+a[15]*(-d*g*k-b*h*n+b*g*q+d*f*n-c*f*
|
|
|
q+c*h*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
|
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
|
|
|
-b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],l=d[1],k=d[5],n=d[9],q=d[13],s=d[2],t=d[6],u=d[10],p=d[14],v=d[3],w=d[7],r=d[11],d=d[15];c[0]=n*p*w-q*u*w+q*t*r-k*p*r-n*t*d+k*u*d;c[4]=h*u*w-g*p*w-h*t*r+f*p*r+g*t*d-f*u*d;c[8]=g*q*w-h*n*w+h*k*r-f*q*r-g*k*d+f*n*d;c[12]=h*n*t-g*q*t-h*k*u+f*q*u+g*k*p-f*n*p;c[1]=q*u*v-n*p*v-q*s*r+l*p*r+n*s*d-l*u*d;c[5]=g*p*v-h*u*v+h*s*r-e*p*r-g*s*d+e*u*d;c[9]=h*n*v-g*q*v-h*l*r+e*q*r+g*l*d-
|
|
|
-e*n*d;c[13]=g*q*s-h*n*s+h*l*u-e*q*u-g*l*p+e*n*p;c[2]=k*p*v-q*t*v+q*s*w-l*p*w-k*s*d+l*t*d;c[6]=h*t*v-f*p*v-h*s*w+e*p*w+f*s*d-e*t*d;c[10]=f*q*v-h*k*v+h*l*w-e*q*w-f*l*d+e*k*d;c[14]=h*k*s-f*q*s-h*l*t+e*q*t+f*l*p-e*k*p;c[3]=n*t*v-k*u*v-n*s*w+l*u*w+k*s*r-l*t*r;c[7]=f*u*v-g*t*v+g*s*w-e*u*w-f*s*r+e*t*r;c[11]=g*k*v-f*n*v-g*l*w+e*n*w+f*l*r-e*k*r;c[15]=f*n*s-g*k*s+g*l*t-e*n*t-f*l*u+e*k*u;c=e*c[0]+l*c[4]+s*c[8]+v*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
+b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],l=d[1],k=d[5],n=d[9],q=d[13],s=d[2],u=d[6],t=d[10],p=d[14],v=d[3],w=d[7],r=d[11],d=d[15];c[0]=n*p*w-q*t*w+q*u*r-k*p*r-n*u*d+k*t*d;c[4]=h*t*w-g*p*w-h*u*r+f*p*r+g*u*d-f*t*d;c[8]=g*q*w-h*n*w+h*k*r-f*q*r-g*k*d+f*n*d;c[12]=h*n*u-g*q*u-h*k*t+f*q*t+g*k*p-f*n*p;c[1]=q*t*v-n*p*v-q*s*r+l*p*r+n*s*d-l*t*d;c[5]=g*p*v-h*t*v+h*s*r-e*p*r-g*s*d+e*t*d;c[9]=h*n*v-g*q*v-h*l*r+e*q*r+g*l*d-
|
|
|
+e*n*d;c[13]=g*q*s-h*n*s+h*l*t-e*q*t-g*l*p+e*n*p;c[2]=k*p*v-q*u*v+q*s*w-l*p*w-k*s*d+l*u*d;c[6]=h*u*v-f*p*v-h*s*w+e*p*w+f*s*d-e*u*d;c[10]=f*q*v-h*k*v+h*l*w-e*q*w-f*l*d+e*k*d;c[14]=h*k*s-f*q*s-h*l*u+e*q*u+f*l*p-e*k*p;c[3]=n*u*v-k*t*v-n*s*w+l*t*w+k*s*r-l*u*r;c[7]=f*t*v-g*u*v+g*s*w-e*t*w-f*s*r+e*u*r;c[11]=g*k*v-f*n*v-g*l*w+e*n*w+f*l*r-e*k*r;c[15]=f*n*s-g*k*s+g*l*u-e*n*u-f*l*t+e*k*t;c=e*c[0]+l*c[4]+s*c[8]+v*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(a){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(a){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(a){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(a){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(a,b){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
|
|
|
scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
|
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,l=e*f,k=e*g;this.set(l*f+c,l*g-d*h,l*h+d*g,0,l*g+d*h,k*g+c,k*h-d*f,0,l*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
@@ -122,8 +122,8 @@ clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){t
|
|
|
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}}(),copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=
|
|
|
this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);
|
|
|
return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
|
|
|
-THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],q=c[9],s=c[10],t=c[11],u=c[12],p=c[13],v=c[14],c=c[15];b[0].setComponents(f-a,k-g,t-n,c-u).normalize();b[1].setComponents(f+
|
|
|
-a,k+g,t+n,c+u).normalize();b[2].setComponents(f+d,k+h,t+q,c+p).normalize();b[3].setComponents(f-d,k-h,t-q,c-p).normalize();b[4].setComponents(f-e,k-l,t-s,c-v).normalize();b[5].setComponents(f+e,k+l,t+s,c+v).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,
|
|
|
+THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],k=c[7],n=c[8],q=c[9],s=c[10],u=c[11],t=c[12],p=c[13],v=c[14],c=c[15];b[0].setComponents(f-a,k-g,u-n,c-t).normalize();b[1].setComponents(f+
|
|
|
+a,k+g,u+n,c+t).normalize();b[2].setComponents(f+d,k+h,u+q,c+p).normalize();b[3].setComponents(f-d,k-h,u-q,c-p).normalize();b[4].setComponents(f-e,k-l,u-s,c-v).normalize();b[5].setComponents(f+e,k+l,u+s,c+v).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,
|
|
|
c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}(),
|
|
|
containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
|
|
|
THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
|
|
@@ -145,15 +145,15 @@ THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=thi
|
|
|
a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){};
|
|
|
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
|
|
|
c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(){var a=[];return function(b){if(void 0!==this._listeners){var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=c.length,e=0;e<d;e++)a[e]=c[e];for(e=0;e<d;e++)a[e].call(this,
|
|
|
-b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},g=new a.Vector3,h=new a.Vector3,l=new a.Vector3,k=function(f,n,t){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var u=n.ray.distanceToPoint(d);if(u>f.scale.x)return t;t.push({distance:u,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
-a.LOD)d.setFromMatrixPosition(f.matrixWorld),u=n.ray.origin.distanceTo(d),k(f.getObjectForDistance(u),n,t);else if(f instanceof a.Mesh){var p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return t;if(p instanceof a.BufferGeometry){var v=f.material;if(void 0===
|
|
|
-v)return t;var w,r,x=n.precision;if(void 0!==p.attributes.index)for(var z=p.offsets,G=p.attributes.index.array,J=p.attributes.position.array,H=p.offsets.length,B=p.attributes.index.array.length/3,B=0;B<H;++B)for(var u=z[B].start,A=z[B].index,p=u,K=u+z[B].count;p<K;p+=3)u=A+G[p],w=A+G[p+1],r=A+G[p+2],g.set(J[3*u],J[3*u+1],J[3*u+2]),h.set(J[3*w],J[3*w+1],J[3*w+2]),l.set(J[3*r],J[3*r+1],J[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(l,h,g,!0):c.intersectTriangle(g,h,l,v.side!==a.DoubleSide),null!==
|
|
|
-w&&(w.applyMatrix4(f.matrixWorld),u=n.ray.origin.distanceTo(w),u<x||u<n.near||u>n.far||t.push({distance:u,point:w,face:null,faceIndex:null,object:f}));else for(J=p.attributes.position.array,B=p.attributes.position.array.length,p=0;p<B;p+=3)u=p,w=p+1,r=p+2,g.set(J[3*u],J[3*u+1],J[3*u+2]),h.set(J[3*w],J[3*w+1],J[3*w+2]),l.set(J[3*r],J[3*r+1],J[3*r+2]),w=v.side===a.BackSide?c.intersectTriangle(l,h,g,!0):c.intersectTriangle(g,h,l,v.side!==a.DoubleSide),null!==w&&(w.applyMatrix4(f.matrixWorld),u=n.ray.origin.distanceTo(w),
|
|
|
-u<x||u<n.near||u>n.far||t.push({distance:u,point:w,face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry)for(G=f.material instanceof a.MeshFaceMaterial,J=!0===G?f.material.materials:null,x=n.precision,z=p.vertices,H=0,B=p.faces.length;H<B;H++)if(A=p.faces[H],v=!0===G?J[A.materialIndex]:f.material,void 0!==v){u=z[A.a];w=z[A.b];r=z[A.c];if(!0===v.morphTargets){var K=p.morphTargets,C=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);l.set(0,0,0);for(var Q=0,y=K.length;Q<y;Q++){var L=C[Q];
|
|
|
-if(0!==L){var E=K[Q].vertices;g.x+=(E[A.a].x-u.x)*L;g.y+=(E[A.a].y-u.y)*L;g.z+=(E[A.a].z-u.z)*L;h.x+=(E[A.b].x-w.x)*L;h.y+=(E[A.b].y-w.y)*L;h.z+=(E[A.b].z-w.z)*L;l.x+=(E[A.c].x-r.x)*L;l.y+=(E[A.c].y-r.y)*L;l.z+=(E[A.c].z-r.z)*L}}g.add(u);h.add(w);l.add(r);u=g;w=h;r=l}w=v.side===a.BackSide?c.intersectTriangle(r,w,u,!0):c.intersectTriangle(u,w,r,v.side!==a.DoubleSide);null!==w&&(w.applyMatrix4(f.matrixWorld),u=n.ray.origin.distanceTo(w),u<x||u<n.near||u>n.far||t.push({distance:u,point:w,face:A,faceIndex:H,
|
|
|
-object:f}))}}else if(f instanceof a.Line){x=n.linePrecision;v=x*x;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(p instanceof a.Geometry)for(z=p.vertices,x=z.length,w=new a.Vector3,r=new a.Vector3,B=f.type===a.LineStrip?1:2,p=0;p<x-1;p+=B)c.distanceSqToSegment(z[p],z[p+1],r,w)>v||(u=c.origin.distanceTo(r),u<n.near||u>n.far||
|
|
|
-t.push({distance:u,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},n=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&n(a,this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,
|
|
|
-e=a.length;d<e;d++)k(a[d],this,c),!0===b&&n(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
|
+b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},g=new a.Vector3,h=new a.Vector3,l=new a.Vector3,k=function(f,n,u){if(f instanceof a.Sprite){d.setFromMatrixPosition(f.matrixWorld);var t=n.ray.distanceToPoint(d);if(t>f.scale.x)return u;u.push({distance:t,point:f.position,face:null,object:f})}else if(f instanceof
|
|
|
+a.LOD)d.setFromMatrixPosition(f.matrixWorld),t=n.ray.origin.distanceTo(d),k(f.getObjectForDistance(t),n,u);else if(f instanceof a.Mesh){var p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(null!==p.boundingBox&&!1===c.isIntersectionBox(p.boundingBox))return u;if(p instanceof a.BufferGeometry){var v=f.material;if(void 0===
|
|
|
+v)return u;var w,r,x,z=n.precision;if(void 0!==p.attributes.index)for(var F=p.offsets,P=p.attributes.index.array,B=p.attributes.position.array,C=p.offsets.length,A=p.attributes.index.array.length/3,A=0;A<C;++A){w=F[A].start;for(var I=F[A].index,p=w,H=w+F[A].count;p<H;p+=3){w=I+P[p];r=I+P[p+1];x=I+P[p+2];g.set(B[3*w],B[3*w+1],B[3*w+2]);h.set(B[3*r],B[3*r+1],B[3*r+2]);l.set(B[3*x],B[3*x+1],B[3*x+2]);var N=v.side===a.BackSide?c.intersectTriangle(l,h,g,!0):c.intersectTriangle(g,h,l,v.side!==a.DoubleSide);
|
|
|
+null!==N&&(N.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(N),t<z||t<n.near||t>n.far||u.push({distance:t,point:N,indices:[w,r,x],face:null,faceIndex:null,object:f}))}}else for(B=p.attributes.position.array,A=p.attributes.position.array.length,p=0;p<A;p+=3)w=p,r=p+1,x=p+2,g.set(B[3*w],B[3*w+1],B[3*w+2]),h.set(B[3*r],B[3*r+1],B[3*r+2]),l.set(B[3*x],B[3*x+1],B[3*x+2]),N=v.side===a.BackSide?c.intersectTriangle(l,h,g,!0):c.intersectTriangle(g,h,l,v.side!==a.DoubleSide),null!==N&&(N.applyMatrix4(f.matrixWorld),
|
|
|
+t=n.ray.origin.distanceTo(N),t<z||t<n.near||t>n.far||u.push({distance:t,point:N,indices:[w,r,x],face:null,faceIndex:null,object:f}))}else if(p instanceof a.Geometry)for(P=f.material instanceof a.MeshFaceMaterial,B=!0===P?f.material.materials:null,z=n.precision,F=p.vertices,C=0,A=p.faces.length;C<A;C++)if(I=p.faces[C],v=!0===P?B[I.materialIndex]:f.material,void 0!==v){w=F[I.a];r=F[I.b];x=F[I.c];if(!0===v.morphTargets){t=p.morphTargets;N=f.morphTargetInfluences;g.set(0,0,0);h.set(0,0,0);l.set(0,0,0);
|
|
|
+for(var H=0,y=t.length;H<y;H++){var K=N[H];if(0!==K){var E=t[H].vertices;g.x+=(E[I.a].x-w.x)*K;g.y+=(E[I.a].y-w.y)*K;g.z+=(E[I.a].z-w.z)*K;h.x+=(E[I.b].x-r.x)*K;h.y+=(E[I.b].y-r.y)*K;h.z+=(E[I.b].z-r.z)*K;l.x+=(E[I.c].x-x.x)*K;l.y+=(E[I.c].y-x.y)*K;l.z+=(E[I.c].z-x.z)*K}}g.add(w);h.add(r);l.add(x);w=g;r=h;x=l}N=v.side===a.BackSide?c.intersectTriangle(x,r,w,!0):c.intersectTriangle(w,r,x,v.side!==a.DoubleSide);null!==N&&(N.applyMatrix4(f.matrixWorld),t=n.ray.origin.distanceTo(N),t<z||t<n.near||t>n.far||
|
|
|
+u.push({distance:t,point:N,face:I,faceIndex:C,object:f}))}}else if(f instanceof a.Line){z=n.linePrecision;v=z*z;p=f.geometry;null===p.boundingSphere&&p.computeBoundingSphere();b.copy(p.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===n.ray.isIntersectionSphere(b))return u;e.getInverse(f.matrixWorld);c.copy(n.ray).applyMatrix4(e);if(p instanceof a.Geometry)for(F=p.vertices,z=F.length,w=new a.Vector3,r=new a.Vector3,x=f.type===a.LineStrip?1:2,p=0;p<z-1;p+=x)c.distanceSqToSegment(F[p],F[p+1],r,
|
|
|
+w)>v||(t=c.origin.distanceTo(r),t<n.near||t>n.far||u.push({distance:t,point:w.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}},n=function(a,b,c){a=a.getDescendants();for(var d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&n(a,this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=
|
|
|
+function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&n(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
|
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,get rotation(){return this._rotation},set rotation(a){this._rotation=a;this._rotation._quaternion=this._quaternion;this._quaternion._euler=this._rotation;this._rotation._updateQuaternion()},get quaternion(){return this._quaternion},set quaternion(a){this._quaternion=a;this._quaternion._euler=this._rotation;this._rotation._quaternion=this._quaternion;this._quaternion._updateEuler()},get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");
|
|
|
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.")},applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);
|
|
@@ -165,22 +165,22 @@ this.children.indexOf(a);if(-1!==b){a.parent=void 0;a.dispatchEvent({type:"remov
|
|
|
b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getObjectByName(a,b),void 0!==e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.compose(this.position,
|
|
|
this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);
|
|
|
a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));
|
|
|
-if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(n===s){var a=new THREE.RenderableVertex;q.push(a);s++;n++;return a}return q[n++]}function b(){if(u===v){var a=new THREE.RenderableFace;p.push(a);v++;u++;return a}return p[u++]}function c(){if(r===z){var a=new THREE.RenderableLine;x.push(a);z++;r++;return a}return x[r++]}function d(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function e(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&
|
|
|
-0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var f,g,h=[],l=0,k,n,q=[],s=0,t,u,p=[],v=0,w,r,x=[],z=0,G,J,H=[],B=0,A={objects:[],lights:[],elements:[]},K=new THREE.Vector3,C=new THREE.Vector3,Q=new THREE.Vector3,y=new THREE.Vector3,L=new THREE.Vector4,E=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),D=new THREE.Box3,F=Array(3),S=new THREE.Matrix4,Z=
|
|
|
-new THREE.Matrix4,V,ia=new THREE.Matrix4,Y=new THREE.Matrix3,ja=new THREE.Frustum,M=new THREE.Vector4,ka=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Z.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(Z)};this.unprojectVector=function(){var a=new THREE.Matrix4;return function(b,c){a.getInverse(c.projectionMatrix);Z.multiplyMatrices(c.matrixWorld,a);return b.applyProjection(Z)}}();this.pickingRay=function(a,b){a.z=
|
|
|
--1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var P=function(a){if(!1!==a.visible){if(a instanceof THREE.Light)A.lights.push(a);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Sprite)if(!1===a.frustumCulled||!0===ja.intersectsObject(a)){if(g===l){var b=new THREE.RenderableObject;h.push(b);l++;g++;f=b}else f=h[g++];f.id=a.id;f.object=a;null!==a.renderDepth?f.z=a.renderDepth:
|
|
|
-(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(Z),f.z=y.z);A.objects.push(f)}for(var b=0,c=a.children.length;b<c;b++)P(a.children[b])}},U=new function(){var d=[],e=null,f=new THREE.Matrix3,g=function(a){var b=a.positionWorld,c=a.positionScreen;b.copy(a.position).applyMatrix4(V);c.copy(b).applyMatrix4(Z);b=1/c.w;c.x*=b;c.y*=b;c.z*=b;a.visible=-1<=c.x&&1>=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},h=function(a,b,c){F[0]=a.positionScreen;F[1]=b.positionScreen;F[2]=c.positionScreen;return!0===
|
|
|
-a.visible||!0===b.visible||!0===c.visible||E.isIntersectionBox(D.setFromPoints(F))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){e=a;f.getNormalMatrix(e.matrixWorld);d.length=0},projectVertex:g,checkTriangleVisibility:h,pushVertex:function(b,c,d){k=a();k.position.set(b,c,d);g(k)},pushNormal:function(a,b,c){d.push(a,b,c)},pushLine:function(a,b){var d=
|
|
|
-q[a],f=q[b];w=c();w.id=e.id;w.v1.copy(d);w.v2.copy(f);w.z=(d.positionScreen.z+f.positionScreen.z)/2;w.material=e.material;A.elements.push(w)},pushTriangle:function(a,c,g){var l=q[a],k=q[c],n=q[g];if(!0===h(l,k,n)){t=b();t.id=e.id;t.v1.copy(l);t.v2.copy(k);t.v3.copy(n);t.z=(l.positionScreen.z+k.positionScreen.z+n.positionScreen.z)/3;for(l=0;3>l;l++)k=3*arguments[l],n=t.vertexNormalsModel[l],n.set(d[k+0],d[k+1],d[k+2]),n.applyMatrix3(f).normalize();t.vertexNormalsLength=3;t.material=e.material;A.elements.push(t)}}}};
|
|
|
-this.projectScene=function(f,h,l,k){var p,s,v,x,y,z,E,F,D;J=r=u=0;A.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();S.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Z.multiplyMatrices(h.projectionMatrix,S);ja.setFromMatrix(Z);g=0;A.objects.length=0;A.lights.length=0;P(f);!0===l&&A.objects.sort(d);f=0;for(l=A.objects.length;f<l;f++)if(p=A.objects[f].object,s=p.geometry,U.setObject(p),V=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof
|
|
|
-THREE.BufferGeometry){if(z=s.attributes,x=s.offsets,void 0!==z.position){F=z.position.array;p=0;for(s=F.length;p<s;p+=3)U.pushVertex(F[p],F[p+1],F[p+2]);D=z.normal.array;p=0;for(s=D.length;p<s;p+=3)U.pushNormal(D[p],D[p+1],D[p+2]);if(void 0!==z.index)if(z=z.index.array,0<x.length)for(f=0;f<x.length;f++)for(s=x[f],F=s.index,p=s.start,s=s.start+s.count;p<s;p+=3)U.pushTriangle(z[p]+F,z[p+1]+F,z[p+2]+F);else for(p=0,s=z.length;p<s;p+=3)U.pushTriangle(z[p],z[p+1],z[p+2]);else for(p=0,s=F.length/3;p<s;p+=
|
|
|
-3)U.pushTriangle(p,p+1,p+2)}}else if(s instanceof THREE.Geometry2)for(v=s.vertices,x=p=0,s=v.length;p<s;p+=9,x+=3)U.pushVertex(v[p+0],v[p+1],v[p+2]),U.pushVertex(v[p+3],v[p+4],v[p+5]),U.pushVertex(v[p+6],v[p+7],v[p+8]),U.pushTriangle(x+0,x+1,x+2);else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;z=s.faceVertexUvs;Y.getNormalMatrix(V);F=p.material instanceof THREE.MeshFaceMaterial;D=!0===F?p.material:null;for(var la=0,Ua=v.length;la<Ua;la++){var qa=v[la];U.pushVertex(qa.x,qa.y,qa.z)}la=0;
|
|
|
-for(Ua=x.length;la<Ua;la++){v=x[la];var Pa=!0===F?D.materials[v.materialIndex]:p.material;if(void 0!==Pa){E=Pa.side;var qa=q[v.a],xa=q[v.b],Ka=q[v.c];if(!0===Pa.morphTargets){y=s.morphTargets;var Aa=p.morphTargetInfluences,ya=qa.position,Sa=xa.position,ma=Ka.position;K.set(0,0,0);C.set(0,0,0);Q.set(0,0,0);for(var Ba=0,$a=y.length;Ba<$a;Ba++){var Ca=Aa[Ba];if(0!==Ca){var Da=y[Ba].vertices;K.x+=(Da[v.a].x-ya.x)*Ca;K.y+=(Da[v.a].y-ya.y)*Ca;K.z+=(Da[v.a].z-ya.z)*Ca;C.x+=(Da[v.b].x-Sa.x)*Ca;C.y+=(Da[v.b].y-
|
|
|
-Sa.y)*Ca;C.z+=(Da[v.b].z-Sa.z)*Ca;Q.x+=(Da[v.c].x-ma.x)*Ca;Q.y+=(Da[v.c].y-ma.y)*Ca;Q.z+=(Da[v.c].z-ma.z)*Ca}}qa.position.add(K);xa.position.add(C);Ka.position.add(Q);U.projectVertex(qa);U.projectVertex(xa);U.projectVertex(Ka)}Aa=U.checkTriangleVisibility(qa,xa,Ka);if(Aa!==(E===THREE.BackSide)){t=b();t.id=p.id;t.v1.copy(qa);t.v2.copy(xa);t.v3.copy(Ka);t.normalModel.copy(v.normal);!1!==Aa||E!==THREE.BackSide&&E!==THREE.DoubleSide||t.normalModel.negate();t.normalModel.applyMatrix3(Y).normalize();t.centroidModel.copy(v.centroid).applyMatrix4(V);
|
|
|
-y=v.vertexNormals;ya=0;for(Sa=Math.min(y.length,3);ya<Sa;ya++)ma=t.vertexNormalsModel[ya],ma.copy(y[ya]),!1!==Aa||E!==THREE.BackSide&&E!==THREE.DoubleSide||ma.negate(),ma.applyMatrix3(Y).normalize();t.vertexNormalsLength=y.length;y=0;for(Aa=Math.min(z.length,3);y<Aa;y++)if(E=z[y][la],void 0!==E)for(ya=0,Sa=E.length;ya<Sa;ya++)t.uvs[y][ya]=E[ya];t.color=v.color;t.material=Pa;t.z=(qa.positionScreen.z+xa.positionScreen.z+Ka.positionScreen.z)/3;A.elements.push(t)}}}}}else if(p instanceof THREE.Line)if(s instanceof
|
|
|
-THREE.BufferGeometry){if(z=s.attributes,void 0!==z.position){F=z.position.array;p=0;for(s=F.length;p<s;p+=3)U.pushVertex(F[p],F[p+1],F[p+2]);if(void 0!==z.index)for(z=z.index.array,p=0,s=z.length;p<s;p+=2)U.pushLine(z[p],z[p+1]);else for(p=0,s=F.length/3-1;p<s;p++)U.pushLine(p,p+1)}}else{if(s instanceof THREE.Geometry&&(ia.multiplyMatrices(Z,V),v=p.geometry.vertices,0!==v.length))for(qa=a(),qa.positionScreen.copy(v[0]).applyMatrix4(ia),s=p.type===THREE.LinePieces?2:1,la=1,Ua=v.length;la<Ua;la++)qa=
|
|
|
-a(),qa.positionScreen.copy(v[la]).applyMatrix4(ia),0<(la+1)%s||(xa=q[n-2],M.copy(qa.positionScreen),ka.copy(xa.positionScreen),!0===e(M,ka)&&(M.multiplyScalar(1/M.w),ka.multiplyScalar(1/ka.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(M),w.v2.positionScreen.copy(ka),w.z=Math.max(M.z,ka.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[la]),w.vertexColors[1].copy(p.geometry.colors[la-1])),A.elements.push(w)))}else p instanceof THREE.Sprite&&
|
|
|
-(L.set(V.elements[12],V.elements[13],V.elements[14],1),L.applyMatrix4(Z),s=1/L.w,L.z*=s,-1<=L.z&&1>=L.z&&(J===B?(x=new THREE.RenderableSprite,H.push(x),B++,J++,G=x):G=H[J++],G.id=p.id,G.x=L.x*s,G.y=L.y*s,G.z=L.z,G.object=p,G.rotation=p.rotation,G.scale.x=p.scale.x*Math.abs(G.x-(L.x+h.projectionMatrix.elements[0])/(L.w+h.projectionMatrix.elements[12])),G.scale.y=p.scale.y*Math.abs(G.y-(L.y+h.projectionMatrix.elements[5])/(L.w+h.projectionMatrix.elements[13])),G.material=p.material,A.elements.push(G)));
|
|
|
+if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(n===s){var a=new THREE.RenderableVertex;q.push(a);s++;n++;return a}return q[n++]}function b(){if(t===v){var a=new THREE.RenderableFace;p.push(a);v++;t++;return a}return p[t++]}function c(){if(r===z){var a=new THREE.RenderableLine;x.push(a);z++;r++;return a}return x[r++]}function d(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function e(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&
|
|
|
+0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var f,g,h=[],l=0,k,n,q=[],s=0,u,t,p=[],v=0,w,r,x=[],z=0,F,P,B=[],C=0,A={objects:[],lights:[],elements:[]},I=new THREE.Vector3,H=new THREE.Vector3,N=new THREE.Vector3,y=new THREE.Vector3,K=new THREE.Vector4,E=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),D=new THREE.Box3,G=Array(3),T=new THREE.Matrix4,Z=
|
|
|
+new THREE.Matrix4,V,ia=new THREE.Matrix4,Y=new THREE.Matrix3,ja=new THREE.Frustum,L=new THREE.Vector4,ka=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Z.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(Z)};this.unprojectVector=function(){var a=new THREE.Matrix4;return function(b,c){a.getInverse(c.projectionMatrix);Z.multiplyMatrices(c.matrixWorld,a);return b.applyProjection(Z)}}();this.pickingRay=function(a,b){a.z=
|
|
|
+-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var Q=function(a){if(!1!==a.visible){if(a instanceof THREE.Light)A.lights.push(a);else if(a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.Sprite)if(!1===a.frustumCulled||!0===ja.intersectsObject(a)){if(g===l){var b=new THREE.RenderableObject;h.push(b);l++;g++;f=b}else f=h[g++];f.id=a.id;f.object=a;null!==a.renderDepth?f.z=a.renderDepth:
|
|
|
+(y.setFromMatrixPosition(a.matrixWorld),y.applyProjection(Z),f.z=y.z);A.objects.push(f)}for(var b=0,c=a.children.length;b<c;b++)Q(a.children[b])}},U=new function(){var d=[],e=null,f=new THREE.Matrix3,g=function(a){var b=a.positionWorld,c=a.positionScreen;b.copy(a.position).applyMatrix4(V);c.copy(b).applyMatrix4(Z);b=1/c.w;c.x*=b;c.y*=b;c.z*=b;a.visible=-1<=c.x&&1>=c.x&&-1<=c.y&&1>=c.y&&-1<=c.z&&1>=c.z},h=function(a,b,c){G[0]=a.positionScreen;G[1]=b.positionScreen;G[2]=c.positionScreen;return!0===
|
|
|
+a.visible||!0===b.visible||!0===c.visible||E.isIntersectionBox(D.setFromPoints(G))?0>(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x):!1};return{setObject:function(a){e=a;f.getNormalMatrix(e.matrixWorld);d.length=0},projectVertex:g,checkTriangleVisibility:h,pushVertex:function(b,c,d){k=a();k.position.set(b,c,d);g(k)},pushNormal:function(a,b,c){d.push(a,b,c)},pushLine:function(a,b){var d=
|
|
|
+q[a],f=q[b];w=c();w.id=e.id;w.v1.copy(d);w.v2.copy(f);w.z=(d.positionScreen.z+f.positionScreen.z)/2;w.material=e.material;A.elements.push(w)},pushTriangle:function(a,c,g){var l=q[a],k=q[c],n=q[g];if(!0===h(l,k,n)){u=b();u.id=e.id;u.v1.copy(l);u.v2.copy(k);u.v3.copy(n);u.z=(l.positionScreen.z+k.positionScreen.z+n.positionScreen.z)/3;for(l=0;3>l;l++)k=3*arguments[l],n=u.vertexNormalsModel[l],n.set(d[k+0],d[k+1],d[k+2]),n.applyMatrix3(f).normalize();u.vertexNormalsLength=3;u.material=e.material;A.elements.push(u)}}}};
|
|
|
+this.projectScene=function(f,h,l,k){var p,s,v,x,y,z,E,G,D;P=r=t=0;A.elements.length=0;!0===f.autoUpdate&&f.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();T.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));Z.multiplyMatrices(h.projectionMatrix,T);ja.setFromMatrix(Z);g=0;A.objects.length=0;A.lights.length=0;Q(f);!0===l&&A.objects.sort(d);f=0;for(l=A.objects.length;f<l;f++)if(p=A.objects[f].object,s=p.geometry,U.setObject(p),V=p.matrixWorld,n=0,p instanceof THREE.Mesh)if(s instanceof
|
|
|
+THREE.BufferGeometry){if(z=s.attributes,x=s.offsets,void 0!==z.position){G=z.position.array;p=0;for(s=G.length;p<s;p+=3)U.pushVertex(G[p],G[p+1],G[p+2]);D=z.normal.array;p=0;for(s=D.length;p<s;p+=3)U.pushNormal(D[p],D[p+1],D[p+2]);if(void 0!==z.index)if(z=z.index.array,0<x.length)for(f=0;f<x.length;f++)for(s=x[f],G=s.index,p=s.start,s=s.start+s.count;p<s;p+=3)U.pushTriangle(z[p]+G,z[p+1]+G,z[p+2]+G);else for(p=0,s=z.length;p<s;p+=3)U.pushTriangle(z[p],z[p+1],z[p+2]);else for(p=0,s=G.length/3;p<s;p+=
|
|
|
+3)U.pushTriangle(p,p+1,p+2)}}else if(s instanceof THREE.Geometry2)for(v=s.vertices,x=p=0,s=v.length;p<s;p+=9,x+=3)U.pushVertex(v[p+0],v[p+1],v[p+2]),U.pushVertex(v[p+3],v[p+4],v[p+5]),U.pushVertex(v[p+6],v[p+7],v[p+8]),U.pushTriangle(x+0,x+1,x+2);else{if(s instanceof THREE.Geometry){v=s.vertices;x=s.faces;z=s.faceVertexUvs;Y.getNormalMatrix(V);G=p.material instanceof THREE.MeshFaceMaterial;D=!0===G?p.material:null;for(var la=0,Ua=v.length;la<Ua;la++){var qa=v[la];U.pushVertex(qa.x,qa.y,qa.z)}la=0;
|
|
|
+for(Ua=x.length;la<Ua;la++){v=x[la];var Pa=!0===G?D.materials[v.materialIndex]:p.material;if(void 0!==Pa){E=Pa.side;var qa=q[v.a],xa=q[v.b],Ka=q[v.c];if(!0===Pa.morphTargets){y=s.morphTargets;var Aa=p.morphTargetInfluences,ya=qa.position,Sa=xa.position,ma=Ka.position;I.set(0,0,0);H.set(0,0,0);N.set(0,0,0);for(var Ba=0,$a=y.length;Ba<$a;Ba++){var Ca=Aa[Ba];if(0!==Ca){var Da=y[Ba].vertices;I.x+=(Da[v.a].x-ya.x)*Ca;I.y+=(Da[v.a].y-ya.y)*Ca;I.z+=(Da[v.a].z-ya.z)*Ca;H.x+=(Da[v.b].x-Sa.x)*Ca;H.y+=(Da[v.b].y-
|
|
|
+Sa.y)*Ca;H.z+=(Da[v.b].z-Sa.z)*Ca;N.x+=(Da[v.c].x-ma.x)*Ca;N.y+=(Da[v.c].y-ma.y)*Ca;N.z+=(Da[v.c].z-ma.z)*Ca}}qa.position.add(I);xa.position.add(H);Ka.position.add(N);U.projectVertex(qa);U.projectVertex(xa);U.projectVertex(Ka)}Aa=U.checkTriangleVisibility(qa,xa,Ka);if(Aa!==(E===THREE.BackSide)){u=b();u.id=p.id;u.v1.copy(qa);u.v2.copy(xa);u.v3.copy(Ka);u.normalModel.copy(v.normal);!1!==Aa||E!==THREE.BackSide&&E!==THREE.DoubleSide||u.normalModel.negate();u.normalModel.applyMatrix3(Y).normalize();u.centroidModel.copy(v.centroid).applyMatrix4(V);
|
|
|
+y=v.vertexNormals;ya=0;for(Sa=Math.min(y.length,3);ya<Sa;ya++)ma=u.vertexNormalsModel[ya],ma.copy(y[ya]),!1!==Aa||E!==THREE.BackSide&&E!==THREE.DoubleSide||ma.negate(),ma.applyMatrix3(Y).normalize();u.vertexNormalsLength=y.length;y=0;for(Aa=Math.min(z.length,3);y<Aa;y++)if(E=z[y][la],void 0!==E)for(ya=0,Sa=E.length;ya<Sa;ya++)u.uvs[y][ya]=E[ya];u.color=v.color;u.material=Pa;u.z=(qa.positionScreen.z+xa.positionScreen.z+Ka.positionScreen.z)/3;A.elements.push(u)}}}}}else if(p instanceof THREE.Line)if(s instanceof
|
|
|
+THREE.BufferGeometry){if(z=s.attributes,void 0!==z.position){G=z.position.array;p=0;for(s=G.length;p<s;p+=3)U.pushVertex(G[p],G[p+1],G[p+2]);if(void 0!==z.index)for(z=z.index.array,p=0,s=z.length;p<s;p+=2)U.pushLine(z[p],z[p+1]);else for(p=0,s=G.length/3-1;p<s;p++)U.pushLine(p,p+1)}}else{if(s instanceof THREE.Geometry&&(ia.multiplyMatrices(Z,V),v=p.geometry.vertices,0!==v.length))for(qa=a(),qa.positionScreen.copy(v[0]).applyMatrix4(ia),s=p.type===THREE.LinePieces?2:1,la=1,Ua=v.length;la<Ua;la++)qa=
|
|
|
+a(),qa.positionScreen.copy(v[la]).applyMatrix4(ia),0<(la+1)%s||(xa=q[n-2],L.copy(qa.positionScreen),ka.copy(xa.positionScreen),!0===e(L,ka)&&(L.multiplyScalar(1/L.w),ka.multiplyScalar(1/ka.w),w=c(),w.id=p.id,w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(ka),w.z=Math.max(L.z,ka.z),w.material=p.material,p.material.vertexColors===THREE.VertexColors&&(w.vertexColors[0].copy(p.geometry.colors[la]),w.vertexColors[1].copy(p.geometry.colors[la-1])),A.elements.push(w)))}else p instanceof THREE.Sprite&&
|
|
|
+(K.set(V.elements[12],V.elements[13],V.elements[14],1),K.applyMatrix4(Z),s=1/K.w,K.z*=s,-1<=K.z&&1>=K.z&&(P===C?(x=new THREE.RenderableSprite,B.push(x),C++,P++,F=x):F=B[P++],F.id=p.id,F.x=K.x*s,F.y=K.y*s,F.z=K.z,F.object=p,F.rotation=p.rotation,F.scale.x=p.scale.x*Math.abs(F.x-(K.x+h.projectionMatrix.elements[0])/(K.w+h.projectionMatrix.elements[12])),F.scale.y=p.scale.y*Math.abs(F.y-(K.y+h.projectionMatrix.elements[5])/(K.w+h.projectionMatrix.elements[13])),F.material=p.material,A.elements.push(F)));
|
|
|
!0===k&&A.elements.sort(d);return A}};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,g){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,g)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
|
|
@@ -191,9 +191,9 @@ g);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){
|
|
|
0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=
|
|
|
e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g=
|
|
|
this.morphNormals[a].vertexNormals,h,l;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,l={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(l)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],l=g.vertexNormals[c],h.copy(e.normal),l.a.copy(e.vertexNormals[0]),l.b.copy(e.vertexNormals[1]),l.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<
|
|
|
-d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,l,k,n,q,s,t,u,p,v,w=[],r=[];c=new THREE.Vector3;var x=new THREE.Vector3,z=new THREE.Vector3,G=new THREE.Vector3,J=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,r[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,v=e.b,e=e.c,g=this.vertices[d],h=this.vertices[v],l=this.vertices[e],
|
|
|
-k=f[0],n=f[1],q=f[2],f=h.x-g.x,s=l.x-g.x,t=h.y-g.y,u=l.y-g.y,h=h.z-g.z,g=l.z-g.z,l=n.x-k.x,p=q.x-k.x,n=n.y-k.y,k=q.y-k.y,q=1/(l*k-p*n),c.set((k*f-n*s)*q,(k*t-n*u)*q,(k*h-n*g)*q),x.set((l*s-p*f)*q,(l*u-p*t)*q,(l*g-p*h)*q),w[d].add(c),w[v].add(c),w[e].add(c),r[d].add(x),r[v].add(x),r[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)J.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],z.copy(v),z.sub(J.multiplyScalar(J.dot(v))).normalize(),
|
|
|
-G.crossVectors(e.vertexNormals[c],v),d=G.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
+d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,g,h,l,k,n,q,s,u,t,p,v,w=[],r=[];c=new THREE.Vector3;var x=new THREE.Vector3,z=new THREE.Vector3,F=new THREE.Vector3,P=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,r[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,v=e.b,e=e.c,g=this.vertices[d],h=this.vertices[v],l=this.vertices[e],
|
|
|
+k=f[0],n=f[1],q=f[2],f=h.x-g.x,s=l.x-g.x,u=h.y-g.y,t=l.y-g.y,h=h.z-g.z,g=l.z-g.z,l=n.x-k.x,p=q.x-k.x,n=n.y-k.y,k=q.y-k.y,q=1/(l*k-p*n),c.set((k*f-n*s)*q,(k*u-n*t)*q,(k*h-n*g)*q),x.set((l*s-p*f)*q,(l*t-p*u)*q,(l*g-p*h)*q),w[d].add(c),w[v].add(c),w[e].add(c),r[d].add(x),r[v].add(x),r[e].add(x);x=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)P.copy(e.vertexNormals[c]),d=e[x[c]],v=w[d],z.copy(v),z.sub(P.multiplyScalar(P.dot(v))).normalize(),
|
|
|
+F.crossVectors(e.vertexNormals[c],v),d=F.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f<g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=
|
|
|
a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],g=0,h=e.length;g<h;g++)f.push(new THREE.Vector2(e[g].x,e[g].y));a.faceVertexUvs[0].push(f)}return a},
|
|
|
dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.Geometry2=function(a){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=void 0!==a?new Float32Array(3*a):[];this.normals=void 0!==a?new Float32Array(3*a):[];this.uvs=void 0!==a?new Float32Array(2*a):[];this.boundingSphere=this.boundingBox=null};
|
|
@@ -203,14 +203,14 @@ THREE.EventDispatcher.prototype.apply(THREE.Geometry2.prototype);THREE.BufferGeo
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c,d){this.attributes[a]={itemSize:d,array:new b(c*d)}},applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===
|
|
|
this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox;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 c=3,d=a.length;c<d;c+=3){var e=a[c],f=a[c+1],g=a[c+2];e<b.min.x?b.min.x=e:e>b.max.x&&(b.max.x=e);f<b.min.y?b.min.y=f:f>b.max.y&&(b.max.y=f);g<b.min.z?b.min.z=g:g>b.max.z&&(b.max.z=g)}}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=
|
|
|
new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty();for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g)}}}(),computeVertexNormals:function(){if(this.attributes.position){var a,
|
|
|
-b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else for(a=0,b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0;var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,l,k,n,q,s=new THREE.Vector3,t=new THREE.Vector3,u=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,r=this.offsets;c=0;for(d=
|
|
|
-r.length;c<d;++c){b=r[c].start;g=r[c].count;var x=r[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],l=x+w[a+2],k=e[3*g],n=e[3*g+1],q=e[3*g+2],s.set(k,n,q),k=e[3*h],n=e[3*h+1],q=e[3*h+2],t.set(k,n,q),k=e[3*l],n=e[3*l+1],q=e[3*l+2],u.set(k,n,q),p.subVectors(u,t),v.subVectors(s,t),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*l]+=p.x,f[3*l+1]+=p.y,f[3*l+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)k=e[a],n=e[a+1],q=e[a+2],s.set(k,n,q),k=e[a+3],n=e[a+4],
|
|
|
-q=e[a+5],t.set(k,n,q),k=e[a+6],n=e[a+7],q=e[a+8],u.set(k,n,q),p.subVectors(u,t),v.subVectors(s,t),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a,b,c){q=d[3*a];s=d[3*a+1];
|
|
|
-t=d[3*a+2];u=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];r=d[3*c+1];x=d[3*c+2];z=f[2*a];G=f[2*a+1];J=f[2*b];H=f[2*b+1];B=f[2*c];A=f[2*c+1];K=u-q;C=w-q;Q=p-s;y=r-s;L=v-t;E=x-t;D=J-z;F=B-z;S=H-G;Z=A-G;V=1/(D*Z-F*S);ia.set((Z*K-S*C)*V,(Z*Q-S*y)*V,(Z*L-S*E)*V);Y.set((D*C-F*K)*V,(D*y-F*Q)*V,(D*E-F*L)*V);l[a].add(ia);l[b].add(ia);l[c].add(ia);k[a].add(Y);k[b].add(Y);k[c].add(Y)}function b(a){ta.x=e[3*a];ta.y=e[3*a+1];ta.z=e[3*a+2];Fa.copy(ta);ua=l[a];Ja.copy(ua);Ja.sub(ta.multiplyScalar(ta.dot(ua))).normalize();
|
|
|
+b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else for(a=0,b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0;var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,l,k,n,q,s=new THREE.Vector3,u=new THREE.Vector3,t=new THREE.Vector3,p=new THREE.Vector3,v=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,r=this.offsets;c=0;for(d=
|
|
|
+r.length;c<d;++c){b=r[c].start;g=r[c].count;var x=r[c].index;a=b;for(b+=g;a<b;a+=3)g=x+w[a],h=x+w[a+1],l=x+w[a+2],k=e[3*g],n=e[3*g+1],q=e[3*g+2],s.set(k,n,q),k=e[3*h],n=e[3*h+1],q=e[3*h+2],u.set(k,n,q),k=e[3*l],n=e[3*l+1],q=e[3*l+2],t.set(k,n,q),p.subVectors(t,u),v.subVectors(s,u),p.cross(v),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*l]+=p.x,f[3*l+1]+=p.y,f[3*l+2]+=p.z}}else for(a=0,b=e.length;a<b;a+=9)k=e[a],n=e[a+1],q=e[a+2],s.set(k,n,q),k=e[a+3],n=e[a+4],
|
|
|
+q=e[a+5],u.set(k,n,q),k=e[a+6],n=e[a+7],q=e[a+8],t.set(k,n,q),p.subVectors(t,u),v.subVectors(s,u),p.cross(v),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z;this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a,b,c){q=d[3*a];s=d[3*a+1];
|
|
|
+u=d[3*a+2];t=d[3*b];p=d[3*b+1];v=d[3*b+2];w=d[3*c];r=d[3*c+1];x=d[3*c+2];z=f[2*a];F=f[2*a+1];P=f[2*b];B=f[2*b+1];C=f[2*c];A=f[2*c+1];I=t-q;H=w-q;N=p-s;y=r-s;K=v-u;E=x-u;D=P-z;G=C-z;T=B-F;Z=A-F;V=1/(D*Z-G*T);ia.set((Z*I-T*H)*V,(Z*N-T*y)*V,(Z*K-T*E)*V);Y.set((D*H-G*I)*V,(D*y-G*N)*V,(D*E-G*K)*V);l[a].add(ia);l[b].add(ia);l[c].add(ia);k[a].add(Y);k[b].add(Y);k[c].add(Y)}function b(a){ta.x=e[3*a];ta.y=e[3*a+1];ta.z=e[3*a+2];Fa.copy(ta);ua=l[a];Ja.copy(ua);Ja.sub(ta.multiplyScalar(ta.dot(ua))).normalize();
|
|
|
Na.crossVectors(Fa,ua);ea=Na.dot(k[a]);pa=0>ea?-1:1;h[4*a]=Ja.x;h[4*a+1]=Ja.y;h[4*a+2]=Ja.z;h[4*a+3]=pa}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&
|
|
|
-(this.attributes.tangent={itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,l=[],k=[],n=0;n<g;n++)l[n]=new THREE.Vector3,k[n]=new THREE.Vector3;var q,s,t,u,p,v,w,r,x,z,G,J,H,B,A,K,C,Q,y,L,E,D,F,S,Z,V,ia=new THREE.Vector3,Y=new THREE.Vector3,ja,M,ka,P,U,O=this.offsets,n=0;for(M=O.length;n<M;++n){ja=O[n].start;ka=O[n].count;var T=O[n].index,g=ja;for(ja+=ka;g<ja;g+=3)ka=T+c[g],P=T+c[g+1],U=T+c[g+2],a(ka,P,U)}var Ja=new THREE.Vector3,Na=new THREE.Vector3,ta=new THREE.Vector3,
|
|
|
-Fa=new THREE.Vector3,pa,ua,ea,n=0;for(M=O.length;n<M;++n)for(ja=O[n].start,ka=O[n].count,T=O[n].index,g=ja,ja+=ka;g<ja;g+=3)ka=T+c[g],P=T+c[g+1],U=T+c[g+2],b(ka),b(P),b(U);this.tangentsNeedUpdate=this.hasTangents=!0}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],l=h[0],k=0,n=0,q=new Int32Array(6),s=new Int32Array(c.length),t=new Int32Array(c.length),
|
|
|
-u=0;u<c.length;u++)s[u]=-1,t[u]=-1;for(c=0;c<d;c++){for(var p=n=0;3>p;p++)u=a[3*c+p],-1==s[u]?(q[2*p]=u,q[2*p+1]=-1,n++):s[u]<l.index?(q[2*p]=u,q[2*p+1]=-1,k++):(q[2*p]=u,q[2*p+1]=s[u]);if(g+n>l.index+b)for(l={start:f,count:0,index:g},h.push(l),n=0;6>n;n+=2)p=q[n+1],-1<p&&p<l.index&&(q[n+1]=-1);for(n=0;6>n;n+=2)u=q[n],p=q[n+1],-1===p&&(p=g++),s[u]=p,t[p]=u,e[f++]=p-l.index,l.count++}this.reorderBuffers(e,t,g);return this.offsets=h},reorderBuffers:function(a,b,c){var d={},e=[Int8Array,Uint8Array,Uint8ClampedArray,
|
|
|
+(this.attributes.tangent={itemSize:4,array:new Float32Array(4*g)});for(var h=this.attributes.tangent.array,l=[],k=[],n=0;n<g;n++)l[n]=new THREE.Vector3,k[n]=new THREE.Vector3;var q,s,u,t,p,v,w,r,x,z,F,P,B,C,A,I,H,N,y,K,E,D,G,T,Z,V,ia=new THREE.Vector3,Y=new THREE.Vector3,ja,L,ka,Q,U,O=this.offsets,n=0;for(L=O.length;n<L;++n){ja=O[n].start;ka=O[n].count;var S=O[n].index,g=ja;for(ja+=ka;g<ja;g+=3)ka=S+c[g],Q=S+c[g+1],U=S+c[g+2],a(ka,Q,U)}var Ja=new THREE.Vector3,Na=new THREE.Vector3,ta=new THREE.Vector3,
|
|
|
+Fa=new THREE.Vector3,pa,ua,ea,n=0;for(L=O.length;n<L;++n)for(ja=O[n].start,ka=O[n].count,S=O[n].index,g=ja,ja+=ka;g<ja;g+=3)ka=S+c[g],Q=S+c[g+1],U=S+c[g+2],b(ka),b(Q),b(U);this.tangentsNeedUpdate=this.hasTangents=!0}},computeOffsets:function(a){var b=a;void 0===a&&(b=65535);Date.now();a=this.attributes.index.array;for(var c=this.attributes.position.array,d=a.length/3,e=new Uint16Array(a.length),f=0,g=0,h=[{start:0,count:0,index:0}],l=h[0],k=0,n=0,q=new Int32Array(6),s=new Int32Array(c.length),u=new Int32Array(c.length),
|
|
|
+t=0;t<c.length;t++)s[t]=-1,u[t]=-1;for(c=0;c<d;c++){for(var p=n=0;3>p;p++)t=a[3*c+p],-1==s[t]?(q[2*p]=t,q[2*p+1]=-1,n++):s[t]<l.index?(q[2*p]=t,q[2*p+1]=-1,k++):(q[2*p]=t,q[2*p+1]=s[t]);if(g+n>l.index+b)for(l={start:f,count:0,index:g},h.push(l),n=0;6>n;n+=2)p=q[n+1],-1<p&&p<l.index&&(q[n+1]=-1);for(n=0;6>n;n+=2)t=q[n],p=q[n+1],-1===p&&(p=g++),s[t]=p,u[p]=t,e[f++]=p-l.index,l.count++}this.reorderBuffers(e,u,g);return this.offsets=h},reorderBuffers:function(a,b,c){var d={},e=[Int8Array,Uint8Array,Uint8ClampedArray,
|
|
|
Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],f;for(f in this.attributes)if("index"!=f)for(var g=this.attributes[f].array,h=0,l=e.length;h<l;h++){var k=e[h];if(g instanceof k){d[f]=new k(this.attributes[f].itemSize*c);break}}for(e=0;e<c;e++)for(f in g=b[e],this.attributes)if("index"!=f)for(var h=this.attributes[f].array,l=this.attributes[f].itemSize,k=d[f],n=0;n<l;n++)k[e*l+n]=h[g*l+n];this.attributes.index.array=a;for(f in this.attributes)"index"!=f&&(this.attributes[f].array=
|
|
|
d[f],this.attributes[f].numItems=this.attributes[f].itemSize*c)},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,array:null},d=0,g=b.length;d<g;d++){var h=b[d];if(e instanceof h){f.array=new h(e);break}}a.attributes[c]=f}d=0;for(g=this.offsets.length;d<g;d++)b=this.offsets[d],a.offsets.push({start:b.start,
|
|
|
index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
|
|
@@ -235,10 +235,10 @@ THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){va
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(c){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);if("scene"===h.metadata.type){console.error('THREE.JSONLoader: "'+b+'" seems to be a Scene. Use THREE.SceneLoader instead.');return}h=a.parse(h,d);c(h.geometry,h.materials)}else console.error('THREE.JSONLoader: "'+b+'" seems to be unreachable or the file is empty.');a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load \""+
|
|
|
b+'" ('+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,l,k,n,q,s,t,u,p,v,w,r=a.faces;n=a.vertices;var x=a.normals,z=a.colors,G=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&G++;for(d=0;d<G;d++)c.faceVertexUvs[d]=[]}l=0;for(k=n.length;l<k;)d=new THREE.Vector3,d.x=n[l++]*b,d.y=n[l++]*b,d.z=n[l++]*b,c.vertices.push(d);l=0;for(k=r.length;l<k;)if(b=r[l++],t=b&1,h=b&2,d=b&8,q=b&16,u=b&32,n=b&64,b&=128,t){t=new THREE.Face3;
|
|
|
-t.a=r[l];t.b=r[l+1];t.c=r[l+3];p=new THREE.Face3;p.a=r[l+1];p.b=r[l+2];p.c=r[l+3];l+=4;h&&(h=r[l++],t.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<G;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)s=r[l++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*r[l++],t.normal.set(x[q++],x[q++],x[q]),p.normal.copy(t.normal));if(u)for(d=0;4>d;d++)q=3*r[l++],u=new THREE.Vector3(x[q++],
|
|
|
-x[q++],x[q]),2!==d&&t.vertexNormals.push(u),0!==d&&p.vertexNormals.push(u);n&&(n=r[l++],n=z[n],t.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=r[l++],n=z[n],2!==d&&t.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(t);c.faces.push(p)}else{t=new THREE.Face3;t.a=r[l++];t.b=r[l++];t.c=r[l++];h&&(h=r[l++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<G;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)s=r[l++],w=v[2*s],s=v[2*s+1],
|
|
|
-w=new THREE.Vector2(w,s),c.faceVertexUvs[d][h].push(w);q&&(q=3*r[l++],t.normal.set(x[q++],x[q++],x[q]));if(u)for(d=0;3>d;d++)q=3*r[l++],u=new THREE.Vector3(x[q++],x[q++],x[q]),t.vertexNormals.push(u);n&&(n=r[l++],t.color.setHex(z[n]));if(b)for(d=0;3>d;d++)n=r[l++],t.vertexColors.push(new THREE.Color(z[n]));c.faces.push(t)}})(d);(function(){if(a.skinWeights)for(var b=0,d=a.skinWeights.length;b<d;b+=2)c.skinWeights.push(new THREE.Vector4(a.skinWeights[b],a.skinWeights[b+1],0,0));if(a.skinIndices)for(b=
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,l,k,n,q,s,u,t,p,v,w,r=a.faces;n=a.vertices;var x=a.normals,z=a.colors,F=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&F++;for(d=0;d<F;d++)c.faceVertexUvs[d]=[]}l=0;for(k=n.length;l<k;)d=new THREE.Vector3,d.x=n[l++]*b,d.y=n[l++]*b,d.z=n[l++]*b,c.vertices.push(d);l=0;for(k=r.length;l<k;)if(b=r[l++],u=b&1,h=b&2,d=b&8,q=b&16,t=b&32,n=b&64,b&=128,u){u=new THREE.Face3;
|
|
|
+u.a=r[l];u.b=r[l+1];u.c=r[l+3];p=new THREE.Face3;p.a=r[l+1];p.b=r[l+2];p.c=r[l+3];l+=4;h&&(h=r[l++],u.materialIndex=h,p.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)s=r[l++],w=v[2*s],s=v[2*s+1],w=new THREE.Vector2(w,s),2!==g&&c.faceVertexUvs[d][h].push(w),0!==g&&c.faceVertexUvs[d][h+1].push(w);q&&(q=3*r[l++],u.normal.set(x[q++],x[q++],x[q]),p.normal.copy(u.normal));if(t)for(d=0;4>d;d++)q=3*r[l++],t=new THREE.Vector3(x[q++],
|
|
|
+x[q++],x[q]),2!==d&&u.vertexNormals.push(t),0!==d&&p.vertexNormals.push(t);n&&(n=r[l++],n=z[n],u.color.setHex(n),p.color.setHex(n));if(b)for(d=0;4>d;d++)n=r[l++],n=z[n],2!==d&&u.vertexColors.push(new THREE.Color(n)),0!==d&&p.vertexColors.push(new THREE.Color(n));c.faces.push(u);c.faces.push(p)}else{u=new THREE.Face3;u.a=r[l++];u.b=r[l++];u.c=r[l++];h&&(h=r[l++],u.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<F;d++)for(v=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)s=r[l++],w=v[2*s],s=v[2*s+1],
|
|
|
+w=new THREE.Vector2(w,s),c.faceVertexUvs[d][h].push(w);q&&(q=3*r[l++],u.normal.set(x[q++],x[q++],x[q]));if(t)for(d=0;3>d;d++)q=3*r[l++],t=new THREE.Vector3(x[q++],x[q++],x[q]),u.vertexNormals.push(t);n&&(n=r[l++],u.color.setHex(z[n]));if(b)for(d=0;3>d;d++)n=r[l++],u.vertexColors.push(new THREE.Color(z[n]));c.faces.push(u)}})(d);(function(){if(a.skinWeights)for(var b=0,d=a.skinWeights.length;b<d;b+=2)c.skinWeights.push(new THREE.Vector4(a.skinWeights[b],a.skinWeights[b+1],0,0));if(a.skinIndices)for(b=
|
|
|
0,d=a.skinIndices.length;b<d;b+=2)c.skinIndices.push(new THREE.Vector4(a.skinIndices[b],a.skinIndices[b+1],0,0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,
|
|
|
g,h,l,k,n;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],k=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,l=n.length;h<l;h+=3){var q=new THREE.Vector3;q.x=n[h]*b;q.y=n[h+1]*b;q.z=n[h+2]*b;k.push(q)}}if(void 0!==a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],l=c.morphColors[d].colors,k=a.morphColors[d].colors,
|
|
|
b=0,h=k.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(k[b],k[b+1],k[b+2]),l.push(n)})(d);c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
@@ -253,29 +253,29 @@ d.parse(h.data);break;case "Geometry":g=c.parse(h.data).geometry}g.uuid=h.uuid;v
|
|
|
b.aspect,b.near,b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,
|
|
|
b.groundColor,b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;case "Sprite":f=d[b.material];void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Sprite(f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?
|
|
|
(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var g in b.children)e.add(this.parseObject(b.children[g],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
|
|
|
-THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b,c,d){var e=this;c=new THREE.XHRLoader(e.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(c){e.parse(JSON.parse(c),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:t+"/"+a}function e(){f(B.scene,
|
|
|
-K.objects)}function f(a,b){var c,e,g,h,k,n;for(n in b){var q=B.objects[n],r=b[n];if(void 0===q){if(r.type&&r.type in s.hierarchyHandlers){if(void 0===r.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var t={},w;for(w in r)w in c||(t[w]=r[w]);p=B.materials[r.material];r.loading=!0;c=s.hierarchyHandlers[r.type].loaderObject;c.options?c.load(d(r.url,K.urlBaseType),l(n,a,p,r)):c.load(d(r.url,K.urlBaseType),l(n,
|
|
|
-a,p,r),t)}}else if(void 0!==r.geometry){if(u=B.geometries[r.geometry]){q=!1;p=B.materials[r.material];q=p instanceof THREE.ShaderMaterial;e=r.position;g=r.rotation;h=r.scale;c=r.matrix;k=r.quaternion;r.material||(p=new THREE.MeshFaceMaterial(B.face_materials[r.geometry]));p instanceof THREE.MeshFaceMaterial&&0===p.materials.length&&(p=new THREE.MeshFaceMaterial(B.face_materials[r.geometry]));if(p instanceof THREE.MeshFaceMaterial)for(t=0;t<p.materials.length;t++)q=q||p.materials[t]instanceof THREE.ShaderMaterial;
|
|
|
-q&&u.computeTangents();r.skin?q=new THREE.SkinnedMesh(u,p):r.morph?(q=new THREE.MorphAnimMesh(u,p),void 0!==r.duration&&(q.duration=r.duration),void 0!==r.time&&(q.time=r.time),void 0!==r.mirroredLoop&&(q.mirroredLoop=r.mirroredLoop),p.morphNormals&&u.computeMorphNormals()):q=new THREE.Mesh(u,p);q.name=n;c?(q.matrixAutoUpdate=!1,q.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(q.position.fromArray(e),k?q.quaternion.fromArray(k):q.rotation.fromArray(g),
|
|
|
-q.scale.fromArray(h));q.visible=r.visible;q.castShadow=r.castShadow;q.receiveShadow=r.receiveShadow;a.add(q);B.objects[n]=q}}else if("AmbientLight"===r.type||"PointLight"===r.type||"DirectionalLight"===r.type||"SpotLight"===r.type||"HemisphereLight"===r.type||"AreaLight"===r.type){t=r.color;c=r.intensity;e=r.distance;g=r.position;h=r.rotation;switch(r.type){case "AmbientLight":x=new THREE.AmbientLight(t);break;case "PointLight":x=new THREE.PointLight(t,c,e);x.position.fromArray(g);break;case "DirectionalLight":x=
|
|
|
-new THREE.DirectionalLight(t,c);x.position.fromArray(r.direction);break;case "SpotLight":x=new THREE.SpotLight(t,c,e,1);x.angle=r.angle;x.position.fromArray(g);x.target.set(g[0],g[1]-e,g[2]);x.target.applyEuler(new THREE.Euler(h[0],h[1],h[2],"XYZ"));break;case "HemisphereLight":x=new THREE.DirectionalLight(t,c,e);x.target.set(g[0],g[1]-e,g[2]);x.target.applyEuler(new THREE.Euler(h[0],h[1],h[2],"XYZ"));break;case "AreaLight":x=new THREE.AreaLight(t,c),x.position.fromArray(g),x.width=r.size,x.height=
|
|
|
-r.size_y}a.add(x);x.name=n;B.lights[n]=x;B.objects[n]=x}else"PerspectiveCamera"===r.type||"OrthographicCamera"===r.type?(e=r.position,g=r.rotation,k=r.quaternion,"PerspectiveCamera"===r.type?v=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):"OrthographicCamera"===r.type&&(v=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),v.name=n,v.position.fromArray(e),void 0!==k?v.quaternion.fromArray(k):void 0!==g&&v.rotation.fromArray(g),a.add(v),B.cameras[n]=v,B.objects[n]=
|
|
|
-v):(e=r.position,g=r.rotation,h=r.scale,k=r.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(e),k?q.quaternion.fromArray(k):q.rotation.fromArray(g),q.scale.fromArray(h),q.visible=void 0!==r.visible?r.visible:!1,a.add(q),B.objects[n]=q,B.empties[n]=q);if(q){if(void 0!==r.userData)for(var z in r.userData)q.userData[z]=r.userData[z];if(void 0!==r.groups)for(t=0;t<r.groups.length;t++)c=r.groups[t],void 0===B.groups[c]&&(B.groups[c]=[]),B.groups[c].push(n)}}void 0!==q&&void 0!==r.children&&
|
|
|
-f(q,r.children)}}function g(a,b,c,d,f){var g=f.rotation,h=f.quaternion,l=f.scale;a.position.fromArray(f.position);h?a.quaternion.fromArray(h):a.rotation.fromArray(g);a.scale.fromArray(l);d&&a.traverse(function(a){a.material=d});var k=void 0!==f.visible?f.visible:!0;a.traverse(function(a){a.visible=k});c.add(a);a.name=b;B.objects[b]=a;e()}function h(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c;e();z-=1;s.onLoadComplete();n()}}function l(a,b,c,d){return function(e){g(e.content?
|
|
|
-e.content:e.dae?e.scene:e,a,b,c,d);z-=1;s.onLoadComplete();n()}}function k(a){return function(b,c){b.name=a;B.geometries[a]=b;B.face_materials[a]=c}}function n(){s.callbackProgress({totalModels:J,totalTextures:H,loadedModels:J-z,loadedTextures:H-G},B);s.onLoadProgress();if(0===z&&0===G){for(var a=0;a<A.length;a++){var c=A[a],d=B.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,B.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(B)}}function q(a,
|
|
|
-b){b(a);if(void 0!==a.children)for(var c in a.children)q(a.children[c],b)}var s=this,t=THREE.Loader.prototype.extractUrlBase(c),u,p,v,w,r,x,z,G,J,H,B,A=[],K=a,C;for(C in this.geometryHandlers)a=this.geometryHandlers[C].loaderClass,this.geometryHandlers[C].loaderObject=new a;for(C in this.hierarchyHandlers)a=this.hierarchyHandlers[C].loaderClass,this.hierarchyHandlers[C].loaderObject=new a;G=z=0;B={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
-lights:{},fogs:{},empties:{},groups:{}};K.transform&&(C=K.transform.position,a=K.transform.rotation,c=K.transform.scale,C&&B.scene.position.fromArray(C),a&&B.scene.rotation.fromArray(a),c&&B.scene.scale.fromArray(c),C||a||c)&&(B.scene.updateMatrix(),B.scene.updateMatrixWorld());C=function(a){return function(){G-=a;n();s.onLoadComplete()}};for(var Q in K.fogs)a=K.fogs[Q],"linear"===a.type?w=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(w=new THREE.FogExp2(0,a.density)),a=a.color,w.color.setRGB(a[0],
|
|
|
-a[1],a[2]),B.fogs[Q]=w;for(var y in K.geometries)w=K.geometries[y],w.type in this.geometryHandlers&&(z+=1,s.onLoadStart());for(var L in K.objects)q(K.objects[L],function(a){a.type&&a.type in s.hierarchyHandlers&&(z+=1,s.onLoadStart())});J=z;for(y in K.geometries)if(w=K.geometries[y],"cube"===w.type)u=new THREE.BoxGeometry(w.width,w.height,w.depth,w.widthSegments,w.heightSegments,w.depthSegments),u.name=y,B.geometries[y]=u;else if("plane"===w.type)u=new THREE.PlaneGeometry(w.width,w.height,w.widthSegments,
|
|
|
-w.heightSegments),u.name=y,B.geometries[y]=u;else if("sphere"===w.type)u=new THREE.SphereGeometry(w.radius,w.widthSegments,w.heightSegments),u.name=y,B.geometries[y]=u;else if("cylinder"===w.type)u=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),u.name=y,B.geometries[y]=u;else if("torus"===w.type)u=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),u.name=y,B.geometries[y]=u;else if("icosahedron"===w.type)u=new THREE.IcosahedronGeometry(w.radius,w.subdivisions),
|
|
|
-u.name=y,B.geometries[y]=u;else if(w.type in this.geometryHandlers){L={};for(r in w)"type"!==r&&"url"!==r&&(L[r]=w[r]);this.geometryHandlers[w.type].loaderObject.load(d(w.url,K.urlBaseType),h(y),L)}else"embedded"===w.type&&(L=K.embeds[w.id],L.metadata=K.metadata,L&&(L=this.geometryHandlers.ascii.loaderObject.parse(L,""),k(y)(L.geometry,L.materials)));for(var E in K.textures)if(y=K.textures[E],y.url instanceof Array)for(G+=y.url.length,r=0;r<y.url.length;r++)s.onLoadStart();else G+=1,s.onLoadStart();
|
|
|
-H=G;for(E in K.textures){y=K.textures[E];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){L=y.url.length;w=[];for(r=0;r<L;r++)w[r]=d(y.url[r],K.urlBaseType);r=(r=/\.dds$/i.test(w[0]))?THREE.ImageUtils.loadCompressedTextureCube(w,y.mapping,C(L)):THREE.ImageUtils.loadTextureCube(w,y.mapping,C(L))}else r=/\.dds$/i.test(y.url),L=d(y.url,K.urlBaseType),w=C(1),r=r?THREE.ImageUtils.loadCompressedTexture(L,y.mapping,w):THREE.ImageUtils.loadTexture(L,
|
|
|
-y.mapping,w),void 0!==THREE[y.minFilter]&&(r.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(r.magFilter=THREE[y.magFilter]),y.anisotropy&&(r.anisotropy=y.anisotropy),y.repeat&&(r.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),y.offset&&r.offset.set(y.offset[0],y.offset[1]),y.wrap&&(L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==L[y.wrap[0]]&&(r.wrapS=L[y.wrap[0]]),void 0!==
|
|
|
-L[y.wrap[1]]&&(r.wrapT=L[y.wrap[1]]));B.textures[E]=r}var D,F;for(D in K.materials){E=K.materials[D];for(F in E.parameters)"envMap"===F||"map"===F||"lightMap"===F||"bumpMap"===F?E.parameters[F]=B.textures[E.parameters[F]]:"shading"===F?E.parameters[F]="flat"===E.parameters[F]?THREE.FlatShading:THREE.SmoothShading:"side"===F?E.parameters[F]="double"==E.parameters[F]?THREE.DoubleSide:"back"==E.parameters[F]?THREE.BackSide:THREE.FrontSide:"blending"===F?E.parameters[F]=E.parameters[F]in THREE?THREE[E.parameters[F]]:
|
|
|
-THREE.NormalBlending:"combine"===F?E.parameters[F]=E.parameters[F]in THREE?THREE[E.parameters[F]]:THREE.MultiplyOperation:"vertexColors"===F?"face"==E.parameters[F]?E.parameters[F]=THREE.FaceColors:E.parameters[F]&&(E.parameters[F]=THREE.VertexColors):"wrapRGB"===F&&(C=E.parameters[F],E.parameters[F]=new THREE.Vector3(C[0],C[1],C[2]));void 0!==E.parameters.opacity&&1>E.parameters.opacity&&(E.parameters.transparent=!0);E.parameters.normalMap?(C=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(C.uniforms),
|
|
|
-r=E.parameters.color,L=E.parameters.specular,w=E.parameters.ambient,Q=E.parameters.shininess,y.tNormal.value=B.textures[E.parameters.normalMap],E.parameters.normalScale&&y.uNormalScale.value.set(E.parameters.normalScale[0],E.parameters.normalScale[1]),E.parameters.map&&(y.tDiffuse.value=E.parameters.map,y.enableDiffuse.value=!0),E.parameters.envMap&&(y.tCube.value=E.parameters.envMap,y.enableReflection.value=!0,y.reflectivity.value=E.parameters.reflectivity),E.parameters.lightMap&&(y.tAO.value=E.parameters.lightMap,
|
|
|
-y.enableAO.value=!0),E.parameters.specularMap&&(y.tSpecular.value=B.textures[E.parameters.specularMap],y.enableSpecular.value=!0),E.parameters.displacementMap&&(y.tDisplacement.value=B.textures[E.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=E.parameters.displacementBias,y.uDisplacementScale.value=E.parameters.displacementScale),y.diffuse.value.setHex(r),y.specular.value.setHex(L),y.ambient.value.setHex(w),y.shininess.value=Q,E.parameters.opacity&&(y.opacity.value=
|
|
|
-E.parameters.opacity),p=new THREE.ShaderMaterial({fragmentShader:C.fragmentShader,vertexShader:C.vertexShader,uniforms:y,lights:!0,fog:!0})):p=new THREE[E.type](E.parameters);p.name=D;B.materials[D]=p}for(D in K.materials)if(E=K.materials[D],E.parameters.materials){F=[];for(r=0;r<E.parameters.materials.length;r++)F.push(B.materials[E.parameters.materials[r]]);B.materials[D].materials=F}e();B.cameras&&K.defaults.camera&&(B.currentCamera=B.cameras[K.defaults.camera]);B.fogs&&K.defaults.fog&&(B.scene.fog=
|
|
|
-B.fogs[K.defaults.fog]);s.callbackSync(B);n()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
+THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b,c,d){var e=this;c=new THREE.XHRLoader(e.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(c){e.parse(JSON.parse(c),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:u+"/"+a}function e(){f(C.scene,
|
|
|
+I.objects)}function f(a,b){var c,e,g,h,k,n;for(n in b){var q=C.objects[n],r=b[n];if(void 0===q){if(r.type&&r.type in s.hierarchyHandlers){if(void 0===r.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var u={},w;for(w in r)w in c||(u[w]=r[w]);p=C.materials[r.material];r.loading=!0;c=s.hierarchyHandlers[r.type].loaderObject;c.options?c.load(d(r.url,I.urlBaseType),l(n,a,p,r)):c.load(d(r.url,I.urlBaseType),l(n,
|
|
|
+a,p,r),u)}}else if(void 0!==r.geometry){if(t=C.geometries[r.geometry]){q=!1;p=C.materials[r.material];q=p instanceof THREE.ShaderMaterial;e=r.position;g=r.rotation;h=r.scale;c=r.matrix;k=r.quaternion;r.material||(p=new THREE.MeshFaceMaterial(C.face_materials[r.geometry]));p instanceof THREE.MeshFaceMaterial&&0===p.materials.length&&(p=new THREE.MeshFaceMaterial(C.face_materials[r.geometry]));if(p instanceof THREE.MeshFaceMaterial)for(u=0;u<p.materials.length;u++)q=q||p.materials[u]instanceof THREE.ShaderMaterial;
|
|
|
+q&&t.computeTangents();r.skin?q=new THREE.SkinnedMesh(t,p):r.morph?(q=new THREE.MorphAnimMesh(t,p),void 0!==r.duration&&(q.duration=r.duration),void 0!==r.time&&(q.time=r.time),void 0!==r.mirroredLoop&&(q.mirroredLoop=r.mirroredLoop),p.morphNormals&&t.computeMorphNormals()):q=new THREE.Mesh(t,p);q.name=n;c?(q.matrixAutoUpdate=!1,q.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(q.position.fromArray(e),k?q.quaternion.fromArray(k):q.rotation.fromArray(g),
|
|
|
+q.scale.fromArray(h));q.visible=r.visible;q.castShadow=r.castShadow;q.receiveShadow=r.receiveShadow;a.add(q);C.objects[n]=q}}else if("AmbientLight"===r.type||"PointLight"===r.type||"DirectionalLight"===r.type||"SpotLight"===r.type||"HemisphereLight"===r.type||"AreaLight"===r.type){u=r.color;c=r.intensity;e=r.distance;g=r.position;h=r.rotation;switch(r.type){case "AmbientLight":x=new THREE.AmbientLight(u);break;case "PointLight":x=new THREE.PointLight(u,c,e);x.position.fromArray(g);break;case "DirectionalLight":x=
|
|
|
+new THREE.DirectionalLight(u,c);x.position.fromArray(r.direction);break;case "SpotLight":x=new THREE.SpotLight(u,c,e,1);x.angle=r.angle;x.position.fromArray(g);x.target.set(g[0],g[1]-e,g[2]);x.target.applyEuler(new THREE.Euler(h[0],h[1],h[2],"XYZ"));break;case "HemisphereLight":x=new THREE.DirectionalLight(u,c,e);x.target.set(g[0],g[1]-e,g[2]);x.target.applyEuler(new THREE.Euler(h[0],h[1],h[2],"XYZ"));break;case "AreaLight":x=new THREE.AreaLight(u,c),x.position.fromArray(g),x.width=r.size,x.height=
|
|
|
+r.size_y}a.add(x);x.name=n;C.lights[n]=x;C.objects[n]=x}else"PerspectiveCamera"===r.type||"OrthographicCamera"===r.type?(e=r.position,g=r.rotation,k=r.quaternion,"PerspectiveCamera"===r.type?v=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):"OrthographicCamera"===r.type&&(v=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),v.name=n,v.position.fromArray(e),void 0!==k?v.quaternion.fromArray(k):void 0!==g&&v.rotation.fromArray(g),a.add(v),C.cameras[n]=v,C.objects[n]=
|
|
|
+v):(e=r.position,g=r.rotation,h=r.scale,k=r.quaternion,q=new THREE.Object3D,q.name=n,q.position.fromArray(e),k?q.quaternion.fromArray(k):q.rotation.fromArray(g),q.scale.fromArray(h),q.visible=void 0!==r.visible?r.visible:!1,a.add(q),C.objects[n]=q,C.empties[n]=q);if(q){if(void 0!==r.userData)for(var z in r.userData)q.userData[z]=r.userData[z];if(void 0!==r.groups)for(u=0;u<r.groups.length;u++)c=r.groups[u],void 0===C.groups[c]&&(C.groups[c]=[]),C.groups[c].push(n)}}void 0!==q&&void 0!==r.children&&
|
|
|
+f(q,r.children)}}function g(a,b,c,d,f){var g=f.rotation,h=f.quaternion,l=f.scale;a.position.fromArray(f.position);h?a.quaternion.fromArray(h):a.rotation.fromArray(g);a.scale.fromArray(l);d&&a.traverse(function(a){a.material=d});var k=void 0!==f.visible?f.visible:!0;a.traverse(function(a){a.visible=k});c.add(a);a.name=b;C.objects[b]=a;e()}function h(a){return function(b,c){b.name=a;C.geometries[a]=b;C.face_materials[a]=c;e();z-=1;s.onLoadComplete();n()}}function l(a,b,c,d){return function(e){g(e.content?
|
|
|
+e.content:e.dae?e.scene:e,a,b,c,d);z-=1;s.onLoadComplete();n()}}function k(a){return function(b,c){b.name=a;C.geometries[a]=b;C.face_materials[a]=c}}function n(){s.callbackProgress({totalModels:P,totalTextures:B,loadedModels:P-z,loadedTextures:B-F},C);s.onLoadProgress();if(0===z&&0===F){for(var a=0;a<A.length;a++){var c=A[a],d=C.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,C.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(C)}}function q(a,
|
|
|
+b){b(a);if(void 0!==a.children)for(var c in a.children)q(a.children[c],b)}var s=this,u=THREE.Loader.prototype.extractUrlBase(c),t,p,v,w,r,x,z,F,P,B,C,A=[],I=a,H;for(H in this.geometryHandlers)a=this.geometryHandlers[H].loaderClass,this.geometryHandlers[H].loaderObject=new a;for(H in this.hierarchyHandlers)a=this.hierarchyHandlers[H].loaderClass,this.hierarchyHandlers[H].loaderObject=new a;F=z=0;C={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},
|
|
|
+lights:{},fogs:{},empties:{},groups:{}};I.transform&&(H=I.transform.position,a=I.transform.rotation,c=I.transform.scale,H&&C.scene.position.fromArray(H),a&&C.scene.rotation.fromArray(a),c&&C.scene.scale.fromArray(c),H||a||c)&&(C.scene.updateMatrix(),C.scene.updateMatrixWorld());H=function(a){return function(){F-=a;n();s.onLoadComplete()}};for(var N in I.fogs)a=I.fogs[N],"linear"===a.type?w=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(w=new THREE.FogExp2(0,a.density)),a=a.color,w.color.setRGB(a[0],
|
|
|
+a[1],a[2]),C.fogs[N]=w;for(var y in I.geometries)w=I.geometries[y],w.type in this.geometryHandlers&&(z+=1,s.onLoadStart());for(var K in I.objects)q(I.objects[K],function(a){a.type&&a.type in s.hierarchyHandlers&&(z+=1,s.onLoadStart())});P=z;for(y in I.geometries)if(w=I.geometries[y],"cube"===w.type)t=new THREE.BoxGeometry(w.width,w.height,w.depth,w.widthSegments,w.heightSegments,w.depthSegments),t.name=y,C.geometries[y]=t;else if("plane"===w.type)t=new THREE.PlaneGeometry(w.width,w.height,w.widthSegments,
|
|
|
+w.heightSegments),t.name=y,C.geometries[y]=t;else if("sphere"===w.type)t=new THREE.SphereGeometry(w.radius,w.widthSegments,w.heightSegments),t.name=y,C.geometries[y]=t;else if("cylinder"===w.type)t=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),t.name=y,C.geometries[y]=t;else if("torus"===w.type)t=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),t.name=y,C.geometries[y]=t;else if("icosahedron"===w.type)t=new THREE.IcosahedronGeometry(w.radius,w.subdivisions),
|
|
|
+t.name=y,C.geometries[y]=t;else if(w.type in this.geometryHandlers){K={};for(r in w)"type"!==r&&"url"!==r&&(K[r]=w[r]);this.geometryHandlers[w.type].loaderObject.load(d(w.url,I.urlBaseType),h(y),K)}else"embedded"===w.type&&(K=I.embeds[w.id],K.metadata=I.metadata,K&&(K=this.geometryHandlers.ascii.loaderObject.parse(K,""),k(y)(K.geometry,K.materials)));for(var E in I.textures)if(y=I.textures[E],y.url instanceof Array)for(F+=y.url.length,r=0;r<y.url.length;r++)s.onLoadStart();else F+=1,s.onLoadStart();
|
|
|
+B=F;for(E in I.textures){y=I.textures[E];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){K=y.url.length;w=[];for(r=0;r<K;r++)w[r]=d(y.url[r],I.urlBaseType);r=(r=/\.dds$/i.test(w[0]))?THREE.ImageUtils.loadCompressedTextureCube(w,y.mapping,H(K)):THREE.ImageUtils.loadTextureCube(w,y.mapping,H(K))}else r=/\.dds$/i.test(y.url),K=d(y.url,I.urlBaseType),w=H(1),r=r?THREE.ImageUtils.loadCompressedTexture(K,y.mapping,w):THREE.ImageUtils.loadTexture(K,
|
|
|
+y.mapping,w),void 0!==THREE[y.minFilter]&&(r.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(r.magFilter=THREE[y.magFilter]),y.anisotropy&&(r.anisotropy=y.anisotropy),y.repeat&&(r.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),y.offset&&r.offset.set(y.offset[0],y.offset[1]),y.wrap&&(K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==K[y.wrap[0]]&&(r.wrapS=K[y.wrap[0]]),void 0!==
|
|
|
+K[y.wrap[1]]&&(r.wrapT=K[y.wrap[1]]));C.textures[E]=r}var D,G;for(D in I.materials){E=I.materials[D];for(G in E.parameters)"envMap"===G||"map"===G||"lightMap"===G||"bumpMap"===G?E.parameters[G]=C.textures[E.parameters[G]]:"shading"===G?E.parameters[G]="flat"===E.parameters[G]?THREE.FlatShading:THREE.SmoothShading:"side"===G?E.parameters[G]="double"==E.parameters[G]?THREE.DoubleSide:"back"==E.parameters[G]?THREE.BackSide:THREE.FrontSide:"blending"===G?E.parameters[G]=E.parameters[G]in THREE?THREE[E.parameters[G]]:
|
|
|
+THREE.NormalBlending:"combine"===G?E.parameters[G]=E.parameters[G]in THREE?THREE[E.parameters[G]]:THREE.MultiplyOperation:"vertexColors"===G?"face"==E.parameters[G]?E.parameters[G]=THREE.FaceColors:E.parameters[G]&&(E.parameters[G]=THREE.VertexColors):"wrapRGB"===G&&(H=E.parameters[G],E.parameters[G]=new THREE.Vector3(H[0],H[1],H[2]));void 0!==E.parameters.opacity&&1>E.parameters.opacity&&(E.parameters.transparent=!0);E.parameters.normalMap?(H=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(H.uniforms),
|
|
|
+r=E.parameters.color,K=E.parameters.specular,w=E.parameters.ambient,N=E.parameters.shininess,y.tNormal.value=C.textures[E.parameters.normalMap],E.parameters.normalScale&&y.uNormalScale.value.set(E.parameters.normalScale[0],E.parameters.normalScale[1]),E.parameters.map&&(y.tDiffuse.value=E.parameters.map,y.enableDiffuse.value=!0),E.parameters.envMap&&(y.tCube.value=E.parameters.envMap,y.enableReflection.value=!0,y.reflectivity.value=E.parameters.reflectivity),E.parameters.lightMap&&(y.tAO.value=E.parameters.lightMap,
|
|
|
+y.enableAO.value=!0),E.parameters.specularMap&&(y.tSpecular.value=C.textures[E.parameters.specularMap],y.enableSpecular.value=!0),E.parameters.displacementMap&&(y.tDisplacement.value=C.textures[E.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=E.parameters.displacementBias,y.uDisplacementScale.value=E.parameters.displacementScale),y.diffuse.value.setHex(r),y.specular.value.setHex(K),y.ambient.value.setHex(w),y.shininess.value=N,E.parameters.opacity&&(y.opacity.value=
|
|
|
+E.parameters.opacity),p=new THREE.ShaderMaterial({fragmentShader:H.fragmentShader,vertexShader:H.vertexShader,uniforms:y,lights:!0,fog:!0})):p=new THREE[E.type](E.parameters);p.name=D;C.materials[D]=p}for(D in I.materials)if(E=I.materials[D],E.parameters.materials){G=[];for(r=0;r<E.parameters.materials.length;r++)G.push(C.materials[E.parameters.materials[r]]);C.materials[D].materials=G}e();C.cameras&&I.defaults.camera&&(C.currentCamera=C.cameras[I.defaults.camera]);C.fogs&&I.defaults.fog&&(C.scene.fog=
|
|
|
+C.fogs[I.defaults.fog]);s.callbackSync(C);n()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
|
|
|
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
|
|
|
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);
|
|
@@ -316,30 +316,30 @@ THREE.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object
|
|
|
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.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;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)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}this.dispatchEvent({type:"objectAdded",object:a});a.dispatchEvent({type:"addedToScene",scene:this});for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));this.dispatchEvent({type:"objectRemoved",object:a});a.dispatchEvent({type:"removedFromScene",scene:this});for(b=
|
|
|
-0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=J.length;d<e;d++){var f=J[d];Ua.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ga.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Ua.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=ga.setFromMatrixPosition(f.matrixWorld),h=b.dot(ga.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Ua.multiplyScalar(h)))))}}
|
|
|
-function c(a,b,c,d){s(b);t(c);u(d);p(a.getStyle());y.stroke();Ia.expandByScalar(2*b)}function d(a){v(a.getStyle());y.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);qa[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
+0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=P.length;d<e;d++){var f=P[d];Ua.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=ga.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(Ua.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=ga.setFromMatrixPosition(f.matrixWorld),h=b.dot(ga.subVectors(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(Ua.multiplyScalar(h)))))}}
|
|
|
+function c(a,b,c,d){s(b);u(c);t(d);p(a.getStyle());y.stroke();Ia.expandByScalar(2*b)}function d(a){v(a.getStyle());y.fill()}function e(a){f(a.target)}function f(a){var b=a.wrapS===THREE.RepeatWrapping,c=a.wrapT===THREE.RepeatWrapping,d=a.image,e=document.createElement("canvas");e.width=d.width;e.height=d.height;var f=e.getContext("2d");f.setTransform(1,0,0,-1,0,d.height);f.drawImage(d,0,0);qa[a.id]=y.createPattern(e,!0===b&&!0===c?"repeat":!0===b&&!1===c?"repeat-x":!1===b&&!0===c?"repeat-y":"no-repeat")}
|
|
|
function g(a,b,c,d,g,h,m,l,k,p,n,q,r){if(!(r instanceof THREE.DataTexture)){!1===r.hasEventListener("update",e)&&(void 0!==r.image&&0<r.image.width&&f(r),r.addEventListener("update",e));var s=qa[r.id];if(void 0!==s){v(s);var s=r.offset.x/r.repeat.x,u=r.offset.y/r.repeat.y,t=r.image.width*r.repeat.x;r=r.image.height*r.repeat.y;m=(m+s)*t;l=(l+u)*r;c-=a;d-=b;g-=a;h-=b;k=(k+s)*t-m;p=(p+u)*r-l;n=(n+s)*t-m;q=(q+u)*r-l;r=k*q-n*p;0!==r&&(s=1/r,r=(q*c-p*g)*s,p=(q*d-p*h)*s,c=(k*g-n*c)*s,d=(k*h-n*d)*s,a=a-r*
|
|
|
m-c*l,b=b-p*m-d*l,y.save(),y.transform(r,p,c,d,a,b),y.fill(),y.restore())}else v("rgba(0,0,0,1)"),y.fill()}}function h(a,b,c,d,e,f,g,h,m,l,k,p,n){var r,q;r=n.width-1;q=n.height-1;g*=r;h*=q;c-=a;d-=b;e-=a;f-=b;m=m*r-g;l=l*q-h;k=k*r-g;p=p*q-h;q=1/(m*p-k*l);r=(p*c-l*e)*q;l=(p*d-l*f)*q;c=(m*e-k*c)*q;d=(m*f-k*d)*q;a=a-r*g-c*h;b=b-l*g-d*h;y.save();y.transform(r,l,c,d,a,b);y.clip();y.drawImage(n,0,0);y.restore()}function l(a,b,c,d){Oa[0]=255*a.r|0;Oa[1]=255*a.g|0;Oa[2]=255*a.b|0;Oa[4]=255*b.r|0;Oa[5]=255*
|
|
|
-b.g|0;Oa[6]=255*b.b|0;Oa[8]=255*c.r|0;Oa[9]=255*c.g|0;Oa[10]=255*c.b|0;Oa[12]=255*d.r|0;Oa[13]=255*d.g|0;Oa[14]=255*d.b|0;m.putImageData(Va,0,0);Qa.drawImage(hb,0,0);return Ea}function k(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function n(a){D!==a&&(D=y.globalAlpha=a)}function q(a){F!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
-(y.globalCompositeOperation="darker"),F=a)}function s(a){V!==a&&(V=y.lineWidth=a)}function t(a){ia!==a&&(ia=y.lineCap=a)}function u(a){Y!==a&&(Y=y.lineJoin=a)}function p(a){S!==a&&(S=y.strokeStyle=a)}function v(a){Z!==a&&(Z=y.fillStyle=a)}function w(a,b){if(ja!==a||M!==b)y.setLineDash([a,b]),ja=a,M=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var r=THREE.Math.smoothstep;a=a||{};var x=this,z,G,J,H=new THREE.Projector,B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),A=B.width,K=
|
|
|
-B.height,C=Math.floor(A/2),Q=Math.floor(K/2),y=B.getContext("2d"),L=new THREE.Color(0),E=0,D=1,F=0,S=null,Z=null,V=null,ia=null,Y=null,ja=null,M=0,ka,P,U,O;new THREE.RenderableVertex;new THREE.RenderableVertex;var T,Ja,Na,ta,Fa,pa,ua=new THREE.Color,ea=new THREE.Color,za=new THREE.Color,wa=new THREE.Color,Ga=new THREE.Color,Ha=new THREE.Color,la=new THREE.Color,Ua=new THREE.Color,qa={},Pa,xa,Ka,Aa,ya,Sa,ma,Ba,$a,Ca,Da=new THREE.Box2,na=new THREE.Box2,Ia=new THREE.Box2,Wa=new THREE.Color,xb=new THREE.Color,
|
|
|
+b.g|0;Oa[6]=255*b.b|0;Oa[8]=255*c.r|0;Oa[9]=255*c.g|0;Oa[10]=255*c.b|0;Oa[12]=255*d.r|0;Oa[13]=255*d.g|0;Oa[14]=255*d.b|0;m.putImageData(Va,0,0);Qa.drawImage(hb,0,0);return Ea}function k(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function n(a){D!==a&&(D=y.globalAlpha=a)}function q(a){G!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&
|
|
|
+(y.globalCompositeOperation="darker"),G=a)}function s(a){V!==a&&(V=y.lineWidth=a)}function u(a){ia!==a&&(ia=y.lineCap=a)}function t(a){Y!==a&&(Y=y.lineJoin=a)}function p(a){T!==a&&(T=y.strokeStyle=a)}function v(a){Z!==a&&(Z=y.fillStyle=a)}function w(a,b){if(ja!==a||L!==b)y.setLineDash([a,b]),ja=a,L=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var r=THREE.Math.smoothstep;a=a||{};var x=this,z,F,P,B=new THREE.Projector,C=void 0!==a.canvas?a.canvas:document.createElement("canvas"),A=C.width,I=
|
|
|
+C.height,H=Math.floor(A/2),N=Math.floor(I/2),y=C.getContext("2d"),K=new THREE.Color(0),E=0,D=1,G=0,T=null,Z=null,V=null,ia=null,Y=null,ja=null,L=0,ka,Q,U,O;new THREE.RenderableVertex;new THREE.RenderableVertex;var S,Ja,Na,ta,Fa,pa,ua=new THREE.Color,ea=new THREE.Color,za=new THREE.Color,wa=new THREE.Color,Ga=new THREE.Color,Ha=new THREE.Color,la=new THREE.Color,Ua=new THREE.Color,qa={},Pa,xa,Ka,Aa,ya,Sa,ma,Ba,$a,Ca,Da=new THREE.Box2,na=new THREE.Box2,Ia=new THREE.Box2,Wa=new THREE.Color,xb=new THREE.Color,
|
|
|
Eb=new THREE.Color,ga=new THREE.Vector3,$=new THREE.Vector3,Ta=new THREE.Matrix3,hb,m,Va,Oa,Ea,Qa,ab=16;hb=document.createElement("canvas");hb.width=hb.height=2;m=hb.getContext("2d");m.fillStyle="rgba(0,0,0,1)";m.fillRect(0,0,2,2);Va=m.getImageData(0,0,2,2);Oa=Va.data;Ea=document.createElement("canvas");Ea.width=Ea.height=ab;Qa=Ea.getContext("2d");Qa.translate(-ab/2,-ab/2);Qa.scale(ab,ab);ab--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});
|
|
|
-this.domElement=B;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){A=a*this.devicePixelRatio;K=b*this.devicePixelRatio;C=Math.floor(A/2);Q=Math.floor(K/2);B.width=A;B.height=K;1!==this.devicePixelRatio&&!1!==c&&(B.style.width=a+"px",
|
|
|
-B.style.height=b+"px");Da.min.set(-C,-Q);Da.max.set(C,Q);na.min.set(-C,-Q);na.max.set(C,Q);D=1;F=0;Y=ia=V=Z=S=null};this.setClearColor=function(a,b){L.set(a);E=void 0!==b?b:1;na.min.set(-C,-Q);na.max.set(C,Q)};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(){y.setTransform(1,0,0,-1,C,Q);!1===na.empty()&&(na.intersect(Da),na.expandByScalar(2),
|
|
|
-1>E&&y.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<E&&(q(THREE.NormalBlending),n(1),v("rgba("+Math.floor(255*L.r)+","+Math.floor(255*L.g)+","+Math.floor(255*L.b)+","+E+")"),y.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.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,m){if(!1===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,C,Q);x.info.render.vertices=0;x.info.render.faces=0;z=H.projectScene(a,m,this.sortObjects,this.sortElements);G=z.elements;J=z.lights;ka=m;Ta.getNormalMatrix(m.matrixWorldInverse);Wa.setRGB(0,0,0);xb.setRGB(0,0,0);Eb.setRGB(0,0,0);for(var B=0,K=J.length;B<K;B++){var F=J[B],E=F.color;F instanceof THREE.AmbientLight?Wa.add(E):F instanceof THREE.DirectionalLight?xb.add(E):F instanceof THREE.PointLight&&Eb.add(E)}B=0;for(K=G.length;B<K;B++){var A=
|
|
|
-G[B],D=A.material;if(void 0!==D&&!1!==D.visible){Ia.makeEmpty();if(A instanceof THREE.RenderableSprite){P=A;P.x*=C;P.y*=Q;F=P;E=D;n(E.opacity);q(E.blending);var L=A.scale.x*C,A=A.scale.y*Q,D=0.5*Math.sqrt(L*L+A*A);Ia.min.set(F.x-D,F.y-D);Ia.max.set(F.x+D,F.y+D);if(E instanceof THREE.SpriteMaterial||E instanceof THREE.ParticleSystemMaterial){var M=E.map;if(null!==M){!1===M.hasEventListener("update",e)&&(void 0!==M.image&&0<M.image.width&&f(M),M.addEventListener("update",e));D=qa[M.id];void 0!==D?v(D):
|
|
|
-v("rgba( 0, 0, 0, 1 )");var S=M.image,D=S.width*M.offset.x,V=S.height*M.offset.y,Z=S.width*M.repeat.x,M=S.height*M.repeat.y,S=L/Z,Y=A/M;y.save();y.translate(F.x,F.y);0!==E.rotation&&y.rotate(E.rotation);y.translate(-L/2,-A/2);y.scale(S,Y);y.translate(-D,-V);y.fillRect(D,V,Z,M)}else v(E.color.getStyle()),y.save(),y.translate(F.x,F.y),0!==E.rotation&&y.rotate(E.rotation),y.scale(L,-A),y.fillRect(-0.5,-0.5,1,1);y.restore()}else E instanceof THREE.SpriteCanvasMaterial&&(p(E.color.getStyle()),v(E.color.getStyle()),
|
|
|
-y.save(),y.translate(F.x,F.y),0!==E.rotation&&y.rotate(E.rotation),y.scale(L,A),E.program(y),y.restore())}else if(A instanceof THREE.RenderableLine){if(P=A.v1,U=A.v2,P.positionScreen.x*=C,P.positionScreen.y*=Q,U.positionScreen.x*=C,U.positionScreen.y*=Q,Ia.setFromPoints([P.positionScreen,U.positionScreen]),!0===Da.isIntersectionBox(Ia))if(F=P,E=U,L=A,A=D,n(A.opacity),q(A.blending),y.beginPath(),y.moveTo(F.positionScreen.x,F.positionScreen.y),y.lineTo(E.positionScreen.x,E.positionScreen.y),A instanceof
|
|
|
-THREE.LineBasicMaterial){s(A.linewidth);t(A.linecap);u(A.linejoin);if(A.vertexColors!==THREE.VertexColors)p(A.color.getStyle());else if(D=L.vertexColors[0].getStyle(),L=L.vertexColors[1].getStyle(),D===L)p(D);else{try{var ga=y.createLinearGradient(F.positionScreen.x,F.positionScreen.y,E.positionScreen.x,E.positionScreen.y);ga.addColorStop(0,D);ga.addColorStop(1,L)}catch(ia){ga=D}p(ga)}y.stroke();Ia.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(s(A.linewidth),t(A.linecap),
|
|
|
-u(A.linejoin),p(A.color.getStyle()),w(A.dashSize,A.gapSize),y.stroke(),Ia.expandByScalar(2*A.linewidth),w(null,null))}else if(A instanceof THREE.RenderableFace){P=A.v1;U=A.v2;O=A.v3;if(-1>P.positionScreen.z||1<P.positionScreen.z)continue;if(-1>U.positionScreen.z||1<U.positionScreen.z)continue;if(-1>O.positionScreen.z||1<O.positionScreen.z)continue;P.positionScreen.x*=C;P.positionScreen.y*=Q;U.positionScreen.x*=C;U.positionScreen.y*=Q;O.positionScreen.x*=C;O.positionScreen.y*=Q;0<D.overdraw&&(k(P.positionScreen,
|
|
|
-U.positionScreen,D.overdraw),k(U.positionScreen,O.positionScreen,D.overdraw),k(O.positionScreen,P.positionScreen,D.overdraw));Ia.setFromPoints([P.positionScreen,U.positionScreen,O.positionScreen]);if(!0===Da.isIntersectionBox(Ia)){F=P;E=U;L=O;x.info.render.vertices+=3;x.info.render.faces++;n(D.opacity);q(D.blending);T=F.positionScreen.x;Ja=F.positionScreen.y;Na=E.positionScreen.x;ta=E.positionScreen.y;Fa=L.positionScreen.x;pa=L.positionScreen.y;var V=T,Z=Ja,M=Na,S=ta,Y=Fa,ja=pa;y.beginPath();y.moveTo(V,
|
|
|
-Z);y.lineTo(M,S);y.lineTo(Y,ja);y.closePath();(D instanceof THREE.MeshLambertMaterial||D instanceof THREE.MeshPhongMaterial)&&null===D.map?(Ha.copy(D.color),la.copy(D.emissive),D.vertexColors===THREE.FaceColors&&Ha.multiply(A.color),!1===D.wireframe&&D.shading===THREE.SmoothShading&&3===A.vertexNormalsLength?(ea.copy(Wa),za.copy(Wa),wa.copy(Wa),b(A.v1.positionWorld,A.vertexNormalsModel[0],ea),b(A.v2.positionWorld,A.vertexNormalsModel[1],za),b(A.v3.positionWorld,A.vertexNormalsModel[2],wa),ea.multiply(Ha).add(la),
|
|
|
-za.multiply(Ha).add(la),wa.multiply(Ha).add(la),Ga.addColors(za,wa).multiplyScalar(0.5),Ka=l(ea,za,wa,Ga),h(T,Ja,Na,ta,Fa,pa,0,0,1,0,0,1,Ka)):(ua.copy(Wa),b(A.centroidModel,A.normalModel,ua),ua.multiply(Ha).add(la),!0===D.wireframe?c(ua,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(ua))):D instanceof THREE.MeshBasicMaterial||D instanceof THREE.MeshLambertMaterial||D instanceof THREE.MeshPhongMaterial?null!==D.map?D.map.mapping instanceof THREE.UVMapping&&(Aa=A.uvs[0],g(T,Ja,Na,ta,
|
|
|
-Fa,pa,Aa[0].x,Aa[0].y,Aa[1].x,Aa[1].y,Aa[2].x,Aa[2].y,D.map)):null!==D.envMap?D.envMap.mapping instanceof THREE.SphericalReflectionMapping&&($.copy(A.vertexNormalsModel[0]).applyMatrix3(Ta),ya=0.5*$.x+0.5,Sa=0.5*$.y+0.5,$.copy(A.vertexNormalsModel[1]).applyMatrix3(Ta),ma=0.5*$.x+0.5,Ba=0.5*$.y+0.5,$.copy(A.vertexNormalsModel[2]).applyMatrix3(Ta),$a=0.5*$.x+0.5,Ca=0.5*$.y+0.5,g(T,Ja,Na,ta,Fa,pa,ya,Sa,ma,Ba,$a,Ca,D.envMap)):(ua.copy(D.color),D.vertexColors===THREE.FaceColors&&ua.multiply(A.color),!0===
|
|
|
-D.wireframe?c(ua,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(ua)):D instanceof THREE.MeshDepthMaterial?(Pa=ka.near,xa=ka.far,ea.r=ea.g=ea.b=1-r(F.positionScreen.z*F.positionScreen.w,Pa,xa),za.r=za.g=za.b=1-r(E.positionScreen.z*E.positionScreen.w,Pa,xa),wa.r=wa.g=wa.b=1-r(L.positionScreen.z*L.positionScreen.w,Pa,xa),Ga.addColors(za,wa).multiplyScalar(0.5),Ka=l(ea,za,wa,Ga),h(T,Ja,Na,ta,Fa,pa,0,0,1,0,0,1,Ka)):D instanceof THREE.MeshNormalMaterial&&(D.shading===THREE.FlatShading?($.copy(A.normalModel).applyMatrix3(Ta),
|
|
|
+this.domElement=C;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){A=a*this.devicePixelRatio;I=b*this.devicePixelRatio;H=Math.floor(A/2);N=Math.floor(I/2);C.width=A;C.height=I;1!==this.devicePixelRatio&&!1!==c&&(C.style.width=a+"px",
|
|
|
+C.style.height=b+"px");Da.min.set(-H,-N);Da.max.set(H,N);na.min.set(-H,-N);na.max.set(H,N);D=1;G=0;Y=ia=V=Z=T=null};this.setClearColor=function(a,b){K.set(a);E=void 0!==b?b:1;na.min.set(-H,-N);na.max.set(H,N)};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(){y.setTransform(1,0,0,-1,H,N);!1===na.empty()&&(na.intersect(Da),na.expandByScalar(2),
|
|
|
+1>E&&y.clearRect(na.min.x|0,na.min.y|0,na.max.x-na.min.x|0,na.max.y-na.min.y|0),0<E&&(q(THREE.NormalBlending),n(1),v("rgba("+Math.floor(255*K.r)+","+Math.floor(255*K.g)+","+Math.floor(255*K.b)+","+E+")"),y.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.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(a,m){if(!1===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{!0===this.autoClear&&this.clear();y.setTransform(1,0,0,-1,H,N);x.info.render.vertices=0;x.info.render.faces=0;z=B.projectScene(a,m,this.sortObjects,this.sortElements);F=z.elements;P=z.lights;ka=m;Ta.getNormalMatrix(m.matrixWorldInverse);Wa.setRGB(0,0,0);xb.setRGB(0,0,0);Eb.setRGB(0,0,0);for(var C=0,I=P.length;C<I;C++){var G=P[C],E=G.color;G instanceof THREE.AmbientLight?Wa.add(E):G instanceof THREE.DirectionalLight?xb.add(E):G instanceof THREE.PointLight&&Eb.add(E)}C=0;for(I=F.length;C<I;C++){var A=
|
|
|
+F[C],D=A.material;if(void 0!==D&&!1!==D.visible){Ia.makeEmpty();if(A instanceof THREE.RenderableSprite){Q=A;Q.x*=H;Q.y*=N;G=Q;E=D;n(E.opacity);q(E.blending);var K=A.scale.x*H,A=A.scale.y*N,D=0.5*Math.sqrt(K*K+A*A);Ia.min.set(G.x-D,G.y-D);Ia.max.set(G.x+D,G.y+D);if(E instanceof THREE.SpriteMaterial||E instanceof THREE.ParticleSystemMaterial){var L=E.map;if(null!==L){!1===L.hasEventListener("update",e)&&(void 0!==L.image&&0<L.image.width&&f(L),L.addEventListener("update",e));D=qa[L.id];void 0!==D?v(D):
|
|
|
+v("rgba( 0, 0, 0, 1 )");var T=L.image,D=T.width*L.offset.x,V=T.height*L.offset.y,Z=T.width*L.repeat.x,L=T.height*L.repeat.y,T=K/Z,Y=A/L;y.save();y.translate(G.x,G.y);0!==E.rotation&&y.rotate(E.rotation);y.translate(-K/2,-A/2);y.scale(T,Y);y.translate(-D,-V);y.fillRect(D,V,Z,L)}else v(E.color.getStyle()),y.save(),y.translate(G.x,G.y),0!==E.rotation&&y.rotate(E.rotation),y.scale(K,-A),y.fillRect(-0.5,-0.5,1,1);y.restore()}else E instanceof THREE.SpriteCanvasMaterial&&(p(E.color.getStyle()),v(E.color.getStyle()),
|
|
|
+y.save(),y.translate(G.x,G.y),0!==E.rotation&&y.rotate(E.rotation),y.scale(K,A),E.program(y),y.restore())}else if(A instanceof THREE.RenderableLine){if(Q=A.v1,U=A.v2,Q.positionScreen.x*=H,Q.positionScreen.y*=N,U.positionScreen.x*=H,U.positionScreen.y*=N,Ia.setFromPoints([Q.positionScreen,U.positionScreen]),!0===Da.isIntersectionBox(Ia))if(G=Q,E=U,K=A,A=D,n(A.opacity),q(A.blending),y.beginPath(),y.moveTo(G.positionScreen.x,G.positionScreen.y),y.lineTo(E.positionScreen.x,E.positionScreen.y),A instanceof
|
|
|
+THREE.LineBasicMaterial){s(A.linewidth);u(A.linecap);t(A.linejoin);if(A.vertexColors!==THREE.VertexColors)p(A.color.getStyle());else if(D=K.vertexColors[0].getStyle(),K=K.vertexColors[1].getStyle(),D===K)p(D);else{try{var ga=y.createLinearGradient(G.positionScreen.x,G.positionScreen.y,E.positionScreen.x,E.positionScreen.y);ga.addColorStop(0,D);ga.addColorStop(1,K)}catch(ia){ga=D}p(ga)}y.stroke();Ia.expandByScalar(2*A.linewidth)}else A instanceof THREE.LineDashedMaterial&&(s(A.linewidth),u(A.linecap),
|
|
|
+t(A.linejoin),p(A.color.getStyle()),w(A.dashSize,A.gapSize),y.stroke(),Ia.expandByScalar(2*A.linewidth),w(null,null))}else if(A instanceof THREE.RenderableFace){Q=A.v1;U=A.v2;O=A.v3;if(-1>Q.positionScreen.z||1<Q.positionScreen.z)continue;if(-1>U.positionScreen.z||1<U.positionScreen.z)continue;if(-1>O.positionScreen.z||1<O.positionScreen.z)continue;Q.positionScreen.x*=H;Q.positionScreen.y*=N;U.positionScreen.x*=H;U.positionScreen.y*=N;O.positionScreen.x*=H;O.positionScreen.y*=N;0<D.overdraw&&(k(Q.positionScreen,
|
|
|
+U.positionScreen,D.overdraw),k(U.positionScreen,O.positionScreen,D.overdraw),k(O.positionScreen,Q.positionScreen,D.overdraw));Ia.setFromPoints([Q.positionScreen,U.positionScreen,O.positionScreen]);if(!0===Da.isIntersectionBox(Ia)){G=Q;E=U;K=O;x.info.render.vertices+=3;x.info.render.faces++;n(D.opacity);q(D.blending);S=G.positionScreen.x;Ja=G.positionScreen.y;Na=E.positionScreen.x;ta=E.positionScreen.y;Fa=K.positionScreen.x;pa=K.positionScreen.y;var V=S,Z=Ja,L=Na,T=ta,Y=Fa,ja=pa;y.beginPath();y.moveTo(V,
|
|
|
+Z);y.lineTo(L,T);y.lineTo(Y,ja);y.closePath();(D instanceof THREE.MeshLambertMaterial||D instanceof THREE.MeshPhongMaterial)&&null===D.map?(Ha.copy(D.color),la.copy(D.emissive),D.vertexColors===THREE.FaceColors&&Ha.multiply(A.color),!1===D.wireframe&&D.shading===THREE.SmoothShading&&3===A.vertexNormalsLength?(ea.copy(Wa),za.copy(Wa),wa.copy(Wa),b(A.v1.positionWorld,A.vertexNormalsModel[0],ea),b(A.v2.positionWorld,A.vertexNormalsModel[1],za),b(A.v3.positionWorld,A.vertexNormalsModel[2],wa),ea.multiply(Ha).add(la),
|
|
|
+za.multiply(Ha).add(la),wa.multiply(Ha).add(la),Ga.addColors(za,wa).multiplyScalar(0.5),Ka=l(ea,za,wa,Ga),h(S,Ja,Na,ta,Fa,pa,0,0,1,0,0,1,Ka)):(ua.copy(Wa),b(A.centroidModel,A.normalModel,ua),ua.multiply(Ha).add(la),!0===D.wireframe?c(ua,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(ua))):D instanceof THREE.MeshBasicMaterial||D instanceof THREE.MeshLambertMaterial||D instanceof THREE.MeshPhongMaterial?null!==D.map?D.map.mapping instanceof THREE.UVMapping&&(Aa=A.uvs[0],g(S,Ja,Na,ta,
|
|
|
+Fa,pa,Aa[0].x,Aa[0].y,Aa[1].x,Aa[1].y,Aa[2].x,Aa[2].y,D.map)):null!==D.envMap?D.envMap.mapping instanceof THREE.SphericalReflectionMapping&&($.copy(A.vertexNormalsModel[0]).applyMatrix3(Ta),ya=0.5*$.x+0.5,Sa=0.5*$.y+0.5,$.copy(A.vertexNormalsModel[1]).applyMatrix3(Ta),ma=0.5*$.x+0.5,Ba=0.5*$.y+0.5,$.copy(A.vertexNormalsModel[2]).applyMatrix3(Ta),$a=0.5*$.x+0.5,Ca=0.5*$.y+0.5,g(S,Ja,Na,ta,Fa,pa,ya,Sa,ma,Ba,$a,Ca,D.envMap)):(ua.copy(D.color),D.vertexColors===THREE.FaceColors&&ua.multiply(A.color),!0===
|
|
|
+D.wireframe?c(ua,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(ua)):D instanceof THREE.MeshDepthMaterial?(Pa=ka.near,xa=ka.far,ea.r=ea.g=ea.b=1-r(G.positionScreen.z*G.positionScreen.w,Pa,xa),za.r=za.g=za.b=1-r(E.positionScreen.z*E.positionScreen.w,Pa,xa),wa.r=wa.g=wa.b=1-r(K.positionScreen.z*K.positionScreen.w,Pa,xa),Ga.addColors(za,wa).multiplyScalar(0.5),Ka=l(ea,za,wa,Ga),h(S,Ja,Na,ta,Fa,pa,0,0,1,0,0,1,Ka)):D instanceof THREE.MeshNormalMaterial&&(D.shading===THREE.FlatShading?($.copy(A.normalModel).applyMatrix3(Ta),
|
|
|
ua.setRGB($.x,$.y,$.z).multiplyScalar(0.5).addScalar(0.5),!0===D.wireframe?c(ua,D.wireframeLinewidth,D.wireframeLinecap,D.wireframeLinejoin):d(ua)):D.shading===THREE.SmoothShading&&($.copy(A.vertexNormalsModel[0]).applyMatrix3(Ta),ea.setRGB($.x,$.y,$.z).multiplyScalar(0.5).addScalar(0.5),$.copy(A.vertexNormalsModel[1]).applyMatrix3(Ta),za.setRGB($.x,$.y,$.z).multiplyScalar(0.5).addScalar(0.5),$.copy(A.vertexNormalsModel[2]).applyMatrix3(Ta),wa.setRGB($.x,$.y,$.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-Ga.addColors(za,wa).multiplyScalar(0.5),Ka=l(ea,za,wa,Ga),h(T,Ja,Na,ta,Fa,pa,0,0,1,0,0,1,Ka)))}}na.union(Ia)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
+Ga.addColors(za,wa).multiplyScalar(0.5),Ka=l(ea,za,wa,Ga),h(S,Ja,Na,ta,Fa,pa,0,0,1,0,0,1,Ka)))}}na.union(Ia)}}y.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
|
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",
|
|
@@ -390,9 +390,9 @@ function c(a,b){var c=b.geometry,g=a.faces3,h=3*g.length,l=1*g.length,k=3*g.leng
|
|
|
(a.__webglCustomAttributesList=[]);for(var q in g.attributes){var l=g.attributes[q],k={},s;for(s in l)k[s]=l[s];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(h*c),k.buffer=m.createBuffer(),k.buffer.belongsToAttribute=q,l.needsUpdate=!0,k.__original=l;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 g(a,b,c,d){var e,f,g,l;for(f in b)g=b[f],e=c[f],0<=g&&(e?(l=e.itemSize,m.bindBuffer(m.ARRAY_BUFFER,e.buffer),h(g),m.vertexAttribPointer(g,
|
|
|
l,m.FLOAT,!1,0,d*l*4)):a.defaultAttributeValues&&(2===a.defaultAttributeValues[f].length?m.vertexAttrib2fv(g,a.defaultAttributeValues[f]):3===a.defaultAttributeValues[f].length&&m.vertexAttrib3fv(g,a.defaultAttributeValues[f])))}function h(a){0===Ia[a]&&(m.enableVertexAttribArray(a),Ia[a]=1)}function l(){for(var a in Ia)1===Ia[a]&&(m.disableVertexAttribArray(a),Ia[a]=0)}function k(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b){return b[0]-a[0]}function q(a,b,c){if(a.length)for(var d=0,e=
|
|
|
-a.length;d<e;d++)ua=Na=null,Fa=pa=Ga=wa=xa=Pa=Ha=-1,Ta=!0,a[d].render(b,c,Da,na),ua=Na=null,Fa=pa=Ga=wa=xa=Pa=Ha=-1,Ta=!0}function s(a,b,c,d,e,f,g,h){var m,l,k,p;b?(l=a.length-1,p=b=-1):(l=0,b=a.length,p=1);for(var n=l;n!==b;n+=p)if(m=a[n],m.render){l=m.object;k=m.buffer;if(h)m=h;else{m=m[c];if(!m)continue;g&&O.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst);O.setDepthTest(m.depthTest);O.setDepthWrite(m.depthWrite);K(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}O.setMaterialFaces(m);
|
|
|
-k instanceof THREE.BufferGeometry?O.renderBufferDirect(d,e,f,m,k,l):k instanceof THREE.Geometry2?O.renderBufferGeometry2(d,e,f,m,k,l):O.renderBuffer(d,e,f,m,k,l)}}function t(a,b,c,d,e,f,g){for(var h,m,l=0,k=a.length;l<k;l++)if(h=a[l],m=h.object,m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);K(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,
|
|
|
-d,e,h,m)}}function u(a,d){var e,f,g,h;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Ob)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var l,k;for(l in f.attributes)k="index"===l?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,h=f.attributes[l],h.buffer=m.createBuffer(),m.bindBuffer(k,h.buffer),m.bufferData(k,
|
|
|
+a.length;d<e;d++)ua=Na=null,Fa=pa=Ga=wa=xa=Pa=Ha=-1,Ta=!0,a[d].render(b,c,Da,na),ua=Na=null,Fa=pa=Ga=wa=xa=Pa=Ha=-1,Ta=!0}function s(a,b,c,d,e,f,g,h){var m,l,k,p;b?(l=a.length-1,p=b=-1):(l=0,b=a.length,p=1);for(var n=l;n!==b;n+=p)if(m=a[n],m.render){l=m.object;k=m.buffer;if(h)m=h;else{m=m[c];if(!m)continue;g&&O.setBlending(m.blending,m.blendEquation,m.blendSrc,m.blendDst);O.setDepthTest(m.depthTest);O.setDepthWrite(m.depthWrite);I(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}O.setMaterialFaces(m);
|
|
|
+k instanceof THREE.BufferGeometry?O.renderBufferDirect(d,e,f,m,k,l):k instanceof THREE.Geometry2?O.renderBufferGeometry2(d,e,f,m,k,l):O.renderBuffer(d,e,f,m,k,l)}}function u(a,b,c,d,e,f,g){for(var h,m,l=0,k=a.length;l<k;l++)if(h=a[l],m=h.object,m.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);I(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,
|
|
|
+d,e,h,m)}}function t(a,d){var e,f,g,h;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Ob)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var l,k;for(l in f.attributes)k="index"===l?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER,h=f.attributes[l],h.buffer=m.createBuffer(),m.bindBuffer(k,h.buffer),m.bufferData(k,
|
|
|
h.array,m.STATIC_DRAW)}else if(f instanceof THREE.Geometry2){h={};l=["vertices","normals","uvs"];for(k in l){var n=f[l[k]],r=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,r);m.bufferData(m.ARRAY_BUFFER,n,m.STATIC_DRAW);h[l[k]]=r}V[f.id]=h}else if(a instanceof THREE.Mesh){g=a.material;if(void 0===f.geometryGroups){k=f;var q,s,u;l={};var n=k.morphTargets.length,r=k.morphNormals.length,t=g instanceof THREE.MeshFaceMaterial;k.geometryGroups={};g=0;for(q=k.faces.length;g<q;g++)s=k.faces[g],s=t?s.materialIndex:
|
|
|
0,void 0===l[s]&&(l[s]={hash:s,counter:0}),u=l[s].hash+"_"+l[s].counter,void 0===k.geometryGroups[u]&&(k.geometryGroups[u]={faces3:[],materialIndex:s,vertices:0,numMorphTargets:n,numMorphNormals:r}),65535<k.geometryGroups[u].vertices+3&&(l[s].counter+=1,u=l[s].hash+"_"+l[s].counter,void 0===k.geometryGroups[u]&&(k.geometryGroups[u]={faces3:[],materialIndex:s,vertices:0,numMorphTargets:n,numMorphNormals:r})),k.geometryGroups[u].faces3.push(g),k.geometryGroups[u].vertices+=3;k.geometryGroupsList=[];
|
|
|
for(h in k.geometryGroups)k.geometryGroups[h].id=ea++,k.geometryGroupsList.push(k.geometryGroups[h])}for(e in f.geometryGroups)if(h=f.geometryGroups[e],!h.__webglVertexBuffer){k=h;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();k.__webglTangentBuffer=m.createBuffer();k.__webglColorBuffer=m.createBuffer();k.__webglUVBuffer=m.createBuffer();k.__webglUV2Buffer=m.createBuffer();k.__webglSkinIndicesBuffer=m.createBuffer();k.__webglSkinWeightsBuffer=m.createBuffer();k.__webglFaceBuffer=
|
|
@@ -401,62 +401,62 @@ m.createBuffer();k.__webglLineBuffer=m.createBuffer();n=l=void 0;if(k.numMorphTa
|
|
|
!f.__webglVertexBuffer&&(h=f,h.__webglVertexBuffer=m.createBuffer(),h.__webglColorBuffer=m.createBuffer(),O.info.memory.geometries++,h=f,k=h.vertices.length,h.__vertexArray=new Float32Array(3*k),h.__colorArray=new Float32Array(3*k),h.__sortArray=[],h.__webglParticleCount=k,b(h,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)p(d.__webglObjects,f,a);else if(f instanceof THREE.Geometry2)p(d.__webglObjects,
|
|
|
f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)h=f.geometryGroups[e],p(d.__webglObjects,h,a)}else a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,p(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function p(a,
|
|
|
b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function w(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function r(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?x(b.__webglObjects,a):a instanceof THREE.Sprite?z(b.__webglSprites,a):a instanceof THREE.LensFlare?z(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&
|
|
|
-x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function G(a,b,c,d,e){za=0;d.needsUpdate&&(d.program&&Ib(d),O.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,l=d.uniforms;g!==Na&&(m.useProgram(g),Na=g,f=!0);
|
|
|
-d.id!==Fa&&(Fa=d.id,f=!0);if(f||a!==ua)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ua&&(ua=a);if(d.skinning)if(Cb&&e.useVertexTexture){if(null!==h.boneTexture){var k=J();m.uniform1i(h.boneTexture,k);O.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);
|
|
|
-if(f){c&&d.fog&&(l.fogColor.value=c.color,c instanceof THREE.Fog?(l.fogNear.value=c.near,l.fogFar.value=c.far):c instanceof THREE.FogExp2&&(l.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ta){var p,n=k=0,r=0,q,s,u,t=hb,v=t.directional.colors,w=t.directional.positions,x=t.point.colors,z=t.point.positions,A=t.point.distances,G=t.spot.colors,E=t.spot.positions,K=t.spot.distances,C=t.spot.directions,L=t.spot.anglesCos,M=t.spot.exponents,
|
|
|
-S=t.hemi.skyColors,Q=t.hemi.groundColors,R=t.hemi.positions,V=0,Z=0,U=0,P=0,T=0,ta=0,Ja=0,pa=0,Y=p=0;c=u=Y=0;for(f=b.length;c<f;c++)if(p=b[c],!p.onlyShadow)if(q=p.color,s=p.intensity,u=p.distance,p instanceof THREE.AmbientLight)p.visible&&(O.gammaInput?(k+=q.r*q.r,n+=q.g*q.g,r+=q.b*q.b):(k+=q.r,n+=q.g,r+=q.b));else if(p instanceof THREE.DirectionalLight){if(T+=1,p.visible&&($.setFromMatrixPosition(p.matrixWorld),ga.setFromMatrixPosition(p.target.matrixWorld),$.sub(ga),$.normalize(),0!==$.x||0!==$.y||
|
|
|
-0!==$.z))p=3*V,w[p]=$.x,w[p+1]=$.y,w[p+2]=$.z,O.gammaInput?H(v,p,q,s*s):B(v,p,q,s),V+=1}else p instanceof THREE.PointLight?(ta+=1,p.visible&&(Y=3*Z,O.gammaInput?H(x,Y,q,s*s):B(x,Y,q,s),ga.setFromMatrixPosition(p.matrixWorld),z[Y]=ga.x,z[Y+1]=ga.y,z[Y+2]=ga.z,A[Z]=u,Z+=1)):p instanceof THREE.SpotLight?(Ja+=1,p.visible&&(Y=3*U,O.gammaInput?H(G,Y,q,s*s):B(G,Y,q,s),ga.setFromMatrixPosition(p.matrixWorld),E[Y]=ga.x,E[Y+1]=ga.y,E[Y+2]=ga.z,K[U]=u,$.copy(ga),ga.setFromMatrixPosition(p.target.matrixWorld),
|
|
|
-$.sub(ga),$.normalize(),C[Y]=$.x,C[Y+1]=$.y,C[Y+2]=$.z,L[U]=Math.cos(p.angle),M[U]=p.exponent,U+=1)):p instanceof THREE.HemisphereLight&&(pa+=1,p.visible&&($.setFromMatrixPosition(p.matrixWorld),$.normalize(),0!==$.x||0!==$.y||0!==$.z))&&(u=3*P,R[u]=$.x,R[u+1]=$.y,R[u+2]=$.z,q=p.color,p=p.groundColor,O.gammaInput?(s*=s,H(S,u,q,s),H(Q,u,p,s)):(B(S,u,q,s),B(Q,u,p,s)),P+=1);c=3*V;for(f=Math.max(v.length,3*T);c<f;c++)v[c]=0;c=3*Z;for(f=Math.max(x.length,3*ta);c<f;c++)x[c]=0;c=3*U;for(f=Math.max(G.length,
|
|
|
-3*Ja);c<f;c++)G[c]=0;c=3*P;for(f=Math.max(S.length,3*pa);c<f;c++)S[c]=0;c=3*P;for(f=Math.max(Q.length,3*pa);c<f;c++)Q[c]=0;t.directional.length=V;t.point.length=Z;t.spot.length=U;t.hemi.length=P;t.ambient[0]=k;t.ambient[1]=n;t.ambient[2]=r;Ta=!1}c=hb;l.ambientLightColor.value=c.ambient;l.directionalLightColor.value=c.directional.colors;l.directionalLightDirection.value=c.directional.positions;l.pointLightColor.value=c.point.colors;l.pointLightPosition.value=c.point.positions;l.pointLightDistance.value=
|
|
|
+x(b.__webglObjectsImmediate,a);delete a.__webglActive}function x(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function F(a,b,c,d,e){za=0;d.needsUpdate&&(d.program&&Ib(d),O.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,l=d.uniforms;g!==Na&&(m.useProgram(g),Na=g,f=!0);
|
|
|
+d.id!==Fa&&(Fa=d.id,f=!0);if(f||a!==ua)m.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ua&&(ua=a);if(d.skinning)if(Cb&&e.useVertexTexture){if(null!==h.boneTexture){var k=P();m.uniform1i(h.boneTexture,k);O.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&m.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&m.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&m.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);
|
|
|
+if(f){c&&d.fog&&(l.fogColor.value=c.color,c instanceof THREE.Fog?(l.fogNear.value=c.near,l.fogFar.value=c.far):c instanceof THREE.FogExp2&&(l.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ta){var p,n=k=0,r=0,q,s,u,t=hb,v=t.directional.colors,w=t.directional.positions,x=t.point.colors,z=t.point.positions,A=t.point.distances,F=t.spot.colors,E=t.spot.positions,I=t.spot.distances,H=t.spot.directions,K=t.spot.anglesCos,L=t.spot.exponents,
|
|
|
+N=t.hemi.skyColors,T=t.hemi.groundColors,R=t.hemi.positions,V=0,Z=0,U=0,Q=0,S=0,ta=0,Ja=0,pa=0,Y=p=0;c=u=Y=0;for(f=b.length;c<f;c++)if(p=b[c],!p.onlyShadow)if(q=p.color,s=p.intensity,u=p.distance,p instanceof THREE.AmbientLight)p.visible&&(O.gammaInput?(k+=q.r*q.r,n+=q.g*q.g,r+=q.b*q.b):(k+=q.r,n+=q.g,r+=q.b));else if(p instanceof THREE.DirectionalLight){if(S+=1,p.visible&&($.setFromMatrixPosition(p.matrixWorld),ga.setFromMatrixPosition(p.target.matrixWorld),$.sub(ga),$.normalize(),0!==$.x||0!==$.y||
|
|
|
+0!==$.z))p=3*V,w[p]=$.x,w[p+1]=$.y,w[p+2]=$.z,O.gammaInput?B(v,p,q,s*s):C(v,p,q,s),V+=1}else p instanceof THREE.PointLight?(ta+=1,p.visible&&(Y=3*Z,O.gammaInput?B(x,Y,q,s*s):C(x,Y,q,s),ga.setFromMatrixPosition(p.matrixWorld),z[Y]=ga.x,z[Y+1]=ga.y,z[Y+2]=ga.z,A[Z]=u,Z+=1)):p instanceof THREE.SpotLight?(Ja+=1,p.visible&&(Y=3*U,O.gammaInput?B(F,Y,q,s*s):C(F,Y,q,s),ga.setFromMatrixPosition(p.matrixWorld),E[Y]=ga.x,E[Y+1]=ga.y,E[Y+2]=ga.z,I[U]=u,$.copy(ga),ga.setFromMatrixPosition(p.target.matrixWorld),
|
|
|
+$.sub(ga),$.normalize(),H[Y]=$.x,H[Y+1]=$.y,H[Y+2]=$.z,K[U]=Math.cos(p.angle),L[U]=p.exponent,U+=1)):p instanceof THREE.HemisphereLight&&(pa+=1,p.visible&&($.setFromMatrixPosition(p.matrixWorld),$.normalize(),0!==$.x||0!==$.y||0!==$.z))&&(u=3*Q,R[u]=$.x,R[u+1]=$.y,R[u+2]=$.z,q=p.color,p=p.groundColor,O.gammaInput?(s*=s,B(N,u,q,s),B(T,u,p,s)):(C(N,u,q,s),C(T,u,p,s)),Q+=1);c=3*V;for(f=Math.max(v.length,3*S);c<f;c++)v[c]=0;c=3*Z;for(f=Math.max(x.length,3*ta);c<f;c++)x[c]=0;c=3*U;for(f=Math.max(F.length,
|
|
|
+3*Ja);c<f;c++)F[c]=0;c=3*Q;for(f=Math.max(N.length,3*pa);c<f;c++)N[c]=0;c=3*Q;for(f=Math.max(T.length,3*pa);c<f;c++)T[c]=0;t.directional.length=V;t.point.length=Z;t.spot.length=U;t.hemi.length=Q;t.ambient[0]=k;t.ambient[1]=n;t.ambient[2]=r;Ta=!1}c=hb;l.ambientLightColor.value=c.ambient;l.directionalLightColor.value=c.directional.colors;l.directionalLightDirection.value=c.directional.positions;l.pointLightColor.value=c.point.colors;l.pointLightPosition.value=c.point.positions;l.pointLightDistance.value=
|
|
|
c.point.distances;l.spotLightColor.value=c.spot.colors;l.spotLightPosition.value=c.spot.positions;l.spotLightDistance.value=c.spot.distances;l.spotLightDirection.value=c.spot.directions;l.spotLightAngleCos.value=c.spot.anglesCos;l.spotLightExponent.value=c.spot.exponents;l.hemisphereLightSkyColor.value=c.hemi.skyColors;l.hemisphereLightGroundColor.value=c.hemi.groundColors;l.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
d instanceof THREE.MeshPhongMaterial){l.opacity.value=d.opacity;O.gammaInput?l.diffuse.value.copyGammaToLinear(d.color):l.diffuse.value=d.color;l.map.value=d.map;l.lightMap.value=d.lightMap;l.specularMap.value=d.specularMap;d.bumpMap&&(l.bumpMap.value=d.bumpMap,l.bumpScale.value=d.bumpScale);d.normalMap&&(l.normalMap.value=d.normalMap,l.normalScale.value.copy(d.normalScale));var ea;d.map?ea=d.map:d.specularMap?ea=d.specularMap:d.normalMap?ea=d.normalMap:d.bumpMap&&(ea=d.bumpMap);void 0!==ea&&(c=ea.offset,
|
|
|
ea=ea.repeat,l.offsetRepeat.value.set(c.x,c.y,ea.x,ea.y));l.envMap.value=d.envMap;l.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;l.reflectivity.value=d.reflectivity;l.refractionRatio.value=d.refractionRatio;l.combine.value=d.combine;l.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(l.diffuse.value=d.color,l.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(l.diffuse.value=d.color,l.opacity.value=
|
|
|
-d.opacity,l.dashSize.value=d.dashSize,l.totalSize.value=d.dashSize+d.gapSize,l.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(l.psColor.value=d.color,l.opacity.value=d.opacity,l.size.value=d.size,l.scale.value=F.height/2,l.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(l.shininess.value=d.shininess,O.gammaInput?(l.ambient.value.copyGammaToLinear(d.ambient),l.emissive.value.copyGammaToLinear(d.emissive),l.specular.value.copyGammaToLinear(d.specular)):(l.ambient.value=d.ambient,
|
|
|
+d.opacity,l.dashSize.value=d.dashSize,l.totalSize.value=d.dashSize+d.gapSize,l.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?(l.psColor.value=d.color,l.opacity.value=d.opacity,l.size.value=d.size,l.scale.value=G.height/2,l.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(l.shininess.value=d.shininess,O.gammaInput?(l.ambient.value.copyGammaToLinear(d.ambient),l.emissive.value.copyGammaToLinear(d.emissive),l.specular.value.copyGammaToLinear(d.specular)):(l.ambient.value=d.ambient,
|
|
|
l.emissive.value=d.emissive,l.specular.value=d.specular),d.wrapAround&&l.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(O.gammaInput?(l.ambient.value.copyGammaToLinear(d.ambient),l.emissive.value.copyGammaToLinear(d.emissive)):(l.ambient.value=d.ambient,l.emissive.value=d.emissive),d.wrapAround&&l.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(l.mNear.value=a.near,l.mFar.value=a.far,l.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(l.opacity.value=
|
|
|
d.opacity);if(e.receiveShadow&&!d._shadowPass&&l.shadowMatrix)for(c=ea=0,f=b.length;c<f;c++)k=b[c],k.castShadow&&(k instanceof THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade)&&(l.shadowMap.value[ea]=k.shadowMap,l.shadowMapSize.value[ea]=k.shadowMapSize,l.shadowMatrix.value[ea]=k.shadowMatrix,l.shadowDarkness.value[ea]=k.shadowDarkness,l.shadowBias.value[ea]=k.shadowBias,ea++);b=d.uniformsList;l=0;for(ea=b.length;l<ea;l++)if(f=g.uniforms[b[l][1]])if(c=b[l][0],n=c.type,k=c.value,
|
|
|
"i"===n)m.uniform1i(f,k);else if("f"===n)m.uniform1f(f,k);else if("v2"===n)m.uniform2f(f,k.x,k.y);else if("v3"===n)m.uniform3f(f,k.x,k.y,k.z);else if("v4"===n)m.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===n)m.uniform3f(f,k.r,k.g,k.b);else if("iv1"===n)m.uniform1iv(f,k);else if("iv"===n)m.uniform3iv(f,k);else if("fv1"===n)m.uniform1fv(f,k);else if("fv"===n)m.uniform3fv(f,k);else if("v2v"===n){void 0===c._array&&(c._array=new Float32Array(2*k.length));n=0;for(r=k.length;n<r;n++)t=2*n,c._array[t]=k[n].x,
|
|
|
c._array[t+1]=k[n].y;m.uniform2fv(f,c._array)}else if("v3v"===n){void 0===c._array&&(c._array=new Float32Array(3*k.length));n=0;for(r=k.length;n<r;n++)t=3*n,c._array[t]=k[n].x,c._array[t+1]=k[n].y,c._array[t+2]=k[n].z;m.uniform3fv(f,c._array)}else if("v4v"===n){void 0===c._array&&(c._array=new Float32Array(4*k.length));n=0;for(r=k.length;n<r;n++)t=4*n,c._array[t]=k[n].x,c._array[t+1]=k[n].y,c._array[t+2]=k[n].z,c._array[t+3]=k[n].w;m.uniform4fv(f,c._array)}else if("m4"===n)void 0===c._array&&(c._array=
|
|
|
-new Float32Array(16)),k.flattenToArray(c._array),m.uniformMatrix4fv(f,!1,c._array);else if("m4v"===n){void 0===c._array&&(c._array=new Float32Array(16*k.length));n=0;for(r=k.length;n<r;n++)k[n].flattenToArrayOffset(c._array,16*n);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===n){if(t=k,k=J(),m.uniform1i(f,k),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=m.createTexture(),
|
|
|
+new Float32Array(16)),k.flattenToArray(c._array),m.uniformMatrix4fv(f,!1,c._array);else if("m4v"===n){void 0===c._array&&(c._array=new Float32Array(16*k.length));n=0;for(r=k.length;n<r;n++)k[n].flattenToArrayOffset(c._array,16*n);m.uniformMatrix4fv(f,!1,c._array)}else if("t"===n){if(t=k,k=P(),m.uniform1i(f,k),t)if(t.image instanceof Array&&6===t.image.length){if(c=t,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=m.createTexture(),
|
|
|
O.info.memory.textures++);m.activeTexture(m.TEXTURE0+f);m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(n=0;6>n;n++)O.autoScaleCubemaps&&!f?(r=k,t=n,v=c.image[n],x=cc,v.width<=x&&v.height<=x||(z=Math.max(v.width,v.height),w=Math.floor(v.width*x/z),x=Math.floor(v.height*x/z),z=document.createElement("canvas"),z.width=w,z.height=x,z.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,w,x),v=z),
|
|
|
r[t]=v):k[n]=c.image[n];n=k[0];r=THREE.Math.isPowerOfTwo(n.width)&&THREE.Math.isPowerOfTwo(n.height);t=D(c.format);v=D(c.type);y(m.TEXTURE_CUBE_MAP,c,r);for(n=0;6>n;n++)if(f)for(x=k[n].mipmaps,z=0,A=x.length;z<A;z++)w=x[z],c.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,z,t,w.width,w.height,0,w.data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,z,t,w.width,w.height,0,t,v,w.data);else m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t,t,v,k[n]);c.generateMipmaps&&r&&
|
|
|
-m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+k),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):O.setTexture(t,k)}else if("tv"===n){void 0===c._array&&(c._array=[]);n=0;for(r=c.value.length;n<r;n++)c._array[n]=J();m.uniform1iv(f,c._array);n=0;for(r=c.value.length;n<r;n++)t=c.value[n],k=
|
|
|
+m.generateMipmap(m.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else m.activeTexture(m.TEXTURE0+f),m.bindTexture(m.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,m.activeTexture(m.TEXTURE0+k),m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture)):O.setTexture(t,k)}else if("tv"===n){void 0===c._array&&(c._array=[]);n=0;for(r=c.value.length;n<r;n++)c._array[n]=P();m.uniform1iv(f,c._array);n=0;for(r=c.value.length;n<r;n++)t=c.value[n],k=
|
|
|
c._array[n],t&&O.setTexture(t,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+n);(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&(ga.setFromMatrixPosition(a.matrixWorld),m.uniform3f(h.cameraPosition,ga.x,ga.y,ga.z));(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&m.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}m.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
-!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function J(){var a=za;a>=ab&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ab);za+=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 B(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==Sa&&(m.lineWidth(a),
|
|
|
-Sa=a)}function K(a,b,c){Ka!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),Ka=a);!a||Aa===b&&ya===c||(m.polygonOffset(b,c),Aa=b,ya=c)}function C(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function Q(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),
|
|
|
-console.error(C(b)),null)}function y(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,D(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,D(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,D(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,D(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,E(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,E(b.minFilter)));Ea&&b.type!==THREE.FloatType&&(1<
|
|
|
-b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,Ea.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=b.anisotropy)}function L(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
|
|
|
+!1,e._modelViewMatrix.elements);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&m.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function P(){var a=za;a>=ab&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ab);za+=1;return a}function B(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 C(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==Sa&&(m.lineWidth(a),
|
|
|
+Sa=a)}function I(a,b,c){Ka!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),Ka=a);!a||Aa===b&&ya===c||(m.polygonOffset(b,c),Aa=b,ya=c)}function H(a){a=a.split("\n");for(var b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function N(a,b){var c;"fragment"===a?c=m.createShader(m.FRAGMENT_SHADER):"vertex"===a&&(c=m.createShader(m.VERTEX_SHADER));m.shaderSource(c,b);m.compileShader(c);return m.getShaderParameter(c,m.COMPILE_STATUS)?c:(console.error(m.getShaderInfoLog(c)),
|
|
|
+console.error(H(b)),null)}function y(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,D(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,D(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,D(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,D(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,E(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,E(b.minFilter)));Ea&&b.type!==THREE.FloatType&&(1<
|
|
|
+b.anisotropy||b.__oldAnisotropy)&&(m.texParameterf(a,Ea.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=b.anisotropy)}function K(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,
|
|
|
m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function E(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function D(a){if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;
|
|
|
if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;
|
|
|
if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;if(a===THREE.AlphaFormat)return m.ALPHA;if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;
|
|
|
if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;
|
|
|
if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;if(void 0!==Qa){if(a===THREE.RGB_S3TC_DXT1_Format)return Qa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Qa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Qa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Qa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",
|
|
|
-THREE.REVISION);a=a||{};var F=void 0!==a.canvas?a.canvas:document.createElement("canvas"),S=void 0!==a.context?a.context:null,Z=void 0!==a.precision?a.precision:"highp",V={},ia=void 0!==a.alpha?a.alpha:!1,Y=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ja=void 0!==a.antialias?a.antialias:!1,M=void 0!==a.stencil?a.stencil:!0,ka=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,P=new THREE.Color(0),U=0;this.domElement=F;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?
|
|
|
+THREE.REVISION);a=a||{};var G=void 0!==a.canvas?a.canvas:document.createElement("canvas"),T=void 0!==a.context?a.context:null,Z=void 0!==a.precision?a.precision:"highp",V={},ia=void 0!==a.alpha?a.alpha:!1,Y=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ja=void 0!==a.antialias?a.antialias:!1,L=void 0!==a.stencil?a.stencil:!0,ka=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Q=new THREE.Color(0),U=0;this.domElement=G;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?
|
|
|
a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=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 O=this,T=[],Ja=0,Na=null,ta=null,Fa=-1,pa=null,ua=null,ea=0,za=0,wa=-1,Ga=-1,Ha=-1,la=-1,Ua=-1,qa=-1,Pa=-1,xa=-1,Ka=null,Aa=null,ya=null,Sa=null,ma=0,Ba=0,$a=F.width,Ca=F.height,Da=0,na=0,Ia=new Uint8Array(16),Wa=new THREE.Frustum,xb=new THREE.Matrix4,Eb=new THREE.Matrix4,ga=new THREE.Vector3,$=new THREE.Vector3,Ta=!0,hb={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:[]}},m,Va,Oa,Ea,Qa;(function(){try{var a={alpha:ia,premultipliedAlpha:Y,antialias:ja,stencil:M,preserveDrawingBuffer:ka};m=S||F.getContext("webgl",a)||F.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}Va=m.getExtension("OES_texture_float");
|
|
|
+this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var O=this,S=[],Ja=0,Na=null,ta=null,Fa=-1,pa=null,ua=null,ea=0,za=0,wa=-1,Ga=-1,Ha=-1,la=-1,Ua=-1,qa=-1,Pa=-1,xa=-1,Ka=null,Aa=null,ya=null,Sa=null,ma=0,Ba=0,$a=G.width,Ca=G.height,Da=0,na=0,Ia=new Uint8Array(16),Wa=new THREE.Frustum,xb=new THREE.Matrix4,Eb=new THREE.Matrix4,ga=new THREE.Vector3,$=new THREE.Vector3,Ta=!0,hb={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:[]}},m,Va,Oa,Ea,Qa;(function(){try{var a={alpha:ia,premultipliedAlpha:Y,antialias:ja,stencil:L,preserveDrawingBuffer:ka};m=T||G.getContext("webgl",a)||G.getContext("experimental-webgl",a);if(null===m)throw"Error creating WebGL context.";}catch(b){console.error(b)}Va=m.getExtension("OES_texture_float");
|
|
|
m.getExtension("OES_texture_float_linear");Oa=m.getExtension("OES_standard_derivatives");Ea=m.getExtension("EXT_texture_filter_anisotropic")||m.getExtension("MOZ_EXT_texture_filter_anisotropic")||m.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Qa=m.getExtension("WEBGL_compressed_texture_s3tc")||m.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||m.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Va||console.log("THREE.WebGLRenderer: Float textures not supported.");Oa||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");
|
|
|
Ea||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Qa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})})();m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,
|
|
|
-m.ONE_MINUS_SRC_ALPHA);m.viewport(ma,Ba,$a,Ca);m.clearColor(P.r,P.g,P.b,U);this.context=m;var ab=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),bc=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var cc=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Nb=Ea?m.getParameter(Ea.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,wb=0<bc,Cb=wb&&Va;Qa&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var dc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),ec=m.getShaderPrecisionFormat(m.VERTEX_SHADER,
|
|
|
+m.ONE_MINUS_SRC_ALPHA);m.viewport(ma,Ba,$a,Ca);m.clearColor(Q.r,Q.g,Q.b,U);this.context=m;var ab=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),bc=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS);m.getParameter(m.MAX_TEXTURE_SIZE);var cc=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Nb=Ea?m.getParameter(Ea.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,wb=0<bc,Cb=wb&&Va;Qa&&m.getParameter(m.COMPRESSED_TEXTURE_FORMATS);var dc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),ec=m.getShaderPrecisionFormat(m.VERTEX_SHADER,
|
|
|
m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_FLOAT);var fc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),xc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_FLOAT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_INT);m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.LOW_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,
|
|
|
m.MEDIUM_INT);m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.LOW_INT);var yc=0<dc.precision&&0<fc.precision,Hb=0<ec.precision&&0<xc.precision;"highp"!==Z||yc||(Hb?(Z="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(Z="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"!==Z||Hb||(Z="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return m};this.supportsVertexTextures=function(){return wb};
|
|
|
-this.supportsFloatTextures=function(){return Va};this.supportsStandardDerivatives=function(){return Oa};this.supportsCompressedTextureS3TC=function(){return Qa};this.getMaxAnisotropy=function(){return Nb};this.getPrecision=function(){return Z};this.setSize=function(a,b,c){F.width=a*this.devicePixelRatio;F.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(F.style.width=a+"px",F.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ma=a*this.devicePixelRatio;
|
|
|
-Ba=b*this.devicePixelRatio;$a=c*this.devicePixelRatio;Ca=d*this.devicePixelRatio;m.viewport(ma,Ba,$a,Ca)};this.setScissor=function(a,b,c,d){m.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColor=function(a,b){P.set(a);U=void 0!==b?b:1;m.clearColor(P.r,P.g,P.b,U)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");
|
|
|
-this.setClearColor(a,b)};this.getClearColor=function(){return P};this.getClearAlpha=function(){return U};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);
|
|
|
+this.supportsFloatTextures=function(){return Va};this.supportsStandardDerivatives=function(){return Oa};this.supportsCompressedTextureS3TC=function(){return Qa};this.getMaxAnisotropy=function(){return Nb};this.getPrecision=function(){return Z};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,a,b)};this.setViewport=function(a,b,c,d){ma=a*this.devicePixelRatio;
|
|
|
+Ba=b*this.devicePixelRatio;$a=c*this.devicePixelRatio;Ca=d*this.devicePixelRatio;m.viewport(ma,Ba,$a,Ca)};this.setScissor=function(a,b,c,d){m.scissor(a*this.devicePixelRatio,b*this.devicePixelRatio,c*this.devicePixelRatio,d*this.devicePixelRatio)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColor=function(a,b){Q.set(a);U=void 0!==b?b:1;m.clearColor(Q.r,Q.g,Q.b,U)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");
|
|
|
+this.setClearColor(a,b)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return U};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=function(){m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function(){m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function(){m.clear(m.STENCIL_BUFFER_BIT)};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){Na=null;Fa=pa=xa=Pa=Ha=-1;Ta=!0;Ga=wa=-1;this.shadowMapPlugin.update(a,b)};var Ob=function(a){a=a.target;a.removeEventListener("dispose",Ob);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&m.deleteBuffer(b[c].buffer);O.info.memory.geometries--}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++)m.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals)for(d=0,e=c.numMorphNormals;d<e;d++)m.deleteBuffer(c.__webglMorphNormalsBuffers[d]);Rb(c)}else Rb(a)},Db=function(a){a=a.target;a.removeEventListener("dispose",Db);a.image&&a.image.__webglTextureCube?m.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,m.deleteTexture(a.__webglTexture));
|
|
|
O.info.memory.textures--},Pb=function(a){a=a.target;a.removeEventListener("dispose",Pb);if(a&&a.__webglTexture)if(m.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);O.info.memory.textures--},Qb=function(a){a=a.target;a.removeEventListener("dispose",Qb);Ib(a)},Rb=function(a){void 0!==
|
|
|
a.__webglVertexBuffer&&m.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&m.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&m.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&m.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&m.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&m.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&m.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&
|
|
|
m.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&m.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&m.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&m.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[b].buffer);O.info.memory.geometries--},Ib=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;
|
|
|
-a=0;for(c=T.length;a<c;a++)if(d=T[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=T.length;a<c;a++)d=T[a],d.program!==b&&e.push(d);T=e;m.deleteProgram(b);O.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=m.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer());a.hasColors&&
|
|
|
+a=0;for(c=S.length;a<c;a++)if(d=S[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=S.length;a<c;a++)d=S[a],d.program!==b&&e.push(d);S=e;m.deleteProgram(b);O.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=m.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer());a.hasColors&&
|
|
|
!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer());a.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormals){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,l,k,n,p,r,q,s=3*a.count;for(q=0;q<s;q+=9)r=a.normalArray,d=r[q],e=r[q+1],f=r[q+2],
|
|
|
g=r[q+3],l=r[q+4],n=r[q+5],h=r[q+6],k=r[q+7],p=r[q+8],d=(d+g+h)/3,e=(e+l+k)/3,f=(f+n+p)/3,r[q]=d,r[q+1]=e,r[q+2]=f,r[q+3]=d,r[q+4]=e,r[q+5]=f,r[q+6]=d,r[q+7]=e,r[q+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer),m.bufferData(m.ARRAY_BUFFER,a.uvArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,
|
|
|
-2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferGeometry2=function(a,b,c,d,e,f){a=G(a,b,c,d,f).attributes;b={position:"vertices",normal:"normals",uv:"uvs"};c={position:3,normal:3,uv:2};d=V[e.id];l();for(var g in a)if(f=
|
|
|
-a[g],0<=f){var k=e[b[g]];void 0!==k&&0<k.length?(m.bindBuffer(m.ARRAY_BUFFER,d[b[g]]),h(f),m.vertexAttribPointer(f,c[g],m.FLOAT,!1,0,0)):3===c[g]?m.vertexAttrib3fv(f,[0,0,0]):2===c[g]&&m.vertexAttrib2fv(f,[0,0])}m.drawArrays(m.TRIANGLES,0,e.vertices.length/3)};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var k,n,p,r;k=G(a,b,c,d,f);a=k.attributes;b=e.attributes;c=!1;k=16777215*e.id+2*k.id+(d.wireframe?1:0);k!==pa&&(pa=k,c=!0);c&&l();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;
|
|
|
+2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferGeometry2=function(a,b,c,d,e,f){a=F(a,b,c,d,f).attributes;b={position:"vertices",normal:"normals",uv:"uvs"};c={position:3,normal:3,uv:2};d=V[e.id];l();for(var g in a)if(f=
|
|
|
+a[g],0<=f){var k=e[b[g]];void 0!==k&&0<k.length?(m.bindBuffer(m.ARRAY_BUFFER,d[b[g]]),h(f),m.vertexAttribPointer(f,c[g],m.FLOAT,!1,0,0)):3===c[g]?m.vertexAttrib3fv(f,[0,0,0]):2===c[g]&&m.vertexAttrib2fv(f,[0,0])}m.drawArrays(m.TRIANGLES,0,e.vertices.length/3)};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var k,n,p,r;k=F(a,b,c,d,f);a=k.attributes;b=e.attributes;c=!1;k=16777215*e.id+2*k.id+(d.wireframe?1:0);k!==pa&&(pa=k,c=!0);c&&l();if(f instanceof THREE.Mesh)if(f=b.index){e=e.offsets;
|
|
|
1<e.length&&(c=!0);for(var q=0,s=e.length;q<s;q++){var t=e[q].index;if(c){for(n in a)p=a[n],k=b[n],0<=p&&(k?(r=k.itemSize,m.bindBuffer(m.ARRAY_BUFFER,k.buffer),h(p),m.vertexAttribPointer(p,r,m.FLOAT,!1,0,t*r*4)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)}m.drawElements(m.TRIANGLES,e[q].count,
|
|
|
m.UNSIGNED_SHORT,2*e[q].start);O.info.render.calls++;O.info.render.vertices+=e[q].count;O.info.render.faces+=e[q].count/3}}else{if(c)for(n in a)"index"!==n&&(p=a[n],k=b[n],0<=p&&(k?(r=k.itemSize,m.bindBuffer(m.ARRAY_BUFFER,k.buffer),h(p),m.vertexAttribPointer(p,r,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n]))));
|
|
|
d=e.attributes.position;m.drawArrays(m.TRIANGLES,0,d.array.length/3);O.info.render.calls++;O.info.render.vertices+=d.array.length/3;O.info.render.faces+=d.array.length/3/3}else if(f instanceof THREE.ParticleSystem){if(c)for(n in a)p=a[n],k=b[n],0<=p&&(k?(r=k.itemSize,m.bindBuffer(m.ARRAY_BUFFER,k.buffer),h(p),m.vertexAttribPointer(p,r,m.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[n]&&(2===d.defaultAttributeValues[n].length?m.vertexAttrib2fv(p,d.defaultAttributeValues[n]):3===
|
|
|
d.defaultAttributeValues[n].length&&m.vertexAttrib3fv(p,d.defaultAttributeValues[n])));d=b.position;m.drawArrays(m.POINTS,0,d.array.length/3);O.info.render.calls++;O.info.render.points+=d.array.length/3}else if(f instanceof THREE.Line)if(n=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,A(d.linewidth),f=b.index)for(e=e.offsets,1<e.length&&(c=!0),q=0,s=e.length;q<s;q++)t=e[q].index,c&&(g(d,a,b,t),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.buffer)),m.drawElements(m.LINES,e[q].count,m.UNSIGNED_SHORT,2*e[q].start),
|
|
|
-O.info.render.calls++,O.info.render.vertices+=e[q].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(n,0,d.array.length/3),O.info.render.calls++,O.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,k;c=G(a,b,c,d,f);a=c.attributes;b=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==pa&&(pa=c,b=!0);b&&l();if(!d.morphTargets&&0<=a.position)b&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),m.vertexAttribPointer(a.position,3,m.FLOAT,
|
|
|
+O.info.render.calls++,O.info.render.vertices+=e[q].count;else c&&g(d,a,b,0),d=b.position,m.drawArrays(n,0,d.array.length/3),O.info.render.calls++,O.info.render.points+=d.array.length}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,k;c=F(a,b,c,d,f);a=c.attributes;b=!1;c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==pa&&(pa=c,b=!0);b&&l();if(!d.morphTargets&&0<=a.position)b&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),m.vertexAttribPointer(a.position,3,m.FLOAT,
|
|
|
!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),h(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var p=0;k=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;p<d.numSupportedMorphTargets&&
|
|
|
p<k.length;)0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[p]]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[p]]),h(c["morphNormal"+p]),m.vertexAttribPointer(c["morphNormal"+p],3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[p]=g[k[p]],p++}else{k=[];g=f.morphTargetInfluences;var r,q=g.length;for(r=0;r<q;r++)p=g[r],0<p&&k.push([p,
|
|
|
r]);k.length>d.numSupportedMorphTargets?(k.sort(n),k.length=d.numSupportedMorphTargets):k.length>d.numSupportedMorphNormals?k.sort(n):0===k.length&&k.push([0,0]);for(p=0;p<d.numSupportedMorphTargets;)k[p]?(r=k[p][1],0<=c["morphTarget"+p]&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[r]),h(c["morphTarget"+p]),m.vertexAttribPointer(c["morphTarget"+p],3,m.FLOAT,!1,0,0)),0<=c["morphNormal"+p]&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[r]),h(c["morphNormal"+
|
|
@@ -467,29 +467,29 @@ d.defaultAttributeValues.uv2));d.skinning&&0<=a.skinIndex&&0<=a.skinWeight&&(m.b
|
|
|
(d.wireframe?(A(d.wireframeLinewidth),b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,m.UNSIGNED_SHORT,0)):(b&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,m.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=e.__webglFaceCount,O.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,A(d.linewidth),m.drawArrays(f,0,
|
|
|
e.__webglLineCount),O.info.render.calls++):f instanceof THREE.ParticleSystem&&(m.drawArrays(m.POINTS,0,e.__webglParticleCount),O.info.render.calls++,O.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,l=a.__lights,n=a.fog;Fa=-1;Ta=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
xb.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);Wa.setFromMatrix(xb);this.autoUpdateObjects&&this.initWebGLObjects(a);q(this.renderPluginsPre,a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;O.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||Wa.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,r=p.object,u=p.buffer,v=r.geometry,r=r.material;r instanceof THREE.MeshFaceMaterial?(r=r.materials[v instanceof THREE.BufferGeometry?0:u.materialIndex],r.transparent?(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=null)):r&&(r.transparent?(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=
|
|
|
+THREE.ParticleSystem)||!g.frustumCulled||Wa.intersectsObject(g))){var p=g;p._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,p.matrixWorld);p._normalMatrix.getNormalMatrix(p._modelViewMatrix);var p=f,r=p.object,t=p.buffer,v=r.geometry,r=r.material;r instanceof THREE.MeshFaceMaterial?(r=r.materials[v instanceof THREE.BufferGeometry?0:t.materialIndex],r.transparent?(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=null)):r&&(r.transparent?(p.transparent=r,p.opaque=null):(p.opaque=r,p.transparent=
|
|
|
null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(ga.setFromMatrixPosition(g.matrixWorld),ga.applyProjection(xb),f.z=ga.z))}this.sortObjects&&h.sort(k);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),K(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,l,n,!0,d),t(a.__webglObjectsImmediate,"",b,l,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,l,n,!1,d),t(a.__webglObjectsImmediate,"opaque",b,l,n,!1,d),s(a.__webglObjects,!1,"transparent",b,l,n,!0,d),t(a.__webglObjectsImmediate,
|
|
|
+(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),I(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),s(a.__webglObjects,!1,"",b,l,n,!0,d),u(a.__webglObjectsImmediate,"",b,l,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),s(a.__webglObjects,!0,"opaque",b,l,n,!1,d),u(a.__webglObjectsImmediate,"opaque",b,l,n,!1,d),s(a.__webglObjects,!1,"transparent",b,l,n,!0,d),u(a.__webglObjectsImmediate,
|
|
|
"transparent",b,l,n,!0,d));q(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,c.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,c.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=
|
|
|
-function(a,b,c,d,e){var f=G(a,b,c,d,e);pa=-1;O.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,Wa):e.render(function(a){O.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)u(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),u(h,a));var l=h,k=l.geometry,p=void 0,q=void 0,s=void 0;if(k instanceof THREE.BufferGeometry){var t=m.DYNAMIC_DRAW,x=k.attributes,z=void 0,y=void 0;for(z in x)y=x[z],y.needsUpdate&&("index"===z?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,y.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,y.array,t)):(m.bindBuffer(m.ARRAY_BUFFER,y.buffer),m.bufferData(m.ARRAY_BUFFER,y.array,t)),y.needsUpdate=
|
|
|
-!1)}else if(k instanceof THREE.Geometry2){var A=k,B=m.DYNAMIC_DRAW;if(!1!==A.needsUpdate){var D=["vertices","normals","uvs"],G=V[A.id],E=void 0;for(E in D){var F=A[D[E]];m.bindBuffer(m.ARRAY_BUFFER,G[D[E]]);m.bufferData(m.ARRAY_BUFFER,F,B)}A.needsUpdate=!1}}else if(l instanceof THREE.Mesh){for(var O=0,K=k.geometryGroupsList.length;O<K;O++)if(p=k.geometryGroupsList[O],s=d(l,p),k.buffersNeedUpdate&&c(p,l),q=s.attributes&&v(s),k.verticesNeedUpdate||k.morphTargetsNeedUpdate||k.elementsNeedUpdate||k.uvsNeedUpdate||
|
|
|
-k.normalsNeedUpdate||k.colorsNeedUpdate||k.tangentsNeedUpdate||q){var C=p,H=l,J=m.DYNAMIC_DRAW,L=!k.dynamic,M=s;if(C.__inittedArrays){var S=e(M),Q=M.vertexColors?M.vertexColors:!1,Z=f(M),U=S===THREE.SmoothShading,R=void 0,P=void 0,ea=void 0,T=void 0,Y=void 0,$=void 0,ta=void 0,Ja=void 0,pa=void 0,ua=void 0,Na=void 0,ba=void 0,ca=void 0,da=void 0,Fa=void 0,la=void 0,za=void 0,ia=void 0,ja=void 0,ka=void 0,na=void 0,qa=void 0,wa=void 0,xa=void 0,ya=void 0,Aa=void 0,Ca=void 0,Da=void 0,Ia=void 0,Ra=
|
|
|
-void 0,Oa=void 0,Ka=void 0,Ua=void 0,Pa=void 0,ma=void 0,Ta=void 0,Ga=void 0,Ha=void 0,Qa=void 0,Sa=void 0,Ba=0,Ea=0,Wa=0,$a=0,ab=0,lb=0,cb=0,Va=0,ib=0,va=0,La=0,N=0,bb=void 0,mb=C.__vertexArray,hb=C.__uvArray,wb=C.__uv2Array,yb=C.__normalArray,db=C.__tangentArray,nb=C.__colorArray,eb=C.__skinIndexArray,fb=C.__skinWeightArray,Cb=C.__morphTargetsArrays,Db=C.__morphNormalsArrays,gc=C.__webglCustomAttributesList,I=void 0,Sb=C.__faceArray,zb=C.__lineArray,Xa=H.geometry,Nb=Xa.elementsNeedUpdate,Hb=Xa.uvsNeedUpdate,
|
|
|
-Ob=Xa.normalsNeedUpdate,Pb=Xa.tangentsNeedUpdate,Qb=Xa.colorsNeedUpdate,Rb=Xa.morphTargetsNeedUpdate,hc=Xa.vertices,fa=C.faces3,ob=Xa.faces,Ib=Xa.faceVertexUvs[0],nc=Xa.faceVertexUvs[1],ic=Xa.skinIndices,Tb=Xa.skinWeights,Ub=Xa.morphTargets,oc=Xa.morphNormals;if(Xa.verticesNeedUpdate){R=0;for(P=fa.length;R<P;R++)T=ob[fa[R]],ba=hc[T.a],ca=hc[T.b],da=hc[T.c],mb[Ea]=ba.x,mb[Ea+1]=ba.y,mb[Ea+2]=ba.z,mb[Ea+3]=ca.x,mb[Ea+4]=ca.y,mb[Ea+5]=ca.z,mb[Ea+6]=da.x,mb[Ea+7]=da.y,mb[Ea+8]=da.z,Ea+=9;m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
-C.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,mb,J)}if(Rb)for(ma=0,Ta=Ub.length;ma<Ta;ma++){R=La=0;for(P=fa.length;R<P;R++)Qa=fa[R],T=ob[Qa],ba=Ub[ma].vertices[T.a],ca=Ub[ma].vertices[T.b],da=Ub[ma].vertices[T.c],Ga=Cb[ma],Ga[La]=ba.x,Ga[La+1]=ba.y,Ga[La+2]=ba.z,Ga[La+3]=ca.x,Ga[La+4]=ca.y,Ga[La+5]=ca.z,Ga[La+6]=da.x,Ga[La+7]=da.y,Ga[La+8]=da.z,M.morphNormals&&(U?(Sa=oc[ma].vertexNormals[Qa],ia=Sa.a,ja=Sa.b,ka=Sa.c):ka=ja=ia=oc[ma].faceNormals[Qa],Ha=Db[ma],Ha[La]=ia.x,Ha[La+1]=ia.y,Ha[La+2]=
|
|
|
-ia.z,Ha[La+3]=ja.x,Ha[La+4]=ja.y,Ha[La+5]=ja.z,Ha[La+6]=ka.x,Ha[La+7]=ka.y,Ha[La+8]=ka.z),La+=9;m.bindBuffer(m.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[ma]);m.bufferData(m.ARRAY_BUFFER,Cb[ma],J);M.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,C.__webglMorphNormalsBuffers[ma]),m.bufferData(m.ARRAY_BUFFER,Db[ma],J))}if(Tb.length){R=0;for(P=fa.length;R<P;R++)T=ob[fa[R]],xa=Tb[T.a],ya=Tb[T.b],Aa=Tb[T.c],fb[va]=xa.x,fb[va+1]=xa.y,fb[va+2]=xa.z,fb[va+3]=xa.w,fb[va+4]=ya.x,fb[va+5]=ya.y,fb[va+6]=ya.z,fb[va+
|
|
|
-7]=ya.w,fb[va+8]=Aa.x,fb[va+9]=Aa.y,fb[va+10]=Aa.z,fb[va+11]=Aa.w,Ca=ic[T.a],Da=ic[T.b],Ia=ic[T.c],eb[va]=Ca.x,eb[va+1]=Ca.y,eb[va+2]=Ca.z,eb[va+3]=Ca.w,eb[va+4]=Da.x,eb[va+5]=Da.y,eb[va+6]=Da.z,eb[va+7]=Da.w,eb[va+8]=Ia.x,eb[va+9]=Ia.y,eb[va+10]=Ia.z,eb[va+11]=Ia.w,va+=12;0<va&&(m.bindBuffer(m.ARRAY_BUFFER,C.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,eb,J),m.bindBuffer(m.ARRAY_BUFFER,C.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,fb,J))}if(Qb&&Q){R=0;for(P=fa.length;R<P;R++)T=
|
|
|
-ob[fa[R]],ta=T.vertexColors,Ja=T.color,3===ta.length&&Q===THREE.VertexColors?(na=ta[0],qa=ta[1],wa=ta[2]):wa=qa=na=Ja,nb[ib]=na.r,nb[ib+1]=na.g,nb[ib+2]=na.b,nb[ib+3]=qa.r,nb[ib+4]=qa.g,nb[ib+5]=qa.b,nb[ib+6]=wa.r,nb[ib+7]=wa.g,nb[ib+8]=wa.b,ib+=9;0<ib&&(m.bindBuffer(m.ARRAY_BUFFER,C.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,nb,J))}if(Pb&&Xa.hasTangents){R=0;for(P=fa.length;R<P;R++)T=ob[fa[R]],pa=T.vertexTangents,Fa=pa[0],la=pa[1],za=pa[2],db[cb]=Fa.x,db[cb+1]=Fa.y,db[cb+2]=Fa.z,db[cb+3]=Fa.w,
|
|
|
-db[cb+4]=la.x,db[cb+5]=la.y,db[cb+6]=la.z,db[cb+7]=la.w,db[cb+8]=za.x,db[cb+9]=za.y,db[cb+10]=za.z,db[cb+11]=za.w,cb+=12;m.bindBuffer(m.ARRAY_BUFFER,C.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,db,J)}if(Ob&&S){R=0;for(P=fa.length;R<P;R++)if(T=ob[fa[R]],Y=T.vertexNormals,$=T.normal,3===Y.length&&U)for(Ra=0;3>Ra;Ra++)Ka=Y[Ra],yb[lb]=Ka.x,yb[lb+1]=Ka.y,yb[lb+2]=Ka.z,lb+=3;else for(Ra=0;3>Ra;Ra++)yb[lb]=$.x,yb[lb+1]=$.y,yb[lb+2]=$.z,lb+=3;m.bindBuffer(m.ARRAY_BUFFER,C.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
-yb,J)}if(Hb&&Ib&&Z){R=0;for(P=fa.length;R<P;R++)if(ea=fa[R],ua=Ib[ea],void 0!==ua)for(Ra=0;3>Ra;Ra++)Ua=ua[Ra],hb[Wa]=Ua.x,hb[Wa+1]=Ua.y,Wa+=2;0<Wa&&(m.bindBuffer(m.ARRAY_BUFFER,C.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,hb,J))}if(Hb&&nc&&Z){R=0;for(P=fa.length;R<P;R++)if(ea=fa[R],Na=nc[ea],void 0!==Na)for(Ra=0;3>Ra;Ra++)Pa=Na[Ra],wb[$a]=Pa.x,wb[$a+1]=Pa.y,$a+=2;0<$a&&(m.bindBuffer(m.ARRAY_BUFFER,C.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,wb,J))}if(Nb){R=0;for(P=fa.length;R<P;R++)Sb[ab]=
|
|
|
-Ba,Sb[ab+1]=Ba+1,Sb[ab+2]=Ba+2,ab+=3,zb[Va]=Ba,zb[Va+1]=Ba+1,zb[Va+2]=Ba,zb[Va+3]=Ba+2,zb[Va+4]=Ba+1,zb[Va+5]=Ba+2,Va+=6,Ba+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,C.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Sb,J);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,C.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,zb,J)}if(gc)for(Ra=0,Oa=gc.length;Ra<Oa;Ra++)if(I=gc[Ra],I.__original.needsUpdate){N=0;if(1===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo)for(R=0,P=fa.length;R<P;R++)T=ob[fa[R]],
|
|
|
-I.array[N]=I.value[T.a],I.array[N+1]=I.value[T.b],I.array[N+2]=I.value[T.c],N+=3;else{if("faces"===I.boundTo)for(R=0,P=fa.length;R<P;R++)bb=I.value[fa[R]],I.array[N]=bb,I.array[N+1]=bb,I.array[N+2]=bb,N+=3}else if(2===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo)for(R=0,P=fa.length;R<P;R++)T=ob[fa[R]],ba=I.value[T.a],ca=I.value[T.b],da=I.value[T.c],I.array[N]=ba.x,I.array[N+1]=ba.y,I.array[N+2]=ca.x,I.array[N+3]=ca.y,I.array[N+4]=da.x,I.array[N+5]=da.y,N+=6;else{if("faces"===I.boundTo)for(R=
|
|
|
-0,P=fa.length;R<P;R++)da=ca=ba=bb=I.value[fa[R]],I.array[N]=ba.x,I.array[N+1]=ba.y,I.array[N+2]=ca.x,I.array[N+3]=ca.y,I.array[N+4]=da.x,I.array[N+5]=da.y,N+=6}else if(3===I.size){var sa;sa="c"===I.type?["r","g","b"]:["x","y","z"];if(void 0===I.boundTo||"vertices"===I.boundTo)for(R=0,P=fa.length;R<P;R++)T=ob[fa[R]],ba=I.value[T.a],ca=I.value[T.b],da=I.value[T.c],I.array[N]=ba[sa[0]],I.array[N+1]=ba[sa[1]],I.array[N+2]=ba[sa[2]],I.array[N+3]=ca[sa[0]],I.array[N+4]=ca[sa[1]],I.array[N+5]=ca[sa[2]],
|
|
|
-I.array[N+6]=da[sa[0]],I.array[N+7]=da[sa[1]],I.array[N+8]=da[sa[2]],N+=9;else if("faces"===I.boundTo)for(R=0,P=fa.length;R<P;R++)da=ca=ba=bb=I.value[fa[R]],I.array[N]=ba[sa[0]],I.array[N+1]=ba[sa[1]],I.array[N+2]=ba[sa[2]],I.array[N+3]=ca[sa[0]],I.array[N+4]=ca[sa[1]],I.array[N+5]=ca[sa[2]],I.array[N+6]=da[sa[0]],I.array[N+7]=da[sa[1]],I.array[N+8]=da[sa[2]],N+=9;else if("faceVertices"===I.boundTo)for(R=0,P=fa.length;R<P;R++)bb=I.value[fa[R]],ba=bb[0],ca=bb[1],da=bb[2],I.array[N]=ba[sa[0]],I.array[N+
|
|
|
-1]=ba[sa[1]],I.array[N+2]=ba[sa[2]],I.array[N+3]=ca[sa[0]],I.array[N+4]=ca[sa[1]],I.array[N+5]=ca[sa[2]],I.array[N+6]=da[sa[0]],I.array[N+7]=da[sa[1]],I.array[N+8]=da[sa[2]],N+=9}else if(4===I.size)if(void 0===I.boundTo||"vertices"===I.boundTo)for(R=0,P=fa.length;R<P;R++)T=ob[fa[R]],ba=I.value[T.a],ca=I.value[T.b],da=I.value[T.c],I.array[N]=ba.x,I.array[N+1]=ba.y,I.array[N+2]=ba.z,I.array[N+3]=ba.w,I.array[N+4]=ca.x,I.array[N+5]=ca.y,I.array[N+6]=ca.z,I.array[N+7]=ca.w,I.array[N+8]=da.x,I.array[N+
|
|
|
-9]=da.y,I.array[N+10]=da.z,I.array[N+11]=da.w,N+=12;else if("faces"===I.boundTo)for(R=0,P=fa.length;R<P;R++)da=ca=ba=bb=I.value[fa[R]],I.array[N]=ba.x,I.array[N+1]=ba.y,I.array[N+2]=ba.z,I.array[N+3]=ba.w,I.array[N+4]=ca.x,I.array[N+5]=ca.y,I.array[N+6]=ca.z,I.array[N+7]=ca.w,I.array[N+8]=da.x,I.array[N+9]=da.y,I.array[N+10]=da.z,I.array[N+11]=da.w,N+=12;else if("faceVertices"===I.boundTo)for(R=0,P=fa.length;R<P;R++)bb=I.value[fa[R]],ba=bb[0],ca=bb[1],da=bb[2],I.array[N]=ba.x,I.array[N+1]=ba.y,I.array[N+
|
|
|
-2]=ba.z,I.array[N+3]=ba.w,I.array[N+4]=ca.x,I.array[N+5]=ca.y,I.array[N+6]=ca.z,I.array[N+7]=ca.w,I.array[N+8]=da.x,I.array[N+9]=da.y,I.array[N+10]=da.z,I.array[N+11]=da.w,N+=12;m.bindBuffer(m.ARRAY_BUFFER,I.buffer);m.bufferData(m.ARRAY_BUFFER,I.array,J)}L&&(delete C.__inittedArrays,delete C.__colorArray,delete C.__normalArray,delete C.__tangentArray,delete C.__uvArray,delete C.__uv2Array,delete C.__faceArray,delete C.__vertexArray,delete C.__lineArray,delete C.__skinIndexArray,delete C.__skinWeightArray)}}k.verticesNeedUpdate=
|
|
|
+function(a,b,c,d,e){var f=F(a,b,c,d,e);pa=-1;O.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,m,Wa):e.render(function(a){O.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 l=h,k=l.geometry,p=void 0,q=void 0,s=void 0;if(k instanceof THREE.BufferGeometry){var u=m.DYNAMIC_DRAW,x=k.attributes,z=void 0,y=void 0;for(z in x)y=x[z],y.needsUpdate&&("index"===z?(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,y.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,y.array,u)):(m.bindBuffer(m.ARRAY_BUFFER,y.buffer),m.bufferData(m.ARRAY_BUFFER,y.array,u)),y.needsUpdate=
|
|
|
+!1)}else if(k instanceof THREE.Geometry2){var A=k,F=m.DYNAMIC_DRAW;if(!1!==A.needsUpdate){var C=["vertices","normals","uvs"],D=V[A.id],E=void 0;for(E in C){var G=A[C[E]];m.bindBuffer(m.ARRAY_BUFFER,D[C[E]]);m.bufferData(m.ARRAY_BUFFER,G,F)}A.needsUpdate=!1}}else if(l instanceof THREE.Mesh){for(var I=0,O=k.geometryGroupsList.length;I<O;I++)if(p=k.geometryGroupsList[I],s=d(l,p),k.buffersNeedUpdate&&c(p,l),q=s.attributes&&v(s),k.verticesNeedUpdate||k.morphTargetsNeedUpdate||k.elementsNeedUpdate||k.uvsNeedUpdate||
|
|
|
+k.normalsNeedUpdate||k.colorsNeedUpdate||k.tangentsNeedUpdate||q){var B=p,H=l,P=m.DYNAMIC_DRAW,K=!k.dynamic,L=s;if(B.__inittedArrays){var N=e(L),T=L.vertexColors?L.vertexColors:!1,Z=f(L),U=N===THREE.SmoothShading,R=void 0,Q=void 0,ea=void 0,S=void 0,Y=void 0,$=void 0,ta=void 0,Ja=void 0,pa=void 0,ua=void 0,Na=void 0,ba=void 0,ca=void 0,da=void 0,Fa=void 0,la=void 0,za=void 0,ia=void 0,ja=void 0,ka=void 0,na=void 0,qa=void 0,wa=void 0,xa=void 0,ya=void 0,Aa=void 0,Ca=void 0,Da=void 0,Ia=void 0,Ra=
|
|
|
+void 0,Oa=void 0,Ka=void 0,Ua=void 0,Pa=void 0,ma=void 0,Ta=void 0,Ga=void 0,Ha=void 0,Qa=void 0,Sa=void 0,Ba=0,Ea=0,Wa=0,$a=0,ab=0,lb=0,cb=0,Va=0,ib=0,va=0,La=0,M=0,bb=void 0,mb=B.__vertexArray,hb=B.__uvArray,wb=B.__uv2Array,yb=B.__normalArray,db=B.__tangentArray,nb=B.__colorArray,eb=B.__skinIndexArray,fb=B.__skinWeightArray,Cb=B.__morphTargetsArrays,Db=B.__morphNormalsArrays,gc=B.__webglCustomAttributesList,J=void 0,Sb=B.__faceArray,zb=B.__lineArray,Xa=H.geometry,Nb=Xa.elementsNeedUpdate,Hb=Xa.uvsNeedUpdate,
|
|
|
+Ob=Xa.normalsNeedUpdate,Pb=Xa.tangentsNeedUpdate,Qb=Xa.colorsNeedUpdate,Rb=Xa.morphTargetsNeedUpdate,hc=Xa.vertices,fa=B.faces3,ob=Xa.faces,Ib=Xa.faceVertexUvs[0],nc=Xa.faceVertexUvs[1],ic=Xa.skinIndices,Tb=Xa.skinWeights,Ub=Xa.morphTargets,oc=Xa.morphNormals;if(Xa.verticesNeedUpdate){R=0;for(Q=fa.length;R<Q;R++)S=ob[fa[R]],ba=hc[S.a],ca=hc[S.b],da=hc[S.c],mb[Ea]=ba.x,mb[Ea+1]=ba.y,mb[Ea+2]=ba.z,mb[Ea+3]=ca.x,mb[Ea+4]=ca.y,mb[Ea+5]=ca.z,mb[Ea+6]=da.x,mb[Ea+7]=da.y,mb[Ea+8]=da.z,Ea+=9;m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
+B.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,mb,P)}if(Rb)for(ma=0,Ta=Ub.length;ma<Ta;ma++){R=La=0;for(Q=fa.length;R<Q;R++)Qa=fa[R],S=ob[Qa],ba=Ub[ma].vertices[S.a],ca=Ub[ma].vertices[S.b],da=Ub[ma].vertices[S.c],Ga=Cb[ma],Ga[La]=ba.x,Ga[La+1]=ba.y,Ga[La+2]=ba.z,Ga[La+3]=ca.x,Ga[La+4]=ca.y,Ga[La+5]=ca.z,Ga[La+6]=da.x,Ga[La+7]=da.y,Ga[La+8]=da.z,L.morphNormals&&(U?(Sa=oc[ma].vertexNormals[Qa],ia=Sa.a,ja=Sa.b,ka=Sa.c):ka=ja=ia=oc[ma].faceNormals[Qa],Ha=Db[ma],Ha[La]=ia.x,Ha[La+1]=ia.y,Ha[La+2]=
|
|
|
+ia.z,Ha[La+3]=ja.x,Ha[La+4]=ja.y,Ha[La+5]=ja.z,Ha[La+6]=ka.x,Ha[La+7]=ka.y,Ha[La+8]=ka.z),La+=9;m.bindBuffer(m.ARRAY_BUFFER,B.__webglMorphTargetsBuffers[ma]);m.bufferData(m.ARRAY_BUFFER,Cb[ma],P);L.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,B.__webglMorphNormalsBuffers[ma]),m.bufferData(m.ARRAY_BUFFER,Db[ma],P))}if(Tb.length){R=0;for(Q=fa.length;R<Q;R++)S=ob[fa[R]],xa=Tb[S.a],ya=Tb[S.b],Aa=Tb[S.c],fb[va]=xa.x,fb[va+1]=xa.y,fb[va+2]=xa.z,fb[va+3]=xa.w,fb[va+4]=ya.x,fb[va+5]=ya.y,fb[va+6]=ya.z,fb[va+
|
|
|
+7]=ya.w,fb[va+8]=Aa.x,fb[va+9]=Aa.y,fb[va+10]=Aa.z,fb[va+11]=Aa.w,Ca=ic[S.a],Da=ic[S.b],Ia=ic[S.c],eb[va]=Ca.x,eb[va+1]=Ca.y,eb[va+2]=Ca.z,eb[va+3]=Ca.w,eb[va+4]=Da.x,eb[va+5]=Da.y,eb[va+6]=Da.z,eb[va+7]=Da.w,eb[va+8]=Ia.x,eb[va+9]=Ia.y,eb[va+10]=Ia.z,eb[va+11]=Ia.w,va+=12;0<va&&(m.bindBuffer(m.ARRAY_BUFFER,B.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,eb,P),m.bindBuffer(m.ARRAY_BUFFER,B.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,fb,P))}if(Qb&&T){R=0;for(Q=fa.length;R<Q;R++)S=
|
|
|
+ob[fa[R]],ta=S.vertexColors,Ja=S.color,3===ta.length&&T===THREE.VertexColors?(na=ta[0],qa=ta[1],wa=ta[2]):wa=qa=na=Ja,nb[ib]=na.r,nb[ib+1]=na.g,nb[ib+2]=na.b,nb[ib+3]=qa.r,nb[ib+4]=qa.g,nb[ib+5]=qa.b,nb[ib+6]=wa.r,nb[ib+7]=wa.g,nb[ib+8]=wa.b,ib+=9;0<ib&&(m.bindBuffer(m.ARRAY_BUFFER,B.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,nb,P))}if(Pb&&Xa.hasTangents){R=0;for(Q=fa.length;R<Q;R++)S=ob[fa[R]],pa=S.vertexTangents,Fa=pa[0],la=pa[1],za=pa[2],db[cb]=Fa.x,db[cb+1]=Fa.y,db[cb+2]=Fa.z,db[cb+3]=Fa.w,
|
|
|
+db[cb+4]=la.x,db[cb+5]=la.y,db[cb+6]=la.z,db[cb+7]=la.w,db[cb+8]=za.x,db[cb+9]=za.y,db[cb+10]=za.z,db[cb+11]=za.w,cb+=12;m.bindBuffer(m.ARRAY_BUFFER,B.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,db,P)}if(Ob&&N){R=0;for(Q=fa.length;R<Q;R++)if(S=ob[fa[R]],Y=S.vertexNormals,$=S.normal,3===Y.length&&U)for(Ra=0;3>Ra;Ra++)Ka=Y[Ra],yb[lb]=Ka.x,yb[lb+1]=Ka.y,yb[lb+2]=Ka.z,lb+=3;else for(Ra=0;3>Ra;Ra++)yb[lb]=$.x,yb[lb+1]=$.y,yb[lb+2]=$.z,lb+=3;m.bindBuffer(m.ARRAY_BUFFER,B.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
+yb,P)}if(Hb&&Ib&&Z){R=0;for(Q=fa.length;R<Q;R++)if(ea=fa[R],ua=Ib[ea],void 0!==ua)for(Ra=0;3>Ra;Ra++)Ua=ua[Ra],hb[Wa]=Ua.x,hb[Wa+1]=Ua.y,Wa+=2;0<Wa&&(m.bindBuffer(m.ARRAY_BUFFER,B.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,hb,P))}if(Hb&&nc&&Z){R=0;for(Q=fa.length;R<Q;R++)if(ea=fa[R],Na=nc[ea],void 0!==Na)for(Ra=0;3>Ra;Ra++)Pa=Na[Ra],wb[$a]=Pa.x,wb[$a+1]=Pa.y,$a+=2;0<$a&&(m.bindBuffer(m.ARRAY_BUFFER,B.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,wb,P))}if(Nb){R=0;for(Q=fa.length;R<Q;R++)Sb[ab]=
|
|
|
+Ba,Sb[ab+1]=Ba+1,Sb[ab+2]=Ba+2,ab+=3,zb[Va]=Ba,zb[Va+1]=Ba+1,zb[Va+2]=Ba,zb[Va+3]=Ba+2,zb[Va+4]=Ba+1,zb[Va+5]=Ba+2,Va+=6,Ba+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,B.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Sb,P);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,B.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,zb,P)}if(gc)for(Ra=0,Oa=gc.length;Ra<Oa;Ra++)if(J=gc[Ra],J.__original.needsUpdate){M=0;if(1===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)S=ob[fa[R]],
|
|
|
+J.array[M]=J.value[S.a],J.array[M+1]=J.value[S.b],J.array[M+2]=J.value[S.c],M+=3;else{if("faces"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)bb=J.value[fa[R]],J.array[M]=bb,J.array[M+1]=bb,J.array[M+2]=bb,M+=3}else if(2===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)S=ob[fa[R]],ba=J.value[S.a],ca=J.value[S.b],da=J.value[S.c],J.array[M]=ba.x,J.array[M+1]=ba.y,J.array[M+2]=ca.x,J.array[M+3]=ca.y,J.array[M+4]=da.x,J.array[M+5]=da.y,M+=6;else{if("faces"===J.boundTo)for(R=
|
|
|
+0,Q=fa.length;R<Q;R++)da=ca=ba=bb=J.value[fa[R]],J.array[M]=ba.x,J.array[M+1]=ba.y,J.array[M+2]=ca.x,J.array[M+3]=ca.y,J.array[M+4]=da.x,J.array[M+5]=da.y,M+=6}else if(3===J.size){var sa;sa="c"===J.type?["r","g","b"]:["x","y","z"];if(void 0===J.boundTo||"vertices"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)S=ob[fa[R]],ba=J.value[S.a],ca=J.value[S.b],da=J.value[S.c],J.array[M]=ba[sa[0]],J.array[M+1]=ba[sa[1]],J.array[M+2]=ba[sa[2]],J.array[M+3]=ca[sa[0]],J.array[M+4]=ca[sa[1]],J.array[M+5]=ca[sa[2]],
|
|
|
+J.array[M+6]=da[sa[0]],J.array[M+7]=da[sa[1]],J.array[M+8]=da[sa[2]],M+=9;else if("faces"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)da=ca=ba=bb=J.value[fa[R]],J.array[M]=ba[sa[0]],J.array[M+1]=ba[sa[1]],J.array[M+2]=ba[sa[2]],J.array[M+3]=ca[sa[0]],J.array[M+4]=ca[sa[1]],J.array[M+5]=ca[sa[2]],J.array[M+6]=da[sa[0]],J.array[M+7]=da[sa[1]],J.array[M+8]=da[sa[2]],M+=9;else if("faceVertices"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)bb=J.value[fa[R]],ba=bb[0],ca=bb[1],da=bb[2],J.array[M]=ba[sa[0]],J.array[M+
|
|
|
+1]=ba[sa[1]],J.array[M+2]=ba[sa[2]],J.array[M+3]=ca[sa[0]],J.array[M+4]=ca[sa[1]],J.array[M+5]=ca[sa[2]],J.array[M+6]=da[sa[0]],J.array[M+7]=da[sa[1]],J.array[M+8]=da[sa[2]],M+=9}else if(4===J.size)if(void 0===J.boundTo||"vertices"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)S=ob[fa[R]],ba=J.value[S.a],ca=J.value[S.b],da=J.value[S.c],J.array[M]=ba.x,J.array[M+1]=ba.y,J.array[M+2]=ba.z,J.array[M+3]=ba.w,J.array[M+4]=ca.x,J.array[M+5]=ca.y,J.array[M+6]=ca.z,J.array[M+7]=ca.w,J.array[M+8]=da.x,J.array[M+
|
|
|
+9]=da.y,J.array[M+10]=da.z,J.array[M+11]=da.w,M+=12;else if("faces"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)da=ca=ba=bb=J.value[fa[R]],J.array[M]=ba.x,J.array[M+1]=ba.y,J.array[M+2]=ba.z,J.array[M+3]=ba.w,J.array[M+4]=ca.x,J.array[M+5]=ca.y,J.array[M+6]=ca.z,J.array[M+7]=ca.w,J.array[M+8]=da.x,J.array[M+9]=da.y,J.array[M+10]=da.z,J.array[M+11]=da.w,M+=12;else if("faceVertices"===J.boundTo)for(R=0,Q=fa.length;R<Q;R++)bb=J.value[fa[R]],ba=bb[0],ca=bb[1],da=bb[2],J.array[M]=ba.x,J.array[M+1]=ba.y,J.array[M+
|
|
|
+2]=ba.z,J.array[M+3]=ba.w,J.array[M+4]=ca.x,J.array[M+5]=ca.y,J.array[M+6]=ca.z,J.array[M+7]=ca.w,J.array[M+8]=da.x,J.array[M+9]=da.y,J.array[M+10]=da.z,J.array[M+11]=da.w,M+=12;m.bindBuffer(m.ARRAY_BUFFER,J.buffer);m.bufferData(m.ARRAY_BUFFER,J.array,P)}K&&(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)}}k.verticesNeedUpdate=
|
|
|
!1;k.morphTargetsNeedUpdate=!1;k.elementsNeedUpdate=!1;k.uvsNeedUpdate=!1;k.normalsNeedUpdate=!1;k.colorsNeedUpdate=!1;k.tangentsNeedUpdate=!1;k.buffersNeedUpdate=!1;s.attributes&&w(s)}else if(l instanceof THREE.Line){s=d(l,k);q=s.attributes&&v(s);if(k.verticesNeedUpdate||k.colorsNeedUpdate||k.lineDistancesNeedUpdate||q){var gb=k,Vb=m.DYNAMIC_DRAW,Jb=void 0,Kb=void 0,Lb=void 0,Wb=void 0,ra=void 0,Xb=void 0,pc=gb.vertices,qc=gb.colors,rc=gb.lineDistances,bc=pc.length,cc=qc.length,dc=rc.length,Yb=gb.__vertexArray,
|
|
|
Zb=gb.__colorArray,sc=gb.__lineDistanceArray,ec=gb.colorsNeedUpdate,fc=gb.lineDistancesNeedUpdate,jc=gb.__webglCustomAttributesList,$b=void 0,tc=void 0,Ma=void 0,Fb=void 0,Ya=void 0,oa=void 0;if(gb.verticesNeedUpdate){for(Jb=0;Jb<bc;Jb++)Wb=pc[Jb],ra=3*Jb,Yb[ra]=Wb.x,Yb[ra+1]=Wb.y,Yb[ra+2]=Wb.z;m.bindBuffer(m.ARRAY_BUFFER,gb.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Yb,Vb)}if(ec){for(Kb=0;Kb<cc;Kb++)Xb=qc[Kb],ra=3*Kb,Zb[ra]=Xb.r,Zb[ra+1]=Xb.g,Zb[ra+2]=Xb.b;m.bindBuffer(m.ARRAY_BUFFER,gb.__webglColorBuffer);
|
|
|
m.bufferData(m.ARRAY_BUFFER,Zb,Vb)}if(fc){for(Lb=0;Lb<dc;Lb++)sc[Lb]=rc[Lb];m.bindBuffer(m.ARRAY_BUFFER,gb.__webglLineDistanceBuffer);m.bufferData(m.ARRAY_BUFFER,sc,Vb)}if(jc)for($b=0,tc=jc.length;$b<tc;$b++)if(oa=jc[$b],oa.needsUpdate&&(void 0===oa.boundTo||"vertices"===oa.boundTo)){ra=0;Fb=oa.value.length;if(1===oa.size)for(Ma=0;Ma<Fb;Ma++)oa.array[Ma]=oa.value[Ma];else if(2===oa.size)for(Ma=0;Ma<Fb;Ma++)Ya=oa.value[Ma],oa.array[ra]=Ya.x,oa.array[ra+1]=Ya.y,ra+=2;else if(3===oa.size)if("c"===oa.type)for(Ma=
|
|
@@ -504,15 +504,15 @@ a instanceof THREE.MeshPhongMaterial?r="phong":a instanceof THREE.LineBasicMater
|
|
|
THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&q++);f=s;g=t;h=q;t=q=0;for(s=b.length;t<s;t++)u=b[t],u.castShadow&&(u instanceof THREE.SpotLight&&q++,u instanceof THREE.DirectionalLight&&!u.shadowCascade&&q++);n=q;Cb&&d&&d.useVertexTexture?p=1024:(b=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+
|
|
|
b+" (try OpenGL instead of ANGLE)")),p=b);a:{t=a.fragmentShader;s=a.vertexShader;q=a.uniforms;b=a.attributes;u=a.defines;c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:p,useVertexTexture:Cb&&d&&d.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,
|
|
|
maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide};d=a.index0AttributeName;var v,w,x;e=[];r?e.push(r):(e.push(t),e.push(s));for(w in u)e.push(w),
|
|
|
-e.push(u[w]);for(v in c)e.push(v),e.push(c[v]);r=e.join();v=0;for(w=T.length;v<w;v++)if(e=T[v],e.code===r){e.usedTimes++;k=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e="#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+Z+" float;","precision "+Z+" int;",e,wb?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":
|
|
|
+e.push(u[w]);for(v in c)e.push(v),e.push(c[v]);r=e.join();v=0;for(w=S.length;v<w;v++)if(e=S[v],e.code===r){e.usedTimes++;k=e.program;break a}v="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(x in u)e=u[x],!1!==e&&(e="#define "+x+" "+e,w.push(e));e=w.join("\n");x=m.createProgram();w=["precision "+Z+" float;","precision "+Z+" int;",e,wb?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":
|
|
|
"",O.gammaOutput?"#define GAMMA_OUTPUT":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?
|
|
|
"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:"",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");
|
|
|
v=["precision "+Z+" float;","precision "+Z+" int;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",e,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",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.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+v:
|
|
|
-"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=Q("vertex",w+s);v=Q("fragment",v+t);m.attachShader(x,w);m.attachShader(x,v);void 0!==d?m.bindAttribLocation(x,0,d):m.bindAttribLocation(x,0,"position");m.linkProgram(x);m.getProgramParameter(x,m.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(x,m.VALIDATE_STATUS)+", gl error ["+
|
|
|
+"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=N("vertex",w+s);v=N("fragment",v+t);m.attachShader(x,w);m.attachShader(x,v);void 0!==d?m.bindAttribLocation(x,0,d):m.bindAttribLocation(x,0,"position");m.linkProgram(x);m.getProgramParameter(x,m.LINK_STATUS)||(console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(x,m.VALIDATE_STATUS)+", gl error ["+
|
|
|
m.getError()+"]"),console.error("Program Info Log: "+m.getProgramInfoLog(x)));m.deleteShader(v);m.deleteShader(w);x.uniforms={};x.attributes={};var z;v="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?(v.push("boneTexture"),v.push("boneTextureWidth"),v.push("boneTextureHeight")):v.push("boneGlobalMatrices");for(z in q)v.push(z);z=v;v=0;for(w=z.length;v<w;v++)q=z[v],x.uniforms[q]=m.getUniformLocation(x,q);v="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");
|
|
|
-for(z=0;z<c.maxMorphTargets;z++)v.push("morphTarget"+z);for(z=0;z<c.maxMorphNormals;z++)v.push("morphNormal"+z);for(k in b)v.push(k);k=v;z=0;for(b=k.length;z<b;z++)v=k[z],x.attributes[v]=m.getAttribLocation(x,v);x.id=Ja++;T.push({program:x,code:r,usedTimes:1});O.info.memory.programs=T.length;k=x}a.program=k;z=a.program.attributes;if(a.morphTargets)for(a.numSupportedMorphTargets=0,b="morphTarget",k=0;k<this.maxMorphTargets;k++)x=b+k,0<=z[x]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(a.numSupportedMorphNormals=
|
|
|
+for(z=0;z<c.maxMorphTargets;z++)v.push("morphTarget"+z);for(z=0;z<c.maxMorphNormals;z++)v.push("morphNormal"+z);for(k in b)v.push(k);k=v;z=0;for(b=k.length;z<b;z++)v=k[z],x.attributes[v]=m.getAttribLocation(x,v);x.id=Ja++;S.push({program:x,code:r,usedTimes:1});O.info.memory.programs=S.length;k=x}a.program=k;z=a.program.attributes;if(a.morphTargets)for(a.numSupportedMorphTargets=0,b="morphTarget",k=0;k<this.maxMorphTargets;k++)x=b+k,0<=z[x]&&a.numSupportedMorphTargets++;if(a.morphNormals)for(a.numSupportedMorphNormals=
|
|
|
0,b="morphNormal",k=0;k<this.maxMorphNormals;k++)x=b+k,0<=z[x]&&a.numSupportedMorphNormals++;a.uniformsList=[];for(l in a.uniforms)a.uniformsList.push([a.uniforms[l],l])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?m.disable(m.CULL_FACE):(b===THREE.FrontFaceDirectionCW?m.frontFace(m.CW):m.frontFace(m.CCW),a===THREE.CullFaceBack?m.cullFace(m.BACK):a===THREE.CullFaceFront?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===
|
|
|
THREE.DoubleSide;a=a.side===THREE.BackSide;wa!==b&&(b?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),wa=b);Ga!==a&&(a?m.frontFace(m.CW):m.frontFace(m.CCW),Ga=a)};this.setDepthTest=function(a){Pa!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),Pa=a)};this.setDepthWrite=function(a){xa!==a&&(m.depthMask(a),xa=a)};this.setBlending=function(a,b,c,d){a!==Ha&&(a===THREE.NoBlending?m.disable(m.BLEND):a===THREE.AdditiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.SRC_ALPHA,m.ONE)):
|
|
|
a===THREE.SubtractiveBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(m.enable(m.BLEND),m.blendEquation(m.FUNC_ADD),m.blendFunc(m.ZERO,m.SRC_COLOR)):a===THREE.CustomBlending?m.enable(m.BLEND):(m.enable(m.BLEND),m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)),Ha=a);if(a===THREE.CustomBlending){if(b!==la&&(m.blendEquation(D(b)),la=b),c!==Ua||
|
|
@@ -520,14 +520,14 @@ d!==qa)m.blendFunc(D(c),D(d)),Ua=c,qa=d}else qa=Ua=la=null};this.setTexture=func
|
|
|
THREE.Math.isPowerOfTwo(c.height),e=D(a.format),f=D(a.type);y(m.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture)for(h=0,k=g.length;h<k;h++)c=g[h],a.format!==THREE.RGBAFormat?m.compressedTexImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,c.data):
|
|
|
m.texImage2D(m.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);else if(0<g.length&&d){h=0;for(k=g.length;h<k;h++)c=g[h],m.texImage2D(m.TEXTURE_2D,h,e,e,f,c);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&m.generateMipmap(m.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else m.activeTexture(m.TEXTURE0+b),m.bindTexture(m.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",Pb);a.__webglTexture=m.createTexture();O.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=D(a.format),e=D(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);y(m.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer();a.__webglRenderbuffer[f]=m.createRenderbuffer();
|
|
|
-m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);L(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),
|
|
|
+m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);K(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),
|
|
|
y(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):
|
|
|
-L(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=$a,a=Ca,d=ma,e=Ba);b!==ta&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),ta=b);Da=c;na=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);
|
|
|
+K(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=$a,a=Ca,d=ma,e=Ba);b!==ta&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),ta=b);Da=c;na=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.position=new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace=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.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,l=g.vertices,k=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var q=l.length;b<q;b++){var s=l[b].clone();d&&s.applyMatrix4(d);h.push(s)}b=0;for(q=n.length;b<q;b++){var s=n[b],t,u,p=s.vertexNormals,v=s.vertexColors;t=new THREE.Face3(s.a+
|
|
|
-f,s.b+f,s.c+f);t.normal.copy(s.normal);e&&t.normal.applyMatrix3(e).normalize();h=0;for(l=p.length;h<l;h++)u=p[h].clone(),e&&u.applyMatrix3(e).normalize(),t.vertexNormals.push(u);t.color.copy(s.color);h=0;for(l=v.length;h<l;h++)u=v[h],t.vertexColors.push(u.clone());t.materialIndex=s.materialIndex+c;t.centroid.copy(s.centroid);d&&t.centroid.applyMatrix4(d);k.push(t)}b=0;for(q=g.length;b<q;b++){c=g[b];d=[];h=0;for(l=c.length;h<l;h++)d.push(new THREE.Vector2(c[h].x,c[h].y));a.push(d)}},randomPointInTriangle:function(){var a=
|
|
|
+return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.position=new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace=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.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.rotation=this.z=this.y=this.x=0;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,h=a.vertices,l=g.vertices,k=a.faces,n=g.faces;a=a.faceVertexUvs[0];g=g.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));b=0;for(var q=l.length;b<q;b++){var s=l[b].clone();d&&s.applyMatrix4(d);h.push(s)}b=0;for(q=n.length;b<q;b++){var s=n[b],u,t,p=s.vertexNormals,v=s.vertexColors;u=new THREE.Face3(s.a+
|
|
|
+f,s.b+f,s.c+f);u.normal.copy(s.normal);e&&u.normal.applyMatrix3(e).normalize();h=0;for(l=p.length;h<l;h++)t=p[h].clone(),e&&t.applyMatrix3(e).normalize(),u.vertexNormals.push(t);u.color.copy(s.color);h=0;for(l=v.length;h<l;h++)t=v[h],u.vertexColors.push(t.clone());u.materialIndex=s.materialIndex+c;u.centroid.copy(s.centroid);d&&u.centroid.applyMatrix4(d);k.push(u)}b=0;for(q=g.length;b<q;b++){c=g[b];d=[];h=0;for(l=c.length;h<l;h++)d.push(new THREE.Vector2(c[h].x,c[h].y));a.push(d)}},randomPointInTriangle:function(){var a=
|
|
|
new THREE.Vector3;return function(b,c,d){var e=new THREE.Vector3,f=THREE.Math.random16(),g=THREE.Math.random16();1<f+g&&(f=1-f,g=1-g);var h=1-f-g;e.copy(b);e.multiplyScalar(f);a.copy(c);a.multiplyScalar(g);e.add(a);a.copy(d);a.multiplyScalar(h);e.add(a);return e}}(),randomPointInFace:function(a,b,c){return THREE.GeometryUtils.randomPointInTriangle(b.vertices[a.a],b.vertices[a.b],b.vertices[a.c])},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-
|
|
|
c)/2);return 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,g=a.vertices,h=f.length,l=0,k=[],n,q,s;for(e=0;e<h;e++)d=f[e],n=g[d.a],q=g[d.b],s=g[d.c],d._area=THREE.GeometryUtils.triangleArea(n,q,s),l+=d._area,k[e]=l;d=[];for(e=0;e<b;e++)g=THREE.Math.random16()*l,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){a.subVectors(d,c);b.subVectors(e,c);a.cross(b);return 0.5*
|
|
|
a.length()}}(),center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.addVectors(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},triangulateQuads:function(a){var b,c,d,e,f=[],g=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faces.length;b<c;b++)for(f.push(a.faces[b]),d=0,e=a.faceVertexUvs.length;d<e;d++)g[d].push(a.faceVertexUvs[d][b]);a.faces=f;a.faceVertexUvs=g;a.computeCentroids();
|
|
@@ -538,16 +538,16 @@ e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.
|
|
|
b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;var g=new XMLHttpRequest;g.onload=function(){var a=THREE.ImageUtils.parseDDS(g.response,!0);if(a.isCubemap)for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var n=0;n<a.mipmapCount;n++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+n]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}else f.image.width=a.width,f.image.height=a.height,
|
|
|
f.mipmaps=a.mipmaps;f.format=a.format;f.needsUpdate=!0;c&&c(f)};g.onerror=d;g.open("GET",a,!0);g.responseType="arraybuffer";g.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}function d(a,b,c,d){var e=c*d*4;a=new Uint8Array(a,b,e);for(var e=new Uint8Array(e),f=b=0,g=0;g<d;g++)for(var h=0;h<c;h++){var k=a[f];f++;var l=a[f];f++;var n=a[f];f++;var q=a[f];f++;e[b]=n;b++;e[b]=l;b++;e[b]=k;b++;e[b]=q;b++}return e}
|
|
|
var e={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},f=c("DXT1"),g=c("DXT3"),h=c("DXT5"),l=new Int32Array(a,0,31);if(542327876!==l[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),e;if(!l[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),e;var k=l[21],n=!1;switch(k){case f:f=8;e.format=THREE.RGB_S3TC_DXT1_Format;break;case g:f=16;e.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:f=16;e.format=THREE.RGBA_S3TC_DXT5_Format;
|
|
|
-break;default:if(32==l[22]&&l[23]&16711680&&l[24]&65280&&l[25]&255&&l[26]&4278190080)n=!0,f=64,e.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(k&255,k>>8&255,k>>16&255,k>>24&255)),e}e.mipmapCount=1;l[2]&131072&&!1!==b&&(e.mipmapCount=Math.max(1,l[7]));e.isCubemap=l[28]&512?!0:!1;e.width=l[4];e.height=l[3];for(var l=l[1]+4,g=e.width,h=e.height,k=e.isCubemap?6:1,q=0;q<k;q++){for(var s=0;s<e.mipmapCount;s++){if(n)var t=d(a,l,
|
|
|
-g,h),u=t.length;else u=Math.max(4,g)/4*Math.max(4,h)/4*f,t=new Uint8Array(a,l,u);e.mipmaps.push({data:t,width:g,height:h});l+=u;g=Math.max(0.5*g,1);h=Math.max(0.5*h,1)}g=e.width;h=e.height}return e},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,
|
|
|
-e),k=l.data,n=0;n<d;n++)for(var q=0;q<e;q++){var s=0>q-1?0:q-1,t=q+1>e-1?e-1:q+1,u=0>n-1?0:n-1,p=n+1>d-1?d-1:n+1,v=[],w=[0,0,h[4*(q*d+n)]/255*b];v.push([-1,0,h[4*(q*d+u)]/255*b]);v.push([-1,-1,h[4*(s*d+u)]/255*b]);v.push([0,-1,h[4*(s*d+n)]/255*b]);v.push([1,-1,h[4*(s*d+p)]/255*b]);v.push([1,0,h[4*(q*d+p)]/255*b]);v.push([1,1,h[4*(t*d+p)]/255*b]);v.push([0,1,h[4*(t*d+n)]/255*b]);v.push([-1,1,h[4*(t*d+u)]/255*b]);s=[];u=v.length;for(t=0;t<u;t++){var p=v[t],r=v[(t+1)%u],p=[p[0]-w[0],p[1]-w[1],p[2]-w[2]],
|
|
|
-r=[r[0]-w[0],r[1]-w[1],r[2]-w[2]];s.push(c([p[1]*r[2]-p[2]*r[1],p[2]*r[0]-p[0]*r[2],p[0]*r[1]-p[1]*r[0]]))}v=[0,0,0];for(t=0;t<s.length;t++)v[0]+=s[t][0],v[1]+=s[t][1],v[2]+=s[t][2];v[0]/=s.length;v[1]/=s.length;v[2]/=s.length;w=4*(q*d+n);k[w]=(v[0]+1)/2*255|0;k[w+1]=(v[1]+1)/2*255|0;k[w+2]=255*v[2]|0;k[w+3]=255}g.putImageData(l,0,0);return f},generateDataTexture:function(a,b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*
|
|
|
+break;default:if(32==l[22]&&l[23]&16711680&&l[24]&65280&&l[25]&255&&l[26]&4278190080)n=!0,f=64,e.format=THREE.RGBAFormat;else return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(k&255,k>>8&255,k>>16&255,k>>24&255)),e}e.mipmapCount=1;l[2]&131072&&!1!==b&&(e.mipmapCount=Math.max(1,l[7]));e.isCubemap=l[28]&512?!0:!1;e.width=l[4];e.height=l[3];for(var l=l[1]+4,g=e.width,h=e.height,k=e.isCubemap?6:1,q=0;q<k;q++){for(var s=0;s<e.mipmapCount;s++){if(n)var u=d(a,l,
|
|
|
+g,h),t=u.length;else t=Math.max(4,g)/4*Math.max(4,h)/4*f,u=new Uint8Array(a,l,t);e.mipmaps.push({data:u,width:g,height:h});l+=t;g=Math.max(0.5*g,1);h=Math.max(0.5*h,1)}g=e.width;h=e.height}return e},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,l=g.createImageData(d,
|
|
|
+e),k=l.data,n=0;n<d;n++)for(var q=0;q<e;q++){var s=0>q-1?0:q-1,u=q+1>e-1?e-1:q+1,t=0>n-1?0:n-1,p=n+1>d-1?d-1:n+1,v=[],w=[0,0,h[4*(q*d+n)]/255*b];v.push([-1,0,h[4*(q*d+t)]/255*b]);v.push([-1,-1,h[4*(s*d+t)]/255*b]);v.push([0,-1,h[4*(s*d+n)]/255*b]);v.push([1,-1,h[4*(s*d+p)]/255*b]);v.push([1,0,h[4*(q*d+p)]/255*b]);v.push([1,1,h[4*(u*d+p)]/255*b]);v.push([0,1,h[4*(u*d+n)]/255*b]);v.push([-1,1,h[4*(u*d+t)]/255*b]);s=[];t=v.length;for(u=0;u<t;u++){var p=v[u],r=v[(u+1)%t],p=[p[0]-w[0],p[1]-w[1],p[2]-w[2]],
|
|
|
+r=[r[0]-w[0],r[1]-w[1],r[2]-w[2]];s.push(c([p[1]*r[2]-p[2]*r[1],p[2]*r[0]-p[0]*r[2],p[0]*r[1]-p[1]*r[0]]))}v=[0,0,0];for(u=0;u<s.length;u++)v[0]+=s[u][0],v[1]+=s[u][1],v[2]+=s[u][2];v[0]/=s.length;v[1]/=s.length;v[2]/=s.length;w=4*(q*d+n);k[w]=(v[0]+1)/2*255|0;k[w+1]=(v[1]+1)/2*255|0;k[w+2]=255*v[2]|0;k[w+3]=255}g.putImageData(l,0,0);return f},generateDataTexture:function(a,b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*
|
|
|
h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=
|
|
|
-String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,l,k,n,q,s,t,u,p,v,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),k=b.length,a=0;a<k;)switch(l=b[a++],l){case "m":l=b[a++]*c+d;n=b[a++]*c;e.moveTo(l,n);break;case "l":l=b[a++]*c+d;n=b[a++]*c;e.lineTo(l,n);break;case "q":l=b[a++]*
|
|
|
-c+d;n=b[a++]*c;t=b[a++]*c+d;u=b[a++]*c;e.quadraticCurveTo(t,u,l,n);if(g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++){var r=g/h;THREE.Shape.Utils.b2(r,q,t,l);THREE.Shape.Utils.b2(r,s,u,n)}break;case "b":if(l=b[a++]*c+d,n=b[a++]*c,t=b[a++]*c+d,u=b[a++]*-c,p=b[a++]*c+d,v=b[a++]*-c,e.bezierCurveTo(l,n,t,u,p,v),g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++)r=g/h,THREE.Shape.Utils.b3(r,q,t,p,l),THREE.Shape.Utils.b3(r,s,u,v,n)}return{offset:w.ha*c,path:e}}}};
|
|
|
+String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,l,k,n,q,s,u,t,p,v,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),k=b.length,a=0;a<k;)switch(l=b[a++],l){case "m":l=b[a++]*c+d;n=b[a++]*c;e.moveTo(l,n);break;case "l":l=b[a++]*c+d;n=b[a++]*c;e.lineTo(l,n);break;case "q":l=b[a++]*
|
|
|
+c+d;n=b[a++]*c;u=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(u,t,l,n);if(g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++){var r=g/h;THREE.Shape.Utils.b2(r,q,u,l);THREE.Shape.Utils.b2(r,s,t,n)}break;case "b":if(l=b[a++]*c+d,n=b[a++]*c,u=b[a++]*c+d,t=b[a++]*-c,p=b[a++]*c+d,v=b[a++]*-c,e.bezierCurveTo(l,n,u,t,p,v),g=f[f.length-1])for(q=g.x,s=g.y,g=1,h=this.divisions;g<=h;g++)r=g/h,THREE.Shape.Utils.b3(r,q,u,p,l),THREE.Shape.Utils.b3(r,s,t,v,n)}return{offset:w.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],l,k,n;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var q=2*e;for(k=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}l=k;e<=l&&(l=0);k=l+1;e<=k&&(k=0);n=k+1;e<=n&&(n=0);var s;a:{var t=s=void 0,u=void 0,p=void 0,v=void 0,w=void 0,r=void 0,x=void 0,z=
|
|
|
-void 0,t=a[g[l]].x,u=a[g[l]].y,p=a[g[k]].x,v=a[g[k]].y,w=a[g[n]].x,r=a[g[n]].y;if(1E-10>(p-t)*(r-u)-(v-u)*(w-t))s=!1;else{var G=void 0,J=void 0,H=void 0,B=void 0,A=void 0,K=void 0,C=void 0,Q=void 0,y=void 0,L=void 0,y=Q=C=z=x=void 0,G=w-p,J=r-v,H=t-w,B=u-r,A=p-t,K=v-u;for(s=0;s<e;s++)if(x=a[g[s]].x,z=a[g[s]].y,!(x===t&&z===u||x===p&&z===v||x===w&&z===r)&&(C=x-t,Q=z-u,y=x-p,L=z-v,x-=w,z-=r,y=G*L-J*y,C=A*Q-K*C,Q=H*z-B*x,-1E-10<=y&&-1E-10<=Q&&-1E-10<=C)){s=!1;break a}s=!0}}if(s){f.push([a[g[l]],a[g[k]],
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],l,k,n;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var q=2*e;for(k=e-1;2<e;){if(0>=q--){console.log("Warning, unable to triangulate polygon!");break}l=k;e<=l&&(l=0);k=l+1;e<=k&&(k=0);n=k+1;e<=n&&(n=0);var s;a:{var u=s=void 0,t=void 0,p=void 0,v=void 0,w=void 0,r=void 0,x=void 0,z=
|
|
|
+void 0,u=a[g[l]].x,t=a[g[l]].y,p=a[g[k]].x,v=a[g[k]].y,w=a[g[n]].x,r=a[g[n]].y;if(1E-10>(p-u)*(r-t)-(v-t)*(w-u))s=!1;else{var F=void 0,P=void 0,B=void 0,C=void 0,A=void 0,I=void 0,H=void 0,N=void 0,y=void 0,K=void 0,y=N=H=z=x=void 0,F=w-p,P=r-v,B=u-w,C=t-r,A=p-u,I=v-t;for(s=0;s<e;s++)if(x=a[g[s]].x,z=a[g[s]].y,!(x===u&&z===t||x===p&&z===v||x===w&&z===r)&&(H=x-u,N=z-t,y=x-p,K=z-v,x-=w,z-=r,y=F*K-P*y,H=A*N-I*H,N=B*z-C*x,-1E-10<=y&&-1E-10<=N&&-1E-10<=H)){s=!1;break a}s=!0}}if(s){f.push([a[g[l]],a[g[k]],
|
|
|
a[g[n]]]);h.push([g[l],g[k],g[n]]);l=k;for(n=k+1;n<e;l++,n++)g[l]=g[n];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(a){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,l;g<=h;)if(d=Math.floor(g+(h-g)/2),l=c[d]-f,0>l)g=d+1;else if(0<l)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -568,20 +568,20 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),l=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(l);l=l.getPoint(1);h.push(l.x);h.push(l.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,l,k,n,q,s,t,u,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];l=f[3];q=f[0];s=f[1];0<c.length?(g=c[c.length-1],t=g.x,
|
|
|
-u=g.y):(g=this.actions[d-1].args,t=g[g.length-2],u=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,t,q,h),p=THREE.Shape.Utils.b2(p,u,s,l),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];l=f[5];q=f[0];s=f[1];k=f[2];n=f[3];0<c.length?(g=c[c.length-1],t=g.x,u=g.y):(g=this.actions[d-1].args,t=g[g.length-2],u=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,t,q,k,h),p=THREE.Shape.Utils.b3(p,u,s,n,l),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
-this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];l=f[1];s=f[2];k=f[3];g=f[4];q=!!f[5];t=g-k;u=2*a;for(f=1;f<=u;f++)p=f/u,q||(p=1-p),p=k+p*t,g=h+s*Math.cos(p),p=l+s*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:for(h=f[0],l=f[1],s=f[2],n=f[3],k=f[4],g=f[5],q=!!f[6],t=g-k,u=2*a,f=1;f<=u;f++)p=f/u,q||
|
|
|
-(p=1-p),p=k+p*t,g=h+s*Math.cos(p),p=l+n*Math.sin(p),c.push(new THREE.Vector2(g,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,l,k,n,q,s,u,t,p;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];l=f[3];q=f[0];s=f[1];0<c.length?(g=c[c.length-1],u=g.x,
|
|
|
+t=g.y):(g=this.actions[d-1].args,u=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b2(p,u,q,h),p=THREE.Shape.Utils.b2(p,t,s,l),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];l=f[5];q=f[0];s=f[1];k=f[2];n=f[3];0<c.length?(g=c[c.length-1],u=g.x,t=g.y):(g=this.actions[d-1].args,u=g[g.length-2],t=g[g.length-1]);for(f=1;f<=a;f++)p=f/a,g=THREE.Shape.Utils.b3(p,u,q,k,h),p=THREE.Shape.Utils.b3(p,t,s,n,l),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.CSPLINE_THRU:g=
|
|
|
+this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;p=p.concat(f[0]);p=new THREE.SplineCurve(p);for(f=1;f<=g;f++)c.push(p.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];l=f[1];s=f[2];k=f[3];g=f[4];q=!!f[5];u=g-k;t=2*a;for(f=1;f<=t;f++)p=f/t,q||(p=1-p),p=k+p*u,g=h+s*Math.cos(p),p=l+s*Math.sin(p),c.push(new THREE.Vector2(g,p));break;case THREE.PathActions.ELLIPSE:for(h=f[0],l=f[1],s=f[2],n=f[3],k=f[4],g=f[5],q=!!f[6],u=g-k,t=2*a,f=1;f<=t;f++)p=f/t,q||
|
|
|
+(p=1-p),p=k+p*u,g=h+s*Math.cos(p),p=l+n*Math.sin(p),c.push(new THREE.Vector2(g,p))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
THREE.Path.prototype.toShapes=function(a){function b(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(1E-10<Math.abs(l)){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var c,d,e,f,g=[],h=new THREE.Path;c=0;for(d=this.actions.length;c<d;c++)e=this.actions[c],f=e.args,e=e.action,e==
|
|
|
-THREE.PathActions.MOVE_TO&&0!=h.actions.length&&(g.push(h),h=new THREE.Path),h[e].apply(h,f);0!=h.actions.length&&g.push(h);if(0==g.length)return[];var l,k,n;f=[];if(1==g.length)return k=g[0],n=new THREE.Shape,n.actions=k.actions,n.curves=k.curves,f.push(n),f;var q=!THREE.Shape.Utils.isClockWise(g[0].getPoints()),q=a?!q:q;n=[];h=[];e=[];var s=0,t;h[s]=void 0;e[s]=[];c=0;for(d=g.length;c<d;c++)k=g[c],t=k.getPoints(),l=THREE.Shape.Utils.isClockWise(t),(l=a?!l:l)?(!q&&h[s]&&s++,h[s]={s:new THREE.Shape,
|
|
|
-p:t},h[s].s.actions=k.actions,h[s].s.curves=k.curves,q&&s++,e[s]=[]):e[s].push({h:k,p:t[0]});if(1<h.length){c=!1;d=[];a=0;for(g=h.length;a<g;a++)n[a]=[];a=0;for(g=h.length;a<g;a++)for(k=e[a],l=0;l<k.length;l++){q=k[l];s=!0;for(t=0;t<h.length;t++)b(q.p,h[t].p)&&(a!=t&&d.push({froms:a,tos:t,hole:l}),s?(s=!1,n[t].push(q)):c=!0);s&&n[a].push(q)}0<d.length&&(c||(e=n))}c=0;for(d=h.length;c<d;c++)for(n=h[c].s,f.push(n),a=e[c],g=0,k=a.length;g<k;g++)n.holes.push(a[g].h);return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
+THREE.PathActions.MOVE_TO&&0!=h.actions.length&&(g.push(h),h=new THREE.Path),h[e].apply(h,f);0!=h.actions.length&&g.push(h);if(0==g.length)return[];var l,k,n;f=[];if(1==g.length)return k=g[0],n=new THREE.Shape,n.actions=k.actions,n.curves=k.curves,f.push(n),f;var q=!THREE.Shape.Utils.isClockWise(g[0].getPoints()),q=a?!q:q;n=[];h=[];e=[];var s=0,u;h[s]=void 0;e[s]=[];c=0;for(d=g.length;c<d;c++)k=g[c],u=k.getPoints(),l=THREE.Shape.Utils.isClockWise(u),(l=a?!l:l)?(!q&&h[s]&&s++,h[s]={s:new THREE.Shape,
|
|
|
+p:u},h[s].s.actions=k.actions,h[s].s.curves=k.curves,q&&s++,e[s]=[]):e[s].push({h:k,p:u[0]});if(1<h.length){c=!1;d=[];a=0;for(g=h.length;a<g;a++)n[a]=[];a=0;for(g=h.length;a<g;a++)for(k=e[a],l=0;l<k.length;l++){q=k[l];s=!0;for(u=0;u<h.length;u++)b(q.p,h[u].p)&&(a!=u&&d.push({froms:a,tos:u,hole:l}),s?(s=!1,n[u].push(q)):c=!0);s&&n[a].push(q)}0<d.length&&(c||(e=n))}c=0;for(d=h.length;c<d;c++)for(n=h[c].s,f.push(n),a=e[c],g=0,k=a.length;g<k;g++)n.holes.push(a[g].h);return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,q=a.y-d.y,H=h*k-g*l,B=h*n-g*q;if(1E-10<Math.abs(H)){if(0<H){if(0>B||B>H)return[];k=l*n-k*q;if(0>k||k>H)return[]}else{if(0<B||B<H)return[];k=l*n-k*q;if(0<k||k<H)return[]}if(0==k)return!f||0!=B&&B!=H?[a]:[];if(k==H)return!f||0!=B&&B!=H?[b]:[];if(0==B)return[d];
|
|
|
-if(B==H)return[e];f=k/H;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=B||l*n!=k*q)return[];h=0==g&&0==h;k=0==k&&0==l;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,H=d.x,l=e,d=e.x):(b=e,H=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,H=d.y,l=e,d=e.y):(b=e,H=e.y,l=d,d=d.y));return k<=H?a<H?[]:a==H?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
|
|
|
+THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,n=a.x-d.x,q=a.y-d.y,B=h*k-g*l,C=h*n-g*q;if(1E-10<Math.abs(B)){if(0<B){if(0>C||C>B)return[];k=l*n-k*q;if(0>k||k>B)return[]}else{if(0<C||C<B)return[];k=l*n-k*q;if(0<k||k<B)return[]}if(0==k)return!f||0!=C&&C!=B?[a]:[];if(k==B)return!f||0!=C&&C!=B?[b]:[];if(0==C)return[d];
|
|
|
+if(C==B)return[e];f=k/B;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=C||l*n!=k*q)return[];h=0==g&&0==h;k=0==k&&0==l;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,B=d.x,l=e,d=e.x):(b=e,B=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,B=d.y,l=e,d=e.y):(b=e,B=e.y,l=d,d=d.y));return k<=B?a<B?[]:a==B?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]:
|
|
|
[g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,l,k,n={};h=a.concat();for(f in b)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)k=h[f].x+":"+h[f].y,void 0!==n[k]&&console.log("Duplicate point",k),n[k]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]);if(!d)return!1;d=k.length-1;
|
|
|
-f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,q,J,H,B,A,K,C=[],Q,y;for(H in b)l.push(H);for(var L=2*l.length;0<l.length;){L--;if(0>L){console.log("Infinite Loop! Holes left:"+
|
|
|
-l.length+", Probably Hole outside Shape!");break}for(q=0;q<h.length;q++){J=h[q];n=-1;for(H=0;H<l.length;H++)if(B=l[H],K=J.x+":"+J.y+":"+B,void 0===C[K]){k=b[B];for(B=0;B<k.length;B++)if(A=k[B],c(q,B)&&!f(J,A)&&!g(J,A)){n=B;l.splice(H,1);B=h.slice(0,q+1);A=h.slice(q);Q=k.slice(n);y=k.slice(0,n+1);h=B.concat(Q).concat(y).concat(A);break}if(0<=n)break;C[K]=!0}if(0<=n)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(l=q[f],h=0;3>h;h++)k=l[h].x+":"+l[h].y,k=
|
|
|
+f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat(),k,l=[],n,q,P,B,C,A,I,H=[],N,y;for(B in b)l.push(B);for(var K=2*l.length;0<l.length;){K--;if(0>K){console.log("Infinite Loop! Holes left:"+
|
|
|
+l.length+", Probably Hole outside Shape!");break}for(q=0;q<h.length;q++){P=h[q];n=-1;for(B=0;B<l.length;B++)if(C=l[B],I=P.x+":"+P.y+":"+C,void 0===H[I]){k=b[C];for(C=0;C<k.length;C++)if(A=k[C],c(q,C)&&!f(P,A)&&!g(P,A)){n=C;l.splice(B,1);C=h.slice(0,q+1);A=h.slice(q);N=k.slice(n);y=k.slice(0,n+1);h=C.concat(N).concat(y).concat(A);break}if(0<=n)break;H[I]=!0}if(0<=n)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(l=q[f],h=0;3>h;h++)k=l[h].x+":"+l[h].y,k=
|
|
|
n[k],void 0!==k&&(l[h]=k);return q.concat()},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(a){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)};
|
|
@@ -617,32 +617,32 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspe
|
|
|
THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())};
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
-THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,r=h.heightSegments,x=e/2,z=f/2,G=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",r=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var J=w+1,H=r+1,B=e/w,A=f/r,K=new THREE.Vector3;K[v]=0<g?1:-1;for(e=0;e<H;e++)for(f=0;f<J;f++){var C=new THREE.Vector3;C[a]=(f*B-x)*c;C[b]=(e*A-z)*d;C[v]=g;h.vertices.push(C)}for(e=
|
|
|
-0;e<r;e++)for(f=0;f<w;f++)z=f+J*e,a=f+J*(e+1),b=f+1+J*(e+1),c=f+1+J*e,d=new THREE.Vector2(f/w,1-e/r),g=new THREE.Vector2(f/w,1-(e+1)/r),v=new THREE.Vector2((f+1)/w,1-(e+1)/r),x=new THREE.Vector2((f+1)/w,1-e/r),z=new THREE.Face3(z+G,a+G,c+G),z.normal.copy(K),z.vertexNormals.push(K.clone(),K.clone(),K.clone()),z.materialIndex=p,h.faces.push(z),h.faceVertexUvs[0].push([d,g,x]),z=new THREE.Face3(a+G,b+G,c+G),z.normal.copy(K),z.vertexNormals.push(K.clone(),K.clone(),K.clone()),z.materialIndex=p,h.faces.push(z),
|
|
|
+THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var v,w=h.widthSegments,r=h.heightSegments,x=e/2,z=f/2,F=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)v="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)v="y",r=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)v="x",w=h.depthSegments;var P=w+1,B=r+1,C=e/w,A=f/r,I=new THREE.Vector3;I[v]=0<g?1:-1;for(e=0;e<B;e++)for(f=0;f<P;f++){var H=new THREE.Vector3;H[a]=(f*C-x)*c;H[b]=(e*A-z)*d;H[v]=g;h.vertices.push(H)}for(e=
|
|
|
+0;e<r;e++)for(f=0;f<w;f++)z=f+P*e,a=f+P*(e+1),b=f+1+P*(e+1),c=f+1+P*e,d=new THREE.Vector2(f/w,1-e/r),g=new THREE.Vector2(f/w,1-(e+1)/r),v=new THREE.Vector2((f+1)/w,1-(e+1)/r),x=new THREE.Vector2((f+1)/w,1-e/r),z=new THREE.Face3(z+F,a+F,c+F),z.normal.copy(I),z.vertexNormals.push(I.clone(),I.clone(),I.clone()),z.materialIndex=p,h.faces.push(z),h.faceVertexUvs[0].push([d,g,x]),z=new THREE.Face3(a+F,b+F,c+F),z.normal.copy(I),z.vertexNormals.push(I.clone(),I.clone(),I.clone()),z.materialIndex=p,h.faces.push(z),
|
|
|
h.faceVertexUvs[0].push([g.clone(),v,x.clone()])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,
|
|
|
5);this.computeCentroids();this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.radius=a=a||50;this.segments=b=void 0!==b?Math.max(3,b):8;this.thetaStart=c=void 0!==c?c:0;this.thetaLength=d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,l=c+e/b*d;h.x=a*Math.cos(l);h.y=a*Math.sin(l);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,
|
|
|
-e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),g.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=THREE.BoxGeometry;THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,l,k=[],n=[];for(l=0;l<=e;l++){var q=[],s=[],t=l/e,u=t*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,v=new THREE.Vector3;v.x=u*Math.sin(p*Math.PI*2);v.y=-t*c+g;v.z=u*Math.cos(p*Math.PI*2);this.vertices.push(v);q.push(this.vertices.length-1);s.push(new THREE.Vector2(p,
|
|
|
-1-t))}k.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[k[0][h]].clone(),s=this.vertices[k[0][h+1]].clone()):(q=this.vertices[k[1][h]].clone(),s=this.vertices[k[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),l=0;l<e;l++){var t=k[l][h],u=k[l+1][h],p=k[l+1][h+1],v=k[l][h+1],w=q.clone(),r=q.clone(),x=s.clone(),z=s.clone(),G=n[l][h].clone(),J=n[l+1][h].clone(),H=n[l+1][h+1].clone(),B=n[l][h+1].clone();this.faces.push(new THREE.Face3(t,
|
|
|
-u,v,[w,r,z]));this.faceVertexUvs[0].push([G,J,B]);this.faces.push(new THREE.Face3(u,p,v,[r.clone(),x,z.clone()]));this.faceVertexUvs[0].push([J.clone(),H,B.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)t=k[0][h],u=k[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),G=n[0][h].clone(),J=n[0][h+1].clone(),H=new THREE.Vector2(J.x,0),this.faces.push(new THREE.Face3(t,u,p,[w,r,x])),this.faceVertexUvs[0].push([G,
|
|
|
-J,H]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)t=k[l][h+1],u=k[l][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),G=n[l][h+1].clone(),J=n[l][h].clone(),H=new THREE.Vector2(J.x,1),this.faces.push(new THREE.Face3(t,u,p,[w,r,x])),this.faceVertexUvs[0].push([G,J,H]);this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+e+1,0,[c.clone(),c.clone(),c.clone()])),this.faceVertexUvs[0].push([f[e].clone(),f[e+1].clone(),g.clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=THREE.BoxGeometry;THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var g=c/2,h,l,k=[],n=[];for(l=0;l<=e;l++){var q=[],s=[],u=l/e,t=u*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,v=new THREE.Vector3;v.x=t*Math.sin(p*Math.PI*2);v.y=-u*c+g;v.z=t*Math.cos(p*Math.PI*2);this.vertices.push(v);q.push(this.vertices.length-1);s.push(new THREE.Vector2(p,
|
|
|
+1-u))}k.push(q);n.push(s)}c=(b-a)/c;for(h=0;h<d;h++)for(0!==a?(q=this.vertices[k[0][h]].clone(),s=this.vertices[k[0][h+1]].clone()):(q=this.vertices[k[1][h]].clone(),s=this.vertices[k[1][h+1]].clone()),q.setY(Math.sqrt(q.x*q.x+q.z*q.z)*c).normalize(),s.setY(Math.sqrt(s.x*s.x+s.z*s.z)*c).normalize(),l=0;l<e;l++){var u=k[l][h],t=k[l+1][h],p=k[l+1][h+1],v=k[l][h+1],w=q.clone(),r=q.clone(),x=s.clone(),z=s.clone(),F=n[l][h].clone(),P=n[l+1][h].clone(),B=n[l+1][h+1].clone(),C=n[l][h+1].clone();this.faces.push(new THREE.Face3(u,
|
|
|
+t,v,[w,r,z]));this.faceVertexUvs[0].push([F,P,C]);this.faces.push(new THREE.Face3(t,p,v,[r.clone(),x,z.clone()]));this.faceVertexUvs[0].push([P.clone(),B,C.clone()])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,g,0)),h=0;h<d;h++)u=k[0][h],t=k[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),F=n[0][h].clone(),P=n[0][h+1].clone(),B=new THREE.Vector2(P.x,0),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([F,
|
|
|
+P,B]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-g,0)),h=0;h<d;h++)u=k[l][h+1],t=k[l][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),F=n[l][h+1].clone(),P=n[l][h].clone(),B=new THREE.Vector2(P.x,1),this.faces.push(new THREE.Face3(u,t,p,[w,r,x])),this.faceVertexUvs[0].push([F,P,B]);this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.Math.sign,e=1,e=a.x-b.x,f=a.y-b.y,g=c.x-a.x,h=c.y-a.y,k=e*e+f*f;if(1E-10<Math.abs(e*h-f*g)){var l=Math.sqrt(k),d=Math.sqrt(g*g+h*h),k=b.x-f/l;b=b.y+e/l;g=((c.x-h/d-k)*h-(c.y+g/d-b)*g)/(e*h-f*g);c=k+e*g-a.x;a=b+f*g-a.y;e=c*c+a*a;if(2>=e)return new THREE.Vector2(c,a);e=Math.sqrt(e/2)}else a=!1,1E-10<e?1E-10<g&&(a=!0):-1E-10>e?-1E-10>g&&
|
|
|
-(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(M=c.length;0<=--M;){e=M;f=M-1;0>f&&(f=c.length-1);for(var g=0,h=t+2*n,g=0;g<h;g++){var k=ia*g,l=ia*(g+1),p=d+e+k,k=d+f+k,q=d+f+l,l=d+e+l,s=c,u=g,v=h,w=e,z=f,p=p+Q,k=k+Q,q=q+Q,l=l+Q;C.faces.push(new THREE.Face3(p,k,l,null,null,r));C.faces.push(new THREE.Face3(k,q,l,null,null,r));p=x.generateSideWallUV(C,a,s,b,p,k,q,l,u,v,w,z);C.faceVertexUvs[0].push([p[0],p[1],
|
|
|
-p[3]]);C.faceVertexUvs[0].push([p[1],p[2],p[3]])}}}function f(a,b,c){C.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=Q;d+=Q;e+=Q;C.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?x.generateBottomUV(C,a,b,c,d,e):x.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:l-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,s=
|
|
|
-void 0!==b.curveSegments?b.curveSegments:12,t=void 0!==b.steps?b.steps:1,u=b.extrudePath,p,v=!1,w=b.material,r=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,z,G,J,H;u&&(p=u.getSpacedPoints(t),v=!0,q=!1,z=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(u,t,!1),G=new THREE.Vector3,J=new THREE.Vector3,H=new THREE.Vector3);q||(k=l=n=0);var B,A,K,C=this,Q=this.vertices.length,u=a.extractPoints(s),s=u.shape,y=u.holes;if(u=!THREE.Shape.Utils.isClockWise(s)){s=
|
|
|
-s.reverse();A=0;for(K=y.length;A<K;A++)B=y[A],THREE.Shape.Utils.isClockWise(B)&&(y[A]=B.reverse());u=!1}var L=THREE.Shape.Utils.triangulateShape(s,y),E=s;A=0;for(K=y.length;A<K;A++)B=y[A],s=s.concat(B);var D,F,S,Z,V,ia=s.length,Y,ja=L.length,u=[],M=0;S=E.length;D=S-1;for(F=M+1;M<S;M++,D++,F++)D===S&&(D=0),F===S&&(F=0),u[M]=d(E[M],E[D],E[F]);var ka=[],P,U=u.concat();A=0;for(K=y.length;A<K;A++){B=y[A];P=[];M=0;S=B.length;D=S-1;for(F=M+1;M<S;M++,D++,F++)D===S&&(D=0),F===S&&(F=0),P[M]=d(B[M],B[D],B[F]);
|
|
|
-ka.push(P);U=U.concat(P)}for(D=0;D<n;D++){S=D/n;Z=l*(1-S);F=k*Math.sin(S*Math.PI/2);M=0;for(S=E.length;M<S;M++)V=c(E[M],u[M],F),f(V.x,V.y,-Z);A=0;for(K=y.length;A<K;A++)for(B=y[A],P=ka[A],M=0,S=B.length;M<S;M++)V=c(B[M],P[M],F),f(V.x,V.y,-Z)}F=k;for(M=0;M<ia;M++)V=q?c(s[M],U[M],F):s[M],v?(J.copy(z.normals[0]).multiplyScalar(V.x),G.copy(z.binormals[0]).multiplyScalar(V.y),H.copy(p[0]).add(J).add(G),f(H.x,H.y,H.z)):f(V.x,V.y,0);for(S=1;S<=t;S++)for(M=0;M<ia;M++)V=q?c(s[M],U[M],F):s[M],v?(J.copy(z.normals[S]).multiplyScalar(V.x),
|
|
|
-G.copy(z.binormals[S]).multiplyScalar(V.y),H.copy(p[S]).add(J).add(G),f(H.x,H.y,H.z)):f(V.x,V.y,h/t*S);for(D=n-1;0<=D;D--){S=D/n;Z=l*(1-S);F=k*Math.sin(S*Math.PI/2);M=0;for(S=E.length;M<S;M++)V=c(E[M],u[M],F),f(V.x,V.y,h+Z);A=0;for(K=y.length;A<K;A++)for(B=y[A],P=ka[A],M=0,S=B.length;M<S;M++)V=c(B[M],P[M],F),v?f(V.x,V.y+p[t-1].y,p[t-1].x+Z):f(V.x,V.y,h+Z)}(function(){if(q){var a;a=0*ia;for(M=0;M<ja;M++)Y=L[M],g(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=t+2*n;a*=ia;for(M=0;M<ja;M++)Y=L[M],g(Y[0]+a,Y[1]+a,Y[2]+a,
|
|
|
-!1)}else{for(M=0;M<ja;M++)Y=L[M],g(Y[2],Y[1],Y[0],!0);for(M=0;M<ja;M++)Y=L[M],g(Y[0]+ia*t,Y[1]+ia*t,Y[2]+ia*t,!1)}})();(function(){var a=0;e(E,a);a+=E.length;A=0;for(K=y.length;A<K;A++)B=y[A],e(B,a),a+=B.length})()};
|
|
|
+(a=!0):d(f)==d(h)&&(a=!0),a?(c=-f,a=e,e=Math.sqrt(k)):(c=e,a=f,e=Math.sqrt(k/2));return new THREE.Vector2(c/e,a/e)}function e(c,d){var e,f;for(L=c.length;0<=--L;){e=L;f=L-1;0>f&&(f=c.length-1);for(var g=0,h=u+2*n,g=0;g<h;g++){var k=ia*g,l=ia*(g+1),p=d+e+k,k=d+f+k,q=d+f+l,l=d+e+l,s=c,t=g,v=h,w=e,y=f,p=p+N,k=k+N,q=q+N,l=l+N;H.faces.push(new THREE.Face3(p,k,l,null,null,r));H.faces.push(new THREE.Face3(k,q,l,null,null,r));p=x.generateSideWallUV(H,a,s,b,p,k,q,l,t,v,w,y);H.faceVertexUvs[0].push([p[0],p[1],
|
|
|
+p[3]]);H.faceVertexUvs[0].push([p[1],p[2],p[3]])}}}function f(a,b,c){H.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=N;d+=N;e+=N;H.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?x.generateBottomUV(H,a,b,c,d,e):x.generateTopUV(H,a,b,c,d,e);H.faceVertexUvs[0].push(c)}var h=void 0!==b.amount?b.amount:100,l=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:l-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,s=
|
|
|
+void 0!==b.curveSegments?b.curveSegments:12,u=void 0!==b.steps?b.steps:1,t=b.extrudePath,p,v=!1,w=b.material,r=b.extrudeMaterial,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,z,F,P,B;t&&(p=t.getSpacedPoints(u),v=!0,q=!1,z=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,u,!1),F=new THREE.Vector3,P=new THREE.Vector3,B=new THREE.Vector3);q||(k=l=n=0);var C,A,I,H=this,N=this.vertices.length,t=a.extractPoints(s),s=t.shape,y=t.holes;if(t=!THREE.Shape.Utils.isClockWise(s)){s=
|
|
|
+s.reverse();A=0;for(I=y.length;A<I;A++)C=y[A],THREE.Shape.Utils.isClockWise(C)&&(y[A]=C.reverse());t=!1}var K=THREE.Shape.Utils.triangulateShape(s,y),E=s;A=0;for(I=y.length;A<I;A++)C=y[A],s=s.concat(C);var D,G,T,Z,V,ia=s.length,Y,ja=K.length,t=[],L=0;T=E.length;D=T-1;for(G=L+1;L<T;L++,D++,G++)D===T&&(D=0),G===T&&(G=0),t[L]=d(E[L],E[D],E[G]);var ka=[],Q,U=t.concat();A=0;for(I=y.length;A<I;A++){C=y[A];Q=[];L=0;T=C.length;D=T-1;for(G=L+1;L<T;L++,D++,G++)D===T&&(D=0),G===T&&(G=0),Q[L]=d(C[L],C[D],C[G]);
|
|
|
+ka.push(Q);U=U.concat(Q)}for(D=0;D<n;D++){T=D/n;Z=l*(1-T);G=k*Math.sin(T*Math.PI/2);L=0;for(T=E.length;L<T;L++)V=c(E[L],t[L],G),f(V.x,V.y,-Z);A=0;for(I=y.length;A<I;A++)for(C=y[A],Q=ka[A],L=0,T=C.length;L<T;L++)V=c(C[L],Q[L],G),f(V.x,V.y,-Z)}G=k;for(L=0;L<ia;L++)V=q?c(s[L],U[L],G):s[L],v?(P.copy(z.normals[0]).multiplyScalar(V.x),F.copy(z.binormals[0]).multiplyScalar(V.y),B.copy(p[0]).add(P).add(F),f(B.x,B.y,B.z)):f(V.x,V.y,0);for(T=1;T<=u;T++)for(L=0;L<ia;L++)V=q?c(s[L],U[L],G):s[L],v?(P.copy(z.normals[T]).multiplyScalar(V.x),
|
|
|
+F.copy(z.binormals[T]).multiplyScalar(V.y),B.copy(p[T]).add(P).add(F),f(B.x,B.y,B.z)):f(V.x,V.y,h/u*T);for(D=n-1;0<=D;D--){T=D/n;Z=l*(1-T);G=k*Math.sin(T*Math.PI/2);L=0;for(T=E.length;L<T;L++)V=c(E[L],t[L],G),f(V.x,V.y,h+Z);A=0;for(I=y.length;A<I;A++)for(C=y[A],Q=ka[A],L=0,T=C.length;L<T;L++)V=c(C[L],Q[L],G),v?f(V.x,V.y+p[u-1].y,p[u-1].x+Z):f(V.x,V.y,h+Z)}(function(){if(q){var a;a=0*ia;for(L=0;L<ja;L++)Y=K[L],g(Y[2]+a,Y[1]+a,Y[0]+a,!0);a=u+2*n;a*=ia;for(L=0;L<ja;L++)Y=K[L],g(Y[0]+a,Y[1]+a,Y[2]+a,
|
|
|
+!1)}else{for(L=0;L<ja;L++)Y=K[L],g(Y[2],Y[1],Y[0],!0);for(L=0;L<ja;L++)Y=K[L],g(Y[0]+ia*u,Y[1]+ia*u,Y[2]+ia*u,!1)}})();(function(){var a=0;e(E,a);a+=E.length;A=0;for(I=y.length;A<I;A++)C=y[A],e(C,a),a+=C.length})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h,l,k,n,q){b=a.vertices[e].x;c=a.vertices[e].y;e=a.vertices[e].z;d=a.vertices[f].x;l=a.vertices[f].y;f=a.vertices[f].z;k=a.vertices[g].x;
|
|
|
n=a.vertices[g].y;g=a.vertices[g].z;q=a.vertices[h].x;var s=a.vertices[h].y;a=a.vertices[h].z;return 0.01>Math.abs(c-l)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(q,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(l,1-f),new THREE.Vector2(n,1-g),new THREE.Vector2(s,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
|
THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var l=e.shape,k=e.holes;if(!THREE.Shape.Utils.isClockWise(l))for(l=l.reverse(),e=0,f=k.length;e<f;e++)g=k[e],THREE.Shape.Utils.isClockWise(g)&&(k[e]=g.reverse());var n=THREE.Shape.Utils.triangulateShape(l,k);e=0;for(f=k.length;e<f;e++)g=k[e],
|
|
|
-l=l.concat(g);k=l.length;f=n.length;for(e=0;e<k;e++)g=l[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)k=n[e],l=k[0]+h,g=k[1]+h,k=k[2]+h,this.faces.push(new THREE.Face3(l,g,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,l,g,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var l=c+g*f*d,k=Math.cos(l),n=Math.sin(l),l=0,q=a.length;l<q;l++){var s=a[l],t=new THREE.Vector3;t.x=k*s.x-n*s.y;t.y=n*s.x+k*s.y;t.z=s.z;this.vertices.push(t)}c=a.length;g=0;for(h=b;g<h;g++)for(l=0,q=a.length-1;l<q;l++){b=n=l+c*g;d=n+c;var k=n+1+c,n=n+1,s=g*f,t=l*e,u=s+f,p=t+e;this.faces.push(new THREE.Face3(b,d,n));this.faceVertexUvs[0].push([new THREE.Vector2(s,
|
|
|
-t),new THREE.Vector2(u,t),new THREE.Vector2(s,p)]);this.faces.push(new THREE.Face3(d,k,n));this.faceVertexUvs[0].push([new THREE.Vector2(u,t),new THREE.Vector2(u,p),new THREE.Vector2(s,p)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;var e=a/2,f=b/2;c=this.widthSegments;d=this.heightSegments;var g=c+1,h=d+1,l=this.width/c,k=this.height/d,n=new THREE.Vector3(0,0,1);for(a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*l-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var q=b+g*a,e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,l=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+
|
|
|
-1)/d),s=new THREE.Vector2((b+1)/c,1-(a+1)/d),t=new THREE.Vector2((b+1)/c,1-a/d),q=new THREE.Face3(q,e,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([l,k,t]);q=new THREE.Face3(e,f,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([k.clone(),s,t.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(3,d):8;var g,h=[],l=a,k=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,q=e+g/c*f;n.x=l*Math.cos(q);n.y=l*Math.sin(q);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}l+=k}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)q=g+e,f=q+a,k=q+c+a,n=q+c+1+a,this.faces.push(new THREE.Face3(f,
|
|
|
-k,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[k].clone(),h[n].clone()]),f=q+a,k=q+c+1+a,n=q+1+a,this.faces.push(new THREE.Face3(f,k,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[k].clone(),h[n].clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,l)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=g=void 0!==g?g:Math.PI;var h,l,k=[],n=[];for(l=0;l<=c;l++){var q=[],s=[];for(h=0;h<=b;h++){var t=h/b,u=l/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+t*e)*Math.sin(f+u*g);p.y=a*Math.cos(f+u*g);
|
|
|
-p.z=a*Math.sin(d+t*e)*Math.sin(f+u*g);this.vertices.push(p);q.push(this.vertices.length-1);s.push(new THREE.Vector2(t,1-u))}k.push(q);n.push(s)}for(l=0;l<this.heightSegments;l++)for(h=0;h<this.widthSegments;h++){b=k[l][h+1];c=k[l][h];d=k[l+1][h];e=k[l+1][h+1];f=this.vertices[b].clone().normalize();g=this.vertices[c].clone().normalize();var q=this.vertices[d].clone().normalize(),s=this.vertices[e].clone().normalize(),t=n[l][h+1].clone(),u=n[l][h].clone(),p=n[l+1][h].clone(),v=n[l+1][h+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
-this.radius?(t.x=(t.x+u.x)/2,this.faces.push(new THREE.Face3(b,d,e,[f,q,s])),this.faceVertexUvs[0].push([t,p,v])):Math.abs(this.vertices[d].y)===this.radius?(p.x=(p.x+v.x)/2,this.faces.push(new THREE.Face3(b,c,d,[f,g,q])),this.faceVertexUvs[0].push([t,u,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,g,s])),this.faceVertexUvs[0].push([t,u,v]),this.faces.push(new THREE.Face3(c,d,e,[g.clone(),q,s.clone()])),this.faceVertexUvs[0].push([u.clone(),p,v.clone()]))}this.computeCentroids();this.computeFaceNormals();
|
|
|
+l=l.concat(g);k=l.length;f=n.length;for(e=0;e<k;e++)g=l[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)k=n[e],l=k[0]+h,g=k[1]+h,k=k[2]+h,this.faces.push(new THREE.Face3(l,g,k,null,null,c)),this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,l,g,k))};THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var l=c+g*f*d,k=Math.cos(l),n=Math.sin(l),l=0,q=a.length;l<q;l++){var s=a[l],u=new THREE.Vector3;u.x=k*s.x-n*s.y;u.y=n*s.x+k*s.y;u.z=s.z;this.vertices.push(u)}c=a.length;g=0;for(h=b;g<h;g++)for(l=0,q=a.length-1;l<q;l++){b=n=l+c*g;d=n+c;var k=n+1+c,n=n+1,s=g*f,u=l*e,t=s+f,p=u+e;this.faces.push(new THREE.Face3(b,d,n));this.faceVertexUvs[0].push([new THREE.Vector2(s,
|
|
|
+u),new THREE.Vector2(t,u),new THREE.Vector2(s,p)]);this.faces.push(new THREE.Face3(d,k,n));this.faceVertexUvs[0].push([new THREE.Vector2(t,u),new THREE.Vector2(t,p),new THREE.Vector2(s,p)])}this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;var e=a/2,f=b/2;c=this.widthSegments;d=this.heightSegments;var g=c+1,h=d+1,l=this.width/c,k=this.height/d,n=new THREE.Vector3(0,0,1);for(a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*l-e,-(a*k-f),0));for(a=0;a<d;a++)for(b=0;b<c;b++){var q=b+g*a,e=b+g*(a+1),f=b+1+g*(a+1),h=b+1+g*a,l=new THREE.Vector2(b/c,1-a/d),k=new THREE.Vector2(b/c,1-(a+
|
|
|
+1)/d),s=new THREE.Vector2((b+1)/c,1-(a+1)/d),u=new THREE.Vector2((b+1)/c,1-a/d),q=new THREE.Face3(q,e,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([l,k,u]);q=new THREE.Face3(e,f,h);q.normal.copy(n);q.vertexNormals.push(n.clone(),n.clone(),n.clone());this.faces.push(q);this.faceVertexUvs[0].push([k.clone(),s,u.clone()])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(3,d):8;var g,h=[],l=a,k=(b-a)/d;for(a=0;a<=d;a++){for(g=0;g<=c;g++){var n=new THREE.Vector3,q=e+g/c*f;n.x=l*Math.cos(q);n.y=l*Math.sin(q);this.vertices.push(n);h.push(new THREE.Vector2((n.x/b+1)/2,(n.y/b+1)/2))}l+=k}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*c,g=0;g<=c;g++)q=g+e,f=q+a,k=q+c+a,n=q+c+1+a,this.faces.push(new THREE.Face3(f,
|
|
|
+k,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[k].clone(),h[n].clone()]),f=q+a,k=q+c+1+a,n=q+1+a,this.faces.push(new THREE.Face3(f,k,n,[b.clone(),b.clone(),b.clone()])),this.faceVertexUvs[0].push([h[f].clone(),h[k].clone(),h[n].clone()]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,l)};THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.radius=a=a||50;this.widthSegments=b=Math.max(3,Math.floor(b)||8);this.heightSegments=c=Math.max(2,Math.floor(c)||6);this.phiStart=d=void 0!==d?d:0;this.phiLength=e=void 0!==e?e:2*Math.PI;this.thetaStart=f=void 0!==f?f:0;this.thetaLength=g=void 0!==g?g:Math.PI;var h,l,k=[],n=[];for(l=0;l<=c;l++){var q=[],s=[];for(h=0;h<=b;h++){var u=h/b,t=l/c,p=new THREE.Vector3;p.x=-a*Math.cos(d+u*e)*Math.sin(f+t*g);p.y=a*Math.cos(f+t*g);
|
|
|
+p.z=a*Math.sin(d+u*e)*Math.sin(f+t*g);this.vertices.push(p);q.push(this.vertices.length-1);s.push(new THREE.Vector2(u,1-t))}k.push(q);n.push(s)}for(l=0;l<this.heightSegments;l++)for(h=0;h<this.widthSegments;h++){b=k[l][h+1];c=k[l][h];d=k[l+1][h];e=k[l+1][h+1];f=this.vertices[b].clone().normalize();g=this.vertices[c].clone().normalize();var q=this.vertices[d].clone().normalize(),s=this.vertices[e].clone().normalize(),u=n[l][h+1].clone(),t=n[l][h].clone(),p=n[l+1][h].clone(),v=n[l+1][h+1].clone();Math.abs(this.vertices[b].y)===
|
|
|
+this.radius?(u.x=(u.x+t.x)/2,this.faces.push(new THREE.Face3(b,d,e,[f,q,s])),this.faceVertexUvs[0].push([u,p,v])):Math.abs(this.vertices[d].y)===this.radius?(p.x=(p.x+v.x)/2,this.faces.push(new THREE.Face3(b,c,d,[f,g,q])),this.faceVertexUvs[0].push([u,t,p])):(this.faces.push(new THREE.Face3(b,c,e,[f,g,s])),this.faceVertexUvs[0].push([u,t,v]),this.faces.push(new THREE.Face3(c,d,e,[g.clone(),q,s.clone()])),this.faceVertexUvs[0].push([t.clone(),p,v.clone()]))}this.computeCentroids();this.computeFaceNormals();
|
|
|
this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TextGeometry=function(a,b){b=b||{};var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||2*Math.PI;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=c/this.radialSegments*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
|
|
|
Math.cos(g))*Math.sin(f);h.z=this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.Vector2(d/this.tubularSegments,c/this.radialSegments));b.push(h.clone().sub(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){e=(this.tubularSegments+1)*c+d-1;var f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,l=new THREE.Face3(e,f,h,[b[e].clone(),b[f].clone(),b[h].clone()]);this.faces.push(l);this.faceVertexUvs[0].push([a[e].clone(),
|
|
|
a[f].clone(),a[h].clone()]);l=new THREE.Face3(f,g,h,[b[f].clone(),b[g].clone(),b[h].clone()]);this.faces.push(l);this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids();this.computeFaceNormals()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=b/c;b=Math.cos(a);f*=d*(2+b)*0.5;g=d*(2+b)*g*0.5;d=e*d*Math.sin(a)*0.5;return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a)for(this.grid[a]=
|
|
@@ -655,9 +655,9 @@ THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THRE
|
|
|
d).normalize();f[0].crossVectors(e[0],h);g[0].crossVectors(e[0],f[0]);for(k=1;k<b;k++)f[k]=f[k-1].clone(),g[k]=g[k-1].clone(),h.crossVectors(e[k-1],e[k]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[k-1].dot(e[k]),-1,1)),f[k].applyMatrix4(l.makeRotationAxis(h,d))),g[k].crossVectors(e[k],f[k]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),k=1;k<b;k++)f[k].applyMatrix4(l.makeRotationAxis(e[k],d*k)),g[k].crossVectors(e[k],
|
|
|
f[k])};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=l.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);l.faces.push(d);d=d.centroid;d=Math.atan2(d.z,-d.x);l.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,
|
|
|
c,d)])}function g(a,b){var c=Math.pow(2,b);Math.pow(4,b);for(var d=e(l.vertices[a.a]),g=e(l.vertices[a.b]),h=e(l.vertices[a.c]),k=[],n=0;n<=c;n++){k[n]=[];for(var q=e(d.clone().lerp(h,n/c)),s=e(g.clone().lerp(h,n/c)),t=c-n,u=0;u<=t;u++)k[n][u]=0==u&&n==c?q:e(q.clone().lerp(s,u/t))}for(n=0;n<c;n++)for(u=0;u<2*(c-n)-1;u++)d=Math.floor(u/2),0==u%2?f(k[n][d+1],k[n+1][d],k[n][d]):f(k[n][d+1],k[n+1][d+1],k[n+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/
|
|
|
-2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);c=c||1;d=d||0;for(var l=this,k=0,n=a.length;k<n;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));a=this.vertices;for(var q=[],k=0,n=b.length;k<n;k++){var s=a[b[k][0]],t=a[b[k][1]],u=a[b[k][2]];q[k]=new THREE.Face3(s.index,t.index,u.index,[s.clone(),t.clone(),u.clone()])}k=0;for(n=q.length;k<n;k++)g(q[k],d);k=0;for(n=this.faceVertexUvs[0].length;k<n;k++)b=this.faceVertexUvs[0][k],d=b[0].x,a=b[1].x,q=b[2].x,s=Math.max(d,Math.max(a,q)),
|
|
|
-t=Math.min(d,Math.min(a,q)),0.9<s&&0.1>t&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));k=0;for(n=this.vertices.length;k<n;k++)this.vertices[k].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,l,k,n=b+1;for(g=0;g<=c;g++)for(k=g/c,h=0;h<=b;h++)l=h/b,l=a(l,k),d.push(l);var q,s,t,u;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*n+h,d=g*n+h+1,k=(g+1)*n+h+1,l=(g+1)*n+h,q=new THREE.Vector2(h/b,g/c),s=new THREE.Vector2((h+1)/b,g/c),t=new THREE.Vector2((h+1)/b,(g+1)/c),u=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a,d,l)),f.push([q,s,u]),e.push(new THREE.Face3(d,k,l)),
|
|
|
-f.push([s.clone(),t,u.clone()]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){a=a||1;var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
+2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);c=c||1;d=d||0;for(var l=this,k=0,n=a.length;k<n;k++)e(new THREE.Vector3(a[k][0],a[k][1],a[k][2]));a=this.vertices;for(var q=[],k=0,n=b.length;k<n;k++){var s=a[b[k][0]],u=a[b[k][1]],t=a[b[k][2]];q[k]=new THREE.Face3(s.index,u.index,t.index,[s.clone(),u.clone(),t.clone()])}k=0;for(n=q.length;k<n;k++)g(q[k],d);k=0;for(n=this.faceVertexUvs[0].length;k<n;k++)b=this.faceVertexUvs[0][k],d=b[0].x,a=b[1].x,q=b[2].x,s=Math.max(d,Math.max(a,q)),
|
|
|
+u=Math.min(d,Math.min(a,q)),0.9<s&&0.1>u&&(0.2>d&&(b[0].x+=1),0.2>a&&(b[1].x+=1),0.2>q&&(b[2].x+=1));k=0;for(n=this.vertices.length;k<n;k++)this.vertices[k].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,l,k,n=b+1;for(g=0;g<=c;g++)for(k=g/c,h=0;h<=b;h++)l=h/b,l=a(l,k),d.push(l);var q,s,u,t;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*n+h,d=g*n+h+1,k=(g+1)*n+h+1,l=(g+1)*n+h,q=new THREE.Vector2(h/b,g/c),s=new THREE.Vector2((h+1)/b,g/c),u=new THREE.Vector2((h+1)/b,(g+1)/c),t=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a,d,l)),f.push([q,s,t]),e.push(new THREE.Face3(d,k,l)),
|
|
|
+f.push([s.clone(),u,t.clone()]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){a=a||1;var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d,e,f){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);void 0===e&&(e=0.2*c);void 0===f&&(f=0.2*e);this.position=b;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.5,1,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,-0.5,0));this.cone=
|
|
|
new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(a);this.setLength(c,e,f)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(){var a=new THREE.Vector3,b;return function(c){0.99999<c.y?this.quaternion.set(0,0,0,1):-0.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();
|
|
|
THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=0.2*a);void 0===c&&(c=0.2*b);this.line.scale.set(1,a,1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.BoxHelper=function(a){var b=[new THREE.Vector3(1,1,1),new THREE.Vector3(-1,1,1),new THREE.Vector3(-1,-1,1),new THREE.Vector3(1,-1,1),new THREE.Vector3(1,1,-1),new THREE.Vector3(-1,1,-1),new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,-1,-1)];this.vertices=b;var c=new THREE.Geometry;c.vertices.push(b[0],b[1],b[1],b[2],b[2],b[3],b[3],b[0],b[4],b[5],b[5],b[6],b[6],b[7],b[7],b[4],b[0],b[4],b[1],b[5],b[2],b[6],b[3],b[7]);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);
|
|
@@ -668,7 +668,7 @@ THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.CameraHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Camera,c=new THREE.Projector;return function(){function d(d,g,h,l){a.set(g,h,l);c.unprojectVector(a,b);d=e.pointMap[d];if(void 0!==d)for(g=0,h=d.length;g<h;g++)e.geometry.vertices[d[g]].copy(a)}var e=this;b.projectionMatrix.copy(this.camera.projectionMatrix);d("c",0,0,-1);d("t",0,0,1);d("n1",-1,-1,-1);d("n2",1,-1,-1);d("n3",-1,1,-1);d("n4",1,1,-1);d("f1",-1,-1,1);d("f2",1,-1,1);d("f3",-1,1,1);d("f4",1,1,1);d("u1",0.7,
|
|
|
1.1,-1);d("u2",-0.7,1.1,-1);d("u3",0,2,-1);d("cf1",-1,0,1);d("cf2",1,0,1);d("cf3",0,-1,1);d("cf4",0,1,1);d("cn1",-1,0,-1);d("cn2",1,0,-1);d("cn3",0,-1,-1);d("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0}}();THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;b=b||1;var c=new THREE.PlaneGeometry(b,b),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new THREE.Mesh(c,d);this.add(this.lightPlane);c=new THREE.Geometry;c.vertices.push(new THREE.Vector3);c.vertices.push(new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});
|
|
|
d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update()};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()};
|
|
|
-THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,l=a.geometry.clone();l.mergeVertices();l.computeFaceNormals();for(var k=l.vertices,l=l.faces,n=0,q=0,s=l.length;q<s;q++)for(var t=l[q],u=0;3>u;u++){d[0]=t[g[u]];d[1]=t[g[(u+1)%3]];d.sort(f);var p=d.toString();void 0===e[p]?(e[p]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[p].face2=q}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
+THREE.DirectionalLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(){a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();THREE.EdgesHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,l=a.geometry.clone();l.mergeVertices();l.computeFaceNormals();for(var k=l.vertices,l=l.faces,n=0,q=0,s=l.length;q<s;q++)for(var u=l[q],t=0;3>t;t++){d[0]=u[g[t]];d[1]=u[g[(t+1)%3]];d.sort(f);var p=d.toString();void 0===e[p]?(e[p]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},n++):e[p].face2=q}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
f=0;for(p in e)if(g=e[p],void 0===g.face2||0.9999>l[g.face1].normal.dot(l[g.face2].normal))n=k[g.vert1],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z,n=k[g.vert2],d[f++]=n.x,d[f++]=n.y,d[f++]=n.z;THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3),b.vertices.push(new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
THREE.FaceNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);a=this.geometry.vertices;for(var d=this.object.geometry.faces,e=this.object.matrixWorld,f=0,g=d.length;f<g;f++){var h=d[f];b.copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);var l=2*f;a[l].copy(h.centroid).applyMatrix4(e);a[l+1].addVectors(a[l],b)}this.geometry.verticesNeedUpdate=
|
|
|
!0;return this}}();THREE.GridHelper=function(a,b){var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924);this.color2=new THREE.Color(8947848);for(var e=-a;e<=a;e+=b){c.vertices.push(new THREE.Vector3(-a,0,e),new THREE.Vector3(a,0,e),new THREE.Vector3(e,0,-a),new THREE.Vector3(e,0,a));var f=0===e?this.color1:this.color2;c.colors.push(f,f,f,f)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype);
|
|
@@ -678,12 +678,12 @@ THREE.HemisphereLightHelper.prototype.update=function(){var a=new THREE.Vector3;
|
|
|
THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};THREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld();this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-0.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update()};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};THREE.SpotLightHelper.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){var c=this.light.distance?this.light.distance:1E4,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();THREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:16711680;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexNormals.length;g<h;g++)c.vertices.push(new THREE.Vector3),c.vertices.push(new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update()};
|
|
|
THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
-THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,l=0,k=f.length;l<k;l++)for(var n=f[l],q=0,s=n.vertexNormals.length;q<s;q++){var t=n.vertexNormals[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(t).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);
|
|
|
+THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,l=0,k=f.length;l<k;l++)for(var n=f[l],q=0,s=n.vertexNormals.length;q<s;q++){var u=n.vertexNormals[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(u).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);
|
|
|
b.add(d[h]);h+=1;d[h].copy(b);h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.VertexTangentsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:255;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexTangents.length;g<h;g++)c.vertices.push(new THREE.Vector3),c.vertices.push(new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.update()};THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype);
|
|
|
-THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,l=0,k=f.length;l<k;l++)for(var n=f[l],q=0,s=n.vertexTangents.length;q<s;q++){var t=n.vertexTangents[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(t).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b);
|
|
|
-h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var l=a.geometry.vertices,k=a.geometry.faces,n=0,q=new Uint32Array(6*k.length),s=0,t=k.length;s<t;s++)for(var u=k[s],p=0;3>p;p++){d[0]=u[g[p]];d[1]=u[g[(p+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
-s=0;for(t=n;s<t;s++)for(p=0;2>p;p++)n=l[q[2*s+p]],g=6*s+3*p,d[g+0]=n.x,d[g+1]=n.y,d[g+2]=n.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var l=a.geometry.attributes.position.array,t=a.geometry.attributes.index.array,k=a.geometry.offsets,n=0,q=new Uint32Array(2*t.length),u=0,w=k.length;u<w;++u)for(var p=k[u].start,v=k[u].count,g=k[u].index,s=p,r=p+v;s<r;s+=3)for(p=0;3>p;p++)d[0]=g+t[s+p],d[1]=g+t[s+(p+1)%3],d.sort(f),v=d.toString(),void 0===e[v]&&(q[2*
|
|
|
-n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;s=0;for(t=n;s<t;s++)for(p=0;2>p;p++)g=6*s+3*p,n=3*q[2*s+p],d[g+0]=l[n],d[g+1]=l[n+1],d[g+2]=l[n+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(l=a.geometry.attributes.position.array,n=l.length/3,q=n/3,h.addAttribute("position",Float32Array,2*n,3),d=h.attributes.position.array,s=0,t=q;s<t;s++)for(p=0;3>p;p++)g=18*s+6*p,q=9*s+3*p,d[g+0]=l[q],d[g+1]=l[q+1],d[g+2]=l[q+2],n=9*s+(p+
|
|
|
+THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,l=0,k=f.length;l<k;l++)for(var n=f[l],q=0,s=n.vertexTangents.length;q<s;q++){var u=n.vertexTangents[q];d[h].copy(e[n[a[q]]]).applyMatrix4(g);b.copy(u).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b);
|
|
|
+h+=1}this.geometry.verticesNeedUpdate=!0;return this}}();THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var l=a.geometry.vertices,k=a.geometry.faces,n=0,q=new Uint32Array(6*k.length),s=0,u=k.length;s<u;s++)for(var t=k[s],p=0;3>p;p++){d[0]=t[g[p]];d[1]=t[g[(p+1)%3]];d.sort(f);var v=d.toString();void 0===e[v]&&(q[2*n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++)}h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;
|
|
|
+s=0;for(u=n;s<u;s++)for(p=0;2>p;p++)n=l[q[2*s+p]],g=6*s+3*p,d[g+0]=n.x,d[g+1]=n.y,d[g+2]=n.z}else if(a.geometry instanceof THREE.BufferGeometry&&void 0!==a.geometry.attributes.index){for(var l=a.geometry.attributes.position.array,u=a.geometry.attributes.index.array,k=a.geometry.offsets,n=0,q=new Uint32Array(2*u.length),t=0,w=k.length;t<w;++t)for(var p=k[t].start,v=k[t].count,g=k[t].index,s=p,r=p+v;s<r;s+=3)for(p=0;3>p;p++)d[0]=g+u[s+p],d[1]=g+u[s+(p+1)%3],d.sort(f),v=d.toString(),void 0===e[v]&&(q[2*
|
|
|
+n]=d[0],q[2*n+1]=d[1],e[v]=!0,n++);h.addAttribute("position",Float32Array,2*n,3);d=h.attributes.position.array;s=0;for(u=n;s<u;s++)for(p=0;2>p;p++)g=6*s+3*p,n=3*q[2*s+p],d[g+0]=l[n],d[g+1]=l[n+1],d[g+2]=l[n+2]}else if(a.geometry instanceof THREE.BufferGeometry)for(l=a.geometry.attributes.position.array,n=l.length/3,q=n/3,h.addAttribute("position",Float32Array,2*n,3),d=h.attributes.position.array,s=0,u=q;s<u;s++)for(p=0;3>p;p++)g=18*s+6*p,q=9*s+3*p,d[g+0]=l[q],d[g+1]=l[q+1],d[g+2]=l[q+2],n=9*s+(p+
|
|
|
1)%3*3,d[g+3]=l[n],d[g+4]=l[n+1],d[g+5]=l[n+2];THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.matrixWorld=a.matrixWorld};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=c.x*Math.PI*0.25,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
|
|
@@ -693,36 +693,36 @@ THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=thi
|
|
|
THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b};
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;
|
|
|
-f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,l,k,n,q,s,t;this.init=function(u){b=u.context;c=u;d=u.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);u=0;e[u++]=-1;e[u++]=-1;
|
|
|
-e[u++]=0;e[u++]=0;e[u++]=1;e[u++]=-1;e[u++]=1;e[u++]=0;e[u++]=1;e[u++]=1;e[u++]=1;e[u++]=1;e[u++]=-1;e[u++]=1;e[u++]=0;e[u++]=1;u=0;f[u++]=0;f[u++]=1;f[u++]=2;f[u++]=0;f[u++]=2;f[u++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);l=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,l);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
+f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};THREE.LensFlarePlugin=function(){function a(a,c){var d=b.createProgram(),e=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER),g="precision "+c+" float;\n";b.shaderSource(e,g+a.fragmentShader);b.shaderSource(f,g+a.vertexShader);b.compileShader(e);b.compileShader(f);b.attachShader(d,e);b.attachShader(d,f);b.linkProgram(d);return d}var b,c,d,e,f,g,h,l,k,n,q,s,u;this.init=function(t){b=t.context;c=t;d=t.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);t=0;e[t++]=-1;e[t++]=-1;
|
|
|
+e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);l=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,l);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)?(n=!1,q=a(THREE.ShaderFlares.lensFlare,d)):(n=!0,q=a(THREE.ShaderFlares.lensFlareVertexTexture,d));s={};t={};s.vertex=b.getAttribLocation(q,"position");s.uv=b.getAttribLocation(q,"uv");t.renderType=b.getUniformLocation(q,"renderType");t.map=b.getUniformLocation(q,"map");t.occlusionMap=b.getUniformLocation(q,"occlusionMap");t.opacity=
|
|
|
-b.getUniformLocation(q,"opacity");t.color=b.getUniformLocation(q,"color");t.scale=b.getUniformLocation(q,"scale");t.rotation=b.getUniformLocation(q,"rotation");t.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var r=a.length;if(r){var x=new THREE.Vector3,z=f/e,G=0.5*e,J=0.5*f,H=16/f,B=new THREE.Vector2(H*z,H),A=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),C=t,H=s;b.useProgram(q);b.enableVertexAttribArray(s.vertex);b.enableVertexAttribArray(s.uv);
|
|
|
-b.uniform1i(C.occlusionMap,0);b.uniform1i(C.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(H.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(H.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var Q,y,L,E,D;for(Q=0;Q<r;Q++)if(H=16/f,B.set(H*z,H),E=a[Q],x.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),A.copy(x),K.x=A.x*G+G,
|
|
|
-K.y=A.y*J+J,n||0<K.x&&K.x<e&&0<K.y&&K.y<f)for(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,l),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,K.x-8,K.y-8,16,16,0),b.uniform1i(C.renderType,0),b.uniform2f(C.scale,B.x,B.y),b.uniform3f(C.screenPosition,A.x,A.y,A.z),b.disable(b.BLEND),b.enable(b.DEPTH_TEST),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,k),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,K.x-8,K.y-8,16,16,0),b.uniform1i(C.renderType,1),b.disable(b.DEPTH_TEST),
|
|
|
-b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,l),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),E.positionScreen.copy(A),E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares(),b.uniform1i(C.renderType,2),b.enable(b.BLEND),y=0,L=E.lensFlares.length;y<L;y++)D=E.lensFlares[y],0.001<D.opacity&&0.001<D.scale&&(A.x=D.x,A.y=D.y,A.z=D.z,H=D.size*D.scale/f,B.x=H*z,B.y=H,b.uniform3f(C.screenPosition,A.x,A.y,A.z),b.uniform2f(C.scale,B.x,B.y),b.uniform1f(C.rotation,D.rotation),b.uniform1f(C.opacity,
|
|
|
-D.opacity),b.uniform3f(C.color,D.color.r,D.color.g,D.color.b),c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),c.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,l=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(q,s){var t,u,p,v,w,r,x,z,G,J=[];v=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);t=0;for(u=q.__lights.length;t<u;t++)if(p=q.__lights[t],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var H;if(p.shadowCascadeArray[w])H=p.shadowCascadeArray[w];else{G=p;x=w;H=new THREE.DirectionalLight;H.isVirtual=!0;H.onlyShadow=!0;H.castShadow=!0;H.shadowCameraNear=G.shadowCameraNear;H.shadowCameraFar=G.shadowCameraFar;H.shadowCameraLeft=G.shadowCameraLeft;H.shadowCameraRight=G.shadowCameraRight;
|
|
|
-H.shadowCameraBottom=G.shadowCameraBottom;H.shadowCameraTop=G.shadowCameraTop;H.shadowCameraVisible=G.shadowCameraVisible;H.shadowDarkness=G.shadowDarkness;H.shadowBias=G.shadowCascadeBias[x];H.shadowMapWidth=G.shadowCascadeWidth[x];H.shadowMapHeight=G.shadowCascadeHeight[x];H.pointsWorld=[];H.pointsFrustum=[];z=H.pointsWorld;r=H.pointsFrustum;for(var B=0;8>B;B++)z[B]=new THREE.Vector3,r[B]=new THREE.Vector3;z=G.shadowCascadeNearZ[x];G=G.shadowCascadeFarZ[x];r[0].set(-1,-1,z);r[1].set(1,-1,z);r[2].set(-1,
|
|
|
-1,z);r[3].set(1,1,z);r[4].set(-1,-1,G);r[5].set(1,-1,G);r[6].set(-1,1,G);r[7].set(1,1,G);H.originalCamera=s;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(H);r.add(H.target);s.add(r);p.shadowCascadeArray[w]=H;console.log("Created virtualLight",H)}x=p;z=w;G=x.shadowCascadeArray[z];G.position.copy(x.position);G.target.position.copy(x.target.position);G.lookAt(G.target);G.shadowCameraVisible=x.shadowCameraVisible;G.shadowDarkness=x.shadowDarkness;G.shadowBias=x.shadowCascadeBias[z];r=x.shadowCascadeNearZ[z];
|
|
|
-x=x.shadowCascadeFarZ[z];G=G.pointsFrustum;G[0].z=r;G[1].z=r;G[2].z=r;G[3].z=r;G[4].z=x;G[5].z=x;G[6].z=x;G[7].z=x;J[v]=H;v++}else J[v]=p,v++;t=0;for(u=J.length;t<u;t++){p=J[t];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(n=!1,q=a(THREE.ShaderFlares.lensFlare,d)):(n=!0,q=a(THREE.ShaderFlares.lensFlareVertexTexture,d));s={};u={};s.vertex=b.getAttribLocation(q,"position");s.uv=b.getAttribLocation(q,"uv");u.renderType=b.getUniformLocation(q,"renderType");u.map=b.getUniformLocation(q,"map");u.occlusionMap=b.getUniformLocation(q,"occlusionMap");u.opacity=
|
|
|
+b.getUniformLocation(q,"opacity");u.color=b.getUniformLocation(q,"color");u.scale=b.getUniformLocation(q,"scale");u.rotation=b.getUniformLocation(q,"rotation");u.screenPosition=b.getUniformLocation(q,"screenPosition")};this.render=function(a,d,e,f){a=a.__webglFlares;var r=a.length;if(r){var x=new THREE.Vector3,z=f/e,F=0.5*e,P=0.5*f,B=16/f,C=new THREE.Vector2(B*z,B),A=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),H=u,B=s;b.useProgram(q);b.enableVertexAttribArray(s.vertex);b.enableVertexAttribArray(s.uv);
|
|
|
+b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(B.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var N,y,K,E,D;for(N=0;N<r;N++)if(B=16/f,C.set(B*z,B),E=a[N],x.set(E.matrixWorld.elements[12],E.matrixWorld.elements[13],E.matrixWorld.elements[14]),x.applyMatrix4(d.matrixWorldInverse),x.applyProjection(d.projectionMatrix),A.copy(x),I.x=A.x*F+F,
|
|
|
+I.y=A.y*P+P,n||0<I.x&&I.x<e&&0<I.y&&I.y<f)for(b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,l),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0),b.uniform1i(H.renderType,0),b.uniform2f(H.scale,C.x,C.y),b.uniform3f(H.screenPosition,A.x,A.y,A.z),b.disable(b.BLEND),b.enable(b.DEPTH_TEST),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,k),b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0),b.uniform1i(H.renderType,1),b.disable(b.DEPTH_TEST),
|
|
|
+b.activeTexture(b.TEXTURE1),b.bindTexture(b.TEXTURE_2D,l),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0),E.positionScreen.copy(A),E.customUpdateCallback?E.customUpdateCallback(E):E.updateLensFlares(),b.uniform1i(H.renderType,2),b.enable(b.BLEND),y=0,K=E.lensFlares.length;y<K;y++)D=E.lensFlares[y],0.001<D.opacity&&0.001<D.scale&&(A.x=D.x,A.y=D.y,A.z=D.z,B=D.size*D.scale/f,C.x=B*z,C.y=B,b.uniform3f(H.screenPosition,A.x,A.y,A.z),b.uniform2f(H.scale,C.x,C.y),b.uniform1f(H.rotation,D.rotation),b.uniform1f(H.opacity,
|
|
|
+D.opacity),b.uniform3f(H.color,D.color.r,D.color.g,D.color.b),c.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),c.setTexture(D.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,l=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(q,s){var u,t,p,v,w,r,x,z,F,P=[];v=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);u=0;for(t=q.__lights.length;u<t;u++)if(p=q.__lights[u],p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(w=0;w<p.shadowCascadeCount;w++){var B;if(p.shadowCascadeArray[w])B=p.shadowCascadeArray[w];else{F=p;x=w;B=new THREE.DirectionalLight;B.isVirtual=!0;B.onlyShadow=!0;B.castShadow=!0;B.shadowCameraNear=F.shadowCameraNear;B.shadowCameraFar=F.shadowCameraFar;B.shadowCameraLeft=F.shadowCameraLeft;B.shadowCameraRight=F.shadowCameraRight;
|
|
|
+B.shadowCameraBottom=F.shadowCameraBottom;B.shadowCameraTop=F.shadowCameraTop;B.shadowCameraVisible=F.shadowCameraVisible;B.shadowDarkness=F.shadowDarkness;B.shadowBias=F.shadowCascadeBias[x];B.shadowMapWidth=F.shadowCascadeWidth[x];B.shadowMapHeight=F.shadowCascadeHeight[x];B.pointsWorld=[];B.pointsFrustum=[];z=B.pointsWorld;r=B.pointsFrustum;for(var C=0;8>C;C++)z[C]=new THREE.Vector3,r[C]=new THREE.Vector3;z=F.shadowCascadeNearZ[x];F=F.shadowCascadeFarZ[x];r[0].set(-1,-1,z);r[1].set(1,-1,z);r[2].set(-1,
|
|
|
+1,z);r[3].set(1,1,z);r[4].set(-1,-1,F);r[5].set(1,-1,F);r[6].set(-1,1,F);r[7].set(1,1,F);B.originalCamera=s;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(B);r.add(B.target);s.add(r);p.shadowCascadeArray[w]=B;console.log("Created virtualLight",B)}x=p;z=w;F=x.shadowCascadeArray[z];F.position.copy(x.position);F.target.position.copy(x.target.position);F.lookAt(F.target);F.shadowCameraVisible=x.shadowCameraVisible;F.shadowDarkness=x.shadowDarkness;F.shadowBias=x.shadowCascadeBias[z];r=x.shadowCascadeNearZ[z];
|
|
|
+x=x.shadowCascadeFarZ[z];F=F.pointsFrustum;F[0].z=r;F[1].z=r;F[2].z=r;F[3].z=r;F[4].z=x;F[5].z=x;F[6].z=x;F[7].z=x;P[v]=B;v++}else P[v]=p,v++;u=0;for(t=P.length;u<t;u++){p=P[u];p.shadowMap||(w=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(w=THREE.NearestFilter),p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:w,magFilter:w,format:THREE.RGBAFormat}),p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight),p.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!p.shadowCamera){if(p instanceof THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}q.add(p.shadowCamera);!0===q.autoUpdate&&q.updateMatrixWorld()}p.shadowCameraVisible&&
|
|
|
-!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&H.originalCamera==s){w=s;v=p.shadowCamera;r=p.pointsFrustum;G=p.pointsWorld;l.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)z=G[x],z.copy(r[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(z,w),z.applyMatrix4(v.matrixWorldInverse),z.x<l.x&&(l.x=z.x),z.x>k.x&&(k.x=z.x),z.y<l.y&&(l.y=z.y),z.y>k.y&&(k.y=z.y),z.z<l.z&&(l.z=z.z),z.z>k.z&&
|
|
|
+!p.cameraHelper&&(p.cameraHelper=new THREE.CameraHelper(p.shadowCamera),p.shadowCamera.add(p.cameraHelper));if(p.isVirtual&&B.originalCamera==s){w=s;v=p.shadowCamera;r=p.pointsFrustum;F=p.pointsWorld;l.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)z=F[x],z.copy(r[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(z,w),z.applyMatrix4(v.matrixWorldInverse),z.x<l.x&&(l.x=z.x),z.x>k.x&&(k.x=z.x),z.y<l.y&&(l.y=z.y),z.y>k.y&&(k.y=z.y),z.z<l.z&&(l.z=z.z),z.z>k.z&&
|
|
|
(k.z=z.z);v.left=l.x;v.right=k.x;v.top=k.y;v.bottom=l.y;v.updateProjectionMatrix()}v=p.shadowMap;r=p.shadowMatrix;w=p.shadowCamera;w.position.setFromMatrixPosition(p.matrixWorld);n.setFromMatrixPosition(p.target.matrixWorld);w.lookAt(n);w.updateMatrixWorld();w.matrixWorldInverse.getInverse(w.matrixWorld);p.cameraHelper&&(p.cameraHelper.visible=p.shadowCameraVisible);p.shadowCameraVisible&&p.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiply(w.projectionMatrix);r.multiply(w.matrixWorldInverse);
|
|
|
-h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();G=q.__webglObjects;p=0;for(v=G.length;p<v;p++)x=G[p],r=x.object,x.render=!1,!r.visible||!r.castShadow||(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)&&r.frustumCulled&&!g.intersectsObject(r)||(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,r.matrixWorld),x.render=!0);p=0;for(v=G.length;p<v;p++)x=G[p],x.render&&(r=x.object,x=x.buffer,B=r.material instanceof THREE.MeshFaceMaterial?
|
|
|
-r.material.materials[0]:r.material,z=void 0!==r.geometry.morphTargets&&0<r.geometry.morphTargets.length&&B.morphTargets,B=r instanceof THREE.SkinnedMesh&&B.skinning,z=r.customDepthMaterial?r.customDepthMaterial:B?z?f:e:z?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(w,q.__lights,null,z,x,r):b.renderBuffer(w,q.__lights,null,z,x,r));G=q.__webglObjectsImmediate;p=0;for(v=G.length;p<v;p++)x=G[p],r=x.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,
|
|
|
-r.matrixWorld),b.renderImmediateObject(w,q.__lights,null,c,r))}t=b.getClearColor();u=b.getClearAlpha();a.clearColor(t.r,t.g,t.b,u);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,g,h,l,k,n,q,s,t,u,p,v;function w(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var r,x,z,G,J,H,B,A;this.init=function(w){r=w.context;x=w;G=new Float32Array([-0.5,-0.5,0,0,0.5,-0.5,1,0,0.5,0.5,1,1,-0.5,0.5,0,1]);J=new Uint16Array([0,1,2,0,2,3]);H=r.createBuffer();B=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,H);r.bufferData(r.ARRAY_BUFFER,G,r.STATIC_DRAW);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,B);r.bufferData(r.ELEMENT_ARRAY_BUFFER,J,r.STATIC_DRAW);w=r.createProgram();
|
|
|
-var C=r.createShader(r.VERTEX_SHADER),Q=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(C,["precision "+x.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
-r.shaderSource(Q,["precision "+x.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
|
|
|
-r.compileShader(C);r.compileShader(Q);r.attachShader(w,C);r.attachShader(w,Q);r.linkProgram(w);A=w;p=r.getAttribLocation(A,"position");v=r.getAttribLocation(A,"uv");a=r.getUniformLocation(A,"uvOffset");b=r.getUniformLocation(A,"uvScale");c=r.getUniformLocation(A,"rotation");d=r.getUniformLocation(A,"scale");e=r.getUniformLocation(A,"color");f=r.getUniformLocation(A,"map");g=r.getUniformLocation(A,"opacity");h=r.getUniformLocation(A,"modelViewMatrix");l=r.getUniformLocation(A,"projectionMatrix");k=
|
|
|
-r.getUniformLocation(A,"fogType");n=r.getUniformLocation(A,"fogDensity");q=r.getUniformLocation(A,"fogNear");s=r.getUniformLocation(A,"fogFar");t=r.getUniformLocation(A,"fogColor");u=r.getUniformLocation(A,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;C=w.getContext("2d");C.fillStyle="#ffffff";C.fillRect(0,0,w.width,w.height);z=new THREE.Texture(w);z.needsUpdate=!0};this.render=function(G,C,J,y){J=G.__webglSprites;if(y=J.length){r.useProgram(A);r.enableVertexAttribArray(p);
|
|
|
-r.enableVertexAttribArray(v);r.disable(r.CULL_FACE);r.enable(r.BLEND);r.bindBuffer(r.ARRAY_BUFFER,H);r.vertexAttribPointer(p,2,r.FLOAT,!1,16,0);r.vertexAttribPointer(v,2,r.FLOAT,!1,16,8);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,B);r.uniformMatrix4fv(l,!1,C.projectionMatrix.elements);r.activeTexture(r.TEXTURE0);r.uniform1i(f,0);var L=0,E=0,D=G.fog;D?(r.uniform3f(t,D.color.r,D.color.g,D.color.b),D instanceof THREE.Fog?(r.uniform1f(q,D.near),r.uniform1f(s,D.far),r.uniform1i(k,1),E=L=1):D instanceof THREE.FogExp2&&
|
|
|
-(r.uniform1f(n,D.density),r.uniform1i(k,2),E=L=2)):(r.uniform1i(k,0),E=L=0);for(var F,S=[],D=0;D<y;D++)F=J[D],!1!==F.visible&&(F._modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,F.matrixWorld),F.z=-F._modelViewMatrix.elements[14]);J.sort(w);for(D=0;D<y;D++)F=J[D],!1!==F.visible&&(C=F.material,r.uniform1f(u,C.alphaTest),r.uniformMatrix4fv(h,!1,F._modelViewMatrix.elements),S[0]=F.scale.x,S[1]=F.scale.y,F=G.fog&&C.fog?E:0,L!==F&&(r.uniform1i(k,F),L=F),null!==C.map?(r.uniform2f(a,C.map.offset.x,
|
|
|
-C.map.offset.y),r.uniform2f(b,C.map.repeat.x,C.map.repeat.y)):(r.uniform2f(a,0,0),r.uniform2f(b,1,1)),r.uniform1f(g,C.opacity),r.uniform3f(e,C.color.r,C.color.g,C.color.b),r.uniform1f(c,C.rotation),r.uniform2fv(d,S),x.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),x.setDepthTest(C.depthTest),x.setDepthWrite(C.depthWrite),C.map&&C.map.image&&C.map.image.width?x.setTexture(C.map,0):x.setTexture(z,0),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0));r.enable(r.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(l,k){var n,q,s,t,u,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===l.autoUpdate&&l.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiplyMatrices(k.projectionMatrix,
|
|
|
-k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=l.__webglObjects;n=0;for(q=p.length;n<q;n++)s=p[n],u=s.object,s.render=!1,!u.visible||(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)&&u.frustumCulled&&!g.intersectsObject(u)||(u._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,u.matrixWorld),s.render=!0);var v;n=0;for(q=p.length;n<q;n++)s=p[n],s.render&&(u=s.object,s=s.buffer,u instanceof THREE.ParticleSystem&&!u.customDepthMaterial||((v=
|
|
|
-u.material instanceof THREE.MeshFaceMaterial?u.material.materials[0]:u.material)&&b.setMaterialFaces(u.material),t=0<u.geometry.morphTargets.length&&v.morphTargets,v=u instanceof THREE.SkinnedMesh&&v.skinning,t=u.customDepthMaterial?u.customDepthMaterial:v?t?f:e:t?d:c,s instanceof THREE.BufferGeometry?b.renderBufferDirect(k,l.__lights,null,t,s,u):b.renderBuffer(k,l.__lights,null,t,s,u)));p=l.__webglObjectsImmediate;n=0;for(q=p.length;n<q;n++)s=p[n],u=s.object,u.visible&&(u._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
-u.matrixWorld),b.renderImmediateObject(k,l.__lights,null,c,u));n=b.getClearColor();q=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,q);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
+h.multiplyMatrices(w.projectionMatrix,w.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(v);b.clear();F=q.__webglObjects;p=0;for(v=F.length;p<v;p++)x=F[p],r=x.object,x.render=!1,!r.visible||!r.castShadow||(r instanceof THREE.Mesh||r instanceof THREE.ParticleSystem)&&r.frustumCulled&&!g.intersectsObject(r)||(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,r.matrixWorld),x.render=!0);p=0;for(v=F.length;p<v;p++)x=F[p],x.render&&(r=x.object,x=x.buffer,C=r.material instanceof THREE.MeshFaceMaterial?
|
|
|
+r.material.materials[0]:r.material,z=void 0!==r.geometry.morphTargets&&0<r.geometry.morphTargets.length&&C.morphTargets,C=r instanceof THREE.SkinnedMesh&&C.skinning,z=r.customDepthMaterial?r.customDepthMaterial:C?z?f:e:z?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(w,q.__lights,null,z,x,r):b.renderBuffer(w,q.__lights,null,z,x,r));F=q.__webglObjectsImmediate;p=0;for(v=F.length;p<v;p++)x=F[p],r=x.object,r.visible&&r.castShadow&&(r._modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,
|
|
|
+r.matrixWorld),b.renderImmediateObject(w,q.__lights,null,c,r))}u=b.getClearColor();t=b.getClearAlpha();a.clearColor(u.r,u.g,u.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){var a,b,c,d,e,f,g,h,l,k,n,q,s,u,t,p,v;function w(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var r,x,z,F,P,B,C,A;this.init=function(w){r=w.context;x=w;F=new Float32Array([-0.5,-0.5,0,0,0.5,-0.5,1,0,0.5,0.5,1,1,-0.5,0.5,0,1]);P=new Uint16Array([0,1,2,0,2,3]);B=r.createBuffer();C=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,B);r.bufferData(r.ARRAY_BUFFER,F,r.STATIC_DRAW);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,C);r.bufferData(r.ELEMENT_ARRAY_BUFFER,P,r.STATIC_DRAW);w=r.createProgram();
|
|
|
+var H=r.createShader(r.VERTEX_SHADER),N=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(H,["precision "+x.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
+r.shaderSource(N,["precision "+x.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
|
|
|
+r.compileShader(H);r.compileShader(N);r.attachShader(w,H);r.attachShader(w,N);r.linkProgram(w);A=w;p=r.getAttribLocation(A,"position");v=r.getAttribLocation(A,"uv");a=r.getUniformLocation(A,"uvOffset");b=r.getUniformLocation(A,"uvScale");c=r.getUniformLocation(A,"rotation");d=r.getUniformLocation(A,"scale");e=r.getUniformLocation(A,"color");f=r.getUniformLocation(A,"map");g=r.getUniformLocation(A,"opacity");h=r.getUniformLocation(A,"modelViewMatrix");l=r.getUniformLocation(A,"projectionMatrix");k=
|
|
|
+r.getUniformLocation(A,"fogType");n=r.getUniformLocation(A,"fogDensity");q=r.getUniformLocation(A,"fogNear");s=r.getUniformLocation(A,"fogFar");u=r.getUniformLocation(A,"fogColor");t=r.getUniformLocation(A,"alphaTest");w=document.createElement("canvas");w.width=8;w.height=8;H=w.getContext("2d");H.fillStyle="#ffffff";H.fillRect(0,0,w.width,w.height);z=new THREE.Texture(w);z.needsUpdate=!0};this.render=function(F,H,N,y){N=F.__webglSprites;if(y=N.length){r.useProgram(A);r.enableVertexAttribArray(p);
|
|
|
+r.enableVertexAttribArray(v);r.disable(r.CULL_FACE);r.enable(r.BLEND);r.bindBuffer(r.ARRAY_BUFFER,B);r.vertexAttribPointer(p,2,r.FLOAT,!1,16,0);r.vertexAttribPointer(v,2,r.FLOAT,!1,16,8);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,C);r.uniformMatrix4fv(l,!1,H.projectionMatrix.elements);r.activeTexture(r.TEXTURE0);r.uniform1i(f,0);var K=0,E=0,D=F.fog;D?(r.uniform3f(u,D.color.r,D.color.g,D.color.b),D instanceof THREE.Fog?(r.uniform1f(q,D.near),r.uniform1f(s,D.far),r.uniform1i(k,1),E=K=1):D instanceof THREE.FogExp2&&
|
|
|
+(r.uniform1f(n,D.density),r.uniform1i(k,2),E=K=2)):(r.uniform1i(k,0),E=K=0);for(var G,P=[],D=0;D<y;D++)G=N[D],!1!==G.visible&&(G._modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,G.matrixWorld),G.z=-G._modelViewMatrix.elements[14]);N.sort(w);for(D=0;D<y;D++)G=N[D],!1!==G.visible&&(H=G.material,r.uniform1f(t,H.alphaTest),r.uniformMatrix4fv(h,!1,G._modelViewMatrix.elements),P[0]=G.scale.x,P[1]=G.scale.y,G=F.fog&&H.fog?E:0,K!==G&&(r.uniform1i(k,G),K=G),null!==H.map?(r.uniform2f(a,H.map.offset.x,
|
|
|
+H.map.offset.y),r.uniform2f(b,H.map.repeat.x,H.map.repeat.y)):(r.uniform2f(a,0,0),r.uniform2f(b,1,1)),r.uniform1f(g,H.opacity),r.uniform3f(e,H.color.r,H.color.g,H.color.b),r.uniform1f(c,H.rotation),r.uniform2fv(d,P),x.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),x.setDepthTest(H.depthTest),x.setDepthWrite(H.depthWrite),H.map&&H.map.image&&H.map.image.width?x.setTexture(H.map,0):x.setTexture(z,0),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0));r.enable(r.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;g=THREE.ShaderLib.depthRGBA;var h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(l,k){var n,q,s,u,t,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===l.autoUpdate&&l.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiplyMatrices(k.projectionMatrix,
|
|
|
+k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=l.__webglObjects;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,s.render=!1,!t.visible||(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)&&t.frustumCulled&&!g.intersectsObject(t)||(t._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,t.matrixWorld),s.render=!0);var v;n=0;for(q=p.length;n<q;n++)s=p[n],s.render&&(t=s.object,s=s.buffer,t instanceof THREE.ParticleSystem&&!t.customDepthMaterial||((v=
|
|
|
+t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material)&&b.setMaterialFaces(t.material),u=0<t.geometry.morphTargets.length&&v.morphTargets,v=t instanceof THREE.SkinnedMesh&&v.skinning,u=t.customDepthMaterial?t.customDepthMaterial:v?u?f:e:u?d:c,s instanceof THREE.BufferGeometry?b.renderBufferDirect(k,l.__lights,null,u,s,t):b.renderBuffer(k,l.__lights,null,u,s,t)));p=l.__webglObjectsImmediate;n=0;for(q=p.length;n<q;n++)s=p[n],t=s.object,t.visible&&(t._modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,
|
|
|
+t.matrixWorld),b.renderImmediateObject(k,l.__lights,null,c,t));n=b.getClearColor();q=b.getClearAlpha();a.clearColor(n.r,n.g,n.b,q);a.enable(a.BLEND)}};THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},lensFlare:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
|