|
@@ -32,16 +32,16 @@ Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);if(b<1E-4){this.x=1;this.z=this.y=0}el
|
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],f=-b[10]*b[4]+b[6]*b[8],e=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],i=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,j=this.elements;j[0]=b*a;j[1]=b*c;j[2]=b*d;j[3]=b*f;j[4]=b*e;j[5]=b*g;j[6]=b*h;j[7]=b*i;j[8]=b*l;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},transposeIntoArray:function(a){var b=this.m;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}};THREE.Matrix4=function(a,b,c,d,f,e,g,h,i,l,j,n,m,p,q,o){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,e!==void 0?e:1,g||0,h||0,i||0,l||0,j!==void 0?j:1,n||0,m||0,p||0,q||0,o!==void 0?o:1)};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,l,j,n,m,p,q,o){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=f;t[5]=e;t[9]=g;t[13]=h;t[2]=i;t[6]=l;t[10]=j;t[14]=n;t[3]=m;t[7]=p;t[11]=q;t[15]=o;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){a=a.elements;this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]);return this},lookAt:function(a,b,c){var d=this.elements,
|
|
|
-f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],h=c[8],i=c[12],l=c[1],j=c[5],n=c[9],m=c[13],p=c[2],q=c[6],o=c[10],t=c[14],s=c[3],u=c[7],v=c[11],c=c[15],r=d[0],A=d[4],
|
|
|
-x=d[8],B=d[12],C=d[1],z=d[5],F=d[9],H=d[13],K=d[2],E=d[6],L=d[10],J=d[14],I=d[3],R=d[7],P=d[11],d=d[15];f[0]=e*r+g*C+h*K+i*I;f[4]=e*A+g*z+h*E+i*R;f[8]=e*x+g*F+h*L+i*P;f[12]=e*B+g*H+h*J+i*d;f[1]=l*r+j*C+n*K+m*I;f[5]=l*A+j*z+n*E+m*R;f[9]=l*x+j*F+n*L+m*P;f[13]=l*B+j*H+n*J+m*d;f[2]=p*r+q*C+o*K+t*I;f[6]=p*A+q*z+o*E+t*R;f[10]=p*x+q*F+o*L+t*P;f[14]=p*B+q*H+o*J+t*d;f[3]=s*r+u*C+v*K+c*I;f[7]=s*A+u*z+v*E+c*R;f[11]=s*x+u*F+v*L+c*P;f[15]=s*B+u*H+v*J+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
+f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;f.cross(c,g).normalize();if(f.length()===0){g.x=g.x+1E-4;f.cross(c,g).normalize()}e.cross(g,f);d[0]=f.x;d[4]=e.x;d[8]=g.x;d[1]=f.y;d[5]=e.y;d[9]=g.y;d[2]=f.z;d[6]=e.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,f=this.elements,e=c[0],g=c[4],h=c[8],i=c[12],l=c[1],j=c[5],n=c[9],m=c[13],p=c[2],q=c[6],o=c[10],t=c[14],r=c[3],u=c[7],v=c[11],c=c[15],s=d[0],A=d[4],
|
|
|
+x=d[8],B=d[12],C=d[1],z=d[5],F=d[9],H=d[13],K=d[2],E=d[6],L=d[10],J=d[14],I=d[3],R=d[7],P=d[11],d=d[15];f[0]=e*s+g*C+h*K+i*I;f[4]=e*A+g*z+h*E+i*R;f[8]=e*x+g*F+h*L+i*P;f[12]=e*B+g*H+h*J+i*d;f[1]=l*s+j*C+n*K+m*I;f[5]=l*A+j*z+n*E+m*R;f[9]=l*x+j*F+n*L+m*P;f[13]=l*B+j*H+n*J+m*d;f[2]=p*s+q*C+o*K+t*I;f[6]=p*A+q*z+o*E+t*R;f[10]=p*x+q*F+o*L+t*P;f[14]=p*B+q*H+o*J+t*d;f[3]=r*s+u*C+v*K+c*I;f[7]=r*A+u*z+v*E+c*R;f[11]=r*x+u*F+v*L+c*P;f[15]=r*B+u*H+v*J+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(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]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
|
|
|
b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=1/(b[3]*c+b[7]*d+b[11]*f+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*f+b[12])*e;a.y=(b[1]*c+b[5]*d+b[9]*f+b[13])*e;a.z=(b[2]*c+b[6]*d+b[10]*f+b[14])*e;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w;a.x=b[0]*c+b[4]*d+b[8]*f+b[12]*e;a.y=b[1]*c+b[5]*d+b[9]*f+b[13]*e;a.z=b[2]*c+b[6]*d+b[10]*f+b[14]*e;a.w=b[3]*c+b[7]*d+b[11]*f+b[15]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,
|
|
|
c=0,d=a.length;c<d;c=c+3){b.x=a[c];b.y=a[c+1];b.z=a[c+2];this.multiplyVector3(b);a[c]=b.x;a[c+1]=b.y;a[c+2]=b.z}return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z;a.x=c*b[0]+d*b[4]+f*b[8];a.y=c*b[1]+d*b[5]+f*b[9];a.z=c*b[2]+d*b[6]+f*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*
|
|
|
a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],f=a[12],e=a[1],g=a[5],h=a[9],i=a[13],l=a[2],j=a[6],n=a[10],m=a[14],p=a[3],q=a[7],o=a[11],a=a[15];return f*h*j*p-d*i*j*p-f*g*n*p+c*i*n*p+d*g*m*p-c*h*m*p-f*h*l*q+d*i*l*q+f*e*n*q-b*i*n*q-d*e*m*q+b*h*m*q+f*g*l*o-c*i*l*o-f*e*j*o+b*i*j*o+c*e*m*o-b*g*m*o-d*g*l*a+c*h*l*a+d*e*j*a-b*h*j*a-c*e*n*a+b*g*n*a},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=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],
|
|
|
-a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],h=c[1],i=c[5],l=c[9],j=c[13],n=c[2],m=c[6],p=c[10],q=c[14],o=c[3],t=c[7],s=c[11],c=c[15];b[0]=l*q*t-j*p*t+j*m*s-i*q*s-l*m*c+i*p*c;b[4]=g*p*t-e*q*t-g*m*s+f*q*s+e*m*c-f*p*c;b[8]=e*j*t-g*l*t+g*i*s-f*j*s-e*i*c+f*l*c;b[12]=g*l*m-e*j*m-g*i*p+f*j*p+e*i*q-f*l*q;b[1]=j*p*o-l*q*o-j*n*s+h*q*s+l*n*c-h*p*c;b[5]=e*q*o-g*p*o+g*n*s-d*q*s-e*n*c+d*p*c;b[9]=g*l*o-e*j*o-g*h*s+d*j*s+e*h*c-d*l*c;b[13]=e*j*n-g*l*n+g*h*p-d*
|
|
|
-j*p-e*h*q+d*l*q;b[2]=i*q*o-j*m*o+j*n*t-h*q*t-i*n*c+h*m*c;b[6]=g*m*o-f*q*o-g*n*t+d*q*t+f*n*c-d*m*c;b[10]=f*j*o-g*i*o+g*h*t-d*j*t-f*h*c+d*i*c;b[14]=g*i*n-f*j*n-g*h*m+d*j*m+f*h*q-d*i*q;b[3]=l*m*o-i*p*o-l*n*t+h*p*t+i*n*s-h*m*s;b[7]=f*p*o-e*m*o+e*n*t-d*p*t-f*n*s+d*m*s;b[11]=e*i*o-f*l*o-e*h*t+d*l*t+f*h*s-d*i*s;b[15]=f*l*n-e*i*n+e*h*m-d*l*m-f*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
|
|
|
+a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],h=c[1],i=c[5],l=c[9],j=c[13],n=c[2],m=c[6],p=c[10],q=c[14],o=c[3],t=c[7],r=c[11],c=c[15];b[0]=l*q*t-j*p*t+j*m*r-i*q*r-l*m*c+i*p*c;b[4]=g*p*t-e*q*t-g*m*r+f*q*r+e*m*c-f*p*c;b[8]=e*j*t-g*l*t+g*i*r-f*j*r-e*i*c+f*l*c;b[12]=g*l*m-e*j*m-g*i*p+f*j*p+e*i*q-f*l*q;b[1]=j*p*o-l*q*o-j*n*r+h*q*r+l*n*c-h*p*c;b[5]=e*q*o-g*p*o+g*n*r-d*q*r-e*n*c+d*p*c;b[9]=g*l*o-e*j*o-g*h*r+d*j*r+e*h*c-d*l*c;b[13]=e*j*n-g*l*n+g*h*p-d*
|
|
|
+j*p-e*h*q+d*l*q;b[2]=i*q*o-j*m*o+j*n*t-h*q*t-i*n*c+h*m*c;b[6]=g*m*o-f*q*o-g*n*t+d*q*t+f*n*c-d*m*c;b[10]=f*j*o-g*i*o+g*h*t-d*j*t-f*h*c+d*i*c;b[14]=g*i*n-f*j*n-g*h*m+d*j*m+f*h*q-d*i*q;b[3]=l*m*o-i*p*o-l*n*t+h*p*t+i*n*r-h*m*r;b[7]=f*p*o-e*m*o+e*n*t-d*p*t-f*n*r+d*m*r;b[11]=e*i*o-f*l*o-e*h*t+d*l*t+f*h*r-d*i*r;b[15]=f*l*n-e*i*n+e*h*m-d*l*m-f*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,f=a.y,e=a.z,g=Math.cos(d),d=Math.sin(d),
|
|
|
h=Math.cos(f),f=Math.sin(f),i=Math.cos(e),e=Math.sin(e);if(b===void 0||b==="XYZ"){var l=g*i,j=g*e,n=d*i,m=d*e;c[0]=h*i;c[4]=-h*e;c[8]=f;c[1]=j+n*f;c[5]=l-m*f;c[9]=-d*h;c[2]=m-l*f;c[6]=n+j*f;c[10]=g*h}else if(b==="YXZ"){l=h*i;j=h*e;n=f*i;m=f*e;c[0]=l+m*d;c[4]=n*d-j;c[8]=g*f;c[1]=g*e;c[5]=g*i;c[9]=-d;c[2]=j*d-n;c[6]=m+l*d;c[10]=g*h}else if(b==="ZXY"){l=h*i;j=h*e;n=f*i;m=f*e;c[0]=l-m*d;c[4]=-g*e;c[8]=n+j*d;c[1]=j+n*d;c[5]=g*i;c[9]=m-l*d;c[2]=-g*f;c[6]=d;c[10]=g*h}else if(b==="ZYX"){l=g*i;j=g*e;n=d*i;
|
|
|
m=d*e;c[0]=h*i;c[4]=n*f-j;c[8]=l*f+m;c[1]=h*e;c[5]=m*f+l;c[9]=j*f-n;c[2]=-f;c[6]=d*h;c[10]=g*h}else if(b==="YZX"){l=g*h;j=g*f;n=d*h;m=d*f;c[0]=h*i;c[4]=m-l*e;c[8]=n*e+j;c[1]=e;c[5]=g*i;c[9]=-d*i;c[2]=-f*i;c[6]=j*e+n;c[10]=l-m*e}else if(b==="XZY"){l=g*h;j=g*f;n=d*h;m=d*f;c[0]=h*i;c[4]=-e;c[8]=f*i;c[1]=l*e+m;c[5]=g*i;c[9]=j*e-n;c[2]=n*e-j;c[6]=d*i;c[10]=m*e+l}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,f=a.z,e=a.w,g=c+c,h=d+d,i=f+f,a=c*g,l=c*h,c=c*i,j=d*h,d=d*
|
|
|
i,f=f*i,g=e*g,h=e*h,e=e*i;b[0]=1-(j+f);b[4]=l-e;b[8]=c+h;b[1]=l+e;b[5]=1-(a+f);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+j);return this},compose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__m1,e=THREE.Matrix4.__m2;f.identity();f.setRotationFromQuaternion(b);e.makeScale(c.x,c.y,c.z);this.multiply(f,e);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,f=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;f.set(d[0],d[1],d[2]);e.set(d[4],d[5],d[6]);
|
|
@@ -49,8 +49,8 @@ g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b inst
|
|
|
c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition: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(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),f=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*f;b[5]=a[5]*f;b[6]=a[6]*f;b[8]=a[8]*c;b[9]=a[9]*
|
|
|
c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],f=b[6],e=b[7],g=b[8],h=b[9],i=b[10],l=b[11],j=Math.cos(a),a=Math.sin(a);b[4]=j*c+a*g;b[5]=j*d+a*h;b[6]=j*f+a*i;b[7]=j*e+a*l;b[8]=j*g-a*c;b[9]=j*h-a*d;b[10]=j*i-a*f;b[11]=j*l-a*e;return this},rotateY:function(a){var b=
|
|
|
this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[8],h=b[9],i=b[10],l=b[11],j=Math.cos(a),a=Math.sin(a);b[0]=j*c-a*g;b[1]=j*d-a*h;b[2]=j*f-a*i;b[3]=j*e-a*l;b[8]=j*g+a*c;b[9]=j*h+a*d;b[10]=j*i+a*f;b[11]=j*l+a*e;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],f=b[2],e=b[3],g=b[4],h=b[5],i=b[6],l=b[7],j=Math.cos(a),a=Math.sin(a);b[0]=j*c+a*g;b[1]=j*d+a*h;b[2]=j*f+a*i;b[3]=j*e+a*l;b[4]=j*g-a*c;b[5]=j*h-a*d;b[6]=j*i-a*f;b[7]=j*l-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;
|
|
|
-if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,h=f*f,i=e*e,l=Math.cos(b),j=Math.sin(b),n=1-l,m=d*f*n,p=d*e*n,n=f*e*n,d=d*j,q=f*j,j=e*j,e=g+(1-g)*l,g=m+j,f=p-q,m=m-j,h=h+(1-h)*l,j=n+d,p=p+q,n=n-d,i=i+(1-i)*l,l=c[0],d=c[1],q=c[2],o=c[3],t=c[4],s=c[5],u=c[6],v=c[7],r=c[8],A=c[9],x=c[10],B=c[11];c[0]=e*l+g*t+f*r;c[1]=e*d+g*
|
|
|
-s+f*A;c[2]=e*q+g*u+f*x;c[3]=e*o+g*v+f*B;c[4]=m*l+h*t+j*r;c[5]=m*d+h*s+j*A;c[6]=m*q+h*u+j*x;c[7]=m*o+h*v+j*B;c[8]=p*l+n*t+i*r;c[9]=p*d+n*s+i*A;c[10]=p*q+n*u+i*x;c[11]=p*o+n*v+i*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=b[11]*a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+
|
|
|
+if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,f=a.y,e=a.z,g=Math.sqrt(d*d+f*f+e*e),d=d/g,f=f/g,e=e/g,g=d*d,h=f*f,i=e*e,l=Math.cos(b),j=Math.sin(b),n=1-l,m=d*f*n,p=d*e*n,n=f*e*n,d=d*j,q=f*j,j=e*j,e=g+(1-g)*l,g=m+j,f=p-q,m=m-j,h=h+(1-h)*l,j=n+d,p=p+q,n=n-d,i=i+(1-i)*l,l=c[0],d=c[1],q=c[2],o=c[3],t=c[4],r=c[5],u=c[6],v=c[7],s=c[8],A=c[9],x=c[10],B=c[11];c[0]=e*l+g*t+f*s;c[1]=e*d+g*
|
|
|
+r+f*A;c[2]=e*q+g*u+f*x;c[3]=e*o+g*v+f*B;c[4]=m*l+h*t+j*s;c[5]=m*d+h*r+j*A;c[6]=m*q+h*u+j*x;c[7]=m*o+h*v+j*B;c[8]=p*l+n*t+i*s;c[9]=p*d+n*r+i*A;c[10]=p*q+n*u+i*x;c[11]=p*o+n*v+i*B;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=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),f=1-c,e=a.x,g=a.y,h=a.z,i=f*e,l=f*g;this.set(i*e+c,i*g-d*h,i*h+d*g,0,i*g+d*h,l*g+c,l*h-d*e,0,i*h-d*g,l*h+d*e,f*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,f,e){var g=this.elements;g[0]=2*f/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*f/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(e+f)/(e-f);g[14]=-2*e*f/(e-f);g[3]=
|
|
|
0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),f=-a;return this.makeFrustum(f*b,a*b,f,a,c,d)},makeOrthographic:function(a,b,c,d,f,e){var g=this.elements,h=b-a,i=c-d,l=e-f;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((e+f)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],
|
|
@@ -76,16 +76,16 @@ if(f.name===a)return f;if(b){f=f.getChildByName(a,b);if(f!==void 0)return f}}},g
|
|
|
1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(a){this.matrixAutoUpdate===true&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||a===true){this.parent===void 0?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=false;a=true}for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},
|
|
|
clone:function(){}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function a(){if(e===h){var a=new THREE.RenderableObject;g.push(a);h++;e++;return a}return g[e++]}function b(){if(l===n){var a=new THREE.RenderableVertex;j.push(a);n++;l++;return a}return j[l++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,e=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(f>=0&&e>=0&&g>=0&&h>=0)return true;if(f<0&&e<0||g<0&&h<0)return false;f<0?c=Math.max(c,f/(f-e)):e<0&&(d=Math.min(d,f/(f-e)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));
|
|
|
-if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,e,g=[],h=0,i,l,j=[],n=0,m,p,q=[],o=0,t,s=[],u=0,v,r,A=[],x=0,B,C,z=[],F=0,H={objects:[],sprites:[],lights:[],elements:[]},K=new THREE.Vector3,E=new THREE.Vector4,L=new THREE.Matrix4,J=new THREE.Matrix4,I=new THREE.Frustum,R=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);L.multiply(b.projectionMatrix,b.matrixWorldInverse);L.multiplyVector3(a);return a};this.unprojectVector=
|
|
|
-function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);L.multiply(b.matrixWorld,b.projectionMatrixInverse);L.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(g,h,n,M){var ea=h.near,Q=h.far,ba=false,ta,fa,$,S,X,ia,Ia,pa,ua,Ca,Ja,Xa,ja,pb,Oa,Ya;C=r=t=p=0;H.elements.length=0;g.updateMatrixWorld();h.parent===
|
|
|
+if(d<c)return false;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return true}var f,e,g=[],h=0,i,l,j=[],n=0,m,p,q=[],o=0,t,r=[],u=0,v,s,A=[],x=0,B,C,z=[],F=0,H={objects:[],sprites:[],lights:[],elements:[]},K=new THREE.Vector3,E=new THREE.Vector4,L=new THREE.Matrix4,J=new THREE.Matrix4,I=new THREE.Frustum,R=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);L.multiply(b.projectionMatrix,b.matrixWorldInverse);L.multiplyVector3(a);return a};this.unprojectVector=
|
|
|
+function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);L.multiply(b.matrixWorld,b.projectionMatrixInverse);L.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectScene=function(g,h,n,M){var ea=h.near,Q=h.far,ba=false,ta,fa,$,S,X,ia,Ia,pa,ua,Ca,Ja,Xa,ja,pb,Oa,Ya;C=s=t=p=0;H.elements.length=0;g.updateMatrixWorld();h.parent===
|
|
|
void 0&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);L.multiply(h.projectionMatrix,h.matrixWorldInverse);I.setFromMatrix(L);e=0;H.objects.length=0;H.sprites.length=0;H.lights.length=0;var qb=function(b){if(b.visible!==false){if((b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===false||I.contains(b)===true)){f=a();f.object=b;if(b.renderDepth!==null)f.z=b.renderDepth;else{K.copy(b.matrixWorld.getPosition());L.multiplyVector3(K);f.z=K.z}H.objects.push(f)}else if(b instanceof
|
|
|
THREE.Sprite||b instanceof THREE.Particle){f=a();f.object=b;if(b.renderDepth!==null)f.z=b.renderDepth;else{K.copy(b.matrixWorld.getPosition());L.multiplyVector3(K);f.z=K.z}H.sprites.push(f)}else b instanceof THREE.Light&&H.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)qb(b.children[c])}};qb(g);n===true&&H.objects.sort(c);g=0;for(n=H.objects.length;g<n;g++){pa=H.objects[g].object;ua=pa.matrixWorld;l=0;if(pa instanceof THREE.Mesh){Ca=pa.geometry;Ja=pa.geometry.materials;$=Ca.vertices;Xa=Ca.faces;
|
|
|
pb=Ca.faceVertexUvs;Ca=pa.matrixRotationWorld.extractRotation(ua);Ya=pa.material instanceof THREE.MeshFaceMaterial;ta=0;for(fa=$.length;ta<fa;ta++){i=b();i.positionWorld.copy($[ta]);ua.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);L.multiplyVector4(i.positionScreen);i.positionScreen.x=i.positionScreen.x/i.positionScreen.w;i.positionScreen.y=i.positionScreen.y/i.positionScreen.w;i.visible=i.positionScreen.z>ea&&i.positionScreen.z<Q}$=0;for(ta=Xa.length;$<ta;$++){Ia=Xa[$];
|
|
|
fa=Ya===true?Ja[Ia.materialIndex]:pa.material;if(fa!==void 0){ia=fa.side;if(Ia instanceof THREE.Face3){S=j[Ia.a];X=j[Ia.b];ja=j[Ia.c];if(S.visible===true&&X.visible===true&&ja.visible===true){ba=(ja.positionScreen.x-S.positionScreen.x)*(X.positionScreen.y-S.positionScreen.y)-(ja.positionScreen.y-S.positionScreen.y)*(X.positionScreen.x-S.positionScreen.x)<0;if(ia===THREE.DoubleSide||ba===(ia===THREE.FrontSide)){if(p===o){Oa=new THREE.RenderableFace3;q.push(Oa);o++;p++;m=Oa}else m=q[p++];m.v1.copy(S);
|
|
|
m.v2.copy(X);m.v3.copy(ja)}else continue}else continue}else if(Ia instanceof THREE.Face4){S=j[Ia.a];X=j[Ia.b];ja=j[Ia.c];Oa=j[Ia.d];if(S.visible===true&&X.visible===true&&ja.visible===true&&Oa.visible===true){ba=(Oa.positionScreen.x-S.positionScreen.x)*(X.positionScreen.y-S.positionScreen.y)-(Oa.positionScreen.y-S.positionScreen.y)*(X.positionScreen.x-S.positionScreen.x)<0||(X.positionScreen.x-ja.positionScreen.x)*(Oa.positionScreen.y-ja.positionScreen.y)-(X.positionScreen.y-ja.positionScreen.y)*
|
|
|
-(Oa.positionScreen.x-ja.positionScreen.x)<0;if(ia===THREE.DoubleSide||ba===(ia===THREE.FrontSide)){if(t===u){var wb=new THREE.RenderableFace4;s.push(wb);u++;t++;m=wb}else m=s[t++];m.v1.copy(S);m.v2.copy(X);m.v3.copy(ja);m.v4.copy(Oa)}else continue}else continue}m.normalWorld.copy(Ia.normal);ba===false&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&m.normalWorld.negate();Ca.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Ia.centroid);ua.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
|
|
|
+(Oa.positionScreen.x-ja.positionScreen.x)<0;if(ia===THREE.DoubleSide||ba===(ia===THREE.FrontSide)){if(t===u){var wb=new THREE.RenderableFace4;r.push(wb);u++;t++;m=wb}else m=r[t++];m.v1.copy(S);m.v2.copy(X);m.v3.copy(ja);m.v4.copy(Oa)}else continue}else continue}m.normalWorld.copy(Ia.normal);ba===false&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&m.normalWorld.negate();Ca.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Ia.centroid);ua.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
|
|
|
L.multiplyVector3(m.centroidScreen);Ia=Ia.vertexNormals;S=0;for(X=Ia.length;S<X;S++){ja=m.vertexNormalsWorld[S];ja.copy(Ia[S]);ba===false&&(ia===THREE.BackSide||ia===THREE.DoubleSide)&&ja.negate();Ca.multiplyVector3(ja)}m.vertexNormalsLength=Ia.length;S=0;for(X=pb.length;S<X;S++){ja=pb[S][$];if(ja!==void 0){ia=0;for(Ia=ja.length;ia<Ia;ia++)m.uvs[S][ia]=ja[ia]}}m.material=fa;m.z=m.centroidScreen.z;H.elements.push(m)}}}else if(pa instanceof THREE.Line){J.multiply(L,ua);$=pa.geometry.vertices;S=b();
|
|
|
-S.positionScreen.copy($[0]);J.multiplyVector4(S.positionScreen);ua=pa.type===THREE.LinePieces?2:1;ta=1;for(fa=$.length;ta<fa;ta++){S=b();S.positionScreen.copy($[ta]);J.multiplyVector4(S.positionScreen);if(!((ta+1)%ua>0)){X=j[l-2];R.copy(S.positionScreen);P.copy(X.positionScreen);if(d(R,P)===true){R.multiplyScalar(1/R.w);P.multiplyScalar(1/P.w);if(r===x){Ja=new THREE.RenderableLine;A.push(Ja);x++;r++;v=Ja}else v=A[r++];v.v1.positionScreen.copy(R);v.v2.positionScreen.copy(P);v.z=Math.max(R.z,P.z);v.material=
|
|
|
+S.positionScreen.copy($[0]);J.multiplyVector4(S.positionScreen);ua=pa.type===THREE.LinePieces?2:1;ta=1;for(fa=$.length;ta<fa;ta++){S=b();S.positionScreen.copy($[ta]);J.multiplyVector4(S.positionScreen);if(!((ta+1)%ua>0)){X=j[l-2];R.copy(S.positionScreen);P.copy(X.positionScreen);if(d(R,P)===true){R.multiplyScalar(1/R.w);P.multiplyScalar(1/P.w);if(s===x){Ja=new THREE.RenderableLine;A.push(Ja);x++;s++;v=Ja}else v=A[s++];v.v1.positionScreen.copy(R);v.v2.positionScreen.copy(P);v.z=Math.max(R.z,P.z);v.material=
|
|
|
pa.material;H.elements.push(v)}}}}}g=0;for(n=H.sprites.length;g<n;g++){pa=H.sprites[g].object;ua=pa.matrixWorld;if(pa instanceof THREE.Particle){E.set(ua.elements[12],ua.elements[13],ua.elements[14],1);L.multiplyVector4(E);E.z=E.z/E.w;if(E.z>0&&E.z<1){if(C===F){ea=new THREE.RenderableParticle;z.push(ea);F++;C++;B=ea}else B=z[C++];B.object=pa;B.x=E.x/E.w;B.y=E.y/E.w;B.z=E.z;B.rotation=pa.rotation.z;B.scale.x=pa.scale.x*Math.abs(B.x-(E.x+h.projectionMatrix.elements[0])/(E.w+h.projectionMatrix.elements[12]));
|
|
|
B.scale.y=pa.scale.y*Math.abs(B.y-(E.y+h.projectionMatrix.elements[5])/(E.w+h.projectionMatrix.elements[13]));B.material=pa.material;H.elements.push(B)}}}M===true&&H.elements.sort(c);return H}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a,b){var c=Math.cos(a.x/2),d=Math.cos(a.y/2),f=Math.cos(a.z/2),e=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);if(b===void 0||b==="XYZ"){this.x=e*d*f+c*g*h;this.y=c*g*f-e*d*h;this.z=c*d*h+e*g*f;this.w=c*d*f-e*g*h}else if(b==="YXZ"){this.x=e*d*f+c*g*h;this.y=c*g*f-e*d*h;this.z=
|
|
@@ -110,7 +110,7 @@ for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;
|
|
|
f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];a=0;for(b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var e=new THREE.Geometry;e.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=
|
|
|
[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,l;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];i=new THREE.Vector3;l=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3};g.push(i);h.push(l)}}g=this.morphNormals[a];e.vertices=this.morphTargets[a].vertices;e.computeFaceNormals();e.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];
|
|
|
i=g.faceNormals[c];l=g.vertexNormals[c];i.copy(f.normal);if(f instanceof THREE.Face3){l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2])}else{l.a.copy(f.vertexNormals[0]);l.b.copy(f.vertexNormals[1]);l.c.copy(f.vertexNormals[2]);l.d.copy(f.vertexNormals[3])}}}c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.normal=f.__originalFaceNormal;f.vertexNormals=f.__originalVertexNormals}},computeTangents:function(){function a(a,b,c,d,f,e,C){h=a.vertices[b];i=a.vertices[c];
|
|
|
-l=a.vertices[d];j=g[f];n=g[e];m=g[C];p=i.x-h.x;q=l.x-h.x;o=i.y-h.y;t=l.y-h.y;s=i.z-h.z;u=l.z-h.z;v=n.u-j.u;r=m.u-j.u;A=n.v-j.v;x=m.v-j.v;B=1/(v*x-r*A);H.set((x*p-A*q)*B,(x*o-A*t)*B,(x*s-A*u)*B);K.set((v*q-r*p)*B,(v*t-r*o)*B,(v*u-r*s)*B);z[b].addSelf(H);z[c].addSelf(H);z[d].addSelf(H);F[b].addSelf(K);F[c].addSelf(K);F[d].addSelf(K)}var b,c,d,f,e,g,h,i,l,j,n,m,p,q,o,t,s,u,v,r,A,x,B,C,z=[],F=[],H=new THREE.Vector3,K=new THREE.Vector3,E=new THREE.Vector3,L=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=
|
|
|
+l=a.vertices[d];j=g[f];n=g[e];m=g[C];p=i.x-h.x;q=l.x-h.x;o=i.y-h.y;t=l.y-h.y;r=i.z-h.z;u=l.z-h.z;v=n.u-j.u;s=m.u-j.u;A=n.v-j.v;x=m.v-j.v;B=1/(v*x-s*A);H.set((x*p-A*q)*B,(x*o-A*t)*B,(x*r-A*u)*B);K.set((v*q-s*p)*B,(v*t-s*o)*B,(v*u-s*r)*B);z[b].addSelf(H);z[c].addSelf(H);z[d].addSelf(H);F[b].addSelf(K);F[c].addSelf(K);F[d].addSelf(K)}var b,c,d,f,e,g,h,i,l,j,n,m,p,q,o,t,r,u,v,s,A,x,B,C,z=[],F=[],H=new THREE.Vector3,K=new THREE.Vector3,E=new THREE.Vector3,L=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=
|
|
|
this.vertices.length;b<c;b++){z[b]=new THREE.Vector3;F[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.faceVertexUvs[0][b];if(e instanceof THREE.Face3)a(this,e.a,e.b,e.c,0,1,2);else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.d,0,1,3);a(this,e.b,e.c,e.d,1,2,3)}}var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){e=this.faces[b];for(d=0;d<e.vertexNormals.length;d++){J.copy(e.vertexNormals[d]);f=e[I[d]];C=z[f];E.copy(C);E.subSelf(J.multiplyScalar(J.dot(C))).normalize();
|
|
|
L.cross(e.vertexNormals[d],C);f=L.dot(F[f]);f=f<0?-1:1;e.vertexTangents[d]=new THREE.Vector4(E.x,E.y,E.z,f)}}this.hasTangents=true},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<f;d++){a=this.vertices[d];if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=
|
|
|
a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){var a=0;if(this.boundingSphere===null)this.boundingSphere={radius:0};for(var b=0,c=this.vertices.length;b<c;b++){var d=this.vertices[b].lengthSq();d>a&&(a=d)}this.boundingSphere.radius=Math.sqrt(a)},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,4),e,g,h,i;e=0;for(g=this.vertices.length;e<g;e++){d=
|
|
@@ -119,11 +119,11 @@ a.materialIndex);d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexU
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;if(this.attributes.position)b=this.attributes.position.array;if(this.attributes.normal)c=this.attributes.normal.array;if(b!==void 0){a.multiplyVector3Array(b);this.verticesNeedUpdate=true}if(c!==void 0){b=new THREE.Matrix4;b.extractRotation(a);b.multiplyVector3Array(c);this.normalsNeedUpdate=true}},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,
|
|
|
Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,f,e=0,g=a.length;e<g;e=e+3){c=a[e];d=a[e+1];f=a[e+2];if(c<b.min.x)b.min.x=c;else if(c>b.max.x)b.max.x=c;if(d<b.min.y)b.min.y=d;else if(d>b.max.y)b.max.y=d;if(f<b.min.z)b.min.z=f;else if(f>b.max.z)b.max.z=f}if(a===void 0||a.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere=
|
|
|
{radius:0};var a=this.attributes.position.array;if(a){for(var b,c=0,d,f,e=0,g=a.length;e<g;e=e+3){b=a[e];d=a[e+1];f=a[e+2];b=b*b+d*d+f*f;b>c&&(c=b)}this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position&&this.attributes.index){var a,b,c,d;a=this.attributes.position.array.length;if(this.attributes.normal===void 0)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
|
-0}var f=this.offsets,e=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,l,j,n,m,p,q=new THREE.Vector3,o=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;i=f[c].count;var v=f[c].index;a=b;for(b=b+i;a<b;a=a+3){i=v+e[a];l=v+e[a+1];j=v+e[a+2];n=g[i*3];m=g[i*3+1];p=g[i*3+2];q.set(n,m,p);n=g[l*3];m=g[l*3+1];p=g[l*3+2];o.set(n,m,p);n=g[j*3];m=g[j*3+1];p=g[j*3+2];t.set(n,m,p);s.sub(t,o);u.sub(q,
|
|
|
-o);s.crossSelf(u);h[i*3]=h[i*3]+s.x;h[i*3+1]=h[i*3+1]+s.y;h[i*3+2]=h[i*3+2]+s.z;h[l*3]=h[l*3]+s.x;h[l*3+1]=h[l*3+1]+s.y;h[l*3+2]=h[l*3+2]+s.z;h[j*3]=h[j*3]+s.x;h[j*3+1]=h[j*3+1]+s.y;h[j*3+2]=h[j*3+2]+s.z}}a=0;for(b=h.length;a<b;a=a+3){n=h[a];m=h[a+1];p=h[a+2];c=1/Math.sqrt(n*n+m*m+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a){N.x=d[a*3];N.y=d[a*3+1];N.z=d[a*3+2];ca.copy(N);ea=i[a];P.copy(ea);P.subSelf(N.multiplyScalar(N.dot(ea))).normalize();
|
|
|
+0}var f=this.offsets,e=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,l,j,n,m,p,q=new THREE.Vector3,o=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,u=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;i=f[c].count;var v=f[c].index;a=b;for(b=b+i;a<b;a=a+3){i=v+e[a];l=v+e[a+1];j=v+e[a+2];n=g[i*3];m=g[i*3+1];p=g[i*3+2];q.set(n,m,p);n=g[l*3];m=g[l*3+1];p=g[l*3+2];o.set(n,m,p);n=g[j*3];m=g[j*3+1];p=g[j*3+2];t.set(n,m,p);r.sub(t,o);u.sub(q,
|
|
|
+o);r.crossSelf(u);h[i*3]=h[i*3]+r.x;h[i*3+1]=h[i*3+1]+r.y;h[i*3+2]=h[i*3+2]+r.z;h[l*3]=h[l*3]+r.x;h[l*3+1]=h[l*3+1]+r.y;h[l*3+2]=h[l*3+2]+r.z;h[j*3]=h[j*3]+r.x;h[j*3+1]=h[j*3+1]+r.y;h[j*3+2]=h[j*3+2]+r.z}}a=0;for(b=h.length;a<b;a=a+3){n=h[a];m=h[a+1];p=h[a+2];c=1/Math.sqrt(n*n+m*m+p*p);h[a]=h[a]*c;h[a+1]=h[a+1]*c;h[a+2]=h[a+2]*c}this.normalsNeedUpdate=true}},computeTangents:function(){function a(a){N.x=d[a*3];N.y=d[a*3+1];N.z=d[a*3+2];ca.copy(N);ea=i[a];P.copy(ea);P.subSelf(N.multiplyScalar(N.dot(ea))).normalize();
|
|
|
G.cross(ca,ea);Q=G.dot(l[a]);M=Q<0?-1:1;h[a*4]=P.x;h[a*4+1]=P.y;h[a*4+2]=P.z;h[a*4+3]=M}if(this.attributes.index===void 0||this.attributes.position===void 0||this.attributes.normal===void 0||this.attributes.uv===void 0)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,f=this.attributes.uv.array,e=c.length/3;if(this.attributes.tangent===
|
|
|
-void 0){var g=4*e;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],l=[],g=0;g<e;g++){i[g]=new THREE.Vector3;l[g]=new THREE.Vector3}var j,n,m,p,q,o,t,s,u,v,r,A,x,B,C,e=new THREE.Vector3,g=new THREE.Vector3,z,F,H,K,E,L,J,I=this.offsets;H=0;for(K=I.length;H<K;++H){F=I[H].start;E=I[H].count;var R=I[H].index;z=F;for(F=F+E;z<F;z=z+3){E=R+b[z];L=R+b[z+1];J=R+b[z+2];j=c[E*3];n=c[E*3+1];m=c[E*3+2];p=c[L*3];q=c[L*3+1];o=c[L*3+2];t=c[J*3];
|
|
|
-s=c[J*3+1];u=c[J*3+2];v=f[E*2];r=f[E*2+1];A=f[L*2];x=f[L*2+1];B=f[J*2];C=f[J*2+1];p=p-j;j=t-j;q=q-n;n=s-n;o=o-m;m=u-m;A=A-v;v=B-v;x=x-r;r=C-r;C=1/(A*r-v*x);e.set((r*p-x*j)*C,(r*q-x*n)*C,(r*o-x*m)*C);g.set((A*j-v*p)*C,(A*n-v*q)*C,(A*m-v*o)*C);i[E].addSelf(e);i[L].addSelf(e);i[J].addSelf(e);l[E].addSelf(g);l[L].addSelf(g);l[J].addSelf(g)}}var P=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,ca=new THREE.Vector3,M,ea,Q;H=0;for(K=I.length;H<K;++H){F=I[H].start;E=I[H].count;R=I[H].index;z=F;
|
|
|
+void 0){var g=4*e;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],l=[],g=0;g<e;g++){i[g]=new THREE.Vector3;l[g]=new THREE.Vector3}var j,n,m,p,q,o,t,r,u,v,s,A,x,B,C,e=new THREE.Vector3,g=new THREE.Vector3,z,F,H,K,E,L,J,I=this.offsets;H=0;for(K=I.length;H<K;++H){F=I[H].start;E=I[H].count;var R=I[H].index;z=F;for(F=F+E;z<F;z=z+3){E=R+b[z];L=R+b[z+1];J=R+b[z+2];j=c[E*3];n=c[E*3+1];m=c[E*3+2];p=c[L*3];q=c[L*3+1];o=c[L*3+2];t=c[J*3];
|
|
|
+r=c[J*3+1];u=c[J*3+2];v=f[E*2];s=f[E*2+1];A=f[L*2];x=f[L*2+1];B=f[J*2];C=f[J*2+1];p=p-j;j=t-j;q=q-n;n=r-n;o=o-m;m=u-m;A=A-v;v=B-v;x=x-s;s=C-s;C=1/(A*s-v*x);e.set((s*p-x*j)*C,(s*q-x*n)*C,(s*o-x*m)*C);g.set((A*j-v*p)*C,(A*n-v*q)*C,(A*m-v*o)*C);i[E].addSelf(e);i[L].addSelf(e);i[J].addSelf(e);l[E].addSelf(g);l[L].addSelf(g);l[J].addSelf(g)}}var P=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,ca=new THREE.Vector3,M,ea,Q;H=0;for(K=I.length;H<K;++H){F=I[H].start;E=I[H].count;R=I[H].index;z=F;
|
|
|
for(F=F+E;z<F;z=z+3){E=R+b[z];L=R+b[z+1];J=R+b[z+2];a(E);a(L);a(J)}}this.tangentsNeedUpdate=this.hasTangents=true}}};
|
|
|
THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*e+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,e,g,h,i,l,j,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;e=Math.floor(f);g=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>this.points.length-2?this.points.length-1:e+1;c[3]=e>this.points.length-3?this.points.length-1:
|
|
|
e+2;l=this.points[c[0]];j=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(l.x,j.x,n.x,m.x,g,h,i);d.y=b(l.y,j.y,n.y,m.y,g,h,i);d.z=b(l.z,j.z,n.z,m.z,g,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++){b=this.points[a];d[a]=[b.x,b.y,b.z]}return d};this.getLength=function(a){var b,c,d,f=b=b=0,e=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;e.copy(this.points[0]);for(a=1;a<c;a++){b=
|
|
@@ -141,7 +141,7 @@ THREE.SpotLight=function(a,b,c,d,f){THREE.Light.call(this,a);this.position=new T
|
|
|
this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++){b=a.materials[c];if(b instanceof THREE.ShaderMaterial)return true}return false},createMaterial:function(a,b){function c(a){a=
|
|
|
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,f,e,h,i,l,t){var s=document.createElement("canvas");a[f]=new THREE.Texture(s);a[f].sourceFile=e;if(h){a[f].repeat.set(h[0],h[1]);if(h[0]!==1)a[f].wrapS=THREE.RepeatWrapping;if(h[1]!==1)a[f].wrapT=THREE.RepeatWrapping}i&&a[f].offset.set(i[0],i[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[f].wrapS=h[l[0]];if(h[l[1]]!==
|
|
|
+Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,f,e,h,i,l,t){var r=document.createElement("canvas");a[f]=new THREE.Texture(r);a[f].sourceFile=e;if(h){a[f].repeat.set(h[0],h[1]);if(h[0]!==1)a[f].wrapS=THREE.RepeatWrapping;if(h[1]!==1)a[f].wrapT=THREE.RepeatWrapping}i&&a[f].offset.set(i[0],i[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[f].wrapS=h[l[0]];if(h[l[1]]!==
|
|
|
void 0)a[f].wrapT=h[l[1]]}if(t)a[f].anisotropy=t;var u=a[f],a=b+"/"+e,f=new Image;f.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);u.image.width=a;u.image.height=b;u.image.getContext("2d").drawImage(this,0,0,a,b)}else u.image=this;u.needsUpdate=true};f.crossOrigin=g.crossOrigin;f.src=a}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,
|
|
|
wireframe:false};if(a.shading){var l=a.shading.toLowerCase();l==="phong"?h="MeshPhongMaterial":l==="basic"&&(h="MeshBasicMaterial")}if(a.blending!==void 0&&THREE[a.blending]!==void 0)i.blending=THREE[a.blending];if(a.transparent!==void 0||a.opacity<1)i.transparent=a.transparent;if(a.depthTest!==void 0)i.depthTest=a.depthTest;if(a.depthWrite!==void 0)i.depthWrite=a.depthWrite;if(a.visible!==void 0)i.visible=a.visible;if(a.flipSided!==void 0)i.side=THREE.BackSide;if(a.doubleSided!==void 0)i.side=THREE.DoubleSide;
|
|
|
if(a.wireframe!==void 0)i.wireframe=a.wireframe;if(a.vertexColors!==void 0)if(a.vertexColors=="face")i.vertexColors=THREE.FaceColors;else if(a.vertexColors)i.vertexColors=THREE.VertexColors;if(a.colorDiffuse)i.color=e(a.colorDiffuse);else if(a.DbgColor)i.color=a.DbgColor;if(a.colorSpecular)i.specular=e(a.colorSpecular);if(a.colorAmbient)i.ambient=e(a.colorAmbient);if(a.transparency)i.opacity=a.transparency;if(a.specularCoef)i.shininess=a.specularCoef;a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,
|
|
@@ -152,24 +152,24 @@ THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBas
|
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,e){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,f,d,e)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,true);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var e=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0){var c=e.response;if(c===void 0)c=(new Uint8Array(e.responseBody)).buffer;THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+e.status+"]");else if(e.readyState==3){if(f){h==0&&(h=e.getResponseHeader("Content-Length"));f({total:h,loaded:e.responseText.length})}}else e.readyState==
|
|
|
2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",g,true);e.responseType="arraybuffer";e.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,l,j,n,m,p,q,o,t,s,u,v,r;function A(a){return a%4?4-a%4:0}function x(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,f,e,g,h,i,j,l,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=n[d*3];e=n[d*3+1];g=n[d*3+2];h=R[f*2];f=R[f*2+1];i=R[e*2];j=R[e*2+1];e=R[g*2];l=R[g*2+1];g=L.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,j));m.push(new THREE.UV(e,
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,l,j,n,m,p,q,o,t,r,u,v,s;function A(a){return a%4?4-a%4:0}function x(a,b){return(new Uint8Array(a,b,1))[0]}function B(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,f,e,g,h,i,j,l,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=n[d*3];e=n[d*3+1];g=n[d*3+2];h=R[f*2];f=R[f*2+1];i=R[e*2];j=R[e*2+1];e=R[g*2];l=R[g*2+1];g=L.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,j));m.push(new THREE.UV(e,
|
|
|
l));g.push(m)}}function z(b,c){var d,f,e,g,h,i,j,l,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[d*4];e=o[d*4+1];g=o[d*4+2];h=o[d*4+3];i=R[f*2];f=R[f*2+1];j=R[e*2];n=R[e*2+1];l=R[g*2];m=R[g*2+1];g=R[h*2];e=R[h*2+1];h=L.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,f));q.push(new THREE.UV(j,n));q.push(new THREE.UV(l,m));q.push(new THREE.UV(g,e));h.push(q)}}function F(b,c,d){for(var f,e,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*3];e=c[d*3+1];g=c[d*3+2];h=i[d];
|
|
|
L.faces.push(new THREE.Face3(f,e,g,null,null,h))}}function H(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++){f=c[d*4];e=c[d*4+1];g=c[d*4+2];h=c[d*4+3];i=j[d];L.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}}function K(b,c,d,f){for(var e,g,h,i,j,l,n,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*3];g=c[f*3+1];h=c[f*3+2];j=d[f*3];l=d[f*3+1];n=d[f*3+2];i=m[f];var o=I[l*3],q=I[l*3+1];l=I[l*3+2];var p=I[n*3],
|
|
|
-r=I[n*3+1];n=I[n*3+2];L.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(I[j*3],I[j*3+1],I[j*3+2]),new THREE.Vector3(o,q,l),new THREE.Vector3(p,r,n)],null,i))}}function E(b,c,d,f){for(var e,g,h,i,j,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];l=d[f*4];n=d[f*4+1];m=d[f*4+2];o=d[f*4+3];j=q[f];var p=I[n*3],r=I[n*3+1];n=I[n*3+2];var s=I[m*3],t=I[m*3+1];m=I[m*3+2];var u=I[o*3],v=I[o*3+1];o=I[o*3+2];L.faces.push(new THREE.Face4(e,
|
|
|
-g,h,i,[new THREE.Vector3(I[l*3],I[l*3+1],I[l*3+2]),new THREE.Vector3(p,r,n),new THREE.Vector3(s,t,m),new THREE.Vector3(u,v,o)],null,j))}}var L=this,J=0,I=[],R=[],P,G,N;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);r=a;G=J;b=new Uint8Array(r,G,12);o="";for(u=0;u<12;u++)o=o+String.fromCharCode(b[G+u]);c=x(r,G+12);x(r,G+13);x(r,G+14);x(r,G+15);f=x(r,G+16);i=x(r,G+17);l=x(r,G+18);j=x(r,G+19);n=B(r,G+20);m=B(r,G+20+4);p=B(r,G+20+8);q=B(r,G+20+12);o=B(r,G+20+16);t=B(r,G+20+20);s=
|
|
|
-B(r,G+20+24);u=B(r,G+20+28);b=B(r,G+20+32);v=B(r,G+20+36);r=B(r,G+20+40);J=J+c;G=f*3+j;N=f*4+j;P=q*G;c=o*(G+i*3);f=t*(G+l*3);j=s*(G+i*3+l*3);G=u*N;i=b*(N+i*4);l=v*(N+l*4);N=J;var J=new Float32Array(a,J,n*3),ca,M,ea,Q;for(ca=0;ca<n;ca++){M=J[ca*3];ea=J[ca*3+1];Q=J[ca*3+2];L.vertices.push(new THREE.Vector3(M,ea,Q))}n=J=N+n*3*Float32Array.BYTES_PER_ELEMENT;if(m){J=new Int8Array(a,J,m*3);for(N=0;N<m;N++){ca=J[N*3];M=J[N*3+1];ea=J[N*3+2];I.push(ca/127,M/127,ea/127)}}J=n+m*3*Int8Array.BYTES_PER_ELEMENT;
|
|
|
-m=J=J+A(m*3);if(p){J=new Float32Array(a,J,p*2);for(n=0;n<p;n++){N=J[n*2];ca=J[n*2+1];R.push(N,ca)}}p=J=m+p*2*Float32Array.BYTES_PER_ELEMENT;P=p+P+A(q*2);m=P+c+A(o*2);c=m+f+A(t*2);f=c+j+A(s*2);G=f+G+A(u*2);j=G+i+A(b*2);i=j+l+A(v*2);if(t){l=m+t*Uint32Array.BYTES_PER_ELEMENT*3;F(t,m,l+t*Uint32Array.BYTES_PER_ELEMENT*3);C(t,l)}if(s){t=c+s*Uint32Array.BYTES_PER_ELEMENT*3;l=t+s*Uint32Array.BYTES_PER_ELEMENT*3;K(s,c,t,l+s*Uint32Array.BYTES_PER_ELEMENT*3);C(s,l)}if(v){s=j+v*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
-4;H(v,j,s+v*Uint32Array.BYTES_PER_ELEMENT*4);z(v,s)}if(r){v=i+r*Uint32Array.BYTES_PER_ELEMENT*4;s=v+r*Uint32Array.BYTES_PER_ELEMENT*4;E(r,i,v,s+r*Uint32Array.BYTES_PER_ELEMENT*4);z(r,s)}q&&F(q,p,p+q*Uint32Array.BYTES_PER_ELEMENT*3);if(o){q=P+o*Uint32Array.BYTES_PER_ELEMENT*3;K(o,P,q,q+o*Uint32Array.BYTES_PER_ELEMENT*3)}u&&H(u,f,f+u*Uint32Array.BYTES_PER_ELEMENT*4);if(b){o=G+b*Uint32Array.BYTES_PER_ELEMENT*4;E(b,G,o,o+b*Uint32Array.BYTES_PER_ELEMENT*4)}this.computeCentroids();this.computeFaceNormals();
|
|
|
+s=I[n*3+1];n=I[n*3+2];L.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(I[j*3],I[j*3+1],I[j*3+2]),new THREE.Vector3(o,q,l),new THREE.Vector3(p,s,n)],null,i))}}function E(b,c,d,f){for(var e,g,h,i,j,l,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[f*4];g=c[f*4+1];h=c[f*4+2];i=c[f*4+3];l=d[f*4];n=d[f*4+1];m=d[f*4+2];o=d[f*4+3];j=q[f];var p=I[n*3],s=I[n*3+1];n=I[n*3+2];var t=I[m*3],r=I[m*3+1];m=I[m*3+2];var u=I[o*3],v=I[o*3+1];o=I[o*3+2];L.faces.push(new THREE.Face4(e,
|
|
|
+g,h,i,[new THREE.Vector3(I[l*3],I[l*3+1],I[l*3+2]),new THREE.Vector3(p,s,n),new THREE.Vector3(t,r,m),new THREE.Vector3(u,v,o)],null,j))}}var L=this,J=0,I=[],R=[],P,G,N;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);s=a;G=J;b=new Uint8Array(s,G,12);o="";for(u=0;u<12;u++)o=o+String.fromCharCode(b[G+u]);c=x(s,G+12);x(s,G+13);x(s,G+14);x(s,G+15);f=x(s,G+16);i=x(s,G+17);l=x(s,G+18);j=x(s,G+19);n=B(s,G+20);m=B(s,G+20+4);p=B(s,G+20+8);q=B(s,G+20+12);o=B(s,G+20+16);t=B(s,G+20+20);r=
|
|
|
+B(s,G+20+24);u=B(s,G+20+28);b=B(s,G+20+32);v=B(s,G+20+36);s=B(s,G+20+40);J=J+c;G=f*3+j;N=f*4+j;P=q*G;c=o*(G+i*3);f=t*(G+l*3);j=r*(G+i*3+l*3);G=u*N;i=b*(N+i*4);l=v*(N+l*4);N=J;var J=new Float32Array(a,J,n*3),ca,M,ea,Q;for(ca=0;ca<n;ca++){M=J[ca*3];ea=J[ca*3+1];Q=J[ca*3+2];L.vertices.push(new THREE.Vector3(M,ea,Q))}n=J=N+n*3*Float32Array.BYTES_PER_ELEMENT;if(m){J=new Int8Array(a,J,m*3);for(N=0;N<m;N++){ca=J[N*3];M=J[N*3+1];ea=J[N*3+2];I.push(ca/127,M/127,ea/127)}}J=n+m*3*Int8Array.BYTES_PER_ELEMENT;
|
|
|
+m=J=J+A(m*3);if(p){J=new Float32Array(a,J,p*2);for(n=0;n<p;n++){N=J[n*2];ca=J[n*2+1];R.push(N,ca)}}p=J=m+p*2*Float32Array.BYTES_PER_ELEMENT;P=p+P+A(q*2);m=P+c+A(o*2);c=m+f+A(t*2);f=c+j+A(r*2);G=f+G+A(u*2);j=G+i+A(b*2);i=j+l+A(v*2);if(t){l=m+t*Uint32Array.BYTES_PER_ELEMENT*3;F(t,m,l+t*Uint32Array.BYTES_PER_ELEMENT*3);C(t,l)}if(r){t=c+r*Uint32Array.BYTES_PER_ELEMENT*3;l=t+r*Uint32Array.BYTES_PER_ELEMENT*3;K(r,c,t,l+r*Uint32Array.BYTES_PER_ELEMENT*3);C(r,l)}if(v){r=j+v*Uint32Array.BYTES_PER_ELEMENT*
|
|
|
+4;H(v,j,r+v*Uint32Array.BYTES_PER_ELEMENT*4);z(v,r)}if(s){v=i+s*Uint32Array.BYTES_PER_ELEMENT*4;r=v+s*Uint32Array.BYTES_PER_ELEMENT*4;E(s,i,v,r+s*Uint32Array.BYTES_PER_ELEMENT*4);z(s,r)}q&&F(q,p,p+q*Uint32Array.BYTES_PER_ELEMENT*3);if(o){q=P+o*Uint32Array.BYTES_PER_ELEMENT*3;K(o,P,q,q+o*Uint32Array.BYTES_PER_ELEMENT*3)}u&&H(u,f,f+u*Uint32Array.BYTES_PER_ELEMENT*4);if(b){o=G+b*Uint32Array.BYTES_PER_ELEMENT*4;E(b,G,o,o+b*Uint32Array.BYTES_PER_ELEMENT*4)}this.computeCentroids();this.computeFaceNormals();
|
|
|
THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=Object.create(THREE.Geometry.prototype);b(new f(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;b===void 0&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},false);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(c.crossOrigin)b.crossOrigin=c.crossOrigin;b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
|
|
|
THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var e=new XMLHttpRequest,g=0;e.onreadystatechange=function(){if(e.readyState===e.DONE)if(e.status===200||e.status===0){if(e.responseText){var h=JSON.parse(e.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+e.status+"]");else if(e.readyState===e.LOADING){if(f){g===0&&(g=e.getResponseHeader("Content-Length"));
|
|
|
f({total:g,loaded:e.responseText.length})}}else e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,true);e.overrideMimeType&&e.overrideMimeType("application/json; charset=x-user-defined");e.setRequestHeader("Content-Type","application/json");e.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);var e,g,h,i,l,j,n,m,p,q,o,t,s,u,v=a.faces;p=a.vertices;var r=a.normals,A=a.colors,x=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&x++;for(e=0;e<x;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}c=0;for(i=p.length;c<i;){l=new THREE.Vector3;l.x=p[c++]*f;l.y=p[c++]*f;l.z=p[c++]*f;d.vertices.push(l)}c=0;for(i=v.length;c<i;){p=v[c++];l=p&1;h=p&2;e=p&4;g=p&8;n=p&
|
|
|
-16;j=p&32;q=p&64;p=p&128;if(l){o=new THREE.Face4;o.a=v[c++];o.b=v[c++];o.c=v[c++];o.d=v[c++];l=4}else{o=new THREE.Face3;o.a=v[c++];o.b=v[c++];o.c=v[c++];l=3}if(h){h=v[c++];o.materialIndex=h}h=d.faces.length;if(e)for(e=0;e<x;e++){t=a.uvs[e];m=v[c++];u=t[m*2];m=t[m*2+1];d.faceUvs[e][h]=new THREE.UV(u,m)}if(g)for(e=0;e<x;e++){t=a.uvs[e];s=[];for(g=0;g<l;g++){m=v[c++];u=t[m*2];m=t[m*2+1];s[g]=new THREE.UV(u,m)}d.faceVertexUvs[e][h]=s}if(n){n=v[c++]*3;g=new THREE.Vector3;g.x=r[n++];g.y=r[n++];g.z=r[n];
|
|
|
-o.normal=g}if(j)for(e=0;e<l;e++){n=v[c++]*3;g=new THREE.Vector3;g.x=r[n++];g.y=r[n++];g.z=r[n];o.vertexNormals.push(g)}if(q){j=v[c++];j=new THREE.Color(A[j]);o.color=j}if(p)for(e=0;e<l;e++){j=v[c++];j=new THREE.Color(A[j]);o.vertexColors.push(j)}d.faces.push(o)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c=c+2){v=a.skinWeights[c];r=a.skinWeights[c+1];d.skinWeights.push(new THREE.Vector4(v,r,0,0))}}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c=c+2){v=a.skinIndices[c];r=a.skinIndices[c+
|
|
|
-1];d.skinIndices.push(new THREE.Vector4(v,r,0,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets!==void 0){c=0;for(i=a.morphTargets.length;c<i;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];A=d.morphTargets[c].vertices;x=a.morphTargets[c].vertices;v=0;for(r=x.length;v<r;v=v+3){p=new THREE.Vector3;p.x=x[v]*f;p.y=x[v+1]*f;p.z=x[v+2]*f;A.push(p)}}}if(a.morphColors!==void 0){c=0;for(i=a.morphColors.length;c<i;c++){d.morphColors[c]={};
|
|
|
-d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];r=d.morphColors[c].colors;A=a.morphColors[c].colors;f=0;for(v=A.length;f<v;f=f+3){x=new THREE.Color(16755200);x.setRGB(A[f],A[f+1],A[f+2]);r.push(x)}}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);var e,g,h,i,l,j,n,m,p,q,o,t,r,u,v=a.faces;p=a.vertices;var s=a.normals,A=a.colors,x=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&x++;for(e=0;e<x;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}c=0;for(i=p.length;c<i;){l=new THREE.Vector3;l.x=p[c++]*f;l.y=p[c++]*f;l.z=p[c++]*f;d.vertices.push(l)}c=0;for(i=v.length;c<i;){p=v[c++];l=p&1;h=p&2;e=p&4;g=p&8;n=p&
|
|
|
+16;j=p&32;q=p&64;p=p&128;if(l){o=new THREE.Face4;o.a=v[c++];o.b=v[c++];o.c=v[c++];o.d=v[c++];l=4}else{o=new THREE.Face3;o.a=v[c++];o.b=v[c++];o.c=v[c++];l=3}if(h){h=v[c++];o.materialIndex=h}h=d.faces.length;if(e)for(e=0;e<x;e++){t=a.uvs[e];m=v[c++];u=t[m*2];m=t[m*2+1];d.faceUvs[e][h]=new THREE.UV(u,m)}if(g)for(e=0;e<x;e++){t=a.uvs[e];r=[];for(g=0;g<l;g++){m=v[c++];u=t[m*2];m=t[m*2+1];r[g]=new THREE.UV(u,m)}d.faceVertexUvs[e][h]=r}if(n){n=v[c++]*3;g=new THREE.Vector3;g.x=s[n++];g.y=s[n++];g.z=s[n];
|
|
|
+o.normal=g}if(j)for(e=0;e<l;e++){n=v[c++]*3;g=new THREE.Vector3;g.x=s[n++];g.y=s[n++];g.z=s[n];o.vertexNormals.push(g)}if(q){j=v[c++];j=new THREE.Color(A[j]);o.color=j}if(p)for(e=0;e<l;e++){j=v[c++];j=new THREE.Color(A[j]);o.vertexColors.push(j)}d.faces.push(o)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c=c+2){v=a.skinWeights[c];s=a.skinWeights[c+1];d.skinWeights.push(new THREE.Vector4(v,s,0,0))}}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c=c+2){v=a.skinIndices[c];s=a.skinIndices[c+
|
|
|
+1];d.skinIndices.push(new THREE.Vector4(v,s,0,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets!==void 0){c=0;for(i=a.morphTargets.length;c<i;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];A=d.morphTargets[c].vertices;x=a.morphTargets[c].vertices;v=0;for(s=x.length;v<s;v=v+3){p=new THREE.Vector3;p.x=x[v]*f;p.y=x[v+1]*f;p.z=x[v+2]*f;A.push(p)}}}if(a.morphColors!==void 0){c=0;for(i=a.morphColors.length;c<i;c++){d.morphColors[c]={};
|
|
|
+d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];s=d.morphColors[c].colors;A=a.morphColors[c].colors;f=0;for(v=A.length;f<v;f=f+3){x=new THREE.Color(16755200);x.setRGB(A[f],A[f+1],A[f+2]);s.push(x)}}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
|
|
|
THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a){var b=this,c=null;if(b.path===null){var d=a.split("/");d.pop();b.path=d.length<1?".":d.join("/")}d=new XMLHttpRequest;d.addEventListener("load",function(d){d.target.responseText?c=b.parse(JSON.parse(d.target.responseText),f):b.dispatchEvent({type:"error",message:"Invalid file ["+a+"]"})},false);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);d.open("GET",
|
|
|
a,true);d.setRequestHeader("Content-Type","application/json");d.send(null);var f=new THREE.LoadingMonitor;f.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});f.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;if(a.materials){d.materials=[];for(var e=0;e<a.materials.length;++e){var g=a.materials[e],h=function(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==a},i=function(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))},
|
|
|
l=function(a,d,f,e,g,j){a[d]=new THREE.Texture;a[d].sourceFile=f;if(e){a[d].repeat.set(e[0],e[1]);if(e[0]!==1)a[d].wrapS=THREE.RepeatWrapping;if(e[1]!==1)a[d].wrapT=THREE.RepeatWrapping}g&&a[d].offset.set(g[0],g[1]);if(j){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[j[0]]!==void 0)a[d].wrapS=e[j[0]];if(e[j[1]]!==void 0)a[d].wrapT=e[j[1]]}var l=a[d],a=new THREE.ImageLoader;a.addEventListener("load",function(a){a=a.content;if(!h(a.width)||!h(a.height)){var b=i(a.width),c=
|
|
@@ -178,29 +178,29 @@ i(a.height);l.image=document.createElement("canvas");l.image.width=b;l.image.hei
|
|
|
j(g.colorSpecular);if(g.colorAmbient)m.ambient=j(g.colorAmbient);if(g.transparency)m.opacity=g.transparency;if(g.specularCoef)m.shininess=g.specularCoef;if(g.visible!==void 0)m.visible=g.visible;if(g.flipSided!==void 0)m.side=THREE.BackSide;if(g.doubleSided!==void 0)m.side=THREE.DoubleSide;if(g.wireframe!==void 0)m.wireframe=g.wireframe;g.mapDiffuse&&l(m,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&l(m,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,
|
|
|
g.mapLightWrap);g.mapBump&&l(m,"bumpMap",g.mapBump,g.mapBumpRepeat,g.mapBumpOffset,g.mapBumpWrap);g.mapNormal&&l(m,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&l(m,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);if(g.mapNormal){l=THREE.ShaderUtils.lib.normal;j=THREE.UniformsUtils.clone(l.uniforms);j.tNormal.value=m.normalMap;g.mapNormalFactor&&j.uNormalScale.value.set(g.mapNormalFactor,g.mapNormalFactor);if(m.map){j.tDiffuse.value=
|
|
|
m.map;j.enableDiffuse.value=true}if(m.specularMap){j.tSpecular.value=m.specularMap;j.enableSpecular.value=true}if(m.lightMap){j.tAO.value=m.lightMap;j.enableAO.value=true}j.uDiffuseColor.value.setHex(m.color);j.uSpecularColor.value.setHex(m.specular);j.uAmbientColor.value.setHex(m.ambient);j.uShininess.value=m.shininess;if(m.opacity!==void 0)j.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:j,lights:true,fog:true})}else m=new THREE[n](m);
|
|
|
-if(g.DbgName!==void 0)m.name=g.DbgName;d.materials[e]=m}}var g=a.faces,q=a.vertices,m=a.normals,l=a.colors,j=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&j++;for(e=0;e<j;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(p=q.length;n<p;){var o=new THREE.Vector3;o.x=q[n++]*f;o.y=q[n++]*f;o.z=q[n++]*f;d.vertices.push(o)}n=0;for(p=g.length;n<p;){var t=g[n++],s=t&2,e=t&4,u=t&8,v=t&16,q=t&32,r=t&64,o=t&128;if(t&1){t=new THREE.Face4;t.a=g[n++];t.b=g[n++];t.c=g[n++];t.d=g[n++];var A=4}else{t=new THREE.Face3;
|
|
|
-t.a=g[n++];t.b=g[n++];t.c=g[n++];A=3}if(s){s=g[n++];t.materialIndex=s}var x=d.faces.length;if(e)for(e=0;e<j;e++){var B=a.uvs[e],s=g[n++],C=B[s*2],s=B[s*2+1];d.faceUvs[e][x]=new THREE.UV(C,s)}if(u)for(e=0;e<j;e++){for(var B=a.uvs[e],u=[],z=0;z<A;z++){s=g[n++];C=B[s*2];s=B[s*2+1];u[z]=new THREE.UV(C,s)}d.faceVertexUvs[e][x]=u}if(v){v=g[n++]*3;s=new THREE.Vector3;s.x=m[v++];s.y=m[v++];s.z=m[v];t.normal=s}if(q)for(e=0;e<A;e++){v=g[n++]*3;s=new THREE.Vector3;s.x=m[v++];s.y=m[v++];s.z=m[v];t.vertexNormals.push(s)}if(r){q=
|
|
|
+if(g.DbgName!==void 0)m.name=g.DbgName;d.materials[e]=m}}var g=a.faces,q=a.vertices,m=a.normals,l=a.colors,j=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&j++;for(e=0;e<j;e++){d.faceUvs[e]=[];d.faceVertexUvs[e]=[]}n=0;for(p=q.length;n<p;){var o=new THREE.Vector3;o.x=q[n++]*f;o.y=q[n++]*f;o.z=q[n++]*f;d.vertices.push(o)}n=0;for(p=g.length;n<p;){var t=g[n++],r=t&2,e=t&4,u=t&8,v=t&16,q=t&32,s=t&64,o=t&128;if(t&1){t=new THREE.Face4;t.a=g[n++];t.b=g[n++];t.c=g[n++];t.d=g[n++];var A=4}else{t=new THREE.Face3;
|
|
|
+t.a=g[n++];t.b=g[n++];t.c=g[n++];A=3}if(r){r=g[n++];t.materialIndex=r}var x=d.faces.length;if(e)for(e=0;e<j;e++){var B=a.uvs[e],r=g[n++],C=B[r*2],r=B[r*2+1];d.faceUvs[e][x]=new THREE.UV(C,r)}if(u)for(e=0;e<j;e++){for(var B=a.uvs[e],u=[],z=0;z<A;z++){r=g[n++];C=B[r*2];r=B[r*2+1];u[z]=new THREE.UV(C,r)}d.faceVertexUvs[e][x]=u}if(v){v=g[n++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];t.normal=r}if(q)for(e=0;e<A;e++){v=g[n++]*3;r=new THREE.Vector3;r.x=m[v++];r.y=m[v++];r.z=m[v];t.vertexNormals.push(r)}if(s){q=
|
|
|
g[n++];t.color=new THREE.Color(l[q])}if(o)for(e=0;e<A;e++){q=g[n++];t.vertexColors.push(new THREE.Color(l[q]))}d.faces.push(t)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;e=e+2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[e],a.skinWeights[e+1],0,0))}if(a.skinIndices){e=0;for(g=a.skinIndices.length;e<g;e=e+2){m=0;d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],m,0))}}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){e=0;for(g=a.morphTargets.length;e<
|
|
|
-g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];m=d.morphTargets[e].vertices;l=a.morphTargets[e].vertices;s=0;for(j=l.length;s<j;s=s+3){o=new THREE.Vector3;o.x=l[s]*f;o.y=l[s+1]*f;o.z=l[s+2]*f;m.push(o)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]={};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;l=a.morphColors[e].colors;m=0;for(j=l.length;m<j;m=m+3){n=new THREE.Color(16755200);
|
|
|
+g;e++){d.morphTargets[e]={};d.morphTargets[e].name=a.morphTargets[e].name;d.morphTargets[e].vertices=[];m=d.morphTargets[e].vertices;l=a.morphTargets[e].vertices;r=0;for(j=l.length;r<j;r=r+3){o=new THREE.Vector3;o.x=l[r]*f;o.y=l[r+1]*f;o.z=l[r+2]*f;m.push(o)}}}if(a.morphColors){e=0;for(g=a.morphColors.length;e<g;e++){d.morphColors[e]={};d.morphColors[e].name=a.morphColors[e].name;d.morphColors[e].colors=[];f=d.morphColors[e].colors;l=a.morphColors[e].colors;m=0;for(j=l.length;m<j;m=m+3){n=new THREE.Color(16755200);
|
|
|
n.setRGB(l[m],l[m+1],l[m+2]);f.push(n)}}}d.computeCentroids();d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.addGeometryHandler("ascii_mesh",THREE.JSONLoader);this.addGeometryHandler("bin_mesh",THREE.BinaryLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState===4)if(d.status===200||d.status===0){var f=JSON.parse(d.responseText);c.parse(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,true);d.overrideMimeType&&d.overrideMimeType("application/json; charset=x-user-defined");d.setRequestHeader("Content-Type","application/json");d.send(null)};
|
|
|
THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
|
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function f(a,b){var c;for(m in b)if(G.objects[m]===void 0){s=b[m];if(s.geometry!==void 0){if(F=G.geometries[s.geometry]){c=false;H=G.materials[s.materials[0]];(c=H instanceof THREE.ShaderMaterial)&&F.computeTangents();r=s.position;A=s.rotation;x=s.quaternion;B=s.scale;u=s.matrix;x=0;s.materials.length==0&&(H=new THREE.MeshFaceMaterial);s.materials.length>1&&(H=new THREE.MeshFaceMaterial);c=new THREE.Mesh(F,
|
|
|
-H);c.name=m;if(u){c.matrixAutoUpdate=false;c.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{c.position.set(r[0],r[1],r[2]);if(x){c.quaternion.set(x[0],x[1],x[2],x[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(B[0],B[1],B[2])}c.visible=s.visible;c.castShadow=s.castShadow;c.receiveShadow=s.receiveShadow;a.add(c);G.objects[m]=c}}else{r=s.position;A=s.rotation;x=s.quaternion;B=s.scale;x=0;c=new THREE.Object3D;c.name=m;
|
|
|
-c.position.set(r[0],r[1],r[2]);if(x){c.quaternion.set(x[0],x[1],x[2],x[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(B[0],B[1],B[2]);c.visible=s.visible!==void 0?s.visible:false;a.add(c);G.objects[m]=c;G.empties[m]=c}if(s.properties!==void 0)for(var d in s.properties)c.properties[d]=s.properties[d];s.children!==void 0&&f(c,s.children)}}function e(a){return function(b){G.geometries[a]=b;f(G.scene,N.objects);J=J-1;i.onLoadComplete();h()}}function g(a){return function(b){G.geometries[a]=
|
|
|
-b}}function h(){i.callbackProgress({totalModels:R,totalTextures:P,loadedModels:R-J,loadedTextures:P-I},G);i.onLoadProgress();J===0&&I===0&&b(G)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),j,n,m,p,q,o,t,s,u,v,r,A,x,B,C,z,F,H,K,E,L,J,I,R,P,G,N=a;for(C in this.geometryHandlerMap)this.geometryHandlerMap[C].loaderObject=new this.geometryHandlerMap[C].loaderClass;I=J=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(N.transform){a=
|
|
|
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function f(a,b){var c;for(m in b)if(G.objects[m]===void 0){r=b[m];if(r.geometry!==void 0){if(F=G.geometries[r.geometry]){c=false;H=G.materials[r.materials[0]];(c=H instanceof THREE.ShaderMaterial)&&F.computeTangents();s=r.position;A=r.rotation;x=r.quaternion;B=r.scale;u=r.matrix;x=0;r.materials.length==0&&(H=new THREE.MeshFaceMaterial);r.materials.length>1&&(H=new THREE.MeshFaceMaterial);c=new THREE.Mesh(F,
|
|
|
+H);c.name=m;if(u){c.matrixAutoUpdate=false;c.matrix.set(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}else{c.position.set(s[0],s[1],s[2]);if(x){c.quaternion.set(x[0],x[1],x[2],x[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(B[0],B[1],B[2])}c.visible=r.visible;c.castShadow=r.castShadow;c.receiveShadow=r.receiveShadow;a.add(c);G.objects[m]=c}}else{s=r.position;A=r.rotation;x=r.quaternion;B=r.scale;x=0;c=new THREE.Object3D;c.name=m;
|
|
|
+c.position.set(s[0],s[1],s[2]);if(x){c.quaternion.set(x[0],x[1],x[2],x[3]);c.useQuaternion=true}else c.rotation.set(A[0],A[1],A[2]);c.scale.set(B[0],B[1],B[2]);c.visible=r.visible!==void 0?r.visible:false;a.add(c);G.objects[m]=c;G.empties[m]=c}if(r.properties!==void 0)for(var d in r.properties)c.properties[d]=r.properties[d];r.children!==void 0&&f(c,r.children)}}function e(a){return function(b){G.geometries[a]=b;f(G.scene,N.objects);J=J-1;i.onLoadComplete();h()}}function g(a){return function(b){G.geometries[a]=
|
|
|
+b}}function h(){i.callbackProgress({totalModels:R,totalTextures:P,loadedModels:R-J,loadedTextures:P-I},G);i.onLoadProgress();J===0&&I===0&&b(G)}var i=this,l=THREE.Loader.prototype.extractUrlBase(c),j,n,m,p,q,o,t,r,u,v,s,A,x,B,C,z,F,H,K,E,L,J,I,R,P,G,N=a;for(C in this.geometryHandlerMap)this.geometryHandlerMap[C].loaderObject=new this.geometryHandlerMap[C].loaderClass;I=J=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(N.transform){a=
|
|
|
N.transform.position;c=N.transform.rotation;C=N.transform.scale;a&&G.scene.position.set(a[0],a[1],a[2]);c&&G.scene.rotation.set(c[0],c[1],c[2]);C&&G.scene.scale.set(C[0],C[1],C[2]);if(a||c||C){G.scene.updateMatrix();G.scene.updateMatrixWorld()}}a=function(a){return function(){I=I-a;h();i.onLoadComplete()}};for(q in N.cameras){C=N.cameras[q];C.type==="perspective"?K=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type==="ortho"&&(K=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,
|
|
|
-C.near,C.far));r=C.position;c=C.target;C=C.up;K.position.set(r[0],r[1],r[2]);K.target=new THREE.Vector3(c[0],c[1],c[2]);C&&K.up.set(C[0],C[1],C[2]);G.cameras[q]=K}for(p in N.lights){c=N.lights[p];q=c.color!==void 0?c.color:16777215;K=c.intensity!==void 0?c.intensity:1;if(c.type==="directional"){r=c.direction;v=new THREE.DirectionalLight(q,K);v.position.set(r[0],r[1],r[2]);v.position.normalize()}else if(c.type==="point"){r=c.position;v=c.distance;v=new THREE.PointLight(q,K,v);v.position.set(r[0],r[1],
|
|
|
-r[2])}else c.type==="ambient"&&(v=new THREE.AmbientLight(q));G.scene.add(v);G.lights[p]=v}for(o in N.fogs){p=N.fogs[o];p.type==="linear"?E=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(E=new THREE.FogExp2(0,p.density));C=p.color;E.color.setRGB(C[0],C[1],C[2]);G.fogs[o]=E}if(G.cameras&&N.defaults.camera)G.currentCamera=G.cameras[N.defaults.camera];if(G.fogs&&N.defaults.fog)G.scene.fog=G.fogs[N.defaults.fog];C=N.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(C[0],C[1],C[2]);G.bgColorAlpha=
|
|
|
+C.near,C.far));s=C.position;c=C.target;C=C.up;K.position.set(s[0],s[1],s[2]);K.target=new THREE.Vector3(c[0],c[1],c[2]);C&&K.up.set(C[0],C[1],C[2]);G.cameras[q]=K}for(p in N.lights){c=N.lights[p];q=c.color!==void 0?c.color:16777215;K=c.intensity!==void 0?c.intensity:1;if(c.type==="directional"){s=c.direction;v=new THREE.DirectionalLight(q,K);v.position.set(s[0],s[1],s[2]);v.position.normalize()}else if(c.type==="point"){s=c.position;v=c.distance;v=new THREE.PointLight(q,K,v);v.position.set(s[0],s[1],
|
|
|
+s[2])}else c.type==="ambient"&&(v=new THREE.AmbientLight(q));G.scene.add(v);G.lights[p]=v}for(o in N.fogs){p=N.fogs[o];p.type==="linear"?E=new THREE.Fog(0,p.near,p.far):p.type==="exp2"&&(E=new THREE.FogExp2(0,p.density));C=p.color;E.color.setRGB(C[0],C[1],C[2]);G.fogs[o]=E}if(G.cameras&&N.defaults.camera)G.currentCamera=G.cameras[N.defaults.camera];if(G.fogs&&N.defaults.fog)G.scene.fog=G.fogs[N.defaults.fog];C=N.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(C[0],C[1],C[2]);G.bgColorAlpha=
|
|
|
N.defaults.bgalpha;for(j in N.geometries){o=N.geometries[j];if(o.type in this.geometryHandlerMap){J=J+1;i.onLoadStart()}}R=J;for(j in N.geometries){o=N.geometries[j];if(o.type==="cube"){F=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);G.geometries[j]=F}else if(o.type==="plane"){F=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight);G.geometries[j]=F}else if(o.type==="sphere"){F=new THREE.SphereGeometry(o.radius,
|
|
|
o.segmentsWidth,o.segmentsHeight);G.geometries[j]=F}else if(o.type==="cylinder"){F=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs);G.geometries[j]=F}else if(o.type==="torus"){F=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT);G.geometries[j]=F}else if(o.type==="icosahedron"){F=new THREE.IcosahedronGeometry(o.radius,o.subdivisions);G.geometries[j]=F}else if(o.type in this.geometryHandlerMap){E={};for(L in o)L!=="type"&&L!=="url"&&(E[L]=o[L]);this.geometryHandlerMap[o.type].loaderObject.load(d(o.url,
|
|
|
N.urlBaseType),e(j),E)}else if(o.type==="embedded_mesh"){o=N.embeds[o.id];o.metadata=N.metadata;o&&this.geometryHandlerMap.ascii_mesh.loaderObject.createModel(o,g(j),"")}}for(t in N.textures){j=N.textures[t];if(j.url instanceof Array){I=I+j.url.length;for(L=0;L<j.url.length;L++)i.onLoadStart()}else{I=I+1;i.onLoadStart()}}P=I;for(t in N.textures){j=N.textures[t];if(j.mapping!==void 0&&THREE[j.mapping]!==void 0)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){L=j.url.length;o=[];for(E=0;E<
|
|
|
L;E++)o[E]=d(j.url[E],N.urlBaseType);L=THREE.ImageUtils.loadTextureCube(o,j.mapping,a(L))}else{L=THREE.ImageUtils.loadTexture(d(j.url,N.urlBaseType),j.mapping,a(1));if(THREE[j.minFilter]!==void 0)L.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!==void 0)L.magFilter=THREE[j.magFilter];if(j.anisotropy)L.anisotropy=j.anisotropy;if(j.repeat){L.repeat.set(j.repeat[0],j.repeat[1]);if(j.repeat[0]!==1)L.wrapS=THREE.RepeatWrapping;if(j.repeat[1]!==1)L.wrapT=THREE.RepeatWrapping}j.offset&&L.offset.set(j.offset[0],
|
|
|
j.offset[1]);if(j.wrap){o={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(o[j.wrap[0]]!==void 0)L.wrapS=o[j.wrap[0]];if(o[j.wrap[1]]!==void 0)L.wrapT=o[j.wrap[1]]}}G.textures[t]=L}for(n in N.materials){u=N.materials[n];for(z in u.parameters)if(z==="envMap"||z==="map"||z==="lightMap"||z==="bumpMap")u.parameters[z]=G.textures[u.parameters[z]];else if(z==="shading")u.parameters[z]=u.parameters[z]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(z==="blending")u.parameters[z]=
|
|
|
-u.parameters[z]in THREE?THREE[u.parameters[z]]:THREE.NormalBlending;else if(z==="combine")u.parameters[z]=u.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==="vertexColors")if(u.parameters[z]=="face")u.parameters[z]=THREE.FaceColors;else if(u.parameters[z])u.parameters[z]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;if(u.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(t.uniforms);
|
|
|
-j=u.parameters.color;L=u.parameters.specular;o=u.parameters.ambient;E=u.parameters.shininess;a.tNormal.value=G.textures[u.parameters.normalMap];u.parameters.normalScale&&a.uNormalScale.value.set(u.parameters.normalScale[0],u.parameters.normalScale[1]);if(u.parameters.map){a.tDiffuse.value=u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.envMap){a.tCube.value=u.parameters.envMap;a.enableReflection.value=true;a.uReflectivity.value=u.parameters.reflectivity}if(u.parameters.lightMap){a.tAO.value=
|
|
|
-u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.value=G.textures[u.parameters.specularMap];a.enableSpecular.value=true}if(u.parameters.displacementMap){a.tDisplacement.value=G.textures[u.parameters.displacementMap];a.enableDisplacement.value=true;a.uDisplacementBias.value=u.parameters.displacementBias;a.uDisplacementScale.value=u.parameters.displacementScale}a.uDiffuseColor.value.setHex(j);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(o);a.uShininess.value=
|
|
|
-E;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:a,lights:true,fog:true})}else H=new THREE[u.type](u.parameters);G.materials[n]=H}f(G.scene,N.objects);i.callbackSync(G);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
|
+u.parameters[z]in THREE?THREE[u.parameters[z]]:THREE.NormalBlending;else if(z==="combine")u.parameters[z]=u.parameters[z]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(z==="vertexColors")if(u.parameters[z]=="face")u.parameters[z]=THREE.FaceColors;else{if(u.parameters[z])u.parameters[z]=THREE.VertexColors}else if(z==="wrapRGB"){t=u.parameters[z];u.parameters[z]=new THREE.Vector3(t[0],t[1],t[2])}if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=true;
|
|
|
+if(u.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(t.uniforms);j=u.parameters.color;L=u.parameters.specular;o=u.parameters.ambient;E=u.parameters.shininess;a.tNormal.value=G.textures[u.parameters.normalMap];u.parameters.normalScale&&a.uNormalScale.value.set(u.parameters.normalScale[0],u.parameters.normalScale[1]);if(u.parameters.map){a.tDiffuse.value=u.parameters.map;a.enableDiffuse.value=true}if(u.parameters.envMap){a.tCube.value=u.parameters.envMap;a.enableReflection.value=
|
|
|
+true;a.uReflectivity.value=u.parameters.reflectivity}if(u.parameters.lightMap){a.tAO.value=u.parameters.lightMap;a.enableAO.value=true}if(u.parameters.specularMap){a.tSpecular.value=G.textures[u.parameters.specularMap];a.enableSpecular.value=true}if(u.parameters.displacementMap){a.tDisplacement.value=G.textures[u.parameters.displacementMap];a.enableDisplacement.value=true;a.uDisplacementBias.value=u.parameters.displacementBias;a.uDisplacementScale.value=u.parameters.displacementScale}a.uDiffuseColor.value.setHex(j);
|
|
|
+a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(o);a.uShininess.value=E;if(u.parameters.opacity)a.uOpacity.value=u.parameters.opacity;H=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:a,lights:true,fog:true})}else H=new THREE[u.type](u.parameters);G.materials[n]=H}f(G.scene,N.objects);i.callbackSync(G);h()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
|
THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=true;b.dispatchEvent({type:"load",content:a})},false);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},false);if(b.crossOrigin)c.crossOrigin=b.crossOrigin;c.src=a}};
|
|
|
THREE.Material=function(){this.id=THREE.MaterialCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=false;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=true;this.polygonOffset=false;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=false;this.needsUpdate=this.visible=true};
|
|
|
THREE.Material.prototype.setValues=function(a){if(a!==void 0)for(var b in a){var c=a[b];if(c===void 0)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&typeof c==="number"?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
|
|
@@ -260,20 +260,20 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light){this.__lights.indexOf(a)===-1&&this.__lights.push(a);a.target&&a.target.parent===void 0&&this.add(a.target)}else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.__objects.indexOf(a);if(b!==-1){this.__objects.splice(b,1);this.__objectsRemoved.push(a);b=this.__objectsAdded.indexOf(a);b!==-1&&this.__objectsAdded.splice(b,1)}}for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=o.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)o.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)o.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)o.globalCompositeOperation="darker";v=a}}function d(a){if(r!==a)r=o.strokeStyle=a}function f(a){if(A!==a)A=o.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,h,i,l=new THREE.Projector,j=a.canvas!==
|
|
|
-void 0?a.canvas:document.createElement("canvas"),n,m,p,q,o=j.getContext("2d"),t=new THREE.Color(0),s=0,u=1,v=0,r=null,A=null,x=null,B=null,C=null,z,F,H,K,E=new THREE.RenderableVertex,L=new THREE.RenderableVertex,J,I,R,P,G,N,ca,M,ea,Q,ba,ta,fa=new THREE.Color,$=new THREE.Color,S=new THREE.Color,X=new THREE.Color,ia=new THREE.Color,Ia={},pa={},ua,Ca,Ja,Xa,ja,pb,Oa,Ya,qb,wb,fb=new THREE.Rectangle,Fa=new THREE.Rectangle,xa=new THREE.Rectangle,xb=false,Ga=new THREE.Color,$a=new THREE.Color,rb=new THREE.Color,
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(u!==a)u=o.globalAlpha=a}function c(a){if(v!==a){if(a===THREE.NormalBlending)o.globalCompositeOperation="source-over";else if(a===THREE.AdditiveBlending)o.globalCompositeOperation="lighter";else if(a===THREE.SubtractiveBlending)o.globalCompositeOperation="darker";v=a}}function d(a){if(s!==a)s=o.strokeStyle=a}function f(a){if(A!==a)A=o.fillStyle=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,h,i,l=new THREE.Projector,j=a.canvas!==
|
|
|
+void 0?a.canvas:document.createElement("canvas"),n,m,p,q,o=j.getContext("2d"),t=new THREE.Color(0),r=0,u=1,v=0,s=null,A=null,x=null,B=null,C=null,z,F,H,K,E=new THREE.RenderableVertex,L=new THREE.RenderableVertex,J,I,R,P,G,N,ca,M,ea,Q,ba,ta,fa=new THREE.Color,$=new THREE.Color,S=new THREE.Color,X=new THREE.Color,ia=new THREE.Color,Ia={},pa={},ua,Ca,Ja,Xa,ja,pb,Oa,Ya,qb,wb,fb=new THREE.Rectangle,Fa=new THREE.Rectangle,xa=new THREE.Rectangle,xb=false,Ga=new THREE.Color,$a=new THREE.Color,rb=new THREE.Color,
|
|
|
Da=new THREE.Vector3,ab,bb,gb,Pa,Qa,hb,a=16;ab=document.createElement("canvas");ab.width=ab.height=2;bb=ab.getContext("2d");bb.fillStyle="rgba(0,0,0,1)";bb.fillRect(0,0,2,2);gb=bb.getImageData(0,0,2,2);Pa=gb.data;Qa=document.createElement("canvas");Qa.width=Qa.height=a;hb=Qa.getContext("2d");hb.translate(-a/2,-a/2);hb.scale(a,a);a--;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;m=b;p=Math.floor(n/2);
|
|
|
-q=Math.floor(m/2);j.width=n;j.height=m;fb.set(-p,-q,p,q);Fa.set(-p,-q,p,q);u=1;v=0;C=B=x=A=r=null};this.setClearColor=function(a,b){t.copy(a);s=b!==void 0?b:1;Fa.set(-p,-q,p,q)};this.setClearColorHex=function(a,b){t.setHex(a);s=b!==void 0?b:1;Fa.set(-p,-q,p,q)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){o.setTransform(1,0,0,-1,p,q);if(Fa.isEmpty()===false){Fa.minSelf(fb);Fa.inflate(2);s<1&&o.clearRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()));
|
|
|
-if(s>0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+s+")");o.fillRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()))}Fa.empty()}};this.render=function(a,k){function j(a,b,c){for(var d=0,f=i.length;d<f;d++){var e=i[d],g=e.color;if(e instanceof THREE.DirectionalLight){var h=e.matrixWorld.getPosition().normalize(),k=b.dot(h);if(!(k<=0)){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=
|
|
|
+q=Math.floor(m/2);j.width=n;j.height=m;fb.set(-p,-q,p,q);Fa.set(-p,-q,p,q);u=1;v=0;C=B=x=A=s=null};this.setClearColor=function(a,b){t.copy(a);r=b!==void 0?b:1;Fa.set(-p,-q,p,q)};this.setClearColorHex=function(a,b){t.setHex(a);r=b!==void 0?b:1;Fa.set(-p,-q,p,q)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){o.setTransform(1,0,0,-1,p,q);if(Fa.isEmpty()===false){Fa.minSelf(fb);Fa.inflate(2);r<1&&o.clearRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()));
|
|
|
+if(r>0){c(THREE.NormalBlending);b(1);f("rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+r+")");o.fillRect(Math.floor(Fa.getX()),Math.floor(Fa.getY()),Math.floor(Fa.getWidth()),Math.floor(Fa.getHeight()))}Fa.empty()}};this.render=function(a,k){function j(a,b,c){for(var d=0,f=i.length;d<f;d++){var e=i[d],g=e.color;if(e instanceof THREE.DirectionalLight){var h=e.matrixWorld.getPosition().normalize(),k=b.dot(h);if(!(k<=0)){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=
|
|
|
c.b+g.b*k}}else if(e instanceof THREE.PointLight){h=e.matrixWorld.getPosition();k=b.dot(Da.sub(h,a).normalize());if(!(k<=0)){k=k*(e.distance==0?1:1-Math.min(a.distanceTo(h)/e.distance,1));if(k!=0){k=k*e.intensity;c.r=c.r+g.r*k;c.g=c.g+g.g*k;c.b=c.b+g.b*k}}}}}function n(a,d,f,g,h,i,l,o){e.info.render.vertices=e.info.render.vertices+3;e.info.render.faces++;b(o.opacity);c(o.blending);J=a.positionScreen.x;I=a.positionScreen.y;R=d.positionScreen.x;P=d.positionScreen.y;G=f.positionScreen.x;N=f.positionScreen.y;
|
|
|
m(J,I,R,P,G,N);if((o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial)&&o.map===null&&o.map===null)if(xb===true){g=o.color;h=o.emissive;if(o.wireframe===false&&o.shading==THREE.SmoothShading&&l.vertexNormalsLength==3){$.r=S.r=X.r=Ga.r;$.g=S.g=X.g=Ga.g;$.b=S.b=X.b=Ga.b;j(l.v1.positionWorld,l.vertexNormalsWorld[0],$);j(l.v2.positionWorld,l.vertexNormalsWorld[1],S);j(l.v3.positionWorld,l.vertexNormalsWorld[2],X);$.r=g.r*$.r+h.r;$.g=g.g*$.g+h.g;$.b=g.b*$.b+h.b;S.r=g.r*S.r+h.r;
|
|
|
-S.g=g.g*S.g+h.g;S.b=g.b*S.b+h.b;X.r=g.r*X.r+h.r;X.g=g.g*X.g+h.g;X.b=g.b*X.b+h.b;ia.r=(S.r+X.r)*0.5;ia.g=(S.g+X.g)*0.5;ia.b=(S.b+X.b)*0.5;Ja=va($,S,X,ia);v(J,I,R,P,G,N,0,0,1,0,0,1,Ja)}else{fa.r=Ga.r;fa.g=Ga.g;fa.b=Ga.b;j(l.centroidWorld,l.normalWorld,fa);fa.r=g.r*fa.r+h.r;fa.g=g.g*fa.g+h.g;fa.b=g.b*fa.b+h.b;o.wireframe===true?s(fa,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):t(fa)}}else o.wireframe===true?s(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):t(o.color);
|
|
|
+S.g=g.g*S.g+h.g;S.b=g.b*S.b+h.b;X.r=g.r*X.r+h.r;X.g=g.g*X.g+h.g;X.b=g.b*X.b+h.b;ia.r=(S.r+X.r)*0.5;ia.g=(S.g+X.g)*0.5;ia.b=(S.b+X.b)*0.5;Ja=va($,S,X,ia);v(J,I,R,P,G,N,0,0,1,0,0,1,Ja)}else{fa.r=Ga.r;fa.g=Ga.g;fa.b=Ga.b;j(l.centroidWorld,l.normalWorld,fa);fa.r=g.r*fa.r+h.r;fa.g=g.g*fa.g+h.g;fa.b=g.b*fa.b+h.b;o.wireframe===true?t(fa,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):r(fa)}}else o.wireframe===true?t(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):r(o.color);
|
|
|
else if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial)if(o.map!==null){if(o.map.mapping instanceof THREE.UVMapping){Xa=l.uvs[0];u(J,I,R,P,G,N,Xa[g].u,Xa[g].v,Xa[h].u,Xa[h].v,Xa[i].u,Xa[i].v,o.map)}}else if(o.envMap!==null){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=k.matrixWorldInverse;Da.copy(l.vertexNormalsWorld[g]);ja=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;pb=(Da.x*a.elements[1]+
|
|
|
-Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;Da.copy(l.vertexNormalsWorld[h]);Oa=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;Ya=(Da.x*a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;Da.copy(l.vertexNormalsWorld[i]);qb=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;wb=(Da.x*a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;u(J,I,R,P,G,N,ja,pb,Oa,Ya,qb,wb,o.envMap)}}else o.wireframe===true?s(o.color,o.wireframeLinewidth,o.wireframeLinecap,
|
|
|
-o.wireframeLinejoin):t(o.color);else if(o instanceof THREE.MeshDepthMaterial){ua=k.near;Ca=k.far;$.r=$.g=$.b=1-fc(a.positionScreen.z,ua,Ca);S.r=S.g=S.b=1-fc(d.positionScreen.z,ua,Ca);X.r=X.g=X.b=1-fc(f.positionScreen.z,ua,Ca);ia.r=(S.r+X.r)*0.5;ia.g=(S.g+X.g)*0.5;ia.b=(S.b+X.b)*0.5;Ja=va($,S,X,ia);v(J,I,R,P,G,N,0,0,1,0,0,1,Ja)}else if(o instanceof THREE.MeshNormalMaterial){fa.r=jc(l.normalWorld.x);fa.g=jc(l.normalWorld.y);fa.b=jc(l.normalWorld.z);o.wireframe===true?s(fa,o.wireframeLinewidth,o.wireframeLinecap,
|
|
|
-o.wireframeLinejoin):t(fa)}}function m(a,b,c,d,f,e){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(f,e);o.closePath()}function r(a,b,c,d,f,e,g,h){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(f,e);o.lineTo(g,h);o.closePath()}function s(a,b,c,f){if(x!==b)x=o.lineWidth=b;if(B!==c)B=o.lineCap=c;if(C!==f)C=o.lineJoin=f;d(a.getContextStyle());o.stroke();xa.inflate(b*2)}function t(a){f(a.getContextStyle());o.fill()}function u(a,b,c,d,e,g,h,i,k,j,l,n,m){if(!(m instanceof THREE.DataTexture||m.image===
|
|
|
+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;Da.copy(l.vertexNormalsWorld[h]);Oa=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;Ya=(Da.x*a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;Da.copy(l.vertexNormalsWorld[i]);qb=(Da.x*a.elements[0]+Da.y*a.elements[4]+Da.z*a.elements[8])*0.5+0.5;wb=(Da.x*a.elements[1]+Da.y*a.elements[5]+Da.z*a.elements[9])*0.5+0.5;u(J,I,R,P,G,N,ja,pb,Oa,Ya,qb,wb,o.envMap)}}else o.wireframe===true?t(o.color,o.wireframeLinewidth,o.wireframeLinecap,
|
|
|
+o.wireframeLinejoin):r(o.color);else if(o instanceof THREE.MeshDepthMaterial){ua=k.near;Ca=k.far;$.r=$.g=$.b=1-fc(a.positionScreen.z,ua,Ca);S.r=S.g=S.b=1-fc(d.positionScreen.z,ua,Ca);X.r=X.g=X.b=1-fc(f.positionScreen.z,ua,Ca);ia.r=(S.r+X.r)*0.5;ia.g=(S.g+X.g)*0.5;ia.b=(S.b+X.b)*0.5;Ja=va($,S,X,ia);v(J,I,R,P,G,N,0,0,1,0,0,1,Ja)}else if(o instanceof THREE.MeshNormalMaterial){fa.r=jc(l.normalWorld.x);fa.g=jc(l.normalWorld.y);fa.b=jc(l.normalWorld.z);o.wireframe===true?t(fa,o.wireframeLinewidth,o.wireframeLinecap,
|
|
|
+o.wireframeLinejoin):r(fa)}}function m(a,b,c,d,f,e){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(f,e);o.closePath()}function s(a,b,c,d,f,e,g,h){o.beginPath();o.moveTo(a,b);o.lineTo(c,d);o.lineTo(f,e);o.lineTo(g,h);o.closePath()}function t(a,b,c,f){if(x!==b)x=o.lineWidth=b;if(B!==c)B=o.lineCap=c;if(C!==f)C=o.lineJoin=f;d(a.getContextStyle());o.stroke();xa.inflate(b*2)}function r(a){f(a.getContextStyle());o.fill()}function u(a,b,c,d,e,g,h,i,k,j,l,n,m){if(!(m instanceof THREE.DataTexture||m.image===
|
|
|
void 0||m.image.width==0)){if(m.needsUpdate===true||Ia[m.id]===void 0){var va=m.wrapS==THREE.RepeatWrapping,q=m.wrapT==THREE.RepeatWrapping;Ia[m.id]=o.createPattern(m.image,va===true&&q===true?"repeat":va===true&&q===false?"repeat-x":va===false&&q===true?"repeat-y":"no-repeat");m.needsUpdate=false}f(Ia[m.id]);var va=m.offset.x/m.repeat.x,q=m.offset.y/m.repeat.y,p=m.image.width*m.repeat.x,sb=m.image.height*m.repeat.y,h=(h+va)*p,i=(1-i+q)*sb,c=c-a,d=d-b,e=e-a,g=g-b,k=(k+va)*p-h,j=(1-j+q)*sb-i,l=(l+
|
|
|
-va)*p-h,n=(1-n+q)*sb-i,va=k*n-l*j;if(va===0){if(pa[m.id]===void 0){b=document.createElement("canvas");b.width=m.image.width;b.height=m.image.height;b=b.getContext("2d");b.drawImage(m.image,0,0);pa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data}b=pa[m.id];h=(Math.floor(h)+Math.floor(i)*m.image.width)*4;fa.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);t(fa)}else{va=1/va;m=(n*c-j*e)*va;j=(n*d-j*g)*va;c=(k*e-l*c)*va;d=(k*g-l*d)*va;a=a-m*h-c*i;h=b-j*h-d*i;o.save();o.transform(m,j,c,d,a,h);o.fill();
|
|
|
+va)*p-h,n=(1-n+q)*sb-i,va=k*n-l*j;if(va===0){if(pa[m.id]===void 0){b=document.createElement("canvas");b.width=m.image.width;b.height=m.image.height;b=b.getContext("2d");b.drawImage(m.image,0,0);pa[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data}b=pa[m.id];h=(Math.floor(h)+Math.floor(i)*m.image.width)*4;fa.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);r(fa)}else{va=1/va;m=(n*c-j*e)*va;j=(n*d-j*g)*va;c=(k*e-l*c)*va;d=(k*g-l*d)*va;a=a-m*h-c*i;h=b-j*h-d*i;o.save();o.transform(m,j,c,d,a,h);o.fill();
|
|
|
o.restore()}}}function v(a,b,c,d,f,e,g,h,i,k,j,l,m){var n,va;n=m.width-1;va=m.height-1;g=g*n;h=h*va;c=c-a;d=d-b;f=f-a;e=e-b;i=i*n-g;k=k*va-h;j=j*n-g;l=l*va-h;va=1/(i*l-j*k);n=(l*c-k*f)*va;k=(l*d-k*e)*va;c=(i*f-j*c)*va;d=(i*e-j*d)*va;a=a-n*g-c*h;b=b-k*g-d*h;o.save();o.transform(n,k,c,d,a,b);o.clip();o.drawImage(m,0,0);o.restore()}function va(a,b,c,d){Pa[0]=a.r*255|0;Pa[1]=a.g*255|0;Pa[2]=a.b*255|0;Pa[4]=b.r*255|0;Pa[5]=b.g*255|0;Pa[6]=b.b*255|0;Pa[8]=c.r*255|0;Pa[9]=c.g*255|0;Pa[10]=c.b*255|0;Pa[12]=
|
|
|
d.r*255|0;Pa[13]=d.g*255|0;Pa[14]=d.b*255|0;bb.putImageData(gb,0,0);hb.drawImage(ab,0,0);return Qa}function fc(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function jc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function sb(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;if(f!==0){f=1/Math.sqrt(f);c=c*f;d=d*f;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}if(k instanceof THREE.Camera===false)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{var Vb,Ec,A,Y;this.autoClear===true?this.clear():
|
|
|
o.setTransform(1,0,0,-1,p,q);e.info.render.vertices=0;e.info.render.faces=0;g=l.projectScene(a,k,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;xb=i.length>0;if(xb===true){Ga.setRGB(0,0,0);$a.setRGB(0,0,0);rb.setRGB(0,0,0);Vb=0;for(Ec=i.length;Vb<Ec;Vb++){Y=i[Vb];var da=Y.color;if(Y instanceof THREE.AmbientLight){Ga.r=Ga.r+da.r;Ga.g=Ga.g+da.g;Ga.b=Ga.b+da.b}else if(Y instanceof THREE.DirectionalLight){$a.r=$a.r+da.r;$a.g=$a.g+da.g;$a.b=$a.b+da.b}else if(Y instanceof THREE.PointLight){rb.r=
|
|
@@ -286,9 +286,9 @@ H.positionScreen.y);fb.intersects(xa)===true&&n(z,F,H,0,1,2,A,Y,a)}else if(A ins
|
|
|
if(Y.overdraw===true){sb(z.positionScreen,F.positionScreen);sb(F.positionScreen,K.positionScreen);sb(K.positionScreen,z.positionScreen);sb(H.positionScreen,E.positionScreen);sb(H.positionScreen,L.positionScreen)}xa.addPoint(z.positionScreen.x,z.positionScreen.y);xa.addPoint(F.positionScreen.x,F.positionScreen.y);xa.addPoint(H.positionScreen.x,H.positionScreen.y);xa.addPoint(K.positionScreen.x,K.positionScreen.y);if(fb.intersects(xa)===true){oa=z;Ea=F;tb=H;jb=K;kb=E;Wb=L;da=A;A=a;e.info.render.vertices=
|
|
|
e.info.render.vertices+4;e.info.render.faces++;b(Y.opacity);c(Y.blending);if(Y.map!==void 0&&Y.map!==null||Y.envMap!==void 0&&Y.envMap!==null){n(oa,Ea,jb,0,1,3,da,Y,A);n(kb,tb,Wb,1,2,3,da,Y,A)}else{J=oa.positionScreen.x;I=oa.positionScreen.y;R=Ea.positionScreen.x;P=Ea.positionScreen.y;G=tb.positionScreen.x;N=tb.positionScreen.y;ca=jb.positionScreen.x;M=jb.positionScreen.y;ea=kb.positionScreen.x;Q=kb.positionScreen.y;ba=Wb.positionScreen.x;ta=Wb.positionScreen.y;if(Y instanceof THREE.MeshLambertMaterial||
|
|
|
Y instanceof THREE.MeshPhongMaterial)if(xb===true){oa=Y.color;Ea=Y.emissive;if(Y.wireframe===false&&Y.shading==THREE.SmoothShading&&da.vertexNormalsLength==4){$.r=S.r=X.r=ia.r=Ga.r;$.g=S.g=X.g=ia.g=Ga.g;$.b=S.b=X.b=ia.b=Ga.b;j(da.v1.positionWorld,da.vertexNormalsWorld[0],$);j(da.v2.positionWorld,da.vertexNormalsWorld[1],S);j(da.v4.positionWorld,da.vertexNormalsWorld[3],X);j(da.v3.positionWorld,da.vertexNormalsWorld[2],ia);$.r=oa.r*$.r+Ea.r;$.g=oa.g*$.g+Ea.g;$.b=oa.b*$.b+Ea.b;S.r=oa.r*S.r+Ea.r;S.g=
|
|
|
-oa.g*S.g+Ea.g;S.b=oa.b*S.b+Ea.b;X.r=oa.r*X.r+Ea.r;X.g=oa.g*X.g+Ea.g;X.b=oa.b*X.b+Ea.b;ia.r=oa.r*ia.r+Ea.r;ia.g=oa.g*ia.g+Ea.g;ia.b=oa.b*ia.b+Ea.b;Ja=va($,S,X,ia);m(J,I,R,P,ca,M);v(J,I,R,P,ca,M,0,0,1,0,0,1,Ja);m(ea,Q,G,N,ba,ta);v(ea,Q,G,N,ba,ta,1,0,1,1,0,1,Ja)}else{fa.r=Ga.r;fa.g=Ga.g;fa.b=Ga.b;j(da.centroidWorld,da.normalWorld,fa);fa.r=oa.r*fa.r+Ea.r;fa.g=oa.g*fa.g+Ea.g;fa.b=oa.b*fa.b+Ea.b;r(J,I,R,P,G,N,ca,M);Y.wireframe===true?s(fa,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):t(fa)}}else{r(J,
|
|
|
-I,R,P,G,N,ca,M);Y.wireframe===true?s(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):t(Y.color)}else if(Y instanceof THREE.MeshBasicMaterial){r(J,I,R,P,G,N,ca,M);Y.wireframe===true?s(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):t(Y.color)}else if(Y instanceof THREE.MeshNormalMaterial){fa.r=jc(da.normalWorld.x);fa.g=jc(da.normalWorld.y);fa.b=jc(da.normalWorld.z);r(J,I,R,P,G,N,ca,M);Y.wireframe===true?s(fa,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):
|
|
|
-t(fa)}else if(Y instanceof THREE.MeshDepthMaterial){ua=k.near;Ca=k.far;$.r=$.g=$.b=1-fc(oa.positionScreen.z,ua,Ca);S.r=S.g=S.b=1-fc(Ea.positionScreen.z,ua,Ca);X.r=X.g=X.b=1-fc(jb.positionScreen.z,ua,Ca);ia.r=ia.g=ia.b=1-fc(tb.positionScreen.z,ua,Ca);Ja=va($,S,X,ia);m(J,I,R,P,ca,M);v(J,I,R,P,ca,M,0,0,1,0,0,1,Ja);m(ea,Q,G,N,ba,ta);v(ea,Q,G,N,ba,ta,1,0,1,1,0,1,Ja)}}}}Fa.addRectangle(xa)}}o.setTransform(1,0,0,1,0,0)}}};
|
|
|
+oa.g*S.g+Ea.g;S.b=oa.b*S.b+Ea.b;X.r=oa.r*X.r+Ea.r;X.g=oa.g*X.g+Ea.g;X.b=oa.b*X.b+Ea.b;ia.r=oa.r*ia.r+Ea.r;ia.g=oa.g*ia.g+Ea.g;ia.b=oa.b*ia.b+Ea.b;Ja=va($,S,X,ia);m(J,I,R,P,ca,M);v(J,I,R,P,ca,M,0,0,1,0,0,1,Ja);m(ea,Q,G,N,ba,ta);v(ea,Q,G,N,ba,ta,1,0,1,1,0,1,Ja)}else{fa.r=Ga.r;fa.g=Ga.g;fa.b=Ga.b;j(da.centroidWorld,da.normalWorld,fa);fa.r=oa.r*fa.r+Ea.r;fa.g=oa.g*fa.g+Ea.g;fa.b=oa.b*fa.b+Ea.b;s(J,I,R,P,G,N,ca,M);Y.wireframe===true?t(fa,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):r(fa)}}else{s(J,
|
|
|
+I,R,P,G,N,ca,M);Y.wireframe===true?t(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):r(Y.color)}else if(Y instanceof THREE.MeshBasicMaterial){s(J,I,R,P,G,N,ca,M);Y.wireframe===true?t(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):r(Y.color)}else if(Y instanceof THREE.MeshNormalMaterial){fa.r=jc(da.normalWorld.x);fa.g=jc(da.normalWorld.y);fa.b=jc(da.normalWorld.z);s(J,I,R,P,G,N,ca,M);Y.wireframe===true?t(fa,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):
|
|
|
+r(fa)}else if(Y instanceof THREE.MeshDepthMaterial){ua=k.near;Ca=k.far;$.r=$.g=$.b=1-fc(oa.positionScreen.z,ua,Ca);S.r=S.g=S.b=1-fc(Ea.positionScreen.z,ua,Ca);X.r=X.g=X.b=1-fc(jb.positionScreen.z,ua,Ca);ia.r=ia.g=ia.b=1-fc(tb.positionScreen.z,ua,Ca);Ja=va($,S,X,ia);m(J,I,R,P,ca,M);v(J,I,R,P,ca,M,0,0,1,0,0,1,Ja);m(ea,Q,G,N,ba,ta);v(ea,Q,G,N,ba,ta,1,0,1,1,0,1,Ja)}}}}Fa.addRectangle(xa)}}o.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 {\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 mPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 mPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
@@ -343,12 +343,12 @@ if(a.elementsNeedUpdate&&f!==void 0){k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.buffe
|
|
|
i.buffer);k.bufferData(k.ARRAY_BUFFER,i.array,b)}if(a.tangentsNeedUpdate&&d!==void 0){k.bindBuffer(k.ARRAY_BUFFER,d.buffer);k.bufferData(k.ARRAY_BUFFER,d.array,b)}if(c)for(var j in a.attributes)delete a.attributes[j].array}function i(a,b){return b.z-a.z}function l(a,b){return b[1]-a[1]}function j(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++){ia=fa=null;S=X=Ca=ua=Ya=Oa=Ja=-1;hb=true;a[d].render(b,c,rb,Da);ia=fa=null;S=X=Ca=ua=Ya=Oa=Ja=-1;hb=true}}function n(a,b,c,d,f,e,g,h){var i,k,j,l;if(b){k=
|
|
|
a.length-1;l=b=-1}else{k=0;b=a.length;l=1}for(var m=k;m!==b;m=m+l){i=a[m];if(i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&Q.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);Q.setDepthTest(i.depthTest);Q.setDepthWrite(i.depthWrite);B(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}Q.setMaterialFaces(i);j instanceof THREE.BufferGeometry?Q.renderBufferDirect(d,f,e,i,j,k):Q.renderBuffer(d,f,e,i,j,k)}}}function m(a,b,c,d,f,e,g){for(var h,i,k=0,j=a.length;k<
|
|
|
j;k++){h=a[k];i=h.object;if(i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&Q.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);Q.setDepthTest(h.depthTest);Q.setDepthWrite(h.depthWrite);B(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}Q.renderImmediateObject(c,d,f,h,i)}}}function p(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return true;return false}function o(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
|
|
|
-false}function t(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function s(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,f){pa=0;if(d.needsUpdate){d.program&&Q.deallocateMaterial(d);Q.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==fa){k.useProgram(g);fa=g;e=true}if(d.id!==S){S=d.id;
|
|
|
+false}function t(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function r(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,f){pa=0;if(d.needsUpdate){d.program&&Q.deallocateMaterial(d);Q.initMaterial(d,b,c,f);d.needsUpdate=false}if(d.morphTargets&&!f.__webglMorphTargetInfluences)f.__webglMorphTargetInfluences=new Float32Array(Q.maxMorphTargets);var e=false,g=d.program,h=g.uniforms,i=d.uniforms;if(g!==fa){k.useProgram(g);fa=g;e=true}if(d.id!==S){S=d.id;
|
|
|
e=true}if(e||a!==ia){k.uniformMatrix4fv(h.projectionMatrix,false,a._projectionMatrixArray);a!==ia&&(ia=a)}if(d.skinning)if(ec&&f.useVertexTexture){if(h.boneTexture!==null){var j=v();k.uniform1i(h.boneTexture,j);Q.setTexture(f.boneTexture,j)}}else h.boneGlobalMatrices!==null&&k.uniformMatrix4fv(h.boneGlobalMatrices,false,f.boneMatrices);if(e){if(c&&d.fog){i.fogColor.value=c.color;if(c instanceof THREE.Fog){i.fogNear.value=c.near;i.fogFar.value=c.far}else if(c instanceof THREE.FogExp2)i.fogDensity.value=
|
|
|
-c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(hb){for(var l=0,m=0,n=0,o,q,p,r,s=qc,t=s.directional.colors,u=s.directional.positions,z=s.point.colors,B=s.point.positions,C=s.point.distances,H=s.spot.colors,I=s.spot.positions,J=s.spot.distances,G=s.spot.directions,M=s.spot.angles,K=s.spot.exponents,X=s.hemi.skyColors,N=s.hemi.groundColors,P=s.hemi.positions,R=0,$=0,ca=0,ea=0,c=o=p=p=q=0,e=b.length;c<e;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=
|
|
|
-j.color;r=j.intensity;q=j.distance;if(j instanceof THREE.AmbientLight)if(Q.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){q=R*3;Q.gammaInput?A(t,q,o,r*r):x(t,q,o,r);Qa.copy(j.matrixWorld.getPosition());Qa.subSelf(j.target.matrixWorld.getPosition());Qa.normalize();u[q]=Qa.x;u[q+1]=Qa.y;u[q+2]=Qa.z;R=R+1}else if(j instanceof THREE.PointLight){p=$*3;Q.gammaInput?A(z,p,o,r*r):x(z,p,o,r);r=j.matrixWorld.getPosition();B[p]=r.x;B[p+
|
|
|
-1]=r.y;B[p+2]=r.z;C[$]=q;$=$+1}else if(j instanceof THREE.SpotLight){p=ca*3;Q.gammaInput?A(H,p,o,r*r):x(H,p,o,r);r=j.matrixWorld.getPosition();I[p]=r.x;I[p+1]=r.y;I[p+2]=r.z;J[ca]=q;Qa.copy(r);Qa.subSelf(j.target.matrixWorld.getPosition());Qa.normalize();G[p]=Qa.x;G[p+1]=Qa.y;G[p+2]=Qa.z;M[ca]=Math.cos(j.angle);K[ca]=j.exponent;ca=ca+1}else if(j instanceof THREE.HemisphereLight){q=j.color;p=j.groundColor;o=ea*3;if(Q.gammaInput){r=r*r;A(X,o,q,r);A(N,o,p,r)}else{x(X,o,q,r);x(N,o,p,r)}r=j.matrixWorld.getPosition();
|
|
|
-P[o]=r.x;P[o+1]=r.y;P[o+2]=r.z;ea=ea+1}}}c=R*3;for(e=t.length;c<e;c++)t[c]=0;c=$*3;for(e=z.length;c<e;c++)z[c]=0;c=ca*3;for(e=H.length;c<e;c++)H[c]=0;c=ea*3;for(e=X.length;c<e;c++)X[c]=0;c=ea*3;for(e=N.length;c<e;c++)N[c]=0;s.directional.length=R;s.point.length=$;s.spot.length=ca;s.hemi.length=ea;s.ambient[0]=l;s.ambient[1]=m;s.ambient[2]=n;hb=false}c=qc;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;
|
|
|
+c.density}if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(hb){for(var l=0,m=0,n=0,o,q,p,s,t=qc,r=t.directional.colors,u=t.directional.positions,z=t.point.colors,B=t.point.positions,C=t.point.distances,H=t.spot.colors,I=t.spot.positions,J=t.spot.distances,G=t.spot.directions,M=t.spot.angles,K=t.spot.exponents,X=t.hemi.skyColors,N=t.hemi.groundColors,P=t.hemi.positions,R=0,$=0,ca=0,ea=0,c=o=p=p=q=0,e=b.length;c<e;c++){j=b[c];if(!j.onlyShadow&&j.visible){o=
|
|
|
+j.color;s=j.intensity;q=j.distance;if(j instanceof THREE.AmbientLight)if(Q.gammaInput){l=l+o.r*o.r;m=m+o.g*o.g;n=n+o.b*o.b}else{l=l+o.r;m=m+o.g;n=n+o.b}else if(j instanceof THREE.DirectionalLight){q=R*3;Q.gammaInput?A(r,q,o,s*s):x(r,q,o,s);Qa.copy(j.matrixWorld.getPosition());Qa.subSelf(j.target.matrixWorld.getPosition());Qa.normalize();u[q]=Qa.x;u[q+1]=Qa.y;u[q+2]=Qa.z;R=R+1}else if(j instanceof THREE.PointLight){p=$*3;Q.gammaInput?A(z,p,o,s*s):x(z,p,o,s);s=j.matrixWorld.getPosition();B[p]=s.x;B[p+
|
|
|
+1]=s.y;B[p+2]=s.z;C[$]=q;$=$+1}else if(j instanceof THREE.SpotLight){p=ca*3;Q.gammaInput?A(H,p,o,s*s):x(H,p,o,s);s=j.matrixWorld.getPosition();I[p]=s.x;I[p+1]=s.y;I[p+2]=s.z;J[ca]=q;Qa.copy(s);Qa.subSelf(j.target.matrixWorld.getPosition());Qa.normalize();G[p]=Qa.x;G[p+1]=Qa.y;G[p+2]=Qa.z;M[ca]=Math.cos(j.angle);K[ca]=j.exponent;ca=ca+1}else if(j instanceof THREE.HemisphereLight){q=j.color;p=j.groundColor;o=ea*3;if(Q.gammaInput){s=s*s;A(X,o,q,s);A(N,o,p,s)}else{x(X,o,q,s);x(N,o,p,s)}s=j.matrixWorld.getPosition();
|
|
|
+P[o]=s.x;P[o+1]=s.y;P[o+2]=s.z;ea=ea+1}}}c=R*3;for(e=r.length;c<e;c++)r[c]=0;c=$*3;for(e=z.length;c<e;c++)z[c]=0;c=ca*3;for(e=H.length;c<e;c++)H[c]=0;c=ea*3;for(e=X.length;c<e;c++)X[c]=0;c=ea*3;for(e=N.length;c<e;c++)N[c]=0;t.directional.length=R;t.point.length=$;t.spot.length=ca;t.hemi.length=ea;t.ambient[0]=l;t.ambient[1]=m;t.ambient[2]=n;hb=false}c=qc;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;
|
|
|
i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngle.value=c.spot.angles;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightPosition.value=
|
|
|
c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;Q.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;if(d.bumpMap){i.bumpMap.value=d.bumpMap;i.bumpScale.value=d.bumpScale}if(d.normalMap){i.normalMap.value=d.normalMap;i.normalScale.value.copy(d.normalScale)}var ba;if(d.map)ba=d.map;
|
|
|
else if(d.specularMap)ba=d.specularMap;else if(d.normalMap)ba=d.normalMap;else if(d.bumpMap)ba=d.bumpMap;if(ba!==void 0){c=ba.offset;ba=ba.repeat;i.offsetRepeat.value.set(c.x,c.y,ba.x,ba.y)}i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}if(d instanceof THREE.LineBasicMaterial){i.diffuse.value=
|
|
@@ -358,10 +358,10 @@ if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=ba=0;for(e=b.length;c<e;c+
|
|
|
"i")k.uniform1i(e,j);else if(l==="f")k.uniform1f(e,j);else if(l==="v2")k.uniform2f(e,j.x,j.y);else if(l==="v3")k.uniform3f(e,j.x,j.y,j.z);else if(l==="v4")k.uniform4f(e,j.x,j.y,j.z,j.w);else if(l==="c")k.uniform3f(e,j.r,j.g,j.b);else if(l==="iv1")k.uniform1iv(e,j);else if(l==="iv")k.uniform3iv(e,j);else if(l==="fv1")k.uniform1fv(e,j);else if(l==="fv")k.uniform3fv(e,j);else if(l==="v2v"){if(c._array===void 0)c._array=new Float32Array(2*j.length);l=0;for(m=j.length;l<m;l++){n=l*2;c._array[n]=j[l].x;
|
|
|
c._array[n+1]=j[l].y}k.uniform2fv(e,c._array)}else if(l==="v3v"){if(c._array===void 0)c._array=new Float32Array(3*j.length);l=0;for(m=j.length;l<m;l++){n=l*3;c._array[n]=j[l].x;c._array[n+1]=j[l].y;c._array[n+2]=j[l].z}k.uniform3fv(e,c._array)}else if(l==="v4v"){if(c._array===void 0)c._array=new Float32Array(4*j.length);l=0;for(m=j.length;l<m;l++){n=l*4;c._array[n]=j[l].x;c._array[n+1]=j[l].y;c._array[n+2]=j[l].z;c._array[n+3]=j[l].w}k.uniform4fv(e,c._array)}else if(l==="m4"){if(c._array===void 0)c._array=
|
|
|
new Float32Array(16);j.flattenToArray(c._array);k.uniformMatrix4fv(e,false,c._array)}else if(l==="m4v"){if(c._array===void 0)c._array=new Float32Array(16*j.length);l=0;for(m=j.length;l<m;l++)j[l].flattenToArrayOffset(c._array,l*16);k.uniformMatrix4fv(e,false,c._array)}else if(l==="t"){n=j;j=v();k.uniform1i(e,j);if(n)if(n.image instanceof Array&&n.image.length===6){c=n;e=j;if(c.image.length===6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=k.createTexture();k.activeTexture(k.TEXTURE0+
|
|
|
-e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(j=0;j<6;j++)if(Q.autoScaleCubemaps){l=e;m=j;n=c.image[j];t=Sc;if(!(n.width<=t&&n.height<=t)){u=Math.max(n.width,n.height);s=Math.floor(n.width*t/u);t=Math.floor(n.height*t/u);u=document.createElement("canvas");u.width=s;u.height=t;u.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,s,t);n=u}l[m]=n}else e[j]=c.image[j];j=e[0];l=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;
|
|
|
+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);e=[];for(j=0;j<6;j++)if(Q.autoScaleCubemaps){l=e;m=j;n=c.image[j];r=Sc;if(!(n.width<=r&&n.height<=r)){u=Math.max(n.width,n.height);t=Math.floor(n.width*r/u);r=Math.floor(n.height*r/u);u=document.createElement("canvas");u.width=t;u.height=r;u.getContext("2d").drawImage(n,0,0,n.width,n.height,0,0,t,r);n=u}l[m]=n}else e[j]=c.image[j];j=e[0];l=(j.width&j.width-1)===0&&(j.height&j.height-1)===0;
|
|
|
m=E(c.format);n=E(c.type);F(k.TEXTURE_CUBE_MAP,c,l);for(j=0;j<6;j++)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,m,m,n,e[j]);c.generateMipmaps&&l&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=false;if(c.onUpdate)c.onUpdate()}else{k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}}else if(n instanceof THREE.WebGLRenderTargetCube){c=n;k.activeTexture(k.TEXTURE0+j);k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)}else Q.setTexture(n,j)}else if(l==="tv"){if(c._array===
|
|
|
void 0)c._array=[];l=0;for(m=c.value.length;l<m;l++)c._array[l]=v();k.uniform1iv(e,c._array);l=0;for(m=c.value.length;l<m;l++){n=c.value[l];j=c._array[l];n&&Q.setTexture(n,j)}}}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&h.cameraPosition!==null){b=a.matrixWorld.getPosition();k.uniform3f(h.cameraPosition,b.x,b.y,b.z)}(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&h.viewMatrix!==
|
|
|
-null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.modelMatrix!==null&&k.uniformMatrix4fv(h.modelMatrix,false,f.matrixWorld.elements);return g}function v(){var a=pa;a>=Dc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+Dc);pa=pa+1;return a}function r(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,
|
|
|
+null&&k.uniformMatrix4fv(h.viewMatrix,false,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,false,f._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,false,f._normalMatrix.elements);h.modelMatrix!==null&&k.uniformMatrix4fv(h.modelMatrix,false,f.matrixWorld.elements);return g}function v(){var a=pa;a>=Dc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+Dc);pa=pa+1;return a}function s(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,
|
|
|
a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function A(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 x(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function B(a,b,c){if(qb!==a){a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL);qb=a}if(a&&(wb!==b||fb!==c)){k.polygonOffset(b,c);wb=b;fb=c}}function C(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function z(a,b){var c;a==="fragment"?
|
|
|
c=k.createShader(k.FRAGMENT_SHADER):a==="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS)){console.error(k.getShaderInfoLog(c));console.error(C(b));return null}return c}function F(a,b,c){if(c){k.texParameteri(a,k.TEXTURE_WRAP_S,E(b.wrapS));k.texParameteri(a,k.TEXTURE_WRAP_T,E(b.wrapT));k.texParameteri(a,k.TEXTURE_MAG_FILTER,E(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,E(b.minFilter))}else{k.texParameteri(a,k.TEXTURE_WRAP_S,
|
|
|
k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(a,k.TEXTURE_MAG_FILTER,K(b.magFilter));k.texParameteri(a,k.TEXTURE_MIN_FILTER,K(b.minFilter))}if(Pb&&b.type!==THREE.FloatType&&(b.anisotropy>1||b.__oldAnisotropy)){k.texParameterf(a,Pb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,rc));b.__oldAnisotropy=b.anisotropy}}function H(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);if(b.depthBuffer&&!b.stencilBuffer){k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,
|
|
@@ -400,14 +400,14 @@ k.vertexAttribPointer(b.uv2,2,k.FLOAT,false,0,0);k.enableVertexAttribArray(b.uv2
|
|
|
f.__webglLineBuffer);k.drawElements(k.LINES,f.__webglLineCount,k.UNSIGNED_SHORT,0)}else{a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer);k.drawElements(k.TRIANGLES,f.__webglFaceCount,k.UNSIGNED_SHORT,0)}Q.info.render.calls++;Q.info.render.vertices=Q.info.render.vertices+f.__webglFaceCount;Q.info.render.faces=Q.info.render.faces+f.__webglFaceCount/3}else if(e instanceof THREE.Line){e=e.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;d=d.linewidth;if(d!==Fa){k.lineWidth(d);Fa=d}k.drawArrays(e,
|
|
|
0,f.__webglLineCount);Q.info.render.calls++}else if(e instanceof THREE.ParticleSystem){k.drawArrays(k.POINTS,0,f.__webglParticleCount);Q.info.render.calls++;Q.info.render.points=Q.info.render.points+f.__webglParticleCount}else if(e instanceof THREE.Ribbon){k.drawArrays(k.TRIANGLE_STRIP,0,f.__webglVertexCount);Q.info.render.calls++}}};this.render=function(a,b,c,d){if(b instanceof THREE.Camera===false)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var f,
|
|
|
e,g,h,l=a.__lights,o=a.fog;S=-1;hb=true;this.autoUpdateScene&&a.updateMatrixWorld();b.parent===void 0&&b.updateMatrixWorld();if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);bb.multiply(b.projectionMatrix,b.matrixWorldInverse);ab.setFromMatrix(bb);this.autoUpdateObjects&&
|
|
|
-this.initWebGLObjects(a);j(this.renderPluginsPre,a,b);Q.info.render.calls=0;Q.info.render.vertices=0;Q.info.render.faces=0;Q.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(f=h.length;d<f;d++){e=h[d];g=e.object;e.render=false;if(g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ab.contains(g))){r(g,b);var q=e,p=q.object,s=q.buffer,t=void 0,
|
|
|
-t=t=void 0,t=p.material;if(t instanceof THREE.MeshFaceMaterial){t=s.materialIndex;if(t>=0){t=p.geometry.materials[t];if(t.transparent){q.transparent=t;q.opaque=null}else{q.opaque=t;q.transparent=null}}}else if(t)if(t.transparent){q.transparent=t;q.opaque=null}else{q.opaque=t;q.transparent=null}e.render=true;if(this.sortObjects===true)if(g.renderDepth!==null)e.z=g.renderDepth;else{Pa.copy(g.matrixWorld.getPosition());bb.multiplyVector3(Pa);e.z=Pa.z}}}this.sortObjects&&h.sort(i);h=a.__webglObjectsImmediate;
|
|
|
-d=0;for(f=h.length;d<f;d++){e=h[d];g=e.object;if(g.visible){r(g,b);g=e.object.material;if(g.transparent){e.transparent=g;e.opaque=null}else{e.opaque=g;e.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);B(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);n(a.__webglObjects,false,"",b,l,o,true,d);m(a.__webglObjectsImmediate,"",b,l,o,false,d)}else{this.setBlending(THREE.NormalBlending);
|
|
|
+this.initWebGLObjects(a);j(this.renderPluginsPre,a,b);Q.info.render.calls=0;Q.info.render.vertices=0;Q.info.render.faces=0;Q.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(f=h.length;d<f;d++){e=h[d];g=e.object;e.render=false;if(g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ab.contains(g))){s(g,b);var q=e,p=q.object,t=q.buffer,r=void 0,
|
|
|
+r=r=void 0,r=p.material;if(r instanceof THREE.MeshFaceMaterial){r=t.materialIndex;if(r>=0){r=p.geometry.materials[r];if(r.transparent){q.transparent=r;q.opaque=null}else{q.opaque=r;q.transparent=null}}}else if(r)if(r.transparent){q.transparent=r;q.opaque=null}else{q.opaque=r;q.transparent=null}e.render=true;if(this.sortObjects===true)if(g.renderDepth!==null)e.z=g.renderDepth;else{Pa.copy(g.matrixWorld.getPosition());bb.multiplyVector3(Pa);e.z=Pa.z}}}this.sortObjects&&h.sort(i);h=a.__webglObjectsImmediate;
|
|
|
+d=0;for(f=h.length;d<f;d++){e=h[d];g=e.object;if(g.visible){s(g,b);g=e.object.material;if(g.transparent){e.transparent=g;e.opaque=null}else{e.opaque=g;e.transparent=null}}}if(a.overrideMaterial){d=a.overrideMaterial;this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst);this.setDepthTest(d.depthTest);this.setDepthWrite(d.depthWrite);B(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits);n(a.__webglObjects,false,"",b,l,o,true,d);m(a.__webglObjectsImmediate,"",b,l,o,false,d)}else{this.setBlending(THREE.NormalBlending);
|
|
|
n(a.__webglObjects,true,"opaque",b,l,o,false);m(a.__webglObjectsImmediate,"opaque",b,l,o,false);n(a.__webglObjects,false,"transparent",b,l,o,true);m(a.__webglObjectsImmediate,"transparent",b,l,o,true)}j(this.renderPluginsPost,a,b);if(c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)if(c instanceof THREE.WebGLRenderTargetCube){k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture);k.generateMipmap(k.TEXTURE_CUBE_MAP);k.bindTexture(k.TEXTURE_CUBE_MAP,null)}else{k.bindTexture(k.TEXTURE_2D,
|
|
|
c.__webglTexture);k.generateMipmap(k.TEXTURE_2D);k.bindTexture(k.TEXTURE_2D,null)}this.setDepthTest(true);this.setDepthWrite(true)}};this.renderImmediateObject=function(a,b,c,d,f){var e=u(a,b,c,d,f);X=-1;Q.setMaterialFaces(d);f.immediateRenderCallback?f.immediateRenderCallback(e,k,ab):f.render(function(a){Q.renderBufferImmediate(a,e,d)})};this.initWebGLObjects=function(a){if(!a.__webglObjects){a.__webglObjects=[];a.__webglObjectsImmediate=[];a.__webglSprites=[];a.__webglFlares=[]}for(;a.__objectsAdded.length;){var i=
|
|
|
-a.__objectsAdded[0],j=a,l=void 0,m=void 0,n=void 0;if(!i.__webglInit){i.__webglInit=true;i._modelViewMatrix=new THREE.Matrix4;i._normalMatrix=new THREE.Matrix3;if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.Geometry){if(m.geometryGroups===void 0){var r=m,u=void 0,v=void 0,x=void 0,z=void 0,A=void 0,B=void 0,C=void 0,E={},H=r.morphTargets.length,I=r.morphNormals.length;r.geometryGroups={};u=0;for(v=r.faces.length;u<v;u++){x=r.faces[u];z=x.materialIndex;B=z!==void 0?z:-1;E[B]===void 0&&
|
|
|
-(E[B]={hash:B,counter:0});C=E[B].hash+"_"+E[B].counter;r.geometryGroups[C]===void 0&&(r.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:I});A=x instanceof THREE.Face3?3:4;if(r.geometryGroups[C].vertices+A>65535){E[B].counter=E[B].counter+1;C=E[B].hash+"_"+E[B].counter;r.geometryGroups[C]===void 0&&(r.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:I})}x instanceof THREE.Face3?r.geometryGroups[C].faces3.push(u):
|
|
|
-r.geometryGroups[C].faces4.push(u);r.geometryGroups[C].vertices=r.geometryGroups[C].vertices+A}r.geometryGroupsList=[];var J=void 0;for(J in r.geometryGroups){r.geometryGroups[J].id=Ia++;r.geometryGroupsList.push(r.geometryGroups[J])}}for(l in m.geometryGroups){n=m.geometryGroups[l];if(!n.__webglVertexBuffer){var G=n;G.__webglVertexBuffer=k.createBuffer();G.__webglNormalBuffer=k.createBuffer();G.__webglTangentBuffer=k.createBuffer();G.__webglColorBuffer=k.createBuffer();G.__webglUVBuffer=k.createBuffer();
|
|
|
+a.__objectsAdded[0],j=a,l=void 0,m=void 0,n=void 0;if(!i.__webglInit){i.__webglInit=true;i._modelViewMatrix=new THREE.Matrix4;i._normalMatrix=new THREE.Matrix3;if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.Geometry){if(m.geometryGroups===void 0){var s=m,u=void 0,v=void 0,x=void 0,z=void 0,A=void 0,B=void 0,C=void 0,E={},H=s.morphTargets.length,I=s.morphNormals.length;s.geometryGroups={};u=0;for(v=s.faces.length;u<v;u++){x=s.faces[u];z=x.materialIndex;B=z!==void 0?z:-1;E[B]===void 0&&
|
|
|
+(E[B]={hash:B,counter:0});C=E[B].hash+"_"+E[B].counter;s.geometryGroups[C]===void 0&&(s.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:I});A=x instanceof THREE.Face3?3:4;if(s.geometryGroups[C].vertices+A>65535){E[B].counter=E[B].counter+1;C=E[B].hash+"_"+E[B].counter;s.geometryGroups[C]===void 0&&(s.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:I})}x instanceof THREE.Face3?s.geometryGroups[C].faces3.push(u):
|
|
|
+s.geometryGroups[C].faces4.push(u);s.geometryGroups[C].vertices=s.geometryGroups[C].vertices+A}s.geometryGroupsList=[];var J=void 0;for(J in s.geometryGroups){s.geometryGroups[J].id=Ia++;s.geometryGroupsList.push(s.geometryGroups[J])}}for(l in m.geometryGroups){n=m.geometryGroups[l];if(!n.__webglVertexBuffer){var G=n;G.__webglVertexBuffer=k.createBuffer();G.__webglNormalBuffer=k.createBuffer();G.__webglTangentBuffer=k.createBuffer();G.__webglColorBuffer=k.createBuffer();G.__webglUVBuffer=k.createBuffer();
|
|
|
G.__webglUV2Buffer=k.createBuffer();G.__webglSkinIndicesBuffer=k.createBuffer();G.__webglSkinWeightsBuffer=k.createBuffer();G.__webglFaceBuffer=k.createBuffer();G.__webglLineBuffer=k.createBuffer();var S=void 0,M=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];S=0;for(M=G.numMorphTargets;S<M;S++)G.__webglMorphTargetsBuffers.push(k.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];S=0;for(M=G.numMorphNormals;S<M;S++)G.__webglMorphNormalsBuffers.push(k.createBuffer())}Q.info.memory.geometries++;
|
|
|
var F=n,L=i,K=L.geometry,fa=F.faces3,X=F.faces4,N=fa.length*3+X.length*4,P=fa.length*1+X.length*2,R=fa.length*3+X.length*4,$=c(L,F),ca=f($),ea=d($),ia=$.vertexColors?$.vertexColors:false;F.__vertexArray=new Float32Array(N*3);if(ea)F.__normalArray=new Float32Array(N*3);if(K.hasTangents)F.__tangentArray=new Float32Array(N*4);if(ia)F.__colorArray=new Float32Array(N*3);if(ca){if(K.faceUvs.length>0||K.faceVertexUvs.length>0)F.__uvArray=new Float32Array(N*2);if(K.faceUvs.length>1||K.faceVertexUvs.length>
|
|
|
1)F.__uv2Array=new Float32Array(N*2)}if(L.geometry.skinWeights.length&&L.geometry.skinIndices.length){F.__skinIndexArray=new Float32Array(N*4);F.__skinWeightArray=new Float32Array(N*4)}F.__faceArray=new Uint16Array(P*3);F.__lineArray=new Uint16Array(R*2);var ba=void 0,pa=void 0;if(F.numMorphTargets){F.__morphTargetsArrays=[];ba=0;for(pa=F.numMorphTargets;ba<pa;ba++)F.__morphTargetsArrays.push(new Float32Array(N*3))}if(F.numMorphNormals){F.__morphNormalsArrays=[];ba=0;for(pa=F.numMorphNormals;ba<pa;ba++)F.__morphNormalsArrays.push(new Float32Array(N*
|
|
@@ -416,7 +416,7 @@ ua;Ca.needsUpdate=true;ja.__original=Ca}F.__webglCustomAttributesList.push(ja)}}
|
|
|
var xa=m,Ga=xa.vertices.length;xa.__vertexArray=new Float32Array(Ga*3);xa.__colorArray=new Float32Array(Ga*3);xa.__webglVertexCount=Ga;m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}}else if(i instanceof THREE.Line){m=i.geometry;if(!m.__webglVertexBuffer){var Oa=m;Oa.__webglVertexBuffer=k.createBuffer();Oa.__webglColorBuffer=k.createBuffer();Q.info.memory.geometries++;var Fa=m,Pa=i,Qa=Fa.vertices.length;Fa.__vertexArray=new Float32Array(Qa*3);Fa.__colorArray=new Float32Array(Qa*3);Fa.__webglLineCount=
|
|
|
Qa;b(Fa,Pa);m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}}else if(i instanceof THREE.ParticleSystem){m=i.geometry;if(!m.__webglVertexBuffer)if(m instanceof THREE.Geometry){var Xa=m;Xa.__webglVertexBuffer=k.createBuffer();Xa.__webglColorBuffer=k.createBuffer();Q.info.geometries++;var Ya=m,pb=i,fb=Ya.vertices.length;Ya.__vertexArray=new Float32Array(fb*3);Ya.__colorArray=new Float32Array(fb*3);Ya.__sortArray=[];Ya.__webglParticleCount=fb;b(Ya,pb);m.verticesNeedUpdate=true;m.colorsNeedUpdate=true}else m instanceof
|
|
|
THREE.BufferGeometry&&e(m)}}if(!i.__webglActive){if(i instanceof THREE.Mesh){m=i.geometry;if(m instanceof THREE.BufferGeometry)p(j.__webglObjects,m,i);else for(l in m.geometryGroups){n=m.geometryGroups[l];p(j.__webglObjects,n,i)}}else if(i instanceof THREE.Ribbon||i instanceof THREE.Line||i instanceof THREE.ParticleSystem){m=i.geometry;p(j.__webglObjects,m,i)}else i instanceof THREE.ImmediateRenderObject||i.immediateRenderCallback?j.__webglObjectsImmediate.push({object:i,opaque:null,transparent:null}):
|
|
|
-i instanceof THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var lb=a.__objectsRemoved[0],$a=a;lb instanceof THREE.Mesh||lb instanceof THREE.ParticleSystem||lb instanceof THREE.Ribbon||lb instanceof THREE.Line?t($a.__webglObjects,lb):lb instanceof THREE.Sprite?s($a.__webglSprites,lb):lb instanceof THREE.LensFlare?s($a.__webglFlares,lb):(lb instanceof THREE.ImmediateRenderObject||
|
|
|
+i instanceof THREE.Sprite?j.__webglSprites.push(i):i instanceof THREE.LensFlare&&j.__webglFlares.push(i);i.__webglActive=true}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var lb=a.__objectsRemoved[0],$a=a;lb instanceof THREE.Mesh||lb instanceof THREE.ParticleSystem||lb instanceof THREE.Ribbon||lb instanceof THREE.Line?t($a.__webglObjects,lb):lb instanceof THREE.Sprite?r($a.__webglSprites,lb):lb instanceof THREE.LensFlare?r($a.__webglFlares,lb):(lb instanceof THREE.ImmediateRenderObject||
|
|
|
lb.immediateRenderCallback)&&t($a.__webglObjectsImmediate,lb);lb.__webglActive=false;a.__objectsRemoved.splice(0,1)}for(var hb=0,rb=a.__webglObjects.length;hb<rb;hb++){var ub=a.__webglObjects[hb].object,ga=ub.geometry,bb=void 0,ab=void 0,cb=void 0;if(ub instanceof THREE.Mesh)if(ga instanceof THREE.BufferGeometry){(ga.verticesNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangentsNeedUpdate)&&h(ga,k.DYNAMIC_DRAW,!ga.dynamic);ga.verticesNeedUpdate=
|
|
|
false;ga.elementsNeedUpdate=false;ga.uvsNeedUpdate=false;ga.normalsNeedUpdate=false;ga.colorsNeedUpdate=false;ga.tangentsNeedUpdate=false}else{for(var qb=0,wb=ga.geometryGroupsList.length;qb<wb;qb++){bb=ga.geometryGroupsList[qb];cb=c(ub,bb);ab=cb.attributes&&q(cb);if(ga.verticesNeedUpdate||ga.morphTargetsNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangentsNeedUpdate||ab){var la=bb,xb=ub,mb=k.DYNAMIC_DRAW,yb=!ga.dynamic,gb=cb;if(la.__inittedArrays){var Pb=
|
|
|
d(gb),ec=gb.vertexColors?gb.vertexColors:false,ic=f(gb),Fc=Pb===THREE.SmoothShading,D=void 0,W=void 0,Xb=void 0,O=void 0,kc=void 0,Yb=void 0,vb=void 0,Gc=void 0,Qb=void 0,lc=void 0,mc=void 0,T=void 0,U=void 0,V=void 0,ka=void 0,zb=void 0,Ab=void 0,Bb=void 0,sc=void 0,Cb=void 0,Db=void 0,Eb=void 0,tc=void 0,Fb=void 0,Gb=void 0,Hb=void 0,uc=void 0,Ib=void 0,Jb=void 0,Kb=void 0,vc=void 0,Lb=void 0,Mb=void 0,Nb=void 0,wc=void 0,qa=void 0,qc=void 0,Zb=void 0,nc=void 0,oc=void 0,Ra=void 0,rc=void 0,Ma=
|
|
@@ -454,19 +454,19 @@ wa.value[Ua];else if(wa.size===2)for(Ua=0;Ua<pc;Ua++){eb=wa.value[Ua];wa.array[B
|
|
|
Ba+4}k.bindBuffer(k.ARRAY_BUFFER,wa.buffer);k.bufferData(k.ARRAY_BUFFER,wa.array,Zc)}}}}ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false;cb.attributes&&o(cb)}else if(ub instanceof THREE.ParticleSystem)if(ga instanceof THREE.BufferGeometry){(ga.verticesNeedUpdate||ga.colorsNeedUpdate)&&h(ga,k.DYNAMIC_DRAW,!ga.dynamic);ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false}else{cb=c(ub,bb);ab=cb.attributes&&q(cb);(ga.verticesNeedUpdate||ga.colorsNeedUpdate||ub.sortParticles||ab)&&g(ga,k.DYNAMIC_DRAW,
|
|
|
ub);ga.verticesNeedUpdate=false;ga.colorsNeedUpdate=false;cb.attributes&&o(cb)}}};this.initMaterial=function(a,b,c,d){var f,e,g,h,i,j,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var o=
|
|
|
THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var q,p;q=h=e=f=o=0;for(g=b.length;q<g;q++){p=b[q];if(!p.onlyShadow){p instanceof THREE.DirectionalLight&&h++;p instanceof THREE.PointLight&&e++;p instanceof THREE.SpotLight&&f++;p instanceof THREE.HemisphereLight&&o++}}if(e+f+h+o<=ea){q=h;g=f}else{q=Math.ceil(ea*h/(e+h));g=e=ea-q;o=q}f=q;h=o;o=m=0;for(q=b.length;o<q;o++){p=b[o];if(p.castShadow){p instanceof THREE.SpotLight&&
|
|
|
-m++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&m++}}if(ec&&d&&d.useVertexTexture)l=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}l=b}var r;a:{p=a.fragmentShader;q=a.vertexShader;var o=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,
|
|
|
+m++;p instanceof THREE.DirectionalLight&&!p.shadowCascade&&m++}}if(ec&&d&&d.useVertexTexture)l=1024;else{b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS);b=Math.floor((b-20)/4);if(d!==void 0&&d instanceof THREE.SkinnedMesh){b=Math.min(d.bones.length,b);b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")}l=b}var s;a:{p=a.fragmentShader;q=a.vertexShader;var o=a.uniforms,b=a.attributes,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,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:ec&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f,maxPointLights:e,maxSpotLights:g,
|
|
|
-maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,d=[];if(n)d.push(n);else{d.push(p);d.push(q)}for(t in c){d.push(t);d.push(c[t])}n=d.join();t=0;for(d=ba.length;t<d;t++){f=ba[t];if(f.code===n){f.usedTimes++;
|
|
|
-r=f.program;break a}}t=k.createProgram();d=["precision "+J+" float;",ic?"#define VERTEX_TEXTURES":"",Q.gammaInput?"#define GAMMA_INPUT":"",Q.gammaOutput?"#define GAMMA_OUTPUT":"",Q.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
|
|
|
+maxHemiLights:h,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},r,d=[];if(n)d.push(n);else{d.push(p);d.push(q)}for(r in c){d.push(r);d.push(c[r])}n=d.join();r=0;for(d=ba.length;r<d;r++){f=ba[r];if(f.code===n){f.usedTimes++;
|
|
|
+s=f.program;break a}}r=k.createProgram();d=["precision "+J+" float;",ic?"#define VERTEX_TEXTURES":"",Q.gammaInput?"#define GAMMA_INPUT":"",Q.gammaOutput?"#define GAMMA_OUTPUT":"",Q.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":
|
|
|
"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",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");
|
|
|
f=["precision "+J+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"","#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:"",Q.gammaInput?"#define GAMMA_INPUT":"",Q.gammaOutput?"#define GAMMA_OUTPUT":"",Q.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?
|
|
|
-"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f=z("fragment",f+p);d=z("vertex",d+q);k.attachShader(t,d);k.attachShader(t,f);k.linkProgram(t);k.getProgramParameter(t,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(t,
|
|
|
-k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(f);k.deleteShader(d);t.uniforms={};t.attributes={};var s,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):d.push("boneGlobalMatrices");for(s in o)d.push(s);s=d;d=0;for(o=s.length;d<o;d++){f=s[d];t.uniforms[f]=k.getUniformLocation(t,f)}d=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight"];for(s=
|
|
|
-0;s<c.maxMorphTargets;s++)d.push("morphTarget"+s);for(s=0;s<c.maxMorphNormals;s++)d.push("morphNormal"+s);for(r in b)d.push(r);r=d;s=0;for(c=r.length;s<c;s++){d=r[s];t.attributes[d]=k.getAttribLocation(t,d)}t.id=ta++;ba.push({program:t,code:n,usedTimes:1});Q.info.memory.programs=ba.length;r=t}a.program=r;r=a.program.attributes;r.position>=0&&k.enableVertexAttribArray(r.position);r.color>=0&&k.enableVertexAttribArray(r.color);r.normal>=0&&k.enableVertexAttribArray(r.normal);r.tangent>=0&&k.enableVertexAttribArray(r.tangent);
|
|
|
-if(a.skinning&&r.skinIndex>=0&&r.skinWeight>=0){k.enableVertexAttribArray(r.skinIndex);k.enableVertexAttribArray(r.skinWeight)}if(a.attributes)for(j in a.attributes)r[j]!==void 0&&r[j]>=0&&k.enableVertexAttribArray(r[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;t="morphTarget";for(j=0;j<this.maxMorphTargets;j++){s=t+j;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;t="morphNormal";for(j=0;j<this.maxMorphNormals;j++){s=
|
|
|
-t+j;if(r[s]>=0){k.enableVertexAttribArray(r[s]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ua!==b){b?k.disable(k.CULL_FACE):
|
|
|
+"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f=z("fragment",f+p);d=z("vertex",d+q);k.attachShader(r,d);k.attachShader(r,f);k.linkProgram(r);k.getProgramParameter(r,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(r,
|
|
|
+k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(f);k.deleteShader(d);r.uniforms={};r.attributes={};var t,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"];c.useVertexTexture?d.push("boneTexture"):d.push("boneGlobalMatrices");for(t in o)d.push(t);t=d;d=0;for(o=t.length;d<o;d++){f=t[d];r.uniforms[f]=k.getUniformLocation(r,f)}d=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight"];for(t=
|
|
|
+0;t<c.maxMorphTargets;t++)d.push("morphTarget"+t);for(t=0;t<c.maxMorphNormals;t++)d.push("morphNormal"+t);for(s in b)d.push(s);s=d;t=0;for(c=s.length;t<c;t++){d=s[t];r.attributes[d]=k.getAttribLocation(r,d)}r.id=ta++;ba.push({program:r,code:n,usedTimes:1});Q.info.memory.programs=ba.length;s=r}a.program=s;s=a.program.attributes;s.position>=0&&k.enableVertexAttribArray(s.position);s.color>=0&&k.enableVertexAttribArray(s.color);s.normal>=0&&k.enableVertexAttribArray(s.normal);s.tangent>=0&&k.enableVertexAttribArray(s.tangent);
|
|
|
+if(a.skinning&&s.skinIndex>=0&&s.skinWeight>=0){k.enableVertexAttribArray(s.skinIndex);k.enableVertexAttribArray(s.skinWeight)}if(a.attributes)for(j in a.attributes)s[j]!==void 0&&s[j]>=0&&k.enableVertexAttribArray(s[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;r="morphTarget";for(j=0;j<this.maxMorphTargets;j++){t=r+j;if(s[t]>=0){k.enableVertexAttribArray(s[t]);a.numSupportedMorphTargets++}}}if(a.morphNormals){a.numSupportedMorphNormals=0;r="morphNormal";for(j=0;j<this.maxMorphNormals;j++){t=
|
|
|
+r+j;if(s[t]>=0){k.enableVertexAttribArray(s[t]);a.numSupportedMorphNormals++}}}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){if(a){!b||b==="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW);a==="back"?k.cullFace(k.BACK):a==="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK);k.enable(k.CULL_FACE)}else k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;if(ua!==b){b?k.disable(k.CULL_FACE):
|
|
|
k.enable(k.CULL_FACE);ua=b}if(Ca!==a){a?k.frontFace(k.CW):k.frontFace(k.CCW);Ca=a}};this.setDepthTest=function(a){if(Oa!==a){a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST);Oa=a}};this.setDepthWrite=function(a){if(Ya!==a){k.depthMask(a);Ya=a}};this.setBlending=function(a,b,c,d){if(a!==Ja){if(a===THREE.NoBlending)k.disable(k.BLEND);else if(a===THREE.AdditiveBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE)}else if(a===THREE.SubtractiveBlending){k.enable(k.BLEND);
|
|
|
k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)}else if(a===THREE.MultiplyBlending){k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR)}else if(a===THREE.CustomBlending)k.enable(k.BLEND);else{k.enable(k.BLEND);k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD);k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}Ja=a}if(a===THREE.CustomBlending){if(b!==Xa){k.blendEquation(E(b));Xa=b}if(c!==ja||d!==pb){k.blendFunc(E(c),E(d));
|
|
|
ja=c;pb=d}}else pb=ja=Xa=null};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit){a.__webglInit=true;a.__webglTexture=k.createTexture();Q.info.memory.textures++}k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,f=E(a.format),e=E(a.type);F(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var e=
|
|
@@ -485,7 +485,7 @@ THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParti
|
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,e=Math.max(Math.max(c,d),f),g=Math.min(Math.min(c,d),f);if(g===e)g=c=0;else{var h=e-g,g=h/e,c=(c===e?(d-f)/h:d===e?2+(f-c)/h:4+(c-d)/h)/6;c<0&&(c=c+1);c>1&&(c=c-1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=g;b.v=e;return b}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,e=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=e.vertices,i=a.faces,l=e.faces,j=a.faceVertexUvs[0],n=e.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[a.materials[p].id]=p;if(b instanceof THREE.Mesh){b.matrixAutoUpdate&&b.updateMatrix();c=b.matrix;d=new THREE.Matrix4;d.extractRotation(c,b.scale)}for(var p=0,q=h.length;p<q;p++){var o=h[p].clone();c&&c.multiplyVector3(o);g.push(o)}p=0;for(q=l.length;p<q;p++){var g=
|
|
|
-l[p],t,s,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));t.normal.copy(g.normal);d&&d.multiplyVector3(t.normal);h=0;for(o=u.length;h<o;h++){s=u[h].clone();d&&d.multiplyVector3(s);t.vertexNormals.push(s)}t.color.copy(g.color);h=0;for(o=v.length;h<o;h++){s=v[h];t.vertexColors.push(s.clone())}if(g.materialIndex!==void 0){h=e.materials[g.materialIndex];o=h.id;v=m[o];if(v===void 0){v=
|
|
|
+l[p],t,r,u=g.vertexNormals,v=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));t.normal.copy(g.normal);d&&d.multiplyVector3(t.normal);h=0;for(o=u.length;h<o;h++){r=u[h].clone();d&&d.multiplyVector3(r);t.vertexNormals.push(r)}t.color.copy(g.color);h=0;for(o=v.length;h<o;h++){r=v[h];t.vertexColors.push(r.clone())}if(g.materialIndex!==void 0){h=e.materials[g.materialIndex];o=h.id;v=m[o];if(v===void 0){v=
|
|
|
a.materials.length;m[o]=v;a.materials.push(h)}t.materialIndex=v}t.centroid.copy(g.centroid);c&&c.multiplyVector3(t.centroid);i.push(t)}p=0;for(q=n.length;p<q;p++){c=n[p];d=[];h=0;for(o=c.length;h<o;h++)d.push(new THREE.UV(c[h].u,c[h].v));j.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=d.length;a<c;a++)b.vertices.push(d[a].clone());a=0;for(c=f.length;a<c;a++)b.faces.push(f[a].clone());a=0;
|
|
|
for(c=e.length;a<c;a++){for(var d=e[a],f=[],g=0,h=d.length;g<h;g++)f.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,e,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();if(d+f>1){d=1-d;f=1-f}e=1-d-f;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);g.addSelf(h);h.copy(c);h.multiplyScalar(e);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,f,e;if(a instanceof
|
|
|
THREE.Face3){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];return THREE.GeometryUtils.randomPointInTriangle(d,f,e)}if(a instanceof THREE.Face4){d=b.vertices[a.a];f=b.vertices[a.b];e=b.vertices[a.c];var b=b.vertices[a.d],g;if(c)if(a._area1&&a._area2){c=a._area1;g=a._area2}else{c=THREE.GeometryUtils.triangleArea(d,f,b);g=THREE.GeometryUtils.triangleArea(f,e,b);a._area1=c;a._area2=g}else{c=THREE.GeometryUtils.triangleArea(d,f,b);g=THREE.GeometryUtils.triangleArea(f,e,b)}return THREE.GeometryUtils.random()*
|
|
@@ -495,23 +495,23 @@ var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5
|
|
|
c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++){d=a.faces[b];if(d instanceof THREE.Face4){f=d.a;var i=d.b,l=d.c,j=d.d,n=new THREE.Face3,m=new THREE.Face3;n.color.copy(d.color);m.color.copy(d.color);n.materialIndex=d.materialIndex;m.materialIndex=d.materialIndex;n.a=f;n.b=i;n.c=j;m.a=i;m.b=l;m.c=j;if(d.vertexColors.length===4){n.vertexColors[0]=d.vertexColors[0].clone();n.vertexColors[1]=d.vertexColors[1].clone();n.vertexColors[2]=d.vertexColors[3].clone();m.vertexColors[0]=d.vertexColors[1].clone();
|
|
|
m.vertexColors[1]=d.vertexColors[2].clone();m.vertexColors[2]=d.vertexColors[3].clone()}e.push(n,m);d=0;for(f=a.faceVertexUvs.length;d<f;d++)if(a.faceVertexUvs[d].length){n=a.faceVertexUvs[d][b];i=n[1];l=n[2];j=n[3];n=[n[0].clone(),i.clone(),j.clone()];i=[i.clone(),l.clone(),j.clone()];h[d].push(n,i)}d=0;for(f=a.faceUvs.length;d<f;d++)if(a.faceUvs[d].length){i=a.faceUvs[d][b];g[d].push(i,i)}}else{e.push(d);d=0;for(f=a.faceUvs.length;d<f;d++)g[d].push(a.faceUvs[d][b]);d=0;for(f=a.faceVertexUvs.length;d<
|
|
|
f;d++)h[d].push(a.faceVertexUvs[d][b])}}a.faces=e;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,e=a.faces[c];if(e instanceof THREE.Face4){var g=e.a,h=e.b,i=e.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],l=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(l.clone());e.a=f;e.b=f+1;e.c=f+2;e.d=f+3}else{g=
|
|
|
-e.a;h=e.b;i=e.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());e.a=f;e.b=f+1;e.c=f+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,l,j,n,m,p,q,o,t,s,u,v,r,A=[],x=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)x[c]=[];c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){e=f.a;g=f.b;h=f.c;l=a.vertices[e];j=a.vertices[g];n=a.vertices[h];p=l.distanceTo(j);q=j.distanceTo(n);m=l.distanceTo(n);if(p>
|
|
|
-b||q>b||m>b){i=a.vertices.length;v=f.clone();r=f.clone();if(p>=q&&p>=m){l=l.clone();l.lerpSelf(j,0.5);v.a=e;v.b=i;v.c=h;r.a=i;r.b=g;r.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);v.vertexNormals[1].copy(e);r.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);v.vertexColors[1].copy(e);r.vertexColors[0].copy(e)}f=0}else if(q>=p&&q>=m){l=j.clone();l.lerpSelf(n,0.5);v.a=e;v.b=g;v.c=
|
|
|
-i;r.a=i;r.b=h;r.c=e;if(f.vertexNormals.length===3){e=f.vertexNormals[1].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);r.vertexNormals[0].copy(e);r.vertexNormals[1].copy(f.vertexNormals[2]);r.vertexNormals[2].copy(f.vertexNormals[0])}if(f.vertexColors.length===3){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);r.vertexColors[0].copy(e);r.vertexColors[1].copy(f.vertexColors[2]);r.vertexColors[2].copy(f.vertexColors[0])}f=1}else{l=l.clone();
|
|
|
-l.lerpSelf(n,0.5);v.a=e;v.b=g;v.c=i;r.a=i;r.b=g;r.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);r.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);r.vertexColors[0].copy(e)}f=2}A.push(v,r);a.vertices.push(l);e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];r=l[0];h=l[1];v=l[2];if(f===
|
|
|
-0){j=r.clone();j.lerpSelf(h,0.5);l=[r.clone(),j.clone(),v.clone()];h=[j.clone(),h.clone(),v.clone()]}else if(f===1){j=h.clone();j.lerpSelf(v,0.5);l=[r.clone(),h.clone(),j.clone()];h=[j.clone(),v.clone(),r.clone()]}else{j=r.clone();j.lerpSelf(v,0.5);l=[r.clone(),h.clone(),j.clone()];h=[j.clone(),h.clone(),v.clone()]}x[e].push(l,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)x[e].push(a.faceVertexUvs[e][c])}}else{e=f.a;g=f.b;h=f.c;i=f.d;l=a.vertices[e];j=a.vertices[g];n=a.vertices[h];m=
|
|
|
-a.vertices[i];p=l.distanceTo(j);q=j.distanceTo(n);o=n.distanceTo(m);t=l.distanceTo(m);if(p>b||q>b||o>b||t>b){s=a.vertices.length;u=a.vertices.length+1;v=f.clone();r=f.clone();if(p>=q&&p>=o&&p>=t||o>=q&&o>=p&&o>=t){p=l.clone();p.lerpSelf(j,0.5);j=n.clone();j.lerpSelf(m,0.5);v.a=e;v.b=s;v.c=u;v.d=i;r.a=s;r.b=g;r.c=h;r.d=u;if(f.vertexNormals.length===4){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);g=f.vertexNormals[2].clone();g.lerpSelf(f.vertexNormals[3],0.5);v.vertexNormals[1].copy(e);
|
|
|
-v.vertexNormals[2].copy(g);r.vertexNormals[0].copy(e);r.vertexNormals[3].copy(g)}if(f.vertexColors.length===4){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);g=f.vertexColors[2].clone();g.lerpSelf(f.vertexColors[3],0.5);v.vertexColors[1].copy(e);v.vertexColors[2].copy(g);r.vertexColors[0].copy(e);r.vertexColors[3].copy(g)}f=0}else{p=j.clone();p.lerpSelf(n,0.5);j=m.clone();j.lerpSelf(l,0.5);v.a=e;v.b=g;v.c=s;v.d=u;r.a=u;r.b=s;r.c=h;r.d=i;if(f.vertexNormals.length===4){e=f.vertexNormals[1].clone();
|
|
|
-e.lerpSelf(f.vertexNormals[2],0.5);g=f.vertexNormals[3].clone();g.lerpSelf(f.vertexNormals[0],0.5);v.vertexNormals[2].copy(e);v.vertexNormals[3].copy(g);r.vertexNormals[0].copy(g);r.vertexNormals[1].copy(e)}if(f.vertexColors.length===4){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);g=f.vertexColors[3].clone();g.lerpSelf(f.vertexColors[0],0.5);v.vertexColors[2].copy(e);v.vertexColors[3].copy(g);r.vertexColors[0].copy(g);r.vertexColors[1].copy(e)}f=1}A.push(v,r);a.vertices.push(p,j);
|
|
|
-e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];r=l[0];h=l[1];v=l[2];l=l[3];if(f===0){j=r.clone();j.lerpSelf(h,0.5);n=v.clone();n.lerpSelf(l,0.5);r=[r.clone(),j.clone(),n.clone(),l.clone()];h=[j.clone(),h.clone(),v.clone(),n.clone()]}else{j=h.clone();j.lerpSelf(v,0.5);n=l.clone();n.lerpSelf(r,0.5);r=[r.clone(),h.clone(),j.clone(),n.clone()];h=[n.clone(),j.clone(),v.clone(),l.clone()]}x[e].push(r,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)x[e].push(a.faceVertexUvs[e][c])}}}a.faces=
|
|
|
+e.a;h=e.b;i=e.c;g=a.vertices[g];h=a.vertices[h];i=a.vertices[i];b.push(g.clone());b.push(h.clone());b.push(i.clone());e.a=f;e.b=f+1;e.c=f+2}}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,f,e,g,h,i,l,j,n,m,p,q,o,t,r,u,v,s,A=[],x=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)x[c]=[];c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){e=f.a;g=f.b;h=f.c;l=a.vertices[e];j=a.vertices[g];n=a.vertices[h];p=l.distanceTo(j);q=j.distanceTo(n);m=l.distanceTo(n);if(p>
|
|
|
+b||q>b||m>b){i=a.vertices.length;v=f.clone();s=f.clone();if(p>=q&&p>=m){l=l.clone();l.lerpSelf(j,0.5);v.a=e;v.b=i;v.c=h;s.a=i;s.b=g;s.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);v.vertexNormals[1].copy(e);s.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);v.vertexColors[1].copy(e);s.vertexColors[0].copy(e)}f=0}else if(q>=p&&q>=m){l=j.clone();l.lerpSelf(n,0.5);v.a=e;v.b=g;v.c=
|
|
|
+i;s.a=i;s.b=h;s.c=e;if(f.vertexNormals.length===3){e=f.vertexNormals[1].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);s.vertexNormals[0].copy(e);s.vertexNormals[1].copy(f.vertexNormals[2]);s.vertexNormals[2].copy(f.vertexNormals[0])}if(f.vertexColors.length===3){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);s.vertexColors[0].copy(e);s.vertexColors[1].copy(f.vertexColors[2]);s.vertexColors[2].copy(f.vertexColors[0])}f=1}else{l=l.clone();
|
|
|
+l.lerpSelf(n,0.5);v.a=e;v.b=g;v.c=i;s.a=i;s.b=g;s.c=h;if(f.vertexNormals.length===3){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[2],0.5);v.vertexNormals[2].copy(e);s.vertexNormals[0].copy(e)}if(f.vertexColors.length===3){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[2],0.5);v.vertexColors[2].copy(e);s.vertexColors[0].copy(e)}f=2}A.push(v,s);a.vertices.push(l);e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];s=l[0];h=l[1];v=l[2];if(f===
|
|
|
+0){j=s.clone();j.lerpSelf(h,0.5);l=[s.clone(),j.clone(),v.clone()];h=[j.clone(),h.clone(),v.clone()]}else if(f===1){j=h.clone();j.lerpSelf(v,0.5);l=[s.clone(),h.clone(),j.clone()];h=[j.clone(),v.clone(),s.clone()]}else{j=s.clone();j.lerpSelf(v,0.5);l=[s.clone(),h.clone(),j.clone()];h=[j.clone(),h.clone(),v.clone()]}x[e].push(l,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)x[e].push(a.faceVertexUvs[e][c])}}else{e=f.a;g=f.b;h=f.c;i=f.d;l=a.vertices[e];j=a.vertices[g];n=a.vertices[h];m=
|
|
|
+a.vertices[i];p=l.distanceTo(j);q=j.distanceTo(n);o=n.distanceTo(m);t=l.distanceTo(m);if(p>b||q>b||o>b||t>b){r=a.vertices.length;u=a.vertices.length+1;v=f.clone();s=f.clone();if(p>=q&&p>=o&&p>=t||o>=q&&o>=p&&o>=t){p=l.clone();p.lerpSelf(j,0.5);j=n.clone();j.lerpSelf(m,0.5);v.a=e;v.b=r;v.c=u;v.d=i;s.a=r;s.b=g;s.c=h;s.d=u;if(f.vertexNormals.length===4){e=f.vertexNormals[0].clone();e.lerpSelf(f.vertexNormals[1],0.5);g=f.vertexNormals[2].clone();g.lerpSelf(f.vertexNormals[3],0.5);v.vertexNormals[1].copy(e);
|
|
|
+v.vertexNormals[2].copy(g);s.vertexNormals[0].copy(e);s.vertexNormals[3].copy(g)}if(f.vertexColors.length===4){e=f.vertexColors[0].clone();e.lerpSelf(f.vertexColors[1],0.5);g=f.vertexColors[2].clone();g.lerpSelf(f.vertexColors[3],0.5);v.vertexColors[1].copy(e);v.vertexColors[2].copy(g);s.vertexColors[0].copy(e);s.vertexColors[3].copy(g)}f=0}else{p=j.clone();p.lerpSelf(n,0.5);j=m.clone();j.lerpSelf(l,0.5);v.a=e;v.b=g;v.c=r;v.d=u;s.a=u;s.b=r;s.c=h;s.d=i;if(f.vertexNormals.length===4){e=f.vertexNormals[1].clone();
|
|
|
+e.lerpSelf(f.vertexNormals[2],0.5);g=f.vertexNormals[3].clone();g.lerpSelf(f.vertexNormals[0],0.5);v.vertexNormals[2].copy(e);v.vertexNormals[3].copy(g);s.vertexNormals[0].copy(g);s.vertexNormals[1].copy(e)}if(f.vertexColors.length===4){e=f.vertexColors[1].clone();e.lerpSelf(f.vertexColors[2],0.5);g=f.vertexColors[3].clone();g.lerpSelf(f.vertexColors[0],0.5);v.vertexColors[2].copy(e);v.vertexColors[3].copy(g);s.vertexColors[0].copy(g);s.vertexColors[1].copy(e)}f=1}A.push(v,s);a.vertices.push(p,j);
|
|
|
+e=0;for(g=a.faceVertexUvs.length;e<g;e++)if(a.faceVertexUvs[e].length){l=a.faceVertexUvs[e][c];s=l[0];h=l[1];v=l[2];l=l[3];if(f===0){j=s.clone();j.lerpSelf(h,0.5);n=v.clone();n.lerpSelf(l,0.5);s=[s.clone(),j.clone(),n.clone(),l.clone()];h=[j.clone(),h.clone(),v.clone(),n.clone()]}else{j=h.clone();j.lerpSelf(v,0.5);n=l.clone();n.lerpSelf(s,0.5);s=[s.clone(),h.clone(),j.clone(),n.clone()];h=[n.clone(),j.clone(),v.clone(),l.clone()]}x[e].push(s,h)}}else{A.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)x[e].push(a.faceVertexUvs[e][c])}}}a.faces=
|
|
|
A;a.faceVertexUvs=x}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var f=new Image,e=new THREE.Texture(f,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){e.image=a.content;e.needsUpdate=true;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,f);return e},loadTextureCube:function(a,b,c){var d,f=[],e=new THREE.Texture(f,b);e.flipY=false;b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount=
|
|
|
f.loadCount+1;if(f.loadCount===6){e.needsUpdate=true;c&&c()}};f[b].crossOrigin=this.crossOrigin;f[b].src=a[b]}return e},loadCompressedTexture:function(a,b,c,d){var f=new THREE.CompressedTexture;f.mapping=b;var e=new XMLHttpRequest;e.onload=function(){var a=THREE.ImageUtils.parseDDS(e.response,true);f.format=a.format;f.mipmaps=a.mipmaps;f.image.width=a.width;f.image.height=a.height;f.generateMipmaps=false;f.needsUpdate=true;c&&c(f)};e.onerror=d;e.open("GET",a,true);e.responseType="arraybuffer";e.send(null);
|
|
|
return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},f=c("DXT1"),e=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(h[0]!==542327876){console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header");return d}if(!h[20]&4){console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code");return d}var i=h[21];switch(i){case f:f=
|
|
|
8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case e:f=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:f=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255));return d}d.mipmapCount=1;if(h[2]&131072&&b!==false)d.mipmapCount=Math.max(1,h[7]);d.width=h[4];d.height=h[3];h=h[1]+4;e=d.width;g=d.height;for(i=0;i<d.mipmapCount;i++){var l=Math.max(4,e)/4*Math.max(4,g)/4*f,j={data:new Uint8Array(a,
|
|
|
h,l),width:e,height:g};d.mipmaps.push(j);h=h+l;e=e*0.5;g=g*0.5}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,f=a.height,e=document.createElement("canvas");e.width=d;e.height=f;var g=e.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,f).data,i=g.createImageData(d,f),l=i.data,j=0;j<d;j++)for(var n=0;n<f;n++){var m=n-1<0?0:n-1,p=n+1>f-1?f-1:n+1,q=j-1<0?0:j-1,o=j+1>d-1?d-1:j+1,t=[],
|
|
|
-s=[0,0,h[(n*d+j)*4]/255*b];t.push([-1,0,h[(n*d+q)*4]/255*b]);t.push([-1,-1,h[(m*d+q)*4]/255*b]);t.push([0,-1,h[(m*d+j)*4]/255*b]);t.push([1,-1,h[(m*d+o)*4]/255*b]);t.push([1,0,h[(n*d+o)*4]/255*b]);t.push([1,1,h[(p*d+o)*4]/255*b]);t.push([0,1,h[(p*d+j)*4]/255*b]);t.push([-1,1,h[(p*d+q)*4]/255*b]);m=[];q=t.length;for(p=0;p<q;p++){var o=t[p],u=t[(p+1)%q],o=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];m.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}t=[0,0,
|
|
|
-0];for(p=0;p<m.length;p++){t[0]=t[0]+m[p][0];t[1]=t[1]+m[p][1];t[2]=t[2]+m[p][2]}t[0]=t[0]/m.length;t[1]=t[1]/m.length;t[2]=t[2]/m.length;s=(n*d+j)*4;l[s]=(t[0]+1)/2*255|0;l[s+1]=(t[1]+1)/2*255|0;l[s+2]=t[2]*255|0;l[s+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){f[h*3]=e;f[h*3+1]=g;f[h*3+2]=c}a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=true;
|
|
|
+r=[0,0,h[(n*d+j)*4]/255*b];t.push([-1,0,h[(n*d+q)*4]/255*b]);t.push([-1,-1,h[(m*d+q)*4]/255*b]);t.push([0,-1,h[(m*d+j)*4]/255*b]);t.push([1,-1,h[(m*d+o)*4]/255*b]);t.push([1,0,h[(n*d+o)*4]/255*b]);t.push([1,1,h[(p*d+o)*4]/255*b]);t.push([0,1,h[(p*d+j)*4]/255*b]);t.push([-1,1,h[(p*d+q)*4]/255*b]);m=[];q=t.length;for(p=0;p<q;p++){var o=t[p],u=t[(p+1)%q],o=[o[0]-r[0],o[1]-r[1],o[2]-r[2]],u=[u[0]-r[0],u[1]-r[1],u[2]-r[2]];m.push(c([o[1]*u[2]-o[2]*u[1],o[2]*u[0]-o[0]*u[2],o[0]*u[1]-o[1]*u[0]]))}t=[0,0,
|
|
|
+0];for(p=0;p<m.length;p++){t[0]=t[0]+m[p][0];t[1]=t[1]+m[p][1];t[2]=t[2]+m[p][2]}t[0]=t[0]/m.length;t[1]=t[1]/m.length;t[2]=t[2]/m.length;r=(n*d+j)*4;l[r]=(t[0]+1)/2*255|0;l[r+1]=(t[1]+1)/2*255|0;l[r+2]=t[2]*255|0;l[r+3]=255}g.putImageData(i,0,0);return e},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),e=Math.floor(c.r*255),g=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++){f[h*3]=e;f[h*3+1]=g;f[h*3+2]=c}a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=true;
|
|
|
return a}};
|
|
|
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++){c=a.children[d];b(c);THREE.SceneUtils.traverseHierarchy(c,b)}},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var e=new THREE.Mesh(a,b[c]);f.add(e)}return f},cloneObject:function(a){var b;if(a instanceof THREE.MorphAnimMesh){b=new THREE.MorphAnimMesh(a.geometry,a.material);
|
|
|
b.duration=a.duration;b.mirroredLoop=a.mirroredLoop;b.time=a.time;b.lastKeyframe=a.lastKeyframe;b.currentKeyframe=a.currentKeyframe;b.direction=a.direction;b.directionBackwards=a.directionBackwards}else if(a instanceof THREE.SkinnedMesh)b=new THREE.SkinnedMesh(a.geometry,a.material);else if(a instanceof THREE.Mesh)b=new THREE.Mesh(a.geometry,a.material);else if(a instanceof THREE.Line)b=new THREE.Line(a.geometry,a.material,a.type);else if(a instanceof THREE.Ribbon)b=new THREE.Ribbon(a.geometry,a.material);
|
|
@@ -529,11 +529,11 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
|
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalMatrix * skinnedNormal.xyz;\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalMatrix * skinnedTangent.xyz;\n#else\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\n#endif\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 mPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = mPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * mPosition;\n}\n#endif\n}"].join("\n")},
|
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}});
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
-0,f=String(a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[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,f){var e=[],g,h,i,l,j,n,m,p,q,o,t,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=b.length;for(a=0;a<l;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;j=b[a++]*c;f.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.lineTo(i,j);break;case "q":i=b[a++]*
|
|
|
-c+d;j=b[a++]*c;p=b[a++]*c+d;q=b[a++]*c;f.quadraticCurveTo(p,q,i,j);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,n,p,i);THREE.Shape.Utils.b2(u,m,q,j)}}break;case "b":i=b[a++]*c+d;j=b[a++]*c;p=b[a++]*c+d;q=b[a++]*-c;o=b[a++]*c+d;t=b[a++]*-c;f.bezierCurveTo(i,j,p,q,o,t);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,n,p,o,i);THREE.Shape.Utils.b3(u,m,q,t,j)}}}}}return{offset:s.ha*c,path:f}}}};
|
|
|
+0,f=String(a).split(""),e=f.length,g=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[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,f){var e=[],g,h,i,l,j,n,m,p,q,o,t,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));l=b.length;for(a=0;a<l;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;j=b[a++]*c;f.moveTo(i,j);break;case "l":i=b[a++]*c+d;j=b[a++]*c;f.lineTo(i,j);break;case "q":i=b[a++]*
|
|
|
+c+d;j=b[a++]*c;p=b[a++]*c+d;q=b[a++]*c;f.quadraticCurveTo(p,q,i,j);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var u=g/h;THREE.Shape.Utils.b2(u,n,p,i);THREE.Shape.Utils.b2(u,m,q,j)}}break;case "b":i=b[a++]*c+d;j=b[a++]*c;p=b[a++]*c+d;q=b[a++]*-c;o=b[a++]*c+d;t=b[a++]*-c;f.bezierCurveTo(i,j,p,q,o,t);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){u=g/h;THREE.Shape.Utils.b3(u,n,p,o,i);THREE.Shape.Utils.b3(u,m,q,t,j)}}}}}return{offset:r.ha*c,path:f}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",e=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=e;c=THREE.FontUtils.drawText(a).paths;d=[];f=0;for(e=c.length;f<e;f++)Array.prototype.push.apply(d,c[f].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=l;f<=i&&(i=0);l=i+1;f<=l&&(l=0);j=l+1;f<=j&&(j=0);var m;a:{m=a;var p=i,q=l,o=j,t=f,s=g,u=void 0,v=void 0,r=void 0,A=void 0,x=void 0,
|
|
|
-B=void 0,C=void 0,z=void 0,F=void 0,v=m[s[p]].x,r=m[s[p]].y,A=m[s[q]].x,x=m[s[q]].y,B=m[s[o]].x,C=m[s[o]].y;if(1E-10>(A-v)*(C-r)-(x-r)*(B-v))m=false;else{for(u=0;u<t;u++)if(!(u==p||u==q||u==o)){var z=m[s[u]].x,F=m[s[u]].y,H=void 0,K=void 0,E=void 0,L=void 0,J=void 0,I=void 0,R=void 0,P=void 0,G=void 0,N=void 0,ca=void 0,M=void 0,H=E=J=void 0,H=B-A,K=C-x,E=v-B,L=r-C,J=A-v,I=x-r,R=z-v,P=F-r,G=z-A,N=F-x,ca=z-B,M=F-C,H=H*N-K*G,J=J*P-I*R,E=E*M-L*ca;if(H>=0&&E>=0&&J>=0){m=false;break a}}m=true}}if(m){e.push([a[g[i]],
|
|
|
+(function(a){var b=function(a){for(var b=a.length,f=0,e=b-1,g=0;g<b;e=g++)f=f+(a[e].x*a[g].y-a[g].x*a[e].y);return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var e=[],g=[],h=[],i,l,j;if(b(a)>0)for(l=0;l<f;l++)g[l]=l;else for(l=0;l<f;l++)g[l]=f-1-l;var n=2*f;for(l=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=l;f<=i&&(i=0);l=i+1;f<=l&&(l=0);j=l+1;f<=j&&(j=0);var m;a:{m=a;var p=i,q=l,o=j,t=f,r=g,u=void 0,v=void 0,s=void 0,A=void 0,x=void 0,
|
|
|
+B=void 0,C=void 0,z=void 0,F=void 0,v=m[r[p]].x,s=m[r[p]].y,A=m[r[q]].x,x=m[r[q]].y,B=m[r[o]].x,C=m[r[o]].y;if(1E-10>(A-v)*(C-s)-(x-s)*(B-v))m=false;else{for(u=0;u<t;u++)if(!(u==p||u==q||u==o)){var z=m[r[u]].x,F=m[r[u]].y,H=void 0,K=void 0,E=void 0,L=void 0,J=void 0,I=void 0,R=void 0,P=void 0,G=void 0,N=void 0,ca=void 0,M=void 0,H=E=J=void 0,H=B-A,K=C-x,E=v-B,L=s-C,J=A-v,I=x-s,R=z-v,P=F-s,G=z-A,N=F-x,ca=z-B,M=F-C,H=H*N-K*G,J=J*P-I*R,E=E*M-L*ca;if(H>=0&&E>=0&&J>=0){m=false;break a}}m=true}}if(m){e.push([a[g[i]],
|
|
|
a[g[l]],a[g[j]]]);h.push([g[i],g[l],g[j]]);i=l;for(j=l+1;j<f;i++,j++)g[i]=g[j];f--;n=2*f}}return d?h:e};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};
|
|
|
THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};
|
|
|
THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=false;var b=[],c,d=this.getPoint(0),f,e=0;b.push(0);for(f=1;f<=a;f++){c=this.getPoint(f/a);e=e+c.distanceTo(d);b.push(e);d=c}return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
|
|
@@ -624,7 +624,7 @@ this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object
|
|
|
this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon=this.lon+this.mouseX*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*a*b;this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,
|
|
|
0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",
|
|
|
c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false);this.handleResize()};
|
|
|
-THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),t=g.length,s=0;f=t-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<t-1;f++){s=d*h.chunks[f]/h.total;b.keys[f]={time:s,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
+THREE.PathControls=function(a,b){function c(a){return(a=a*2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),t=g.length,r=0;f=t-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<t-1;f++){r=d*h.chunks[f]/h.total;b.keys[f]={time:r,pos:g[f]}}e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
|
|
|
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function e(a,b){var c,d,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++){d=c/(a.points.length*b);d=a.getPoint(d);f.vertices[c]=new THREE.Vector3(d.x,d.y,d.z)}return f}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;
|
|
|
this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=true;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;var g=Math.PI*2,h=Math.PI/180;this.viewHalfY=this.viewHalfX=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleResize=function(){if(this.domElement===
|
|
|
document){this.viewHalfX=window.innerWidth/2;this.viewHalfY=window.innerHeight/2}else{this.viewHalfX=this.domElement.offsetWidth/2;this.viewHalfY=this.domElement.offsetHeight/2}};this.update=function(a){var b;if(this.lookHorizontal)this.lon=this.lon+this.mouseX*this.lookSpeed*a;if(this.lookVertical)this.lat=this.lat-this.mouseY*this.lookSpeed*a;this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%g;this.phi=
|
|
@@ -659,28 +659,28 @@ g.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,g.setLe
|
|
|
this.domElement.addEventListener("mousemove",function(a){if(c.enabled){if(f){h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY);l=j=c.getMouseOnScreen(a.clientX,a.clientY);n=m=c.getMouseOnScreen(a.clientX,a.clientY);f=false}e!==-1&&(e===0&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?j=c.getMouseOnScreen(a.clientX,a.clientY):e===2&&!c.noPan&&(m=c.getMouseOnScreen(a.clientX,a.clientY)))}},false);this.domElement.addEventListener("mousedown",function(a){if(c.enabled){a.preventDefault();
|
|
|
a.stopPropagation();if(e===-1){e=a.button;e===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):e===1&&!c.noZoom?l=j=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(n=m=c.getMouseOnScreen(a.clientX,a.clientY))}}},false);this.domElement.addEventListener("mouseup",function(a){if(c.enabled){a.preventDefault();a.stopPropagation();e=-1}},false);window.addEventListener("keydown",function(a){if(c.enabled&&e===-1){a.keyCode===c.keys[0]&&!c.noRotate?e=0:a.keyCode===c.keys[1]&&!c.noZoom?
|
|
|
e=1:a.keyCode===c.keys[2]&&!c.noPan&&(e=2);e!==-1&&(f=true)}},false);window.addEventListener("keyup",function(){c.enabled&&e!==-1&&(e=-1)},false);this.handleResize()};
|
|
|
-THREE.OrbitControls=function(a,b){function c(){return 2*Math.PI/60/60*e.autoRotateSpeed}function d(a){a.preventDefault();if(u===s.ROTATE){i.set(a.clientX,a.clientY);l.sub(i,h);e.rotateLeft(2*Math.PI*l.x/g*e.userRotateSpeed);e.rotateUp(2*Math.PI*l.y/g*e.userRotateSpeed);h.copy(i)}else if(u===s.ZOOM){n.set(a.clientX,a.clientY);m.sub(n,j);m.y>0?e.zoomIn():e.zoomOut();j.copy(n)}}function f(){if(e.userRotate){document.removeEventListener("mousemove",d,false);document.removeEventListener("mouseup",f,false);
|
|
|
-u=s.NONE}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var e=this,g=1800,h=new THREE.Vector2,i=new THREE.Vector2,l=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,p=0,q=0,o=1,t=new THREE.Vector3,s={NONE:-1,ROTATE:0,ZOOM:1},u=s.NONE,v={type:"change"};this.rotateLeft=function(a){a===
|
|
|
+THREE.OrbitControls=function(a,b){function c(){return 2*Math.PI/60/60*e.autoRotateSpeed}function d(a){a.preventDefault();if(u===r.ROTATE){i.set(a.clientX,a.clientY);l.sub(i,h);e.rotateLeft(2*Math.PI*l.x/g*e.userRotateSpeed);e.rotateUp(2*Math.PI*l.y/g*e.userRotateSpeed);h.copy(i)}else if(u===r.ZOOM){n.set(a.clientX,a.clientY);m.sub(n,j);m.y>0?e.zoomIn():e.zoomOut();j.copy(n)}}function f(){if(e.userRotate){document.removeEventListener("mousemove",d,false);document.removeEventListener("mouseup",f,false);
|
|
|
+u=r.NONE}}THREE.EventTarget.call(this);this.object=a;this.domElement=b!==void 0?b:document;this.center=new THREE.Vector3;this.userZoom=true;this.userZoomSpeed=1;this.userRotate=true;this.userRotateSpeed=1;this.autoRotate=false;this.autoRotateSpeed=2;var e=this,g=1800,h=new THREE.Vector2,i=new THREE.Vector2,l=new THREE.Vector2,j=new THREE.Vector2,n=new THREE.Vector2,m=new THREE.Vector2,p=0,q=0,o=1,t=new THREE.Vector3,r={NONE:-1,ROTATE:0,ZOOM:1},u=r.NONE,v={type:"change"};this.rotateLeft=function(a){a===
|
|
|
void 0&&(a=c());q=q-a};this.rotateRight=function(a){a===void 0&&(a=c());q=q+a};this.rotateUp=function(a){a===void 0&&(a=c());p=p-a};this.rotateDown=function(a){a===void 0&&(a=c());p=p+a};this.zoomIn=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));o=o/a};this.zoomOut=function(a){a===void 0&&(a=Math.pow(0.95,e.userZoomSpeed));o=o*a};this.update=function(){var a=this.object.position,b=a.clone().subSelf(this.center),d=Math.atan2(b.x,b.z),e=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&
|
|
|
this.rotateLeft(c());var d=d+q,e=e+p,e=Math.max(1E-6,Math.min(Math.PI-1E-6,e)),f=b.length();b.x=f*Math.sin(e)*Math.sin(d);b.y=f*Math.cos(e);b.z=f*Math.sin(e)*Math.cos(d);b.multiplyScalar(o);a.copy(this.center).addSelf(b);this.object.lookAt(this.center);p=q=0;o=1;if(t.distanceTo(this.object.position)>0){this.dispatchEvent(v);t.copy(this.object.position)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},false);this.domElement.addEventListener("mousedown",function(a){if(e.userRotate){a.preventDefault();
|
|
|
-if(a.button===0||a.button===2){u=s.ROTATE;h.set(a.clientX,a.clientY)}else if(a.button===1){u=s.ZOOM;j.set(a.clientX,a.clientY)}document.addEventListener("mousemove",d,false);document.addEventListener("mouseup",f,false)}},false);this.domElement.addEventListener("mousewheel",function(a){e.userZoom&&(a.wheelDelta>0?e.zoomOut():e.zoomIn())},false)};
|
|
|
+if(a.button===0||a.button===2){u=r.ROTATE;h.set(a.clientX,a.clientY)}else if(a.button===1){u=r.ZOOM;j.set(a.clientX,a.clientY)}document.addEventListener("mousemove",d,false);document.addEventListener("mouseup",f,false)}},false);this.domElement.addEventListener("mousewheel",function(a){e.userZoom&&(a.wheelDelta>0?e.zoomOut():e.zoomIn())},false)};
|
|
|
THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=c!==void 0?c:0,d=d!==void 0?d:Math.PI*2,b=b!==void 0?Math.max(3,b):8,f,e=[];f=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(f);e.push(g);for(f=0;f<=b;f++){var h=new THREE.Vector3;h.x=a*Math.cos(c+f/b*d);h.y=a*Math.sin(c+f/b*d);this.vertices.push(h);e.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(f=1;f<=b;f++){this.faces.push(new THREE.Face3(f,f+1,0,[c,c,c]));this.faceVertexUvs[0].push([e[f],
|
|
|
e[f+1],g])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,j,m){var n,o=d||1,p=f||1,q=h/2,s=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=e||1}var u=o+1,v=p+1,N=h/o,ca=i/p,M=new THREE.Vector3;M[n]=j>0?1:-1;for(h=0;h<v;h++)for(i=0;i<u;i++){var ea=new THREE.Vector3;ea[a]=(i*N-q)*c;ea[b]=(h*ca-s)*g;ea[n]=j;l.vertices.push(ea)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
|
|
|
-u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t);a.normal.copy(M);a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone());a.materialIndex=m;l.faces.push(a);l.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var l=this,j=a/2,n=b/2,m=c/2,p,q,o,t,s,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;t=1;q=2;s=3;o=4;u=
|
|
|
-5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,j,p);this.sides.nx&&i("z","y",1,-1,c,b,-j,t);this.sides.py&&i("x","z",1,1,a,c,n,q);this.sides.ny&&i("x","z",1,-1,a,c,-n,s);this.sides.pz&&i("x","y",1,-1,a,b,m,o);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,g,h,i,j,m){var n,o=d||1,p=f||1,q=h/2,r=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){n="y";p=e||1}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){n="x";o=e||1}var u=o+1,v=p+1,N=h/o,ca=i/p,M=new THREE.Vector3;M[n]=j>0?1:-1;for(h=0;h<v;h++)for(i=0;i<u;i++){var ea=new THREE.Vector3;ea[a]=(i*N-q)*c;ea[b]=(h*ca-r)*g;ea[n]=j;l.vertices.push(ea)}for(h=0;h<p;h++)for(i=0;i<o;i++){a=new THREE.Face4(i+
|
|
|
+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t);a.normal.copy(M);a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone());a.materialIndex=m;l.faces.push(a);l.faceVertexUvs[0].push([new THREE.UV(i/o,1-h/p),new THREE.UV(i/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-(h+1)/p),new THREE.UV((i+1)/o,1-h/p)])}}THREE.Geometry.call(this);var l=this,j=a/2,n=b/2,m=c/2,p,q,o,t,r,u;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(g)}p=0;t=1;q=2;r=3;o=4;u=
|
|
|
+5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,j,p);this.sides.nx&&i("z","y",1,-1,c,b,-j,t);this.sides.py&&i("x","z",1,1,a,c,n,q);this.sides.ny&&i("x","z",1,-1,a,c,-n,r);this.sides.pz&&i("x","y",1,-1,a,b,m,o);this.sides.nz&&i("x","y",-1,-1,a,b,-m,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.CylinderGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,f=f||1,h,i,l=[],j=[];for(i=0;i<=f;i++){var n=[],m=[],p=i/f,q=p*(b-a)+a;for(h=0;h<=d;h++){var o=h/d,t=new THREE.Vector3;t.x=q*Math.sin(o*Math.PI*2);t.y=-p*c+g;t.z=q*Math.cos(o*Math.PI*2);this.vertices.push(t);n.push(this.vertices.length-1);m.push(new THREE.UV(o,1-p))}l.push(n);j.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){n=this.vertices[l[0][h]].clone();m=
|
|
|
-this.vertices[l[0][h+1]].clone()}else{n=this.vertices[l[1][h]].clone();m=this.vertices[l[1][h+1]].clone()}n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<f;i++){var p=l[i][h],q=l[i+1][h],o=l[i+1][h+1],t=l[i][h+1],s=n.clone(),u=n.clone(),v=m.clone(),r=m.clone(),A=j[i][h].clone(),x=j[i+1][h].clone(),B=j[i+1][h+1].clone(),C=j[i][h+1].clone();this.faces.push(new THREE.Face4(p,q,o,t,[s,u,v,r]));this.faceVertexUvs[0].push([A,x,B,C])}}if(!e&&a>
|
|
|
-0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){p=l[0][h];q=l[0][h+1];o=this.vertices.length-1;s=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);v=new THREE.Vector3(0,1,0);A=j[0][h].clone();x=j[0][h+1].clone();B=new THREE.UV(x.u,0);this.faces.push(new THREE.Face3(p,q,o,[s,u,v]));this.faceVertexUvs[0].push([A,x,B])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=l[i][h+1];q=l[i][h];o=this.vertices.length-1;s=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,
|
|
|
--1,0);v=new THREE.Vector3(0,-1,0);A=j[i][h+1].clone();x=j[i][h].clone();B=new THREE.UV(x.u,1);this.faces.push(new THREE.Face3(p,q,o,[s,u,v]));this.faceVertexUvs[0].push([A,x,B])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+this.vertices[l[0][h+1]].clone()}else{n=this.vertices[l[1][h]].clone();m=this.vertices[l[1][h+1]].clone()}n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(i=0;i<f;i++){var p=l[i][h],q=l[i+1][h],o=l[i+1][h+1],t=l[i][h+1],r=n.clone(),u=n.clone(),v=m.clone(),s=m.clone(),A=j[i][h].clone(),x=j[i+1][h].clone(),B=j[i+1][h+1].clone(),C=j[i][h+1].clone();this.faces.push(new THREE.Face4(p,q,o,t,[r,u,v,s]));this.faceVertexUvs[0].push([A,x,B,C])}}if(!e&&a>
|
|
|
+0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){p=l[0][h];q=l[0][h+1];o=this.vertices.length-1;r=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);v=new THREE.Vector3(0,1,0);A=j[0][h].clone();x=j[0][h+1].clone();B=new THREE.UV(x.u,0);this.faces.push(new THREE.Face3(p,q,o,[r,u,v]));this.faceVertexUvs[0].push([A,x,B])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=l[i][h+1];q=l[i][h];o=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);u=new THREE.Vector3(0,
|
|
|
+-1,0);v=new THREE.Vector3(0,-1,0);A=j[i][h+1].clone();x=j[i][h].clone();B=new THREE.UV(x.u,1);this.faces.push(new THREE.Face3(p,q,o,[r,u,v]));this.faceVertexUvs[0].push([A,x,B])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){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).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(c,d){var e,f;for(M=c.length;--M>=0;){e=M;f=M-1;f<0&&(f=
|
|
|
-c.length-1);for(var g=0,h=m+j*2,g=0;g<h;g++){var i=G*g,l=G*(g+1),n=d+e+i,i=d+f+i,o=d+f+l,l=d+e+l,p=c,q=g,t=h,r=e,v=f,n=n+H,i=i+H,o=o+H,l=l+H;F.faces.push(new THREE.Face4(n,i,o,l,null,null,s));n=u.generateSideWallUV(F,a,p,b,n,i,o,l,q,t,r,v);F.faceVertexUvs[0].push(n)}}}function e(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+H;d=d+H;e=e+H;F.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?u.generateBottomUV(F,a,b,c,d,e):u.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}
|
|
|
-var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.extrudePath,q,o=false,t=b.material,s=b.extrudeMaterial,u=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,r,A,x;if(p){q=p.getSpacedPoints(m);o=true;n=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(p,m,
|
|
|
-false);r=new THREE.Vector3;A=new THREE.Vector3;x=new THREE.Vector3}if(!n)l=i=j=0;var B,C,z,F=this,H=this.vertices.length,p=a.extractPoints(),K=p.shape,p=p.holes,E=!THREE.Shape.Utils.isClockWise(K);if(E){K=K.reverse();C=0;for(z=p.length;C<z;C++){B=p[C];THREE.Shape.Utils.isClockWise(B)&&(p[C]=B.reverse())}E=false}var L=THREE.Shape.Utils.triangulateShape(K,p),E=K;C=0;for(z=p.length;C<z;C++){B=p[C];K=K.concat(B)}var J,I,R,P,G=K.length,N=L.length,ca=[],M=0,ea=E.length;J=ea-1;for(I=M+1;M<ea;M++,J++,I++){J===
|
|
|
+c.length-1);for(var g=0,h=m+j*2,g=0;g<h;g++){var i=G*g,l=G*(g+1),n=d+e+i,i=d+f+i,o=d+f+l,l=d+e+l,p=c,q=g,s=h,t=e,v=f,n=n+H,i=i+H,o=o+H,l=l+H;F.faces.push(new THREE.Face4(n,i,o,l,null,null,r));n=u.generateSideWallUV(F,a,p,b,n,i,o,l,q,s,t,v);F.faceVertexUvs[0].push(n)}}}function e(a,b,c){F.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+H;d=d+H;e=e+H;F.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?u.generateBottomUV(F,a,b,c,d,e):u.generateTopUV(F,a,b,c,d,e);F.faceVertexUvs[0].push(c)}
|
|
|
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,l=b.bevelSize!==void 0?b.bevelSize:i-2,j=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,p=b.extrudePath,q,o=false,t=b.material,r=b.extrudeMaterial,u=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,s,A,x;if(p){q=p.getSpacedPoints(m);o=true;n=false;v=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(p,m,
|
|
|
+false);s=new THREE.Vector3;A=new THREE.Vector3;x=new THREE.Vector3}if(!n)l=i=j=0;var B,C,z,F=this,H=this.vertices.length,p=a.extractPoints(),K=p.shape,p=p.holes,E=!THREE.Shape.Utils.isClockWise(K);if(E){K=K.reverse();C=0;for(z=p.length;C<z;C++){B=p[C];THREE.Shape.Utils.isClockWise(B)&&(p[C]=B.reverse())}E=false}var L=THREE.Shape.Utils.triangulateShape(K,p),E=K;C=0;for(z=p.length;C<z;C++){B=p[C];K=K.concat(B)}var J,I,R,P,G=K.length,N=L.length,ca=[],M=0,ea=E.length;J=ea-1;for(I=M+1;M<ea;M++,J++,I++){J===
|
|
|
ea&&(J=0);I===ea&&(I=0);ca[M]=d(E[M],E[J],E[I])}var Q=[],ba,ta=ca.concat();C=0;for(z=p.length;C<z;C++){B=p[C];ba=[];M=0;ea=B.length;J=ea-1;for(I=M+1;M<ea;M++,J++,I++){J===ea&&(J=0);I===ea&&(I=0);ba[M]=d(B[M],B[J],B[I])}Q.push(ba);ta=ta.concat(ba)}for(J=0;J<j;J++){B=J/j;R=i*(1-B);I=l*Math.sin(B*Math.PI/2);M=0;for(ea=E.length;M<ea;M++){P=c(E[M],ca[M],I);e(P.x,P.y,-R)}C=0;for(z=p.length;C<z;C++){B=p[C];ba=Q[C];M=0;for(ea=B.length;M<ea;M++){P=c(B[M],ba[M],I);e(P.x,P.y,-R)}}}I=l;for(M=0;M<G;M++){P=n?c(K[M],
|
|
|
-ta[M],I):K[M];if(o){A.copy(v.normals[0]).multiplyScalar(P.x);r.copy(v.binormals[0]).multiplyScalar(P.y);x.copy(q[0]).addSelf(A).addSelf(r);e(x.x,x.y,x.z)}else e(P.x,P.y,0)}for(B=1;B<=m;B++)for(M=0;M<G;M++){P=n?c(K[M],ta[M],I):K[M];if(o){A.copy(v.normals[B]).multiplyScalar(P.x);r.copy(v.binormals[B]).multiplyScalar(P.y);x.copy(q[B]).addSelf(A).addSelf(r);e(x.x,x.y,x.z)}else e(P.x,P.y,h/m*B)}for(J=j-1;J>=0;J--){B=J/j;R=i*(1-B);I=l*Math.sin(B*Math.PI/2);M=0;for(ea=E.length;M<ea;M++){P=c(E[M],ca[M],I);
|
|
|
+ta[M],I):K[M];if(o){A.copy(v.normals[0]).multiplyScalar(P.x);s.copy(v.binormals[0]).multiplyScalar(P.y);x.copy(q[0]).addSelf(A).addSelf(s);e(x.x,x.y,x.z)}else e(P.x,P.y,0)}for(B=1;B<=m;B++)for(M=0;M<G;M++){P=n?c(K[M],ta[M],I):K[M];if(o){A.copy(v.normals[B]).multiplyScalar(P.x);s.copy(v.binormals[B]).multiplyScalar(P.y);x.copy(q[B]).addSelf(A).addSelf(s);e(x.x,x.y,x.z)}else e(P.x,P.y,h/m*B)}for(J=j-1;J>=0;J--){B=J/j;R=i*(1-B);I=l*Math.sin(B*Math.PI/2);M=0;for(ea=E.length;M<ea;M++){P=c(E[M],ca[M],I);
|
|
|
e(P.x,P.y,h+R)}C=0;for(z=p.length;C<z;C++){B=p[C];ba=Q[C];M=0;for(ea=B.length;M<ea;M++){P=c(B[M],ba[M],I);o?e(P.x,P.y+q[m-1].y,q[m-1].x+R):e(P.x,P.y,h+R)}}}if(n){i=G*0;for(M=0;M<N;M++){h=L[M];g(h[2]+i,h[1]+i,h[0]+i,true)}i=G*(m+j*2);for(M=0;M<N;M++){h=L[M];g(h[0]+i,h[1]+i,h[2]+i,false)}}else{for(M=0;M<N;M++){h=L[M];g(h[2],h[1],h[0],true)}for(M=0;M<N;M++){h=L[M];g(h[0]+G*m,h[1]+G*m,h[2]+G*m,false)}}h=0;f(E,h);h=h+E.length;C=0;for(z=p.length;C<z;C++){B=p[C];f(B,h);h=h+B.length}};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,f,e){b=a.vertices[f].x;f=a.vertices[f].y;c=a.vertices[e].x;e=a.vertices[e].y;return[new THREE.UV(a.vertices[d].x,a.vertices[d].y),new THREE.UV(b,f),new THREE.UV(c,e)]},generateBottomUV:function(a,b,c,d,f,e){return this.generateTopUV(a,b,c,d,f,e)},generateSideWallUV:function(a,b,c,d,f,e,g,h){var b=a.vertices[f].x,c=a.vertices[f].y,f=a.vertices[f].z,d=a.vertices[e].x,i=a.vertices[e].y,e=a.vertices[e].z,l=a.vertices[g].x,j=a.vertices[g].y,
|
|
|
g=a.vertices[g].z,n=a.vertices[h].x,m=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,1-f),new THREE.UV(d,1-e),new THREE.UV(l,1-g),new THREE.UV(n,1-a)]:[new THREE.UV(c,1-f),new THREE.UV(i,1-e),new THREE.UV(j,1-g),new THREE.UV(m,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
|
|
@@ -690,8 +690,8 @@ THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=
|
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,e=b/2,c=c||1,d=d||1,g=c+1,h=d+1,i=a/c,l=b/d,j=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<g;b++)this.vertices.push(new THREE.Vector3(b*i-f,-(a*l-e),0));for(a=0;a<d;a++)for(b=0;b<c;b++){f=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);f.normal.copy(j);f.vertexNormals.push(j.clone(),j.clone(),j.clone(),j.clone());this.faces.push(f);this.faceVertexUvs[0].push([new THREE.UV(b/c,1-a/d),new THREE.UV(b/c,1-(a+1)/d),new THREE.UV((b+
|
|
|
1)/c,1-(a+1)/d),new THREE.UV((b+1)/c,1-a/d)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,e=e!==void 0?e:0,g=g!==void 0?g:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,l=[],j=[];for(i=0;i<=c;i++){var n=[],m=[];for(h=0;h<=b;h++){var p=h/b,q=i/c,o=new THREE.Vector3;o.x=-a*Math.cos(d+p*f)*Math.sin(e+q*g);o.y=a*Math.cos(e+q*g);o.z=a*Math.sin(d+p*f)*Math.sin(e+q*g);this.vertices.push(o);n.push(this.vertices.length-1);m.push(new THREE.UV(p,
|
|
|
-1-q))}l.push(n);j.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],f=l[i][h],e=l[i+1][h],g=l[i+1][h+1],n=this.vertices[d].clone().normalize(),m=this.vertices[f].clone().normalize(),p=this.vertices[e].clone().normalize(),q=this.vertices[g].clone().normalize(),o=j[i][h+1].clone(),t=j[i][h].clone(),s=j[i+1][h].clone(),u=j[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[n,p,q]));this.faceVertexUvs[0].push([o,s,u])}else if(Math.abs(this.vertices[e].y)==
|
|
|
-a){this.faces.push(new THREE.Face3(d,f,e,[n,m,p]));this.faceVertexUvs[0].push([o,t,s])}else{this.faces.push(new THREE.Face4(d,f,e,g,[n,m,p,q]));this.faceVertexUvs[0].push([o,t,s,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+1-q))}l.push(n);j.push(m)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=l[i][h+1],f=l[i][h],e=l[i+1][h],g=l[i+1][h+1],n=this.vertices[d].clone().normalize(),m=this.vertices[f].clone().normalize(),p=this.vertices[e].clone().normalize(),q=this.vertices[g].clone().normalize(),o=j[i][h+1].clone(),t=j[i][h].clone(),r=j[i+1][h].clone(),u=j[i+1][h+1].clone();if(Math.abs(this.vertices[d].y)==a){this.faces.push(new THREE.Face3(d,e,g,[n,p,q]));this.faceVertexUvs[0].push([o,r,u])}else if(Math.abs(this.vertices[e].y)==
|
|
|
+a){this.faces.push(new THREE.Face3(d,f,e,[n,m,p]));this.faceVertexUvs[0].push([o,t,r])}else{this.faces.push(new THREE.Face4(d,f,e,g,[n,m,p,q]));this.faceVertexUvs[0].push([o,t,r,u])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.TextGeometry=function(a,b){var c=THREE.FontUtils.generateShapes(a,b);b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=false;THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);
|
|
|
THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,g=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(e);f.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(g))*Math.sin(e);h.z=
|
|
|
this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.segmentsT,c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,e=(this.segmentsT+1)*(c-1)+d-1,g=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,e,g,h,[b[f],b[e],b[g],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[f].clone(),
|
|
@@ -727,13 +727,13 @@ THREE.CameraHelper.prototype.update=function(){function a(a,d,f,e){THREE.CameraH
|
|
|
a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.geometry.verticesNeedUpdate=true};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
|
|
|
THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=false;this.supportUVs=true;this.debug=false};THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){j.debug&&console.log.apply(console,arguments)}function c(){console&&console.log.apply(console,arguments)}function d(a,c,d,f,g,h,m){var n=new THREE.Face4(a,c,d,f,null,g.color,g.materialIndex);if(j.useOldVertexColors){n.vertexColors=[];for(var o,p,q,r=0;r<4;r++){q=h[r];o=new THREE.Color;o.setRGB(0,0,0);for(var s=0;s<q.length;s++){p=g.vertexColors[q[s]-1];o.r=o.r+p.r;o.g=o.g+p.g;o.b=o.b+p.b}o.r=o.r/q.length;o.g=o.g/q.length;o.b=o.b/
|
|
|
-q.length;n.vertexColors[r]=o}}i.push(n);if(j.supportUVs){g=[e(a,""),e(c,m),e(d,m),e(f,m)];g[0]?g[1]?g[2]?g[3]?l.push(g):b("d :( ",f+":"+m):b("c :( ",d+":"+m):b("b :( ",c+":"+m):b("a :( ",a+":"+m)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=t[e];if(!f){a>=s&&a<s+m.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}var h=
|
|
|
-[],i=[],l=[],j=this,n=a.vertices,m=a.faces,h=n.concat(),p=[],q={},o={},t={},s=n.length,u,v,r,A,x,B=a.faceVertexUvs[0];b("originalFaces, uvs, originalVerticesLength",m.length,B.length,s);if(j.supportUVs){u=0;for(v=B.length;u<v;u++){r=0;for(A=B[u].length;r<A;r++){x=m[u]["abcd".charAt(r)];g(x,u,B[u][r])}}}if(B.length==0)j.supportUVs=false;u=0;for(var C in t)u++;if(!u){j.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",t,"vs",B.length);var z;u=0;for(v=m.length;u<v;u++){x=m[u];
|
|
|
-p.push(x.centroid);h.push(x.centroid);if(j.supportUVs){z=new THREE.UV;if(x instanceof THREE.Face3){z.u=e(x.a,u).u+e(x.b,u).u+e(x.c,u).u;z.v=e(x.a,u).v+e(x.b,u).v+e(x.c,u).v;z.u=z.u/3;z.v=z.v/3}else if(x instanceof THREE.Face4){z.u=e(x.a,u).u+e(x.b,u).u+e(x.c,u).u+e(x.d,u).u;z.v=e(x.a,u).v+e(x.b,u).v+e(x.c,u).v+e(x.d,u).v;z.u=z.u/4;z.v=z.v/4}g(s+u,"",z)}}b("-- added UVs for new Faces",t);C=function(a,b){F[a]===void 0&&(F[a]=[]);F[a].push(b)};var F={},B=0;for(v=a.faces.length;B<v;B++){x=a.faces[B];
|
|
|
-if(x instanceof THREE.Face3){z=f(x.a,x.b);C(z,B);z=f(x.b,x.c);C(z,B);z=f(x.c,x.a);C(z,B)}else if(x instanceof THREE.Face4){z=f(x.a,x.b);C(z,B);z=f(x.b,x.c);C(z,B);z=f(x.c,x.d);C(z,B);z=f(x.d,x.a);C(z,B)}}v=F;var H=0,K,E;C={};B={};for(u in v){z=v[u];K=u.split("_");E=K[0];K=K[1];r=E;x=[E,K];C[r]===void 0&&(C[r]=[]);C[r].push(x);r=K;x=[E,K];C[r]===void 0&&(C[r]=[]);C[r].push(x);r=0;for(A=z.length;r<A;r++){x=z[r];var L=E,J=x,I=u;B[L]===void 0&&(B[L]={});B[L][J]=I;L=K;J=u;B[L]===void 0&&(B[L]={});B[L][x]=
|
|
|
-J}z.length<2&&(o[u]=true)}b("vertexEdgeMap",C,"vertexFaceMap",B);for(u in v){z=v[u];x=z[0];A=z[1];K=u.split("_");E=K[0];K=K[1];z=new THREE.Vector3;if(o[u]){z.addSelf(n[E]);z.addSelf(n[K]);z.multiplyScalar(0.5)}else{z.addSelf(p[x]);z.addSelf(p[A]);z.addSelf(n[E]);z.addSelf(n[K]);z.multiplyScalar(0.25)}q[u]=s+m.length+H;h.push(z);H++;if(j.supportUVs){z=new THREE.UV;z.u=e(E,x).u+e(K,x).u;z.v=e(E,x).v+e(K,x).v;z.u=z.u/2;z.v=z.v/2;g(q[u],x,z);if(!o[u]){z=new THREE.UV;z.u=e(E,A).u+e(K,A).u;z.v=e(E,A).v+
|
|
|
-e(K,A).v;z.u=z.u/2;z.v=z.v/2;g(q[u],A,z)}}}b("-- Step 2 done");var R,P;K=["123","12","2","23"];A=["123","23","3","31"];var L=["123","31","1","12"],J=["1234","12","2","23"],I=["1234","23","3","34"],G=["1234","34","4","41"],N=["1234","41","1","12"];u=0;for(v=p.length;u<v;u++){x=m[u];z=s+u;if(x instanceof THREE.Face3){H=f(x.a,x.b);E=f(x.b,x.c);R=f(x.c,x.a);d(z,q[H],x.b,q[E],x,K,u);d(z,q[E],x.c,q[R],x,A,u);d(z,q[R],x.a,q[H],x,L,u)}else if(x instanceof THREE.Face4){H=f(x.a,x.b);E=f(x.b,x.c);R=f(x.c,x.d);
|
|
|
-P=f(x.d,x.a);d(z,q[H],x.b,q[E],x,J,u);d(z,q[E],x.c,q[R],x,I,u);d(z,q[R],x.d,q[P],x,G,u);d(z,q[P],x.a,q[H],x,N,u)}else b("face should be a face!",x)}q=new THREE.Vector3;x=new THREE.Vector3;u=0;for(v=n.length;u<v;u++)if(C[u]!==void 0){q.set(0,0,0);x.set(0,0,0);E=new THREE.Vector3(0,0,0);z=0;for(r in B[u]){q.addSelf(p[r]);z++}K=0;H=C[u].length;for(r=0;r<H;r++)o[f(C[u][r][0],C[u][r][1])]&&K++;if(K!=2){q.divideScalar(z);for(r=0;r<H;r++){z=C[u][r];z=n[z[0]].clone().addSelf(n[z[1]]).divideScalar(2);x.addSelf(z)}x.divideScalar(H);
|
|
|
+q.length;n.vertexColors[r]=o}}i.push(n);if(j.supportUVs){g=[e(a,""),e(c,m),e(d,m),e(f,m)];g[0]?g[1]?g[2]?g[3]?l.push(g):b("d :( ",f+":"+m):b("c :( ",d+":"+m):b("b :( ",c+":"+m):b("a :( ",a+":"+m)}}function f(a,b){return Math.min(a,b)+"_"+Math.max(a,b)}function e(a,d){var e=a+":"+d,f=t[e];if(!f){a>=r&&a<r+m.length?b("face pt"):b("edge pt");c("warning, UV not found for",e);return null}return f}function g(a,b,d){var e=a+":"+b;e in t?c("dup vertexNo",a,"oldFaceNo",b,"value",d,"key",e,t[e]):t[e]=d}var h=
|
|
|
+[],i=[],l=[],j=this,n=a.vertices,m=a.faces,h=n.concat(),p=[],q={},o={},t={},r=n.length,u,v,s,A,x,B=a.faceVertexUvs[0];b("originalFaces, uvs, originalVerticesLength",m.length,B.length,r);if(j.supportUVs){u=0;for(v=B.length;u<v;u++){s=0;for(A=B[u].length;s<A;s++){x=m[u]["abcd".charAt(s)];g(x,u,B[u][s])}}}if(B.length==0)j.supportUVs=false;u=0;for(var C in t)u++;if(!u){j.supportUVs=false;b("no uvs")}b("-- Original Faces + Vertices UVs completed",t,"vs",B.length);var z;u=0;for(v=m.length;u<v;u++){x=m[u];
|
|
|
+p.push(x.centroid);h.push(x.centroid);if(j.supportUVs){z=new THREE.UV;if(x instanceof THREE.Face3){z.u=e(x.a,u).u+e(x.b,u).u+e(x.c,u).u;z.v=e(x.a,u).v+e(x.b,u).v+e(x.c,u).v;z.u=z.u/3;z.v=z.v/3}else if(x instanceof THREE.Face4){z.u=e(x.a,u).u+e(x.b,u).u+e(x.c,u).u+e(x.d,u).u;z.v=e(x.a,u).v+e(x.b,u).v+e(x.c,u).v+e(x.d,u).v;z.u=z.u/4;z.v=z.v/4}g(r+u,"",z)}}b("-- added UVs for new Faces",t);C=function(a,b){F[a]===void 0&&(F[a]=[]);F[a].push(b)};var F={},B=0;for(v=a.faces.length;B<v;B++){x=a.faces[B];
|
|
|
+if(x instanceof THREE.Face3){z=f(x.a,x.b);C(z,B);z=f(x.b,x.c);C(z,B);z=f(x.c,x.a);C(z,B)}else if(x instanceof THREE.Face4){z=f(x.a,x.b);C(z,B);z=f(x.b,x.c);C(z,B);z=f(x.c,x.d);C(z,B);z=f(x.d,x.a);C(z,B)}}v=F;var H=0,K,E;C={};B={};for(u in v){z=v[u];K=u.split("_");E=K[0];K=K[1];s=E;x=[E,K];C[s]===void 0&&(C[s]=[]);C[s].push(x);s=K;x=[E,K];C[s]===void 0&&(C[s]=[]);C[s].push(x);s=0;for(A=z.length;s<A;s++){x=z[s];var L=E,J=x,I=u;B[L]===void 0&&(B[L]={});B[L][J]=I;L=K;J=u;B[L]===void 0&&(B[L]={});B[L][x]=
|
|
|
+J}z.length<2&&(o[u]=true)}b("vertexEdgeMap",C,"vertexFaceMap",B);for(u in v){z=v[u];x=z[0];A=z[1];K=u.split("_");E=K[0];K=K[1];z=new THREE.Vector3;if(o[u]){z.addSelf(n[E]);z.addSelf(n[K]);z.multiplyScalar(0.5)}else{z.addSelf(p[x]);z.addSelf(p[A]);z.addSelf(n[E]);z.addSelf(n[K]);z.multiplyScalar(0.25)}q[u]=r+m.length+H;h.push(z);H++;if(j.supportUVs){z=new THREE.UV;z.u=e(E,x).u+e(K,x).u;z.v=e(E,x).v+e(K,x).v;z.u=z.u/2;z.v=z.v/2;g(q[u],x,z);if(!o[u]){z=new THREE.UV;z.u=e(E,A).u+e(K,A).u;z.v=e(E,A).v+
|
|
|
+e(K,A).v;z.u=z.u/2;z.v=z.v/2;g(q[u],A,z)}}}b("-- Step 2 done");var R,P;K=["123","12","2","23"];A=["123","23","3","31"];var L=["123","31","1","12"],J=["1234","12","2","23"],I=["1234","23","3","34"],G=["1234","34","4","41"],N=["1234","41","1","12"];u=0;for(v=p.length;u<v;u++){x=m[u];z=r+u;if(x instanceof THREE.Face3){H=f(x.a,x.b);E=f(x.b,x.c);R=f(x.c,x.a);d(z,q[H],x.b,q[E],x,K,u);d(z,q[E],x.c,q[R],x,A,u);d(z,q[R],x.a,q[H],x,L,u)}else if(x instanceof THREE.Face4){H=f(x.a,x.b);E=f(x.b,x.c);R=f(x.c,x.d);
|
|
|
+P=f(x.d,x.a);d(z,q[H],x.b,q[E],x,J,u);d(z,q[E],x.c,q[R],x,I,u);d(z,q[R],x.d,q[P],x,G,u);d(z,q[P],x.a,q[H],x,N,u)}else b("face should be a face!",x)}q=new THREE.Vector3;x=new THREE.Vector3;u=0;for(v=n.length;u<v;u++)if(C[u]!==void 0){q.set(0,0,0);x.set(0,0,0);E=new THREE.Vector3(0,0,0);z=0;for(s in B[u]){q.addSelf(p[s]);z++}K=0;H=C[u].length;for(s=0;s<H;s++)o[f(C[u][s][0],C[u][s][1])]&&K++;if(K!=2){q.divideScalar(z);for(s=0;s<H;s++){z=C[u][s];z=n[z[0]].clone().addSelf(n[z[1]]).divideScalar(2);x.addSelf(z)}x.divideScalar(H);
|
|
|
E.addSelf(n[u]);E.multiplyScalar(H-3);E.addSelf(q);E.addSelf(x.multiplyScalar(2));E.divideScalar(H);h[u]=E}}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=l;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,f,e){b===void 0&&(b=-1);c===void 0&&(c=0);e===void 0&&(e=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)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:e,color:f,blending:d})};
|
|
@@ -750,30 +750,30 @@ THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.creat
|
|
|
0;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=0;d[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);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,i);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);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){l=false;j=a(THREE.ShaderFlares.lensFlare)}else{l=true;j=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};m={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
|
|
|
-"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");p=false};this.render=function(a,d,f,s){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,r=s/f,A=f*0.5,x=s*0.5,B=16/s,C=new THREE.Vector2(B*r,B),z=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),H=m,B=n;b.useProgram(j);if(!p){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);p=true}b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(B.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,E,L,J,I;for(K=0;K<u;K++){B=16/s;C.set(B*r,B);J=a[K];v.set(J.matrixWorld.elements[12],J.matrixWorld.elements[13],J.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);z.copy(v);F.x=z.x*A+A;F.y=z.y*x+x;if(l||F.x>0&&F.x<f&&F.y>0&&
|
|
|
-F.y<s){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,C.x,C.y);b.uniform3f(H.screenPosition,z.x,z.y,z.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(H.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
|
|
|
-b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);J.positionScreen.copy(z);J.customUpdateCallback?J.customUpdateCallback(J):J.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);E=0;for(L=J.lensFlares.length;E<L;E++){I=J.lensFlares[E];if(I.opacity>0.001&&I.scale>0.001){z.x=I.x;z.y=I.y;z.z=I.z;B=I.size*I.scale/s;C.x=B*r;C.y=B;b.uniform3f(H.screenPosition,z.x,z.y,z.z);b.uniform2f(H.scale,C.x,C.y);b.uniform1f(H.rotation,I.rotation);b.uniform1f(H.opacity,I.opacity);
|
|
|
+"color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");p=false};this.render=function(a,d,f,r){var a=a.__webglFlares,u=a.length;if(u){var v=new THREE.Vector3,s=r/f,A=f*0.5,x=r*0.5,B=16/r,C=new THREE.Vector2(B*s,B),z=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),H=m,B=n;b.useProgram(j);if(!p){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);p=true}b.uniform1i(H.occlusionMap,0);b.uniform1i(H.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(B.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,E,L,J,I;for(K=0;K<u;K++){B=16/r;C.set(B*s,B);J=a[K];v.set(J.matrixWorld.elements[12],J.matrixWorld.elements[13],J.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(v);d.projectionMatrix.multiplyVector3(v);z.copy(v);F.x=z.x*A+A;F.y=z.y*x+x;if(l||F.x>0&&F.x<f&&F.y>0&&
|
|
|
+F.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(H.renderType,0);b.uniform2f(H.scale,C.x,C.y);b.uniform3f(H.screenPosition,z.x,z.y,z.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(H.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
|
|
|
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);J.positionScreen.copy(z);J.customUpdateCallback?J.customUpdateCallback(J):J.updateLensFlares();b.uniform1i(H.renderType,2);b.enable(b.BLEND);E=0;for(L=J.lensFlares.length;E<L;E++){I=J.lensFlares[E];if(I.opacity>0.001&&I.scale>0.001){z.x=I.x;z.y=I.y;z.z=I.z;B=I.size*I.scale/r;C.x=B*s;C.y=B;b.uniform3f(H.screenPosition,z.x,z.y,z.z);b.uniform2f(H.scale,C.x,C.y);b.uniform1f(H.rotation,I.rotation);b.uniform1f(H.opacity,I.opacity);
|
|
|
b.uniform3f(H.color,I.color.r,I.color.g,I.color.b);c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst);c.setTexture(I.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,f,e,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:true});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;f._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,n){var m,p,q,o,t,s,u,v,r,A=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces?
|
|
|
-a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(p=j.__lights.length;m<p;m++){q=j.__lights[m];if(q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(t=0;t<q.shadowCascadeCount;t++){var x;if(q.shadowCascadeArray[t])x=q.shadowCascadeArray[t];else{r=q;u=t;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=r.shadowCameraNear;x.shadowCameraFar=r.shadowCameraFar;x.shadowCameraLeft=r.shadowCameraLeft;x.shadowCameraRight=
|
|
|
-r.shadowCameraRight;x.shadowCameraBottom=r.shadowCameraBottom;x.shadowCameraTop=r.shadowCameraTop;x.shadowCameraVisible=r.shadowCameraVisible;x.shadowDarkness=r.shadowDarkness;x.shadowBias=r.shadowCascadeBias[u];x.shadowMapWidth=r.shadowCascadeWidth[u];x.shadowMapHeight=r.shadowCascadeHeight[u];x.pointsWorld=[];x.pointsFrustum=[];v=x.pointsWorld;s=x.pointsFrustum;for(var B=0;B<8;B++){v[B]=new THREE.Vector3;s[B]=new THREE.Vector3}v=r.shadowCascadeNearZ[u];r=r.shadowCascadeFarZ[u];s[0].set(-1,-1,v);
|
|
|
-s[1].set(1,-1,v);s[2].set(-1,1,v);s[3].set(1,1,v);s[4].set(-1,-1,r);s[5].set(1,-1,r);s[6].set(-1,1,r);s[7].set(1,1,r);x.originalCamera=n;s=new THREE.Gyroscope;s.position=q.shadowCascadeOffset;s.add(x);s.add(x.target);n.add(s);q.shadowCascadeArray[t]=x;console.log("Created virtualLight",x)}u=q;v=t;r=u.shadowCascadeArray[v];r.position.copy(u.position);r.target.position.copy(u.target.position);r.lookAt(r.target);r.shadowCameraVisible=u.shadowCameraVisible;r.shadowDarkness=u.shadowDarkness;r.shadowBias=
|
|
|
-u.shadowCascadeBias[v];s=u.shadowCascadeNearZ[v];u=u.shadowCascadeFarZ[v];r=r.pointsFrustum;r[0].z=s;r[1].z=s;r[2].z=s;r[3].z=s;r[4].z=u;r[5].z=u;r[6].z=u;r[7].z=u;A[o]=x;o++}else{A[o]=q;o++}}m=0;for(p=A.length;m<p;m++){q=A[m];if(!q.shadowMap){q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight);q.shadowMatrix=new THREE.Matrix4}if(!q.shadowCamera){if(q instanceof
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:true});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;f._shadowPass=true;e._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(j,n){var m,p,q,o,t,r,u,v,s,A=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFrontFaces?
|
|
|
+a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(true);m=0;for(p=j.__lights.length;m<p;m++){q=j.__lights[m];if(q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(t=0;t<q.shadowCascadeCount;t++){var x;if(q.shadowCascadeArray[t])x=q.shadowCascadeArray[t];else{s=q;u=t;x=new THREE.DirectionalLight;x.isVirtual=true;x.onlyShadow=true;x.castShadow=true;x.shadowCameraNear=s.shadowCameraNear;x.shadowCameraFar=s.shadowCameraFar;x.shadowCameraLeft=s.shadowCameraLeft;x.shadowCameraRight=
|
|
|
+s.shadowCameraRight;x.shadowCameraBottom=s.shadowCameraBottom;x.shadowCameraTop=s.shadowCameraTop;x.shadowCameraVisible=s.shadowCameraVisible;x.shadowDarkness=s.shadowDarkness;x.shadowBias=s.shadowCascadeBias[u];x.shadowMapWidth=s.shadowCascadeWidth[u];x.shadowMapHeight=s.shadowCascadeHeight[u];x.pointsWorld=[];x.pointsFrustum=[];v=x.pointsWorld;r=x.pointsFrustum;for(var B=0;B<8;B++){v[B]=new THREE.Vector3;r[B]=new THREE.Vector3}v=s.shadowCascadeNearZ[u];s=s.shadowCascadeFarZ[u];r[0].set(-1,-1,v);
|
|
|
+r[1].set(1,-1,v);r[2].set(-1,1,v);r[3].set(1,1,v);r[4].set(-1,-1,s);r[5].set(1,-1,s);r[6].set(-1,1,s);r[7].set(1,1,s);x.originalCamera=n;r=new THREE.Gyroscope;r.position=q.shadowCascadeOffset;r.add(x);r.add(x.target);n.add(r);q.shadowCascadeArray[t]=x;console.log("Created virtualLight",x)}u=q;v=t;s=u.shadowCascadeArray[v];s.position.copy(u.position);s.target.position.copy(u.target.position);s.lookAt(s.target);s.shadowCameraVisible=u.shadowCameraVisible;s.shadowDarkness=u.shadowDarkness;s.shadowBias=
|
|
|
+u.shadowCascadeBias[v];r=u.shadowCascadeNearZ[v];u=u.shadowCascadeFarZ[v];s=s.pointsFrustum;s[0].z=r;s[1].z=r;s[2].z=r;s[3].z=r;s[4].z=u;s[5].z=u;s[6].z=u;s[7].z=u;A[o]=x;o++}else{A[o]=q;o++}}m=0;for(p=A.length;m<p;m++){q=A[m];if(!q.shadowMap){q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight);q.shadowMatrix=new THREE.Matrix4}if(!q.shadowCamera){if(q instanceof
|
|
|
THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}j.add(q.shadowCamera);b.autoUpdateScene&&j.updateMatrixWorld()}if(q.shadowCameraVisible&&
|
|
|
-!q.cameraHelper){q.cameraHelper=new THREE.CameraHelper(q.shadowCamera);q.shadowCamera.add(q.cameraHelper)}if(q.isVirtual&&x.originalCamera==n){t=n;o=q.shadowCamera;s=q.pointsFrustum;r=q.pointsWorld;i.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(u=0;u<8;u++){v=r[u];v.copy(s[u]);THREE.ShadowMapPlugin.__projector.unprojectVector(v,t);o.matrixWorldInverse.multiplyVector3(v);if(v.x<i.x)i.x=v.x;if(v.x>l.x)l.x=v.x;if(v.y<i.y)i.y=v.y;if(v.y>l.y)l.y=v.y;if(v.z<i.z)i.z=v.z;if(v.z>
|
|
|
-l.z)l.z=v.z}o.left=i.x;o.right=l.x;o.top=l.y;o.bottom=i.y;o.updateProjectionMatrix()}o=q.shadowMap;s=q.shadowMatrix;t=q.shadowCamera;t.position.copy(q.matrixWorld.getPosition());t.lookAt(q.target.matrixWorld.getPosition());t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);if(q.cameraHelper)q.cameraHelper.visible=q.shadowCameraVisible;q.shadowCameraVisible&&q.cameraHelper.update();s.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);s.multiplySelf(t.projectionMatrix);s.multiplySelf(t.matrixWorldInverse);
|
|
|
-if(!t._viewMatrixArray)t._viewMatrixArray=new Float32Array(16);if(!t._projectionMatrixArray)t._projectionMatrixArray=new Float32Array(16);t.matrixWorldInverse.flattenToArray(t._viewMatrixArray);t.projectionMatrix.flattenToArray(t._projectionMatrixArray);h.multiply(t.projectionMatrix,t.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(o);b.clear();r=j.__webglObjects;q=0;for(o=r.length;q<o;q++){u=r[q];s=u.object;u.render=false;if(s.visible&&s.castShadow&&(!(s instanceof THREE.Mesh)||!s.frustumCulled||
|
|
|
-g.contains(s))){s._modelViewMatrix.multiply(t.matrixWorldInverse,s.matrixWorld);u.render=true}}q=0;for(o=r.length;q<o;q++){u=r[q];if(u.render){s=u.object;u=u.buffer;v=s.customDepthMaterial?s.customDepthMaterial:s instanceof THREE.SkinnedMesh?s.geometry.morphTargets.length?e:f:s.geometry.morphTargets.length?d:c;u instanceof THREE.BufferGeometry?b.renderBufferDirect(t,j.__lights,null,v,u,s):b.renderBuffer(t,j.__lights,null,v,u,s)}}r=j.__webglObjectsImmediate;q=0;for(o=r.length;q<o;q++){u=r[q];s=u.object;
|
|
|
-if(s.visible&&s.castShadow){s._modelViewMatrix.multiply(t.matrixWorldInverse,s.matrixWorld);b.renderImmediateObject(t,j.__lights,null,c,s)}}}m=b.getClearColor();p=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
+!q.cameraHelper){q.cameraHelper=new THREE.CameraHelper(q.shadowCamera);q.shadowCamera.add(q.cameraHelper)}if(q.isVirtual&&x.originalCamera==n){t=n;o=q.shadowCamera;r=q.pointsFrustum;s=q.pointsWorld;i.set(Infinity,Infinity,Infinity);l.set(-Infinity,-Infinity,-Infinity);for(u=0;u<8;u++){v=s[u];v.copy(r[u]);THREE.ShadowMapPlugin.__projector.unprojectVector(v,t);o.matrixWorldInverse.multiplyVector3(v);if(v.x<i.x)i.x=v.x;if(v.x>l.x)l.x=v.x;if(v.y<i.y)i.y=v.y;if(v.y>l.y)l.y=v.y;if(v.z<i.z)i.z=v.z;if(v.z>
|
|
|
+l.z)l.z=v.z}o.left=i.x;o.right=l.x;o.top=l.y;o.bottom=i.y;o.updateProjectionMatrix()}o=q.shadowMap;r=q.shadowMatrix;t=q.shadowCamera;t.position.copy(q.matrixWorld.getPosition());t.lookAt(q.target.matrixWorld.getPosition());t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);if(q.cameraHelper)q.cameraHelper.visible=q.shadowCameraVisible;q.shadowCameraVisible&&q.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(t.projectionMatrix);r.multiplySelf(t.matrixWorldInverse);
|
|
|
+if(!t._viewMatrixArray)t._viewMatrixArray=new Float32Array(16);if(!t._projectionMatrixArray)t._projectionMatrixArray=new Float32Array(16);t.matrixWorldInverse.flattenToArray(t._viewMatrixArray);t.projectionMatrix.flattenToArray(t._projectionMatrixArray);h.multiply(t.projectionMatrix,t.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(o);b.clear();s=j.__webglObjects;q=0;for(o=s.length;q<o;q++){u=s[q];r=u.object;u.render=false;if(r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh)||!r.frustumCulled||
|
|
|
+g.contains(r))){r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld);u.render=true}}q=0;for(o=s.length;q<o;q++){u=s[q];if(u.render){r=u.object;u=u.buffer;v=r.customDepthMaterial?r.customDepthMaterial:r instanceof THREE.SkinnedMesh?r.geometry.morphTargets.length?e:f:r.geometry.morphTargets.length?d:c;u instanceof THREE.BufferGeometry?b.renderBufferDirect(t,j.__lights,null,v,u,r):b.renderBuffer(t,j.__lights,null,v,u,r)}}s=j.__webglObjectsImmediate;q=0;for(o=s.length;q<o;q++){u=s[q];r=u.object;
|
|
|
+if(r.visible&&r.castShadow){r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld);b.renderImmediateObject(t,j.__lights,null,c,r)}}}m=b.getClearColor();p=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,e,g,h,i,l,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=0;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=0;d[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;e=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(p);b.compileShader(q);b.attachShader(m,p);b.attachShader(m,q);b.linkProgram(m);h=m;i={};l={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");l.uvOffset=b.getUniformLocation(h,"uvOffset");l.uvScale=b.getUniformLocation(h,
|
|
|
"uvScale");l.rotation=b.getUniformLocation(h,"rotation");l.scale=b.getUniformLocation(h,"scale");l.alignment=b.getUniformLocation(h,"alignment");l.color=b.getUniformLocation(h,"color");l.map=b.getUniformLocation(h,"map");l.opacity=b.getUniformLocation(h,"opacity");l.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");l.screenPosition=b.getUniformLocation(h,"screenPosition");l.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=false};this.render=function(d,f,p,q){var d=d.__webglSprites,o=d.length;if(o){var t=i,s=l,u=q/p,p=p*0.5,v=q*0.5,r=true;b.useProgram(h);if(!j){b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);j=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(t.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-g);b.uniformMatrix4fv(s.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(s.map,0);for(var A,x=[],t=0;t<o;t++){A=d[t];if(A.visible&&A.opacity!==0)if(A.useScreenCoordinates)A.z=-A.position.z;else{A._modelViewMatrix.multiply(f.matrixWorldInverse,A.matrixWorld);A.z=-A._modelViewMatrix.elements[14]}}d.sort(a);for(t=0;t<o;t++){A=d[t];if(A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width){if(A.useScreenCoordinates){b.uniform1i(s.useScreenCoordinates,1);
|
|
|
-b.uniform3f(s.screenPosition,(A.position.x-p)/p,(v-A.position.y)/v,Math.max(0,Math.min(1,A.position.z)))}else{b.uniform1i(s.useScreenCoordinates,0);b.uniform1i(s.affectedByDistance,A.affectedByDistance?1:0);b.uniformMatrix4fv(s.modelViewMatrix,false,A._modelViewMatrix.elements)}f=A.map.image.width/(A.scaleByViewport?q:1);x[0]=f*u*A.scale.x;x[1]=f*A.scale.y;b.uniform2f(s.uvScale,A.uvScale.x,A.uvScale.y);b.uniform2f(s.uvOffset,A.uvOffset.x,A.uvOffset.y);b.uniform2f(s.alignment,A.alignment.x,A.alignment.y);
|
|
|
-b.uniform1f(s.opacity,A.opacity);b.uniform3f(s.color,A.color.r,A.color.g,A.color.b);b.uniform1f(s.rotation,A.rotation);b.uniform2fv(s.scale,x);if(A.mergeWith3D&&!r){b.enable(b.DEPTH_TEST);r=true}else if(!A.mergeWith3D&&r){b.disable(b.DEPTH_TEST);r=false}c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst);c.setTexture(A.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
+l.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j=false};this.render=function(d,f,p,q){var d=d.__webglSprites,o=d.length;if(o){var t=i,r=l,u=q/p,p=p*0.5,v=q*0.5,s=true;b.useProgram(h);if(!j){b.enableVertexAttribArray(t.position);b.enableVertexAttribArray(t.uv);j=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(t.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+g);b.uniformMatrix4fv(r.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var A,x=[],t=0;t<o;t++){A=d[t];if(A.visible&&A.opacity!==0)if(A.useScreenCoordinates)A.z=-A.position.z;else{A._modelViewMatrix.multiply(f.matrixWorldInverse,A.matrixWorld);A.z=-A._modelViewMatrix.elements[14]}}d.sort(a);for(t=0;t<o;t++){A=d[t];if(A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width){if(A.useScreenCoordinates){b.uniform1i(r.useScreenCoordinates,1);
|
|
|
+b.uniform3f(r.screenPosition,(A.position.x-p)/p,(v-A.position.y)/v,Math.max(0,Math.min(1,A.position.z)))}else{b.uniform1i(r.useScreenCoordinates,0);b.uniform1i(r.affectedByDistance,A.affectedByDistance?1:0);b.uniformMatrix4fv(r.modelViewMatrix,false,A._modelViewMatrix.elements)}f=A.map.image.width/(A.scaleByViewport?q:1);x[0]=f*u*A.scale.x;x[1]=f*A.scale.y;b.uniform2f(r.uvScale,A.uvScale.x,A.uvScale.y);b.uniform2f(r.uvOffset,A.uvOffset.x,A.uvOffset.y);b.uniform2f(r.alignment,A.alignment.x,A.alignment.y);
|
|
|
+b.uniform1f(r.opacity,A.opacity);b.uniform3f(r.color,A.color.r,A.color.g,A.color.b);b.uniform1f(r.rotation,A.rotation);b.uniform2fv(r.scale,x);if(A.mergeWith3D&&!s){b.enable(b.DEPTH_TEST);s=true}else if(!A.mergeWith3D&&s){b.disable(b.DEPTH_TEST);s=false}c.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst);c.setTexture(A.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,f=new THREE.Frustum,e=new THREE.Matrix4;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:true});c._shadowPass=true;d._shadowPass=true};this.render=
|
|
|
function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,l,j,n,m,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&g.updateMatrixWorld();if(!h._viewMatrixArray)h._viewMatrixArray=new Float32Array(16);if(!h._projectionMatrixArray)h._projectionMatrixArray=new Float32Array(16);h.matrixWorldInverse.getInverse(h.matrixWorld);h.matrixWorldInverse.flattenToArray(h._viewMatrixArray);h.projectionMatrix.flattenToArray(h._projectionMatrixArray);e.multiply(h.projectionMatrix,
|
|
|
h.matrixWorldInverse);f.setFromMatrix(e);b.setRenderTarget(this.renderTarget);b.clear();p=g.__webglObjects;i=0;for(l=p.length;i<l;i++){j=p[i];m=j.object;j.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);j.render=true}}i=0;for(l=p.length;i<l;i++){j=p[i];if(j.render){m=j.object;j=j.buffer;m.material&&b.setMaterialFaces(m.material);n=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|