|
@@ -18,9 +18,9 @@ THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;
|
|
|
sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):
|
|
|
this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=
|
|
|
(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},angleTo:function(a){return Math.acos(this.dot(a)/this.length()/a.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
|
|
|
-a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],h=d[1],i=d[5],j=d[9],l=d[2],n=d[6],d=d[10];void 0===b||"XYZ"===b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-e,f)):(this.x=Math.atan2(n,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?
|
|
|
-(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-l,f),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(n)),0.99999>Math.abs(n)?(this.y=Math.atan2(-l,d),this.z=Math.atan2(-e,i)):(this.y=0,this.z=Math.atan2(h,f))):"ZYX"===b?(this.y=Math.asin(-c(l)),0.99999>Math.abs(l)?(this.x=Math.atan2(n,d),this.z=Math.atan2(h,f)):(this.x=0,this.z=Math.atan2(-e,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-l,f)):(this.x=0,this.y=Math.atan2(g,d))):
|
|
|
-"XZY"===b&&(this.z=Math.asin(-c(e)),0.99999>Math.abs(e)?(this.x=Math.atan2(n,i),this.y=Math.atan2(g,f)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*
|
|
|
+a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setEulerFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,f=d[0],e=d[4],g=d[8],h=d[1],i=d[5],j=d[9],l=d[2],m=d[6],d=d[10];void 0===b||"XYZ"===b?(this.y=Math.asin(c(g)),0.99999>Math.abs(g)?(this.x=Math.atan2(-j,d),this.z=Math.atan2(-e,f)):(this.x=Math.atan2(m,i),this.z=0)):"YXZ"===b?(this.x=Math.asin(-c(j)),0.99999>Math.abs(j)?
|
|
|
+(this.y=Math.atan2(g,d),this.z=Math.atan2(h,i)):(this.y=Math.atan2(-l,f),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(m)),0.99999>Math.abs(m)?(this.y=Math.atan2(-l,d),this.z=Math.atan2(-e,i)):(this.y=0,this.z=Math.atan2(h,f))):"ZYX"===b?(this.y=Math.asin(-c(l)),0.99999>Math.abs(l)?(this.x=Math.atan2(m,d),this.z=Math.atan2(h,f)):(this.x=0,this.z=Math.atan2(-e,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-l,f)):(this.x=0,this.y=Math.atan2(g,d))):
|
|
|
+"XZY"===b&&(this.z=Math.asin(-c(e)),0.99999>Math.abs(e)?(this.x=Math.atan2(m,i),this.y=Math.atan2(g,f)):(this.x=Math.atan2(-j,d),this.y=0));return this},setEulerFromQuaternion:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.x*a.x,f=a.y*a.y,e=a.z*a.z,g=a.w*a.w;void 0===b||"XYZ"===b?(this.x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-d-f+e),this.y=Math.asin(c(2*(a.x*a.z+a.y*a.w))),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+d-f-e)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*
|
|
|
(a.x*a.z+a.y*a.w),g-d-f+e),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+f-e)):"ZXY"===b?(this.x=Math.asin(c(2*(a.x*a.w+a.y*a.z))),this.y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-d-f+e),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+f-e)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-f+e),this.y=Math.asin(c(2*(a.y*a.w-a.x*a.z))),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+d-f-e)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+f-e),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-f-e),this.z=Math.asin(c(2*(a.x*a.y+
|
|
|
a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+f-e),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-f-e),this.z=Math.asin(c(2*(a.z*a.w-a.x*a.y))));return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();this.x=b;this.y=c;this.z=a;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},
|
|
|
isZero:function(a){return this.lengthSq()<(void 0!==a?a:1E-4)},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
@@ -30,40 +30,40 @@ Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return
|
|
|
(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,f=a[0];d=a[4];var e=a[8],g=a[1],h=a[5],i=a[9];c=a[2];b=a[6];var j=a[10];if(0.01>Math.abs(d-g)&&0.01>Math.abs(e-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(e+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(f+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;f=(f+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;e=(e+c)/4;i=(i+b)/4;f>h&&f>j?0.01>f?(b=0,d=c=0.707106781):(b=Math.sqrt(f),c=d/b,d=e/
|
|
|
b):h>j?0.01>h?(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):0.01>j?(c=b=0.707106781,d=0):(d=Math.sqrt(j),b=e/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(e-c)*(e-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(e-c)/a;this.z=(g-d)/a;this.w=Math.acos((f+h+j-1)/2);return this}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
|
|
|
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],j=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*f+b[2]*h;0===b&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,l=this.elements;l[0]=b*a;l[1]=b*c;l[2]=b*d;l[3]=b*f;l[4]=b*e;l[5]=b*g;l[6]=b*h;l[7]=b*i;l[8]=b*j;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,j,l,n,m,o,q,p){this.elements=new Float32Array(16);this.set(void 0!==a?a:1,b||0,c||0,d||0,f||0,void 0!==e?e:1,g||0,h||0,i||0,j||0,void 0!==l?l:1,n||0,m||0,o||0,q||0,void 0!==p?p:1)};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,j,l,n,m,o,q,p){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=f;s[5]=e;s[9]=g;s[13]=h;s[2]=i;s[6]=j;s[10]=l;s[14]=n;s[3]=m;s[7]=o;s[11]=q;s[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){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();0===g.length()&&(g.z=1);f.cross(c,g).normalize();0===f.length()&&(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],j=c[1],l=c[5],n=c[9],m=c[13],o=c[2],q=c[6],p=c[10],s=c[14],t=c[3],B=c[7],u=c[11],c=c[15],r=d[0],y=d[4],z=d[8],
|
|
|
-w=d[12],A=d[1],F=d[5],C=d[9],D=d[13],K=d[2],I=d[6],L=d[10],H=d[14],J=d[3],O=d[7],P=d[11],d=d[15];f[0]=e*r+g*A+h*K+i*J;f[4]=e*y+g*F+h*I+i*O;f[8]=e*z+g*C+h*L+i*P;f[12]=e*w+g*D+h*H+i*d;f[1]=j*r+l*A+n*K+m*J;f[5]=j*y+l*F+n*I+m*O;f[9]=j*z+l*C+n*L+m*P;f[13]=j*w+l*D+n*H+m*d;f[2]=o*r+q*A+p*K+s*J;f[6]=o*y+q*F+p*I+s*O;f[10]=o*z+q*C+p*L+s*P;f[14]=o*w+q*D+p*H+s*d;f[3]=t*r+B*A+u*K+c*J;f[7]=t*y+B*F+u*I+c*O;f[11]=t*z+B*C+u*L+c*P;f[15]=t*w+B*D+u*H+c*d;return this},multiplySelf:function(a){return this.multiply(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,j,l,m,n,p,o,q){this.elements=new Float32Array(16);this.set(void 0!==a?a:1,b||0,c||0,d||0,f||0,void 0!==e?e:1,g||0,h||0,i||0,j||0,void 0!==l?l:1,m||0,n||0,p||0,o||0,void 0!==q?q:1)};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,e,g,h,i,j,l,m,n,p,o,q){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=f;s[5]=e;s[9]=g;s[13]=h;s[2]=i;s[6]=j;s[10]=l;s[14]=m;s[3]=n;s[7]=p;s[11]=o;s[15]=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){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();0===g.length()&&(g.z=1);f.cross(c,g).normalize();0===f.length()&&(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],j=c[1],l=c[5],m=c[9],n=c[13],p=c[2],o=c[6],q=c[10],s=c[14],t=c[3],A=c[7],u=c[11],c=c[15],r=d[0],B=d[4],y=d[8],
|
|
|
+w=d[12],z=d[1],C=d[5],D=d[9],F=d[13],I=d[2],G=d[6],M=d[10],J=d[14],K=d[3],N=d[7],O=d[11],d=d[15];f[0]=e*r+g*z+h*I+i*K;f[4]=e*B+g*C+h*G+i*N;f[8]=e*y+g*D+h*M+i*O;f[12]=e*w+g*F+h*J+i*d;f[1]=j*r+l*z+m*I+n*K;f[5]=j*B+l*C+m*G+n*N;f[9]=j*y+l*D+m*M+n*O;f[13]=j*w+l*F+m*J+n*d;f[2]=p*r+o*z+q*I+s*K;f[6]=p*B+o*C+q*G+s*N;f[10]=p*y+o*D+q*M+s*O;f[14]=p*w+o*F+q*J+s*d;f[3]=t*r+A*z+u*I+c*K;f[7]=t*B+A*C+u*G+c*N;f[11]=t*y+A*D+u*M+c*O;f[15]=t*w+A*F+u*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]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){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+=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],j=a[2],l=a[6],n=a[10],m=a[14],o=a[3],q=a[7],p=a[11],a=a[15];return f*h*l*o-d*i*l*o-f*g*n*o+c*i*n*o+d*g*m*o-c*h*m*o-f*h*j*q+d*i*j*q+f*e*n*q-b*i*n*q-d*e*m*q+b*h*m*q+f*g*j*p-c*i*j*p-f*e*l*p+b*i*l*p+c*e*m*p-b*g*m*p-d*g*j*a+c*h*j*a+d*e*l*a-b*h*l*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=
|
|
|
+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],j=a[2],l=a[6],m=a[10],n=a[14],p=a[3],o=a[7],q=a[11],a=a[15];return f*h*l*p-d*i*l*p-f*g*m*p+c*i*m*p+d*g*n*p-c*h*n*p-f*h*j*o+d*i*j*o+f*e*m*o-b*i*m*o-d*e*n*o+b*h*n*o+f*g*j*q-c*i*j*q-f*e*l*q+b*i*l*q+c*e*n*q-b*g*n*q-d*g*j*a+c*h*j*a+d*e*l*a-b*h*l*a-c*e*m*a+b*g*m*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],j=c[9],l=c[13],n=c[2],m=c[6],o=c[10],q=c[14],p=c[3],s=c[7],t=c[11],c=c[15];b[0]=j*q*s-l*o*s+l*m*t-i*q*t-j*m*c+i*o*c;b[4]=g*o*s-e*q*s-g*m*t+f*q*t+e*m*c-f*o*c;b[8]=e*l*s-g*j*s+g*i*t-f*l*t-e*i*c+f*j*c;b[12]=g*j*m-e*l*m-g*i*o+f*l*o+e*i*q-f*j*q;b[1]=l*o*p-j*q*p-l*n*t+h*q*t+j*n*c-h*o*c;b[5]=e*q*p-g*o*p+g*n*t-d*q*t-e*n*c+d*o*c;b[9]=g*j*p-e*l*p-g*h*t+d*l*t+e*h*c-d*j*c;b[13]=e*l*n-g*j*n+g*h*o-d*l*o-e*h*q+d*j*q;b[2]=i*q*p-l*m*p+l*n*s-h*q*
|
|
|
-s-i*n*c+h*m*c;b[6]=g*m*p-f*q*p-g*n*s+d*q*s+f*n*c-d*m*c;b[10]=f*l*p-g*i*p+g*h*s-d*l*s-f*h*c+d*i*c;b[14]=g*i*n-f*l*n-g*h*m+d*l*m+f*h*q-d*i*q;b[3]=j*m*p-i*o*p-j*n*s+h*o*s+i*n*t-h*m*t;b[7]=f*o*p-e*m*p+e*n*s-d*o*s-f*n*t+d*m*t;b[11]=e*i*p-f*j*p-e*h*s+d*j*s+f*h*t-d*i*t;b[15]=f*j*n-e*i*n+e*h*m-d*j*m-f*h*o+d*i*o;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(void 0===b||"XYZ"===b){var j=g*i,l=g*e,n=d*i,m=d*e;c[0]=h*i;c[4]=-h*e;c[8]=f;c[1]=l+n*f;c[5]=j-m*f;c[9]=-d*h;c[2]=m-j*f;c[6]=n+l*f;c[10]=g*h}else"YXZ"===b?(j=h*i,l=h*e,n=f*i,m=f*e,c[0]=j+m*d,c[4]=n*d-l,c[8]=g*f,c[1]=g*e,c[5]=g*i,c[9]=-d,c[2]=l*d-n,c[6]=m+j*d,c[10]=g*h):"ZXY"===b?(j=h*i,l=h*e,n=f*i,m=f*e,c[0]=j-m*d,c[4]=-g*e,c[8]=n+l*d,c[1]=l+n*d,c[5]=g*i,c[9]=m-j*d,c[2]=-g*f,c[6]=d,c[10]=g*h):"ZYX"===b?(j=g*i,l=g*e,n=d*i,m=d*e,c[0]=h*i,c[4]=n*f-l,c[8]=j*f+m,c[1]=h*e,c[5]=m*f+j,c[9]=
|
|
|
-l*f-n,c[2]=-f,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,l=g*f,n=d*h,m=d*f,c[0]=h*i,c[4]=m-j*e,c[8]=n*e+l,c[1]=e,c[5]=g*i,c[9]=-d*i,c[2]=-f*i,c[6]=l*e+n,c[10]=j-m*e):"XZY"===b&&(j=g*h,l=g*f,n=d*h,m=d*f,c[0]=h*i,c[4]=-e,c[8]=f*i,c[1]=j*e+m,c[5]=g*i,c[9]=l*e-n,c[2]=n*e-l,c[6]=d*i,c[10]=m*e+j);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,j=c*h,c=c*i,l=d*h,d=d*i,f=f*i,g=e*g,h=e*h,e=e*i;b[0]=1-(l+f);b[4]=j-e;b[8]=c+h;b[1]=j+e;b[5]=1-(a+
|
|
|
+this.elements,c=a.elements,d=c[0],f=c[4],e=c[8],g=c[12],h=c[1],i=c[5],j=c[9],l=c[13],m=c[2],n=c[6],p=c[10],o=c[14],q=c[3],s=c[7],t=c[11],c=c[15];b[0]=j*o*s-l*p*s+l*n*t-i*o*t-j*n*c+i*p*c;b[4]=g*p*s-e*o*s-g*n*t+f*o*t+e*n*c-f*p*c;b[8]=e*l*s-g*j*s+g*i*t-f*l*t-e*i*c+f*j*c;b[12]=g*j*n-e*l*n-g*i*p+f*l*p+e*i*o-f*j*o;b[1]=l*p*q-j*o*q-l*m*t+h*o*t+j*m*c-h*p*c;b[5]=e*o*q-g*p*q+g*m*t-d*o*t-e*m*c+d*p*c;b[9]=g*j*q-e*l*q-g*h*t+d*l*t+e*h*c-d*j*c;b[13]=e*l*m-g*j*m+g*h*p-d*l*p-e*h*o+d*j*o;b[2]=i*o*q-l*n*q+l*m*s-h*o*
|
|
|
+s-i*m*c+h*n*c;b[6]=g*n*q-f*o*q-g*m*s+d*o*s+f*m*c-d*n*c;b[10]=f*l*q-g*i*q+g*h*s-d*l*s-f*h*c+d*i*c;b[14]=g*i*m-f*l*m-g*h*n+d*l*n+f*h*o-d*i*o;b[3]=j*n*q-i*p*q-j*m*s+h*p*s+i*m*t-h*n*t;b[7]=f*p*q-e*n*q+e*m*s-d*p*s-f*m*t+d*n*t;b[11]=e*i*q-f*j*q-e*h*s+d*j*s+f*h*t-d*i*t;b[15]=f*j*m-e*i*m+e*h*n-d*j*n-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(void 0===b||"XYZ"===b){var j=g*i,l=g*e,m=d*i,n=d*e;c[0]=h*i;c[4]=-h*e;c[8]=f;c[1]=l+m*f;c[5]=j-n*f;c[9]=-d*h;c[2]=n-j*f;c[6]=m+l*f;c[10]=g*h}else"YXZ"===b?(j=h*i,l=h*e,m=f*i,n=f*e,c[0]=j+n*d,c[4]=m*d-l,c[8]=g*f,c[1]=g*e,c[5]=g*i,c[9]=-d,c[2]=l*d-m,c[6]=n+j*d,c[10]=g*h):"ZXY"===b?(j=h*i,l=h*e,m=f*i,n=f*e,c[0]=j-n*d,c[4]=-g*e,c[8]=m+l*d,c[1]=l+m*d,c[5]=g*i,c[9]=n-j*d,c[2]=-g*f,c[6]=d,c[10]=g*h):"ZYX"===b?(j=g*i,l=g*e,m=d*i,n=d*e,c[0]=h*i,c[4]=m*f-l,c[8]=j*f+n,c[1]=h*e,c[5]=n*f+j,c[9]=
|
|
|
+l*f-m,c[2]=-f,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,l=g*f,m=d*h,n=d*f,c[0]=h*i,c[4]=n-j*e,c[8]=m*e+l,c[1]=e,c[5]=g*i,c[9]=-d*i,c[2]=-f*i,c[6]=l*e+m,c[10]=j-n*e):"XZY"===b&&(j=g*h,l=g*f,m=d*h,n=d*f,c[0]=h*i,c[4]=-e,c[8]=f*i,c[1]=j*e+n,c[5]=g*i,c[9]=l*e-m,c[2]=m*e-l,c[6]=d*i,c[10]=n*e+j);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,j=c*h,c=c*i,l=d*h,d=d*i,f=f*i,g=e*g,h=e*h,e=e*i;b[0]=1-(l+f);b[4]=j-e;b[8]=c+h;b[1]=j+e;b[5]=1-(a+
|
|
|
f);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+l);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]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=
|
|
|
b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=f.length();c.y=e.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]/=c.x;d.elements[1]/=c.x;d.elements[2]/=c.x;d.elements[4]/=c.y;d.elements[5]/=c.y;d.elements[6]/=c.y;d.elements[8]/=c.z;d.elements[9]/=c.z;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],j=b[11],l=Math.cos(a),a=Math.sin(a);b[4]=l*c+a*g;b[5]=l*d+a*h;b[6]=l*f+a*i;b[7]=l*e+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*f;b[11]=l*j-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],j=b[11],l=Math.cos(a),a=Math.sin(a);b[0]=l*c-a*g;b[1]=l*d-a*h;b[2]=l*f-a*i;b[3]=l*e-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=
|
|
|
l*i+a*f;b[11]=l*j+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],j=b[7],l=Math.cos(a),a=Math.sin(a);b[0]=l*c+a*g;b[1]=l*d+a*h;b[2]=l*f+a*i;b[3]=l*e+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*f;b[7]=l*j-a*e;return this},rotateByAxis:function(a,b){var c=this.elements;if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)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,j=Math.cos(b),l=Math.sin(b),n=1-j,m=d*f*n,o=d*e*n,n=f*e*n,d=d*l,q=f*l,l=e*l,e=g+(1-g)*j,g=m+l,f=o-q,m=m-l,h=h+(1-h)*j,l=n+d,o=o+q,n=n-d,i=i+(1-i)*j,j=c[0],d=c[1],q=c[2],p=c[3],s=c[4],t=c[5],B=c[6],u=c[7],r=c[8],y=c[9],z=c[10],w=c[11];c[0]=e*j+g*s+f*r;c[1]=e*d+g*t+f*y;c[2]=e*q+g*B+f*z;c[3]=e*p+g*u+f*w;c[4]=m*j+h*s+l*r;c[5]=m*d+h*t+l*y;c[6]=m*q+h*B+l*z;c[7]=m*p+h*u+l*w;c[8]=o*j+n*s+i*r;c[9]=o*d+n*t+i*y;c[10]=o*q+n*B+i*z;c[11]=o*p+n*u+i*w;
|
|
|
+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,j=Math.cos(b),l=Math.sin(b),m=1-j,n=d*f*m,p=d*e*m,m=f*e*m,d=d*l,o=f*l,l=e*l,e=g+(1-g)*j,g=n+l,f=p-o,n=n-l,h=h+(1-h)*j,l=m+d,p=p+o,m=m-d,i=i+(1-i)*j,j=c[0],d=c[1],o=c[2],q=c[3],s=c[4],t=c[5],A=c[6],u=c[7],r=c[8],B=c[9],y=c[10],w=c[11];c[0]=e*j+g*s+f*r;c[1]=e*d+g*t+f*B;c[2]=e*o+g*A+f*y;c[3]=e*q+g*u+f*w;c[4]=n*j+h*s+l*r;c[5]=n*d+h*t+l*B;c[6]=n*o+h*A+l*y;c[7]=n*q+h*u+l*w;c[8]=p*j+m*s+i*r;c[9]=p*d+m*t+i*B;c[10]=p*o+m*A+i*y;c[11]=p*q+m*u+i*w;
|
|
|
return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);
|
|
|
this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,e=a.x,g=a.y,h=a.z,i=f*e,j=f*g;this.set(i*e+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*e,0,i*h-d*g,j*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,j=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/j;g[14]=-((e+f)/j);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],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
|
|
|
-THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],n=c[9],m=c[10],o=c[11],q=c[12],p=c[13],s=c[14],c=c[15];b[0].set(e-a,j-g,o-l,c-q);b[1].set(e+a,j+g,o+l,c+q);b[2].set(e+d,j+h,o+n,c+p);b[3].set(e-d,j-h,o-n,c-p);b[4].set(e-f,j-i,o-m,c-s);b[5].set(e+f,j+i,o+m,c+s);for(d=0;6>d;d++)a=b[d],a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))};
|
|
|
+THREE.Frustum.prototype.setFromMatrix=function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],f=c[2],e=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],m=c[9],n=c[10],p=c[11],o=c[12],q=c[13],s=c[14],c=c[15];b[0].set(e-a,j-g,p-l,c-o);b[1].set(e+a,j+g,p+l,c+o);b[2].set(e+d,j+h,p+m,c+q);b[3].set(e-d,j-h,p-m,c-q);b[4].set(e-f,j-i,p-n,c-s);b[5].set(e+f,j+i,p+n,c+s);for(d=0;6>d;d++)a=b[d],a.divideScalar(Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))};
|
|
|
THREE.Frustum.prototype.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),f=0;6>f;f++)if(b=c[f].x*d[12]+c[f].y*d[13]+c[f].z*d[14]+c[f].w,b<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
|
-(function(a){a.Ray=function(b,c,d,f){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=f||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,f=new a.Vector3,e=new a.Vector3,g=new a.Vector3,h=new a.Matrix4,i=function(a,b){return a.distance-b.distance},j=new a.Vector3,l=new a.Vector3,n=new a.Vector3,m=function(a,b,c){j.sub(c,a);var d=j.dot(b),a=l.add(a,n.copy(b).multiplyScalar(d));return c.distanceTo(a)},o=function(a,b,c,d){j.sub(d,b);l.sub(c,b);n.sub(a,
|
|
|
-b);var a=j.dot(j),b=j.dot(l),c=j.dot(n),f=l.dot(l),d=l.dot(n),e=1/(a*f-b*b),f=(f*c-b*d)*e,a=(a*d-b*c)*e;return 0<=f&&0<=a&&1>f+a},q=function(i,l,j){var n,p;if(i instanceof a.Particle){n=m(l.origin,l.direction,i.matrixWorld.getPosition());if(n>i.scale.x)return j;p={distance:n,point:i.position,face:null,object:i};j.push(p)}else if(i instanceof a.Mesh){var q=i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis();n=m(l.origin,l.direction,i.matrixWorld.getPosition());if(n>q)return j;var z,
|
|
|
-w,A=i.geometry,F=A.vertices,C,D,K;C=i.geometry.materials;D=i.material instanceof a.MeshFaceMaterial;var I,L=l.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);b.copy(l.origin);h.getInverse(i.matrixWorld);c.copy(b);h.multiplyVector3(c);d.copy(l.direction);h.rotateAxis(d).normalize();q=0;for(z=A.faces.length;q<z;q++)if(p=A.faces[q],n=!0===D?C[p.materialIndex]:i.material,void 0!==n&&(K=n.side,f.sub(p.centroid,c),e=p.normal,n=d.dot(e),!(Math.abs(n)<L)&&(w=e.dot(f)/n,!(0>w)&&(K===a.DoubleSide||
|
|
|
-(K===a.FrontSide?0>n:0<n)))))if(g.add(c,d.multiplyScalar(w)),p instanceof a.Face3)n=F[p.a],w=F[p.b],K=F[p.c],o(g,n,w,K)&&(w=i.matrixWorld.multiplyVector3(g.clone()),n=b.distanceTo(w),n<l.near||n>l.far||(p={distance:n,point:w,face:p,faceIndex:q,object:i},j.push(p)));else if(p instanceof a.Face4&&(n=F[p.a],w=F[p.b],K=F[p.c],I=F[p.d],o(g,n,w,I)||o(g,w,K,I)))w=i.matrixWorld.multiplyVector3(g.clone()),n=b.distanceTo(w),n<l.near||n>l.far||(p={distance:n,point:w,face:p,faceIndex:q,object:i},j.push(p))}},
|
|
|
-p=function(a,b,c){for(var a=a.getDescendants(),d=0,f=a.length;d<f;d++)q(a[d],b,c)};a.Ray.prototype.precision=1E-4;a.Ray.prototype.set=function(a,b){this.origin=a;this.direction=b};a.Ray.prototype.intersectObject=function(a,b){var c=[];!0===b&&p(a,this,c);q(a,this,c);c.sort(i);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)q(a[d],this,c),!0===b&&p(a[d],this,c);c.sort(i);return c}})(THREE);
|
|
|
-THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,l,n){h=!1;b=e;c=g;d=l;f=n;a()};this.addPoint=function(e,g){!0===h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>
|
|
|
-g?f:g);a()};this.add3Points=function(e,g,l,n,m,o){!0===h?(h=!1,b=e<l?e<m?e:m:l<m?l:m,c=g<n?g<o?g:o:n<o?n:o,d=e>l?e>m?e:m:l>m?l:m,f=g>n?g>o?g:o:n>o?n:o):(b=e<l?e<m?e<b?e:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b,c=g<n?g<o?g<c?g:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=e>l?e>m?e>d?e:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d,f=g>n?g>o?g>f?g:f:o>f?o:f:n>o?n>f?n:f:o>f?o:f);a()};this.addRectangle=function(e){!0===h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),
|
|
|
+(function(a){a.Ray=function(b,c,d,f){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=f||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,f=new a.Vector3,e=new a.Vector3,g=new a.Vector3,h=new a.Matrix4,i=function(a,b){return a.distance-b.distance},j=new a.Vector3,l=new a.Vector3,m=new a.Vector3,n=function(a,b,c){j.sub(c,a);var d=j.dot(b),a=l.add(a,m.copy(b).multiplyScalar(d));return c.distanceTo(a)},p=function(a,b,c,d){j.sub(d,b);l.sub(c,b);m.sub(a,
|
|
|
+b);var a=j.dot(j),b=j.dot(l),c=j.dot(m),f=l.dot(l),d=l.dot(m),e=1/(a*f-b*b),f=(f*c-b*d)*e,a=(a*d-b*c)*e;return 0<=f&&0<=a&&1>f+a},o=function(i,l,j){var m,o;if(i instanceof a.Particle){m=n(l.origin,l.direction,i.matrixWorld.getPosition());if(m>i.scale.x)return j;o={distance:m,point:i.position,face:null,object:i};j.push(o)}else if(i instanceof a.Mesh){var q=i.geometry.boundingSphere.radius*i.matrixWorld.getMaxScaleOnAxis();m=n(l.origin,l.direction,i.matrixWorld.getPosition());if(m>q)return j;var y,
|
|
|
+w,z=i.geometry,C=z.vertices,D,F,I;D=i.geometry.materials;F=i.material instanceof a.MeshFaceMaterial;var G,M=l.precision;i.matrixRotationWorld.extractRotation(i.matrixWorld);b.copy(l.origin);h.getInverse(i.matrixWorld);c.copy(b);h.multiplyVector3(c);d.copy(l.direction);h.rotateAxis(d).normalize();q=0;for(y=z.faces.length;q<y;q++)if(o=z.faces[q],m=!0===F?D[o.materialIndex]:i.material,void 0!==m&&(I=m.side,f.sub(o.centroid,c),e=o.normal,m=d.dot(e),!(Math.abs(m)<M)&&(w=e.dot(f)/m,!(0>w)&&(I===a.DoubleSide||
|
|
|
+(I===a.FrontSide?0>m:0<m)))))if(g.add(c,d.multiplyScalar(w)),o instanceof a.Face3)m=C[o.a],w=C[o.b],I=C[o.c],p(g,m,w,I)&&(w=i.matrixWorld.multiplyVector3(g.clone()),m=b.distanceTo(w),m<l.near||m>l.far||(o={distance:m,point:w,face:o,faceIndex:q,object:i},j.push(o)));else if(o instanceof a.Face4&&(m=C[o.a],w=C[o.b],I=C[o.c],G=C[o.d],p(g,m,w,G)||p(g,w,I,G)))w=i.matrixWorld.multiplyVector3(g.clone()),m=b.distanceTo(w),m<l.near||m>l.far||(o={distance:m,point:w,face:o,faceIndex:q,object:i},j.push(o))}},
|
|
|
+q=function(a,b,c){for(var a=a.getDescendants(),d=0,f=a.length;d<f;d++)o(a[d],b,c)};a.Ray.prototype.precision=1E-4;a.Ray.prototype.set=function(a,b){this.origin=a;this.direction=b};a.Ray.prototype.intersectObject=function(a,b){var c=[];!0===b&&q(a,this,c);o(a,this,c);c.sort(i);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,f=a.length;d<f;d++)o(a[d],this,c),!0===b&&q(a[d],this,c);c.sort(i);return c}})(THREE);
|
|
|
+THREE.Rectangle=function(){function a(){e=d-b;g=f-c}var b=0,c=0,d=0,f=0,e=0,g=0,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return e};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(e,g,l,m){h=!1;b=e;c=g;d=l;f=m;a()};this.addPoint=function(e,g){!0===h?(h=!1,b=e,c=g,d=e,f=g):(b=b<e?b:e,c=c<g?c:g,d=d>e?d:e,f=f>
|
|
|
+g?f:g);a()};this.add3Points=function(e,g,l,m,n,p){!0===h?(h=!1,b=e<l?e<n?e:n:l<n?l:n,c=g<m?g<p?g:p:m<p?m:p,d=e>l?e>n?e:n:l>n?l:n,f=g>m?g>p?g:p:m>p?m:p):(b=e<l?e<n?e<b?e:b:n<b?n:b:l<n?l<b?l:b:n<b?n:b,c=g<m?g<p?g<c?g:c:p<c?p:c:m<p?m<c?m:c:p<c?p:c,d=e>l?e>n?e>d?e:d:n>d?n:d:l>n?l>d?l:d:n>d?n:d,f=g>m?g>p?g>f?g:f:p>f?p:f:m>p?m>f?m:f:p>f?p:f);a()};this.addRectangle=function(e){!0===h?(h=!1,b=e.getLeft(),c=e.getTop(),d=e.getRight(),f=e.getBottom()):(b=b<e.getLeft()?b:e.getLeft(),c=c<e.getTop()?c:e.getTop(),
|
|
|
d=d>e.getRight()?d:e.getRight(),f=f>e.getBottom()?f:e.getBottom());a()};this.inflate=function(e){b-=e;c-=e;d+=e;f+=e;a()};this.minSelf=function(e){b=b>e.getLeft()?b:e.getLeft();c=c>e.getTop()?c:e.getTop();d=d<e.getRight()?d:e.getRight();f=f<e.getBottom()?f:e.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||f<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
|
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0}};
|
|
|
THREE.Object3D=function(){THREE.Object3DLibrary.push(this);this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=
|
|
@@ -76,25 +76,25 @@ if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.s
|
|
|
c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;
|
|
|
a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.boundRadius=this.boundRadius;a.boundRadiusScale=this.boundRadiusScale;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;return a},deallocate:function(){var a=THREE.Object3DLibrary.indexOf(this);-1!==a&&THREE.Object3DLibrary.splice(a,1)}};THREE.Object3D.__m1=new THREE.Matrix4;
|
|
|
THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Object3DLibrary=[];
|
|
|
-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(j===n){var a=new THREE.RenderableVertex;l.push(a);n++;j++;return a}return l[j++]}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(0<=f&&0<=e&&0<=g&&0<=h)return!0;if(0>f&&0>e||0>g&&0>h)return!1;0>f?c=Math.max(c,f/(f-e)):0>e&&(d=Math.min(d,f/(f-e)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
-c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var f,e,g=[],h=0,i,j,l=[],n=0,m,o,q=[],p=0,s,t=[],B=0,u,r,y=[],z=0,w,A,F=[],C=0,D={objects:[],sprites:[],lights:[],elements:[]},K=new THREE.Vector3,I=new THREE.Vector4,L=new THREE.Matrix4,H=new THREE.Matrix4,J=new THREE.Frustum,O=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 Z=h.near,sa=h.far,R=!1,ia,Q,fa,W,$,ea,Y,ca,Ia,La,Ea,ua,ra,Ma,kb,cb;A=r=s=o=0;D.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&
|
|
|
-h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);L.multiply(h.projectionMatrix,h.matrixWorldInverse);J.setFromMatrix(L);e=0;D.objects.length=0;D.sprites.length=0;D.lights.length=0;var Ua=function(b){for(var c=0,d=b.children.length;c<d;c++){var e=b.children[c];if(!1!==e.visible){if(e instanceof THREE.Light)D.lights.push(e);else if(e instanceof THREE.Mesh||e instanceof THREE.Line){if(!1===e.frustumCulled||!0===J.contains(e))f=a(),f.object=e,null!==e.renderDepth?f.z=e.renderDepth:
|
|
|
-(K.copy(e.matrixWorld.getPosition()),L.multiplyVector3(K),f.z=K.z),D.objects.push(f)}else e instanceof THREE.Sprite||e instanceof THREE.Particle?(f=a(),f.object=e,null!==e.renderDepth?f.z=e.renderDepth:(K.copy(e.matrixWorld.getPosition()),L.multiplyVector3(K),f.z=K.z),D.sprites.push(f)):(f=a(),f.object=e,null!==e.renderDepth?f.z=e.renderDepth:(K.copy(e.matrixWorld.getPosition()),L.multiplyVector3(K),f.z=K.z),D.objects.push(f));Ua(e)}}};Ua(g);!0===n&&D.objects.sort(c);g=0;for(n=D.objects.length;g<
|
|
|
-n;g++)if(ca=D.objects[g].object,Ia=ca.matrixWorld,j=0,ca instanceof THREE.Mesh){La=ca.geometry;Ea=ca.geometry.materials;fa=La.vertices;ua=La.faces;Ma=La.faceVertexUvs;La=ca.matrixRotationWorld.extractRotation(Ia);kb=ca.material instanceof THREE.MeshFaceMaterial;ia=0;for(Q=fa.length;ia<Q;ia++)i=b(),i.positionWorld.copy(fa[ia]),Ia.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),L.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,
|
|
|
-i.visible=i.positionScreen.z>Z&&i.positionScreen.z<sa;fa=0;for(ia=ua.length;fa<ia;fa++)if(Q=ua[fa],cb=!0===kb?Ea[Q.materialIndex]:ca.material,void 0!==cb){ea=cb.side;if(Q instanceof THREE.Face3)if(W=l[Q.a],$=l[Q.b],Y=l[Q.c],!0===W.visible&&!0===$.visible&&!0===Y.visible)if(R=0>(Y.positionScreen.x-W.positionScreen.x)*($.positionScreen.y-W.positionScreen.y)-(Y.positionScreen.y-W.positionScreen.y)*($.positionScreen.x-W.positionScreen.x),ea===THREE.DoubleSide||R===(ea===THREE.FrontSide))o===p?(ra=new THREE.RenderableFace3,
|
|
|
-q.push(ra),p++,o++,m=ra):m=q[o++],m.v1.copy(W),m.v2.copy($),m.v3.copy(Y);else continue;else continue;else if(Q instanceof THREE.Face4)if(W=l[Q.a],$=l[Q.b],Y=l[Q.c],ra=l[Q.d],!0===W.visible&&!0===$.visible&&!0===Y.visible&&!0===ra.visible)if(R=0>(ra.positionScreen.x-W.positionScreen.x)*($.positionScreen.y-W.positionScreen.y)-(ra.positionScreen.y-W.positionScreen.y)*($.positionScreen.x-W.positionScreen.x)||0>($.positionScreen.x-Y.positionScreen.x)*(ra.positionScreen.y-Y.positionScreen.y)-($.positionScreen.y-
|
|
|
-Y.positionScreen.y)*(ra.positionScreen.x-Y.positionScreen.x),ea===THREE.DoubleSide||R===(ea===THREE.FrontSide)){if(s===B){var gb=new THREE.RenderableFace4;t.push(gb);B++;s++;m=gb}else m=t[s++];m.v1.copy(W);m.v2.copy($);m.v3.copy(Y);m.v4.copy(ra)}else continue;else continue;m.normalWorld.copy(Q.normal);!1===R&&(ea===THREE.BackSide||ea===THREE.DoubleSide)&&m.normalWorld.negate();La.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Q.centroid);Ia.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
|
|
|
-L.multiplyVector3(m.centroidScreen);Y=Q.vertexNormals;W=0;for($=Y.length;W<$;W++)ra=m.vertexNormalsWorld[W],ra.copy(Y[W]),!1===R&&(ea===THREE.BackSide||ea===THREE.DoubleSide)&&ra.negate(),La.multiplyVector3(ra);m.vertexNormalsLength=Y.length;W=0;for($=Ma.length;W<$;W++)if(ra=Ma[W][fa],void 0!==ra){ea=0;for(Y=ra.length;ea<Y;ea++)m.uvs[W][ea]=ra[ea]}m.color=Q.color;m.material=cb;m.z=m.centroidScreen.z;D.elements.push(m)}}else if(ca instanceof THREE.Line){H.multiply(L,Ia);fa=ca.geometry.vertices;W=b();
|
|
|
-W.positionScreen.copy(fa[0]);H.multiplyVector4(W.positionScreen);Ia=ca.type===THREE.LinePieces?2:1;ia=1;for(Q=fa.length;ia<Q;ia++)W=b(),W.positionScreen.copy(fa[ia]),H.multiplyVector4(W.positionScreen),0<(ia+1)%Ia||($=l[j-2],O.copy(W.positionScreen),P.copy($.positionScreen),!0===d(O,P)&&(O.multiplyScalar(1/O.w),P.multiplyScalar(1/P.w),r===z?(Ea=new THREE.RenderableLine,y.push(Ea),z++,r++,u=Ea):u=y[r++],u.v1.positionScreen.copy(O),u.v2.positionScreen.copy(P),u.z=Math.max(O.z,P.z),u.material=ca.material,
|
|
|
-D.elements.push(u)))}g=0;for(n=D.sprites.length;g<n;g++)ca=D.sprites[g].object,Ia=ca.matrixWorld,ca instanceof THREE.Particle&&(I.set(Ia.elements[12],Ia.elements[13],Ia.elements[14],1),L.multiplyVector4(I),I.z/=I.w,0<I.z&&1>I.z&&(A===C?(Z=new THREE.RenderableParticle,F.push(Z),C++,A++,w=Z):w=F[A++],w.object=ca,w.x=I.x/I.w,w.y=I.y/I.w,w.z=I.z,w.rotation=ca.rotation.z,w.scale.x=ca.scale.x*Math.abs(w.x-(I.x+h.projectionMatrix.elements[0])/(I.w+h.projectionMatrix.elements[12])),w.scale.y=ca.scale.y*Math.abs(w.y-
|
|
|
-(I.y+h.projectionMatrix.elements[5])/(I.w+h.projectionMatrix.elements[13])),w.material=ca.material,D.elements.push(w)));!0===M&&D.elements.sort(c);return D}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
|
|
|
+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(j===m){var a=new THREE.RenderableVertex;l.push(a);m++;j++;return a}return l[j++]}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(0<=f&&0<=e&&0<=g&&0<=h)return!0;if(0>f&&0>e||0>g&&0>h)return!1;0>f?c=Math.max(c,f/(f-e)):0>e&&(d=Math.min(d,f/(f-e)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
+c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var f,e,g=[],h=0,i,j,l=[],m=0,n,p,o=[],q=0,s,t=[],A=0,u,r,B=[],y=0,w,z,C=[],D=0,F={objects:[],sprites:[],lights:[],elements:[]},I=new THREE.Vector3,G=new THREE.Vector4,M=new THREE.Matrix4,J=new THREE.Matrix4,K=new THREE.Frustum,N=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);M.multiply(b.projectionMatrix,b.matrixWorldInverse);M.multiplyVector3(a);return a};this.unprojectVector=
|
|
|
+function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);M.multiply(b.matrixWorld,b.projectionMatrixInverse);M.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,m,H){var fa=h.near,sa=h.far,R=!1,oa,Q,ha,W,aa,Z,$,da,Ka,La,Ea,ua,ra,Ma,kb,cb;z=r=s=p=0;F.elements.length=0;g.updateMatrixWorld();void 0===
|
|
|
+h.parent&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);M.multiply(h.projectionMatrix,h.matrixWorldInverse);K.setFromMatrix(M);e=0;F.objects.length=0;F.sprites.length=0;F.lights.length=0;var Ua=function(b){for(var c=0,d=b.children.length;c<d;c++){var e=b.children[c];if(!1!==e.visible){if(e instanceof THREE.Light)F.lights.push(e);else if(e instanceof THREE.Mesh||e instanceof THREE.Line){if(!1===e.frustumCulled||!0===K.contains(e))f=a(),f.object=e,null!==e.renderDepth?f.z=e.renderDepth:
|
|
|
+(I.copy(e.matrixWorld.getPosition()),M.multiplyVector3(I),f.z=I.z),F.objects.push(f)}else e instanceof THREE.Sprite||e instanceof THREE.Particle?(f=a(),f.object=e,null!==e.renderDepth?f.z=e.renderDepth:(I.copy(e.matrixWorld.getPosition()),M.multiplyVector3(I),f.z=I.z),F.sprites.push(f)):(f=a(),f.object=e,null!==e.renderDepth?f.z=e.renderDepth:(I.copy(e.matrixWorld.getPosition()),M.multiplyVector3(I),f.z=I.z),F.objects.push(f));Ua(e)}}};Ua(g);!0===m&&F.objects.sort(c);g=0;for(m=F.objects.length;g<
|
|
|
+m;g++)if(da=F.objects[g].object,Ka=da.matrixWorld,j=0,da instanceof THREE.Mesh){La=da.geometry;Ea=da.geometry.materials;ha=La.vertices;ua=La.faces;Ma=La.faceVertexUvs;La=da.matrixRotationWorld.extractRotation(Ka);kb=da.material instanceof THREE.MeshFaceMaterial;oa=0;for(Q=ha.length;oa<Q;oa++)i=b(),i.positionWorld.copy(ha[oa]),Ka.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),M.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,
|
|
|
+i.visible=i.positionScreen.z>fa&&i.positionScreen.z<sa;ha=0;for(oa=ua.length;ha<oa;ha++)if(Q=ua[ha],cb=!0===kb?Ea[Q.materialIndex]:da.material,void 0!==cb){Z=cb.side;if(Q instanceof THREE.Face3)if(W=l[Q.a],aa=l[Q.b],$=l[Q.c],!0===W.visible&&!0===aa.visible&&!0===$.visible)if(R=0>($.positionScreen.x-W.positionScreen.x)*(aa.positionScreen.y-W.positionScreen.y)-($.positionScreen.y-W.positionScreen.y)*(aa.positionScreen.x-W.positionScreen.x),Z===THREE.DoubleSide||R===(Z===THREE.FrontSide))p===q?(ra=new THREE.RenderableFace3,
|
|
|
+o.push(ra),q++,p++,n=ra):n=o[p++],n.v1.copy(W),n.v2.copy(aa),n.v3.copy($);else continue;else continue;else if(Q instanceof THREE.Face4)if(W=l[Q.a],aa=l[Q.b],$=l[Q.c],ra=l[Q.d],!0===W.visible&&!0===aa.visible&&!0===$.visible&&!0===ra.visible)if(R=0>(ra.positionScreen.x-W.positionScreen.x)*(aa.positionScreen.y-W.positionScreen.y)-(ra.positionScreen.y-W.positionScreen.y)*(aa.positionScreen.x-W.positionScreen.x)||0>(aa.positionScreen.x-$.positionScreen.x)*(ra.positionScreen.y-$.positionScreen.y)-(aa.positionScreen.y-
|
|
|
+$.positionScreen.y)*(ra.positionScreen.x-$.positionScreen.x),Z===THREE.DoubleSide||R===(Z===THREE.FrontSide)){if(s===A){var gb=new THREE.RenderableFace4;t.push(gb);A++;s++;n=gb}else n=t[s++];n.v1.copy(W);n.v2.copy(aa);n.v3.copy($);n.v4.copy(ra)}else continue;else continue;n.normalWorld.copy(Q.normal);!1===R&&(Z===THREE.BackSide||Z===THREE.DoubleSide)&&n.normalWorld.negate();La.multiplyVector3(n.normalWorld);n.centroidWorld.copy(Q.centroid);Ka.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
|
|
|
+M.multiplyVector3(n.centroidScreen);$=Q.vertexNormals;W=0;for(aa=$.length;W<aa;W++)ra=n.vertexNormalsWorld[W],ra.copy($[W]),!1===R&&(Z===THREE.BackSide||Z===THREE.DoubleSide)&&ra.negate(),La.multiplyVector3(ra);n.vertexNormalsLength=$.length;W=0;for(aa=Ma.length;W<aa;W++)if(ra=Ma[W][ha],void 0!==ra){Z=0;for($=ra.length;Z<$;Z++)n.uvs[W][Z]=ra[Z]}n.color=Q.color;n.material=cb;n.z=n.centroidScreen.z;F.elements.push(n)}}else if(da instanceof THREE.Line){J.multiply(M,Ka);ha=da.geometry.vertices;W=b();
|
|
|
+W.positionScreen.copy(ha[0]);J.multiplyVector4(W.positionScreen);Ka=da.type===THREE.LinePieces?2:1;oa=1;for(Q=ha.length;oa<Q;oa++)W=b(),W.positionScreen.copy(ha[oa]),J.multiplyVector4(W.positionScreen),0<(oa+1)%Ka||(aa=l[j-2],N.copy(W.positionScreen),O.copy(aa.positionScreen),!0===d(N,O)&&(N.multiplyScalar(1/N.w),O.multiplyScalar(1/O.w),r===y?(Ea=new THREE.RenderableLine,B.push(Ea),y++,r++,u=Ea):u=B[r++],u.v1.positionScreen.copy(N),u.v2.positionScreen.copy(O),u.z=Math.max(N.z,O.z),u.material=da.material,
|
|
|
+F.elements.push(u)))}g=0;for(m=F.sprites.length;g<m;g++)da=F.sprites[g].object,Ka=da.matrixWorld,da instanceof THREE.Particle&&(G.set(Ka.elements[12],Ka.elements[13],Ka.elements[14],1),M.multiplyVector4(G),G.z/=G.w,0<G.z&&1>G.z&&(z===D?(fa=new THREE.RenderableParticle,C.push(fa),D++,z++,w=fa):w=C[z++],w.object=da,w.x=G.x/G.w,w.y=G.y/G.w,w.z=G.z,w.rotation=da.rotation.z,w.scale.x=da.scale.x*Math.abs(w.x-(G.x+h.projectionMatrix.elements[0])/(G.w+h.projectionMatrix.elements[12])),w.scale.y=da.scale.y*
|
|
|
+Math.abs(w.y-(G.y+h.projectionMatrix.elements[5])/(G.w+h.projectionMatrix.elements[13])),w.material=da.material,F.elements.push(w)));!0===H&&F.elements.sort(c);return F}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?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);void 0===b||"XYZ"===b?(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):"YXZ"===b?(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):"ZXY"===b?(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):"ZYX"===b?(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):"YZX"===b?(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):"XZY"===b&&(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);return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);
|
|
|
return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],f=b[1],e=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+e+b;0<j?(c=0.5/Math.sqrt(j+1),this.w=0.25/c,this.x=(i-g)*c,this.y=(d-h)*c,this.z=(f-a)*c):c>e&&c>b?(c=2*Math.sqrt(1+c-e-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+f)/c,this.z=(d+h)/c):e>b?(c=2*Math.sqrt(1+e-c-b),this.w=(d-h)/c,this.x=(a+f)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-e),this.w=(f-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},calculateW:function(){this.w=
|
|
|
-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiply:function(a,b){var c=a.x,d=a.y,f=a.z,e=a.w,g=b.x,h=b.y,i=b.z,j=b.w;
|
|
|
-this.x=c*j+d*i-f*h+e*g;this.y=-c*i+d*j+f*g+e*h;this.z=c*h-d*g+f*j+e*i;this.w=-c*g-d*h-f*i+e*j;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*f-h*d,l=i*d+h*c-e*f,n=i*f+e*d-g*c,c=-e*c-g*d-h*f;b.x=j*i+c*-e+l*-h-n*-g;b.y=l*i+c*-g+n*-e-j*-h;
|
|
|
-b.z=n*i+c*-h+j*-g-l*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;0>g?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,g=-g):this.copy(a);if(1<=g)return this.w=e,this.x=c,this.y=d,this.z=f,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(e+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(f+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=e*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+
|
|
|
+this.x=c*j+d*i-f*h+e*g;this.y=-c*i+d*j+f*g+e*h;this.z=c*h-d*g+f*j+e*i;this.w=-c*g-d*h-f*i+e*j;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*f-h*d,l=i*d+h*c-e*f,m=i*f+e*d-g*c,c=-e*c-g*d-h*f;b.x=j*i+c*-e+l*-h-m*-g;b.y=l*i+c*-g+m*-e-j*-h;
|
|
|
+b.z=m*i+c*-h+j*-g-l*-e;return b},slerpSelf:function(a,b){var c=this.x,d=this.y,f=this.z,e=this.w,g=e*a.w+c*a.x+d*a.y+f*a.z;0>g?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,g=-g):this.copy(a);if(1<=g)return this.w=e,this.x=c,this.y=d,this.z=f,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(e+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(f+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=e*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+
|
|
|
this.y*h;this.z=f*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
|
|
|
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>f?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(1<=Math.abs(f))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var b=Math.acos(f),e=Math.sqrt(1-f*f);if(0.001>Math.abs(e))return c.w=0.5*(a.w+c.w),c.x=0.5*(a.x+c.x),c.y=0.5*(a.y+c.y),c.z=0.5*(a.z+c.z),c;f=Math.sin((1-d)*b)/e;d=Math.sin(d*b)/e;c.w=a.w*f+c.w*d;c.x=a.x*f+c.x*d;c.y=a.y*f+c.y*d;c.z=a.z*f+c.z*d;return c};
|
|
|
THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
|
|
@@ -111,23 +111,23 @@ c instanceof THREE.Face4&&(c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,
|
|
|
b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,b,c,d,f;c=0;for(d=this.faces.length;c<d;c++){f=this.faces[c];f.__originalFaceNormal?f.__originalFaceNormal.copy(f.normal):
|
|
|
f.__originalFaceNormal=f.normal.clone();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,j;c=0;for(d=this.faces.length;c<d;c++)f=this.faces[c],i=new THREE.Vector3,j=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(j)}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],j=g.vertexNormals[c],
|
|
|
-i.copy(f.normal),f instanceof THREE.Face3?(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2])):(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2]),j.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,A){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[f];n=g[e];m=g[A];o=i.x-
|
|
|
-h.x;q=j.x-h.x;p=i.y-h.y;s=j.y-h.y;t=i.z-h.z;B=j.z-h.z;u=n.u-l.u;r=m.u-l.u;y=n.v-l.v;z=m.v-l.v;w=1/(u*z-r*y);D.set((z*o-y*q)*w,(z*p-y*s)*w,(z*t-y*B)*w);K.set((u*q-r*o)*w,(u*s-r*p)*w,(u*B-r*t)*w);F[b].addSelf(D);F[c].addSelf(D);F[d].addSelf(D);C[b].addSelf(K);C[c].addSelf(K);C[d].addSelf(K)}var b,c,d,f,e,g,h,i,j,l,n,m,o,q,p,s,t,B,u,r,y,z,w,A,F=[],C=[],D=new THREE.Vector3,K=new THREE.Vector3,I=new THREE.Vector3,L=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,
|
|
|
-C[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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 J=["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++)H.copy(e.vertexNormals[d]),f=e[J[d]],A=F[f],I.copy(A),I.subSelf(H.multiplyScalar(H.dot(A))).normalize(),L.cross(e.vertexNormals[d],A),f=L.dot(C[f]),f=0>f?
|
|
|
--1:1,e.vertexTangents[d]=new THREE.Vector4(I.x,I.y,I.z,f)}this.hasTangents=!0},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3});if(0<this.vertices.length){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],a.x<b.x?b.x=a.x:a.x>c.x&&(c.x=a.x),a.y<b.y?b.y=a.y:a.y>c.y&&(c.y=a.y),a.z<b.z)?b.z=a.z:a.z>
|
|
|
+i.copy(f.normal),f instanceof THREE.Face3?(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2])):(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2]),j.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,z){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[f];m=g[e];n=g[z];p=i.x-
|
|
|
+h.x;o=j.x-h.x;q=i.y-h.y;s=j.y-h.y;t=i.z-h.z;A=j.z-h.z;u=m.u-l.u;r=n.u-l.u;B=m.v-l.v;y=n.v-l.v;w=1/(u*y-r*B);F.set((y*p-B*o)*w,(y*q-B*s)*w,(y*t-B*A)*w);I.set((u*o-r*p)*w,(u*s-r*q)*w,(u*A-r*t)*w);C[b].addSelf(F);C[c].addSelf(F);C[d].addSelf(F);D[b].addSelf(I);D[c].addSelf(I);D[d].addSelf(I)}var b,c,d,f,e,g,h,i,j,l,m,n,p,o,q,s,t,A,u,r,B,y,w,z,C=[],D=[],F=new THREE.Vector3,I=new THREE.Vector3,G=new THREE.Vector3,M=new THREE.Vector3,J=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,
|
|
|
+D[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],g=this.faceVertexUvs[0][b],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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 K=["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[K[d]],z=C[f],G.copy(z),G.subSelf(J.multiplyScalar(J.dot(z))).normalize(),M.cross(e.vertexNormals[d],z),f=M.dot(D[f]),f=0>f?
|
|
|
+-1:1,e.vertexTangents[d]=new THREE.Vector4(G.x,G.y,G.z,f)}this.hasTangents=!0},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3});if(0<this.vertices.length){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],a.x<b.x?b.x=a.x:a.x>c.x&&(c.x=a.x),a.y<b.y?b.y=a.y:a.y>c.y&&(c.y=a.y),a.z<b.z)?b.z=a.z: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;null===this.boundingSphere&&(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=this.vertices[e],d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),
|
|
|
void 0===a[d]?(a[d]=e,b.push(this.vertices[e]),c[e]=b.length-1):c[e]=c[a[d]];e=0;for(g=this.faces.length;e<g;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];d=[a.a,a.b,a.c,a.d];for(f=3;0<f;f--)if(d.indexOf(a["abcd"[f]])!==f){d.splice(f,1);this.faces[e]=new THREE.Face3(d[0],d[1],d[2],a.normal,a.color,a.materialIndex);d=0;for(h=this.faceVertexUvs.length;d<h;d++)(i=this.faceVertexUvs[d][e])&&
|
|
|
i.splice(f,1);this.faces[e].vertexColors=a.vertexColors;break}}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){},deallocate:function(){var a=THREE.GeometryLibrary.indexOf(this);-1!==a&&THREE.GeometryLibrary.splice(a,1)}};THREE.GeometryIdCount=0;THREE.GeometryLibrary=[];THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.attributes={};this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix4,b.extractRotation(a),b.multiplyVector3Array(c),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){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+=3)(c=a[e],d=a[e+1],f=a[e+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),f<b.min.z)?b.min.z=f:f>b.max.z&&(b.max.z=f);if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){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+=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(void 0===this.attributes.normal)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,j,l,n,m,o,q=new THREE.Vector3,p=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3,B=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;i=f[c].count;var u=f[c].index;a=b;for(b+=i;a<b;a+=3)i=u+e[a],j=u+e[a+1],l=u+e[a+2],n=g[3*i],m=g[3*i+1],o=g[3*i+2],q.set(n,m,o),n=g[3*j],m=g[3*j+1],o=g[3*j+2],p.set(n,m,o),n=g[3*l],m=g[3*l+1],o=g[3*l+2],s.set(n,m,o),t.sub(s,p),B.sub(q,p),t.crossSelf(B),h[3*i]+=t.x,h[3*i+1]+=t.y,h[3*i+
|
|
|
-2]+=t.z,h[3*j]+=t.x,h[3*j+1]+=t.y,h[3*j+2]+=t.z,h[3*l]+=t.x,h[3*l+1]+=t.y,h[3*l+2]+=t.z}a=0;for(b=h.length;a<b;a+=3)n=h[a],m=h[a+1],o=h[a+2],c=1/Math.sqrt(n*n+m*m+o*o),h[a]*=c,h[a+1]*=c,h[a+2]*=c;this.normalsNeedUpdate=!0}},computeTangents:function(){function a(a){N.x=d[3*a];N.y=d[3*a+1];N.z=d[3*a+2];na.copy(N);Z=i[a];P.copy(Z);P.subSelf(N.multiplyScalar(N.dot(Z))).normalize();G.cross(na,Z);sa=G.dot(j[a]);M=0>sa?-1:1;h[4*a]=P.x;h[4*a+1]=P.y;h[4*a+2]=P.z;h[4*a+3]=M}if(void 0===this.attributes.index||
|
|
|
+g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,m,n,p,o=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,t=new THREE.Vector3,A=new THREE.Vector3;c=0;for(d=f.length;c<d;++c){b=f[c].start;i=f[c].count;var u=f[c].index;a=b;for(b+=i;a<b;a+=3)i=u+e[a],j=u+e[a+1],l=u+e[a+2],m=g[3*i],n=g[3*i+1],p=g[3*i+2],o.set(m,n,p),m=g[3*j],n=g[3*j+1],p=g[3*j+2],q.set(m,n,p),m=g[3*l],n=g[3*l+1],p=g[3*l+2],s.set(m,n,p),t.sub(s,q),A.sub(o,q),t.crossSelf(A),h[3*i]+=t.x,h[3*i+1]+=t.y,h[3*i+
|
|
|
+2]+=t.z,h[3*j]+=t.x,h[3*j+1]+=t.y,h[3*j+2]+=t.z,h[3*l]+=t.x,h[3*l+1]+=t.y,h[3*l+2]+=t.z}a=0;for(b=h.length;a<b;a+=3)m=h[a],n=h[a+1],p=h[a+2],c=1/Math.sqrt(m*m+n*n+p*p),h[a]*=c,h[a+1]*=c,h[a+2]*=c;this.normalsNeedUpdate=!0}},computeTangents:function(){function a(a){L.x=d[3*a];L.y=d[3*a+1];L.z=d[3*a+2];X.copy(L);fa=i[a];O.copy(fa);O.subSelf(L.multiplyScalar(L.dot(fa))).normalize();P.cross(X,fa);sa=P.dot(j[a]);H=0>sa?-1:1;h[4*a]=O.x;h[4*a+1]=O.y;h[4*a+2]=O.z;h[4*a+3]=H}if(void 0===this.attributes.index||
|
|
|
void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,f=this.attributes.uv.array,e=c.length/3;if(void 0===this.attributes.tangent){var g=4*e;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,
|
|
|
-i=[],j=[],g=0;g<e;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,n,m,o,q,p,s,t,B,u,r,y,z,w,A,e=new THREE.Vector3,g=new THREE.Vector3,F,C,D,K,I,L,H,J=this.offsets;D=0;for(K=J.length;D<K;++D){C=J[D].start;I=J[D].count;var O=J[D].index;F=C;for(C+=I;F<C;F+=3)I=O+b[F],L=O+b[F+1],H=O+b[F+2],l=c[3*I],n=c[3*I+1],m=c[3*I+2],o=c[3*L],q=c[3*L+1],p=c[3*L+2],s=c[3*H],t=c[3*H+1],B=c[3*H+2],u=f[2*I],r=f[2*I+1],y=f[2*L],z=f[2*L+1],w=f[2*H],A=f[2*H+1],o-=l,l=s-l,q-=n,n=t-n,p-=m,m=B-m,y-=u,u=w-u,z-=r,r=A-
|
|
|
-r,A=1/(y*r-u*z),e.set((r*o-z*l)*A,(r*q-z*n)*A,(r*p-z*m)*A),g.set((y*l-u*o)*A,(y*n-u*q)*A,(y*m-u*p)*A),i[I].addSelf(e),i[L].addSelf(e),i[H].addSelf(e),j[I].addSelf(g),j[L].addSelf(g),j[H].addSelf(g)}var P=new THREE.Vector3,G=new THREE.Vector3,N=new THREE.Vector3,na=new THREE.Vector3,M,Z,sa;D=0;for(K=J.length;D<K;++D){C=J[D].start;I=J[D].count;O=J[D].index;F=C;for(C+=I;F<C;F+=3)I=O+b[F],L=O+b[F+1],H=O+b[F+2],a(I),a(L),a(H)}this.tangentsNeedUpdate=this.hasTangents=!0}}};
|
|
|
-THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=0.5*(c-a);d=0.5*(d-b);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,j,l,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]=0===e?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;j=this.points[c[0]];l=this.points[c[1]];n=this.points[c[2]];m=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,n.x,m.x,g,h,i);d.y=b(j.y,l.y,n.y,m.y,g,h,i);d.z=b(j.z,l.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=
|
|
|
+i=[],j=[],g=0;g<e;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,m,n,p,o,q,s,t,A,u,r,B,y,w,z,e=new THREE.Vector3,g=new THREE.Vector3,C,D,F,I,G,M,J,K=this.offsets;F=0;for(I=K.length;F<I;++F){D=K[F].start;G=K[F].count;var N=K[F].index;C=D;for(D+=G;C<D;C+=3)G=N+b[C],M=N+b[C+1],J=N+b[C+2],l=c[3*G],m=c[3*G+1],n=c[3*G+2],p=c[3*M],o=c[3*M+1],q=c[3*M+2],s=c[3*J],t=c[3*J+1],A=c[3*J+2],u=f[2*G],r=f[2*G+1],B=f[2*M],y=f[2*M+1],w=f[2*J],z=f[2*J+1],p-=l,l=s-l,o-=m,m=t-m,q-=n,n=A-n,B-=u,u=w-u,y-=r,r=z-
|
|
|
+r,z=1/(B*r-u*y),e.set((r*p-y*l)*z,(r*o-y*m)*z,(r*q-y*n)*z),g.set((B*l-u*p)*z,(B*m-u*o)*z,(B*n-u*q)*z),i[G].addSelf(e),i[M].addSelf(e),i[J].addSelf(e),j[G].addSelf(g),j[M].addSelf(g),j[J].addSelf(g)}var O=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,X=new THREE.Vector3,H,fa,sa;F=0;for(I=K.length;F<I;++F){D=K[F].start;G=K[F].count;N=K[F].index;C=D;for(D+=G;C<D;C+=3)G=N+b[C],M=N+b[C+1],J=N+b[C+2],a(G),a(M),a(J)}this.tangentsNeedUpdate=this.hasTangents=!0}}};
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,f,e,g){a=0.5*(c-a);d=0.5*(d-b);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,j,l,m,n;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]=0===e?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;j=this.points[c[0]];l=this.points[c[1]];m=this.points[c[2]];n=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,l.x,m.x,n.x,g,h,i);d.y=b(j.y,l.y,m.y,n.y,g,h,i);d.z=b(j.z,l.z,m.z,n.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=
|
|
|
a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(e),e.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=f&&(h[b]=i,f=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,e,g,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];g=Math.ceil(a*c/l.total);f=(b-1)/(this.points.length-1);e=b/(this.points.length-1);for(c=1;c<g-1;c++)d=f+c*(1/g)*(e-f),d=this.getPoint(d),
|
|
|
h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};
|
|
|
THREE.OrthographicCamera=function(a,b,c,d,f,e){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==f?f:0.1;this.far=void 0!==e?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
@@ -142,8 +142,8 @@ THREE.SpotLight=function(a,b,c,d,f){THREE.Light.call(this,a);this.position=new T
|
|
|
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(1>a.length?".":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++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=
|
|
|
-Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,f,e,h,i,j,s){var t=e.toLowerCase().endsWith(".dds"),B=b+"/"+e;if(t){var u=THREE.ImageUtils.loadCompressedTexture(B);a[f]=u}else u=document.createElement("canvas"),a[f]=new THREE.Texture(u);a[f].sourceFile=e;if(h&&(a[f].repeat.set(h[0],h[1]),1!==h[0]&&(a[f].wrapS=THREE.RepeatWrapping),1!==h[1]))a[f].wrapT=THREE.RepeatWrapping;i&&a[f].offset.set(i[0],i[1]);if(j&&(e={repeat:THREE.RepeatWrapping,
|
|
|
-mirror:THREE.MirroredRepeatWrapping},void 0!==e[j[0]]&&(a[f].wrapS=e[j[0]]),void 0!==e[j[1]]))a[f].wrapT=e[j[1]];s&&(a[f].anisotropy=s);if(!t){var r=a[f],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);r.image.width=a;r.image.height=b;r.image.getContext("2d").drawImage(this,0,0,a,b)}else r.image=this;r.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=B}}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",
|
|
|
+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,j,s){var t=e.toLowerCase().endsWith(".dds"),A=b+"/"+e;if(t){var u=THREE.ImageUtils.loadCompressedTexture(A);a[f]=u}else u=document.createElement("canvas"),a[f]=new THREE.Texture(u);a[f].sourceFile=e;if(h&&(a[f].repeat.set(h[0],h[1]),1!==h[0]&&(a[f].wrapS=THREE.RepeatWrapping),1!==h[1]))a[f].wrapT=THREE.RepeatWrapping;i&&a[f].offset.set(i[0],i[1]);if(j&&(e={repeat:THREE.RepeatWrapping,
|
|
|
+mirror:THREE.MirroredRepeatWrapping},void 0!==e[j[0]]&&(a[f].wrapS=e[j[0]]),void 0!==e[j[1]]))a[f].wrapT=e[j[1]];s&&(a[f].anisotropy=s);if(!t){var r=a[f],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);r.image.width=a;r.image.height=b;r.image.getContext("2d").drawImage(this,0,0,a,b)}else r.image=this;r.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=A}}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",
|
|
|
i={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==
|
|
|
a.flipSided&&(i.side=THREE.BackSide);void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=e(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=e(a.colorSpecular));a.colorAmbient&&(i.ambient=e(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=
|
|
|
a.specularCoef);a.mapDiffuse&&b&&f(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&f(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&f(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&f(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&f(i,"specularMap",
|
|
@@ -153,57 +153,57 @@ 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(4==g.readyState)if(200==g.status||0==g.status){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,!0);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(4==e.readyState)if(200==e.status||0==e.status){var c=e.response;void 0===c&&(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 3==e.readyState?f&&(0==h&&(h=e.getResponseHeader("Content-Length")),f({total:h,loaded:e.responseText.length})):
|
|
|
2==e.readyState&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",g,!0);e.responseType="arraybuffer";e.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,l,n,m,o,q,p,s,t,B,u,r;function y(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function w(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,f,e,g,h,i,l,j,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=m[3*d];e=m[3*d+1];g=m[3*d+2];h=O[2*f];f=O[2*f+1];i=O[2*e];l=O[2*e+1];e=O[2*g];j=O[2*g+1];g=L.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,f));n.push(new THREE.UV(i,l));n.push(new THREE.UV(e,
|
|
|
-j));g.push(n)}}function F(b,c){var d,f,e,g,h,i,l,j,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[4*d];e=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=O[2*f];f=O[2*f+1];l=O[2*e];n=O[2*e+1];j=O[2*g];m=O[2*g+1];g=O[2*h];e=O[2*h+1];h=L.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(l,n));p.push(new THREE.UV(j,m));p.push(new THREE.UV(g,e));h.push(p)}}function C(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[3*d],e=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
-L.faces.push(new THREE.Face3(f,e,g,null,null,h))}function D(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++)f=c[4*d],e=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=l[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,l,j,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[3*f];g=c[3*f+1];h=c[3*f+2];l=d[3*f];j=d[3*f+1];n=d[3*f+2];i=m[f];var o=J[3*j],p=J[3*j+1];j=J[3*j+2];var q=J[3*n],t=
|
|
|
-J[3*n+1];n=J[3*n+2];L.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(J[3*l],J[3*l+1],J[3*l+2]),new THREE.Vector3(o,p,j),new THREE.Vector3(q,t,n)],null,i))}}function I(b,c,d,f){for(var e,g,h,i,l,j,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[4*f];g=c[4*f+1];h=c[4*f+2];i=c[4*f+3];j=d[4*f];n=d[4*f+1];m=d[4*f+2];o=d[4*f+3];l=p[f];var q=J[3*n],t=J[3*n+1];n=J[3*n+2];var r=J[3*m],s=J[3*m+1];m=J[3*m+2];var u=J[3*o],w=J[3*o+1];o=J[3*o+2];L.faces.push(new THREE.Face4(e,
|
|
|
-g,h,i,[new THREE.Vector3(J[3*j],J[3*j+1],J[3*j+2]),new THREE.Vector3(q,t,n),new THREE.Vector3(r,s,m),new THREE.Vector3(u,w,o)],null,l))}}var L=this,H=0,J=[],O=[],P,G,N;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(L,d,b);r=a;G=H;b=new Uint8Array(r,G,12);p="";for(B=0;12>B;B++)p+=String.fromCharCode(b[G+B]);c=z(r,G+12);z(r,G+13);z(r,G+14);z(r,G+15);f=z(r,G+16);i=z(r,G+17);j=z(r,G+18);l=z(r,G+19);n=w(r,G+20);m=w(r,G+20+4);o=w(r,G+20+8);q=w(r,G+20+12);p=w(r,G+20+16);s=w(r,G+20+20);t=
|
|
|
-w(r,G+20+24);B=w(r,G+20+28);b=w(r,G+20+32);u=w(r,G+20+36);r=w(r,G+20+40);H+=c;G=3*f+l;N=4*f+l;P=q*G;c=p*(G+3*i);f=s*(G+3*j);l=t*(G+3*i+3*j);G=B*N;i=b*(N+4*i);j=u*(N+4*j);N=H;var H=new Float32Array(a,H,3*n),na,M,Z,sa;for(na=0;na<n;na++)M=H[3*na],Z=H[3*na+1],sa=H[3*na+2],L.vertices.push(new THREE.Vector3(M,Z,sa));n=H=N+3*n*Float32Array.BYTES_PER_ELEMENT;if(m){H=new Int8Array(a,H,3*m);for(N=0;N<m;N++)na=H[3*N],M=H[3*N+1],Z=H[3*N+2],J.push(na/127,M/127,Z/127)}H=n+3*m*Int8Array.BYTES_PER_ELEMENT;m=H+=
|
|
|
-y(3*m);if(o){H=new Float32Array(a,H,2*o);for(n=0;n<o;n++)N=H[2*n],na=H[2*n+1],O.push(N,na)}o=H=m+2*o*Float32Array.BYTES_PER_ELEMENT;P=o+P+y(2*q);m=P+c+y(2*p);c=m+f+y(2*s);f=c+l+y(2*t);G=f+G+y(2*B);l=G+i+y(2*b);i=l+j+y(2*u);s&&(j=m+3*s*Uint32Array.BYTES_PER_ELEMENT,C(s,m,j+3*s*Uint32Array.BYTES_PER_ELEMENT),A(s,j));t&&(s=c+3*t*Uint32Array.BYTES_PER_ELEMENT,j=s+3*t*Uint32Array.BYTES_PER_ELEMENT,K(t,c,s,j+3*t*Uint32Array.BYTES_PER_ELEMENT),A(t,j));u&&(t=l+4*u*Uint32Array.BYTES_PER_ELEMENT,D(u,l,t+4*
|
|
|
-u*Uint32Array.BYTES_PER_ELEMENT),F(u,t));r&&(u=i+4*r*Uint32Array.BYTES_PER_ELEMENT,t=u+4*r*Uint32Array.BYTES_PER_ELEMENT,I(r,i,u,t+4*r*Uint32Array.BYTES_PER_ELEMENT),F(r,t));q&&C(q,o,o+3*q*Uint32Array.BYTES_PER_ELEMENT);p&&(q=P+3*p*Uint32Array.BYTES_PER_ELEMENT,K(p,P,q,q+3*p*Uint32Array.BYTES_PER_ELEMENT));B&&D(B,f,f+4*B*Uint32Array.BYTES_PER_ELEMENT);b&&(p=G+4*b*Uint32Array.BYTES_PER_ELEMENT,I(b,G,p,p+4*b*Uint32Array.BYTES_PER_ELEMENT));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.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,l,m,n,p,o,q,s,t,A,u,r;function B(a){return a%4?4-a%4:0}function y(a,b){return(new Uint8Array(a,b,1))[0]}function w(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,f,e,g,h,i,l,j,n=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){f=n[3*d];e=n[3*d+1];g=n[3*d+2];h=N[2*f];f=N[2*f+1];i=N[2*e];l=N[2*e+1];e=N[2*g];j=N[2*g+1];g=M.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,f));m.push(new THREE.UV(i,l));m.push(new THREE.UV(e,
|
|
|
+j));g.push(m)}}function C(b,c){var d,f,e,g,h,i,l,j,n,m,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){f=o[4*d];e=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=N[2*f];f=N[2*f+1];l=N[2*e];n=N[2*e+1];j=N[2*g];m=N[2*g+1];g=N[2*h];e=N[2*h+1];h=M.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,f));p.push(new THREE.UV(l,n));p.push(new THREE.UV(j,m));p.push(new THREE.UV(g,e));h.push(p)}}function D(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[3*d],e=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
+M.faces.push(new THREE.Face3(f,e,g,null,null,h))}function F(b,c,d){for(var f,e,g,h,i,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++)f=c[4*d],e=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=l[d],M.faces.push(new THREE.Face4(f,e,g,h,null,null,i))}function I(b,c,d,f){for(var e,g,h,i,l,j,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[3*f];g=c[3*f+1];h=c[3*f+2];l=d[3*f];j=d[3*f+1];n=d[3*f+2];i=m[f];var o=K[3*j],p=K[3*j+1];j=K[3*j+2];var q=K[3*n],r=
|
|
|
+K[3*n+1];n=K[3*n+2];M.faces.push(new THREE.Face3(e,g,h,[new THREE.Vector3(K[3*l],K[3*l+1],K[3*l+2]),new THREE.Vector3(o,p,j),new THREE.Vector3(q,r,n)],null,i))}}function G(b,c,d,f){for(var e,g,h,i,l,j,n,m,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,f,b),f=0;f<b;f++){e=c[4*f];g=c[4*f+1];h=c[4*f+2];i=c[4*f+3];j=d[4*f];n=d[4*f+1];m=d[4*f+2];o=d[4*f+3];l=p[f];var q=K[3*n],r=K[3*n+1];n=K[3*n+2];var t=K[3*m],s=K[3*m+1];m=K[3*m+2];var u=K[3*o],y=K[3*o+1];o=K[3*o+2];M.faces.push(new THREE.Face4(e,
|
|
|
+g,h,i,[new THREE.Vector3(K[3*j],K[3*j+1],K[3*j+2]),new THREE.Vector3(q,r,n),new THREE.Vector3(t,s,m),new THREE.Vector3(u,y,o)],null,l))}}var M=this,J=0,K=[],N=[],O,P,L;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(M,d,b);r=a;P=J;b=new Uint8Array(r,P,12);q="";for(A=0;12>A;A++)q+=String.fromCharCode(b[P+A]);c=y(r,P+12);y(r,P+13);y(r,P+14);y(r,P+15);f=y(r,P+16);i=y(r,P+17);j=y(r,P+18);l=y(r,P+19);m=w(r,P+20);n=w(r,P+20+4);p=w(r,P+20+8);o=w(r,P+20+12);q=w(r,P+20+16);s=w(r,P+20+20);t=
|
|
|
+w(r,P+20+24);A=w(r,P+20+28);b=w(r,P+20+32);u=w(r,P+20+36);r=w(r,P+20+40);J+=c;P=3*f+l;L=4*f+l;O=o*P;c=q*(P+3*i);f=s*(P+3*j);l=t*(P+3*i+3*j);P=A*L;i=b*(L+4*i);j=u*(L+4*j);L=J;var J=new Float32Array(a,J,3*m),X,H,fa,sa;for(X=0;X<m;X++)H=J[3*X],fa=J[3*X+1],sa=J[3*X+2],M.vertices.push(new THREE.Vector3(H,fa,sa));m=J=L+3*m*Float32Array.BYTES_PER_ELEMENT;if(n){J=new Int8Array(a,J,3*n);for(L=0;L<n;L++)X=J[3*L],H=J[3*L+1],fa=J[3*L+2],K.push(X/127,H/127,fa/127)}J=m+3*n*Int8Array.BYTES_PER_ELEMENT;n=J+=B(3*
|
|
|
+n);if(p){J=new Float32Array(a,J,2*p);for(m=0;m<p;m++)L=J[2*m],X=J[2*m+1],N.push(L,X)}p=J=n+2*p*Float32Array.BYTES_PER_ELEMENT;O=p+O+B(2*o);n=O+c+B(2*q);c=n+f+B(2*s);f=c+l+B(2*t);P=f+P+B(2*A);l=P+i+B(2*b);i=l+j+B(2*u);s&&(j=n+3*s*Uint32Array.BYTES_PER_ELEMENT,D(s,n,j+3*s*Uint32Array.BYTES_PER_ELEMENT),z(s,j));t&&(s=c+3*t*Uint32Array.BYTES_PER_ELEMENT,j=s+3*t*Uint32Array.BYTES_PER_ELEMENT,I(t,c,s,j+3*t*Uint32Array.BYTES_PER_ELEMENT),z(t,j));u&&(t=l+4*u*Uint32Array.BYTES_PER_ELEMENT,F(u,l,t+4*u*Uint32Array.BYTES_PER_ELEMENT),
|
|
|
+C(u,t));r&&(u=i+4*r*Uint32Array.BYTES_PER_ELEMENT,t=u+4*r*Uint32Array.BYTES_PER_ELEMENT,G(r,i,u,t+4*r*Uint32Array.BYTES_PER_ELEMENT),C(r,t));o&&D(o,p,p+3*o*Uint32Array.BYTES_PER_ELEMENT);q&&(o=O+3*q*Uint32Array.BYTES_PER_ELEMENT,I(q,O,o,o+3*q*Uint32Array.BYTES_PER_ELEMENT));A&&F(A,f,f+4*A*Uint32Array.BYTES_PER_ELEMENT);b&&(q=P+4*b*Uint32Array.BYTES_PER_ELEMENT,G(b,P,q,q+4*b*Uint32Array.BYTES_PER_ELEMENT));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;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);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(200===e.status||0===e.status){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 e.readyState===e.LOADING?f&&(0===g&&(g=e.getResponseHeader("Content-Length")),
|
|
|
f({total:g,loaded:e.responseText.length})):e.readyState===e.HEADERS_RECEIVED&&(g=e.getResponseHeader("Content-Length"))};e.open("GET",b,!0);e.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);var e,g,h,i,j,l,n,m,o,q,p,s,t,B,u=a.faces;o=a.vertices;var r=a.normals,y=a.colors,z=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&z++;for(e=0;e<z;e++)d.faceUvs[e]=[],d.faceVertexUvs[e]=[];c=0;for(i=o.length;c<i;)j=new THREE.Vector3,j.x=o[c++]*f,j.y=o[c++]*f,j.z=o[c++]*f,d.vertices.push(j);c=0;for(i=u.length;c<i;){o=u[c++];j=o&1;h=o&2;e=o&4;g=o&8;n=o&16;
|
|
|
-l=o&32;q=o&64;o&=128;j?(p=new THREE.Face4,p.a=u[c++],p.b=u[c++],p.c=u[c++],p.d=u[c++],j=4):(p=new THREE.Face3,p.a=u[c++],p.b=u[c++],p.c=u[c++],j=3);h&&(h=u[c++],p.materialIndex=h);h=d.faces.length;if(e)for(e=0;e<z;e++)s=a.uvs[e],m=u[c++],B=s[2*m],m=s[2*m+1],d.faceUvs[e][h]=new THREE.UV(B,m);if(g)for(e=0;e<z;e++){s=a.uvs[e];t=[];for(g=0;g<j;g++)m=u[c++],B=s[2*m],m=s[2*m+1],t[g]=new THREE.UV(B,m);d.faceVertexUvs[e][h]=t}n&&(n=3*u[c++],g=new THREE.Vector3,g.x=r[n++],g.y=r[n++],g.z=r[n],p.normal=g);if(l)for(e=
|
|
|
-0;e<j;e++)n=3*u[c++],g=new THREE.Vector3,g.x=r[n++],g.y=r[n++],g.z=r[n],p.vertexNormals.push(g);q&&(l=u[c++],l=new THREE.Color(y[l]),p.color=l);if(o)for(e=0;e<j;e++)l=u[c++],l=new THREE.Color(y[l]),p.vertexColors.push(l);d.faces.push(p)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c+=2)u=a.skinWeights[c],r=a.skinWeights[c+1],d.skinWeights.push(new THREE.Vector4(u,r,0,0))}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c+=2)u=a.skinIndices[c],r=a.skinIndices[c+1],d.skinIndices.push(new THREE.Vector4(u,
|
|
|
-r,0,0))}d.bones=a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){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=[];y=d.morphTargets[c].vertices;z=a.morphTargets[c].vertices;u=0;for(r=z.length;u<r;u+=3)o=new THREE.Vector3,o.x=z[u]*f,o.y=z[u+1]*f,o.z=z[u+2]*f,y.push(o)}}if(void 0!==a.morphColors){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;y=a.morphColors[c].colors;f=0;for(u=y.length;f<u;f+=3)z=new THREE.Color(16755200),z.setRGB(y[f],y[f+1],y[f+2]),r.push(z)}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.LoadingMonitor=function(){THREE.EventTarget.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);var e,g,h,i,j,l,m,n,p,o,q,s,t,A,u=a.faces;p=a.vertices;var r=a.normals,B=a.colors,y=0;for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&y++;for(e=0;e<y;e++)d.faceUvs[e]=[],d.faceVertexUvs[e]=[];c=0;for(i=p.length;c<i;)j=new THREE.Vector3,j.x=p[c++]*f,j.y=p[c++]*f,j.z=p[c++]*f,d.vertices.push(j);c=0;for(i=u.length;c<i;){p=u[c++];j=p&1;h=p&2;e=p&4;g=p&8;m=p&16;
|
|
|
+l=p&32;o=p&64;p&=128;j?(q=new THREE.Face4,q.a=u[c++],q.b=u[c++],q.c=u[c++],q.d=u[c++],j=4):(q=new THREE.Face3,q.a=u[c++],q.b=u[c++],q.c=u[c++],j=3);h&&(h=u[c++],q.materialIndex=h);h=d.faces.length;if(e)for(e=0;e<y;e++)s=a.uvs[e],n=u[c++],A=s[2*n],n=s[2*n+1],d.faceUvs[e][h]=new THREE.UV(A,n);if(g)for(e=0;e<y;e++){s=a.uvs[e];t=[];for(g=0;g<j;g++)n=u[c++],A=s[2*n],n=s[2*n+1],t[g]=new THREE.UV(A,n);d.faceVertexUvs[e][h]=t}m&&(m=3*u[c++],g=new THREE.Vector3,g.x=r[m++],g.y=r[m++],g.z=r[m],q.normal=g);if(l)for(e=
|
|
|
+0;e<j;e++)m=3*u[c++],g=new THREE.Vector3,g.x=r[m++],g.y=r[m++],g.z=r[m],q.vertexNormals.push(g);o&&(l=u[c++],l=new THREE.Color(B[l]),q.color=l);if(p)for(e=0;e<j;e++)l=u[c++],l=new THREE.Color(B[l]),q.vertexColors.push(l);d.faces.push(q)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c+=2)u=a.skinWeights[c],r=a.skinWeights[c+1],d.skinWeights.push(new THREE.Vector4(u,r,0,0))}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c+=2)u=a.skinIndices[c],r=a.skinIndices[c+1],d.skinIndices.push(new THREE.Vector4(u,
|
|
|
+r,0,0))}d.bones=a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){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=[];B=d.morphTargets[c].vertices;y=a.morphTargets[c].vertices;u=0;for(r=y.length;u<r;u+=3)p=new THREE.Vector3,p.x=y[u]*f,p.y=y[u+1]*f,p.z=y[u+2]*f,B.push(p)}}if(void 0!==a.morphColors){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;B=a.morphColors[c].colors;f=0;for(u=B.length;f<u;f+=3)y=new THREE.Color(16755200),y.setRGB(B[f],B[f+1],B[f+2]),r.push(y)}}d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};THREE.LoadingMonitor=function(){THREE.EventTarget.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};
|
|
|
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(null===b.path){var d=a.split("/");d.pop();b.path=1>d.length?".":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+"]"})},!1);d.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);d.open("GET",a,
|
|
|
!0);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=void 0!==a.scale?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))},j=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]),1!==e[0]&&(a[d].wrapS=THREE.RepeatWrapping),1!==e[1]))a[d].wrapT=THREE.RepeatWrapping;g&&a[d].offset.set(g[0],g[1]);if(j&&(e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==e[j[0]]&&(a[d].wrapS=e[j[0]]),void 0!==e[j[1]]))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=i(a.height);l.image=document.createElement("canvas");l.image.width=
|
|
|
-b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=!0});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},l=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},n="MeshLambertMaterial",m={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(g.shading){var o=g.shading.toLowerCase();"phong"===o?n="MeshPhongMaterial":"basic"===o&&(n="MeshBasicMaterial")}void 0!==g.blending&&void 0!==THREE[g.blending]&&
|
|
|
-(m.blending=THREE[g.blending]);if(void 0!==g.transparent||1>g.opacity)m.transparent=g.transparent;void 0!==g.depthTest&&(m.depthTest=g.depthTest);void 0!==g.depthWrite&&(m.depthWrite=g.depthWrite);void 0!==g.vertexColors&&("face"==g.vertexColors?m.vertexColors=THREE.FaceColors:g.vertexColors&&(m.vertexColors=THREE.VertexColors));g.colorDiffuse?m.color=l(g.colorDiffuse):g.DbgColor&&(m.color=g.DbgColor);g.colorSpecular&&(m.specular=l(g.colorSpecular));g.colorAmbient&&(m.ambient=l(g.colorAmbient));g.transparency&&
|
|
|
-(m.opacity=g.transparency);g.specularCoef&&(m.shininess=g.specularCoef);void 0!==g.visible&&(m.visible=g.visible);void 0!==g.flipSided&&(m.side=THREE.BackSide);void 0!==g.doubleSided&&(m.side=THREE.DoubleSide);void 0!==g.wireframe&&(m.wireframe=g.wireframe);g.mapDiffuse&&j(m,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(m,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&j(m,"bumpMap",g.mapBump,g.mapBumpRepeat,g.mapBumpOffset,
|
|
|
-g.mapBumpWrap);g.mapNormal&&j(m,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(m,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);g.mapNormal?(j=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(j.uniforms),l.tNormal.value=m.normalMap,g.mapNormalFactor&&l.uNormalScale.value.set(g.mapNormalFactor,g.mapNormalFactor),m.map&&(l.tDiffuse.value=m.map,l.enableDiffuse.value=!0),m.specularMap&&(l.tSpecular.value=m.specularMap,
|
|
|
-l.enableSpecular.value=!0),m.lightMap&&(l.tAO.value=m.lightMap,l.enableAO.value=!0),l.uDiffuseColor.value.setHex(m.color),l.uSpecularColor.value.setHex(m.specular),l.uAmbientColor.value.setHex(m.ambient),l.uShininess.value=m.shininess,void 0!==m.opacity&&(l.uOpacity.value=m.opacity),m=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:!0,fog:!0})):m=new THREE[n](m);void 0!==g.DbgName&&(m.name=g.DbgName);d.materials[e]=m}}var g=a.faces,q=a.vertices,
|
|
|
-m=a.normals,j=a.colors,l=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&l++;for(e=0;e<l;e++)d.faceUvs[e]=[],d.faceVertexUvs[e]=[];n=0;for(o=q.length;n<o;){var p=new THREE.Vector3;p.x=q[n++]*f;p.y=q[n++]*f;p.z=q[n++]*f;d.vertices.push(p)}n=0;for(o=g.length;n<o;){var s=g[n++],t=s&2,e=s&4,B=s&8,u=s&16,q=s&32,r=s&64,p=s&128;if(s&1){s=new THREE.Face4;s.a=g[n++];s.b=g[n++];s.c=g[n++];s.d=g[n++];var y=4}else s=new THREE.Face3,s.a=g[n++],s.b=g[n++],s.c=g[n++],y=3;t&&(t=g[n++],s.materialIndex=t);var z=
|
|
|
-d.faces.length;if(e)for(e=0;e<l;e++){var w=a.uvs[e],t=g[n++],A=w[2*t],t=w[2*t+1];d.faceUvs[e][z]=new THREE.UV(A,t)}if(B)for(e=0;e<l;e++){for(var w=a.uvs[e],B=[],F=0;F<y;F++)t=g[n++],A=w[2*t],t=w[2*t+1],B[F]=new THREE.UV(A,t);d.faceVertexUvs[e][z]=B}u&&(u=3*g[n++],t=new THREE.Vector3,t.x=m[u++],t.y=m[u++],t.z=m[u],s.normal=t);if(q)for(e=0;e<y;e++)u=3*g[n++],t=new THREE.Vector3,t.x=m[u++],t.y=m[u++],t.z=m[u],s.vertexNormals.push(t);r&&(q=g[n++],s.color=new THREE.Color(j[q]));if(p)for(e=0;e<y;e++)q=
|
|
|
-g[n++],s.vertexColors.push(new THREE.Color(j[q]));d.faces.push(s)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;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+=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;j=a.morphTargets[e].vertices;t=0;for(l=j.length;t<l;t+=3)p=new THREE.Vector3,p.x=j[t]*f,p.y=j[t+1]*f,p.z=j[t+2]*f,m.push(p)}}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;j=a.morphColors[e].colors;m=0;for(l=j.length;m<l;m+=3)n=new THREE.Color(16755200),n.setRGB(j[m],j[m+1],j[m+2]),f.push(n)}}d.computeCentroids();
|
|
|
+b;l.image.height=c;l.image.getContext("2d").drawImage(a,0,0,b,c)}else l.image=a;l.needsUpdate=!0});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+f);b&&b.add(a)},l=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},m="MeshLambertMaterial",n={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(g.shading){var p=g.shading.toLowerCase();"phong"===p?m="MeshPhongMaterial":"basic"===p&&(m="MeshBasicMaterial")}void 0!==g.blending&&void 0!==THREE[g.blending]&&
|
|
|
+(n.blending=THREE[g.blending]);if(void 0!==g.transparent||1>g.opacity)n.transparent=g.transparent;void 0!==g.depthTest&&(n.depthTest=g.depthTest);void 0!==g.depthWrite&&(n.depthWrite=g.depthWrite);void 0!==g.vertexColors&&("face"==g.vertexColors?n.vertexColors=THREE.FaceColors:g.vertexColors&&(n.vertexColors=THREE.VertexColors));g.colorDiffuse?n.color=l(g.colorDiffuse):g.DbgColor&&(n.color=g.DbgColor);g.colorSpecular&&(n.specular=l(g.colorSpecular));g.colorAmbient&&(n.ambient=l(g.colorAmbient));g.transparency&&
|
|
|
+(n.opacity=g.transparency);g.specularCoef&&(n.shininess=g.specularCoef);void 0!==g.visible&&(n.visible=g.visible);void 0!==g.flipSided&&(n.side=THREE.BackSide);void 0!==g.doubleSided&&(n.side=THREE.DoubleSide);void 0!==g.wireframe&&(n.wireframe=g.wireframe);g.mapDiffuse&&j(n,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(n,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&j(n,"bumpMap",g.mapBump,g.mapBumpRepeat,g.mapBumpOffset,
|
|
|
+g.mapBumpWrap);g.mapNormal&&j(n,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(n,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);g.mapNormal?(j=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(j.uniforms),l.tNormal.value=n.normalMap,g.mapNormalFactor&&l.uNormalScale.value.set(g.mapNormalFactor,g.mapNormalFactor),n.map&&(l.tDiffuse.value=n.map,l.enableDiffuse.value=!0),n.specularMap&&(l.tSpecular.value=n.specularMap,
|
|
|
+l.enableSpecular.value=!0),n.lightMap&&(l.tAO.value=n.lightMap,l.enableAO.value=!0),l.uDiffuseColor.value.setHex(n.color),l.uSpecularColor.value.setHex(n.specular),l.uAmbientColor.value.setHex(n.ambient),l.uShininess.value=n.shininess,void 0!==n.opacity&&(l.uOpacity.value=n.opacity),n=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:l,lights:!0,fog:!0})):n=new THREE[m](n);void 0!==g.DbgName&&(n.name=g.DbgName);d.materials[e]=n}}var g=a.faces,o=a.vertices,
|
|
|
+n=a.normals,j=a.colors,l=0;if(a.uvs)for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&l++;for(e=0;e<l;e++)d.faceUvs[e]=[],d.faceVertexUvs[e]=[];m=0;for(p=o.length;m<p;){var q=new THREE.Vector3;q.x=o[m++]*f;q.y=o[m++]*f;q.z=o[m++]*f;d.vertices.push(q)}m=0;for(p=g.length;m<p;){var s=g[m++],t=s&2,e=s&4,A=s&8,u=s&16,o=s&32,r=s&64,q=s&128;if(s&1){s=new THREE.Face4;s.a=g[m++];s.b=g[m++];s.c=g[m++];s.d=g[m++];var B=4}else s=new THREE.Face3,s.a=g[m++],s.b=g[m++],s.c=g[m++],B=3;t&&(t=g[m++],s.materialIndex=t);var y=
|
|
|
+d.faces.length;if(e)for(e=0;e<l;e++){var w=a.uvs[e],t=g[m++],z=w[2*t],t=w[2*t+1];d.faceUvs[e][y]=new THREE.UV(z,t)}if(A)for(e=0;e<l;e++){for(var w=a.uvs[e],A=[],C=0;C<B;C++)t=g[m++],z=w[2*t],t=w[2*t+1],A[C]=new THREE.UV(z,t);d.faceVertexUvs[e][y]=A}u&&(u=3*g[m++],t=new THREE.Vector3,t.x=n[u++],t.y=n[u++],t.z=n[u],s.normal=t);if(o)for(e=0;e<B;e++)u=3*g[m++],t=new THREE.Vector3,t.x=n[u++],t.y=n[u++],t.z=n[u],s.vertexNormals.push(t);r&&(o=g[m++],s.color=new THREE.Color(j[o]));if(q)for(e=0;e<B;e++)o=
|
|
|
+g[m++],s.vertexColors.push(new THREE.Color(j[o]));d.faces.push(s)}if(a.skinWeights){e=0;for(g=a.skinWeights.length;e<g;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+=2)n=0,d.skinIndices.push(new THREE.Vector4(a.skinIndices[e],a.skinIndices[e+1],n,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=[];n=d.morphTargets[e].vertices;j=a.morphTargets[e].vertices;t=0;for(l=j.length;t<l;t+=3)q=new THREE.Vector3,q.x=j[t]*f,q.y=j[t+1]*f,q.z=j[t+2]*f,n.push(q)}}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;j=a.morphColors[e].colors;n=0;for(l=j.length;n<l;n+=3)m=new THREE.Color(16755200),m.setRGB(j[n],j[n+1],j[n+2]),f.push(m)}}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",THREE.JSONLoader);this.addGeometryHandler("binary",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(4===d.readyState)if(200===d.status||0===d.status){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,!0);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"relativeToHTML"==b?a:j+"/"+a}function f(a,b){for(var c in b)if(void 0===G.objects[c]){var d=b[c],e=null;if(void 0!==d.geometry){if(w=G.geometries[d.geometry])e=!1,A=G.materials[d.materials[0]],(e=A instanceof THREE.ShaderMaterial)&&w.computeTangents(),t=d.position,B=d.rotation,u=d.quaternion,r=d.scale,p=d.matrix,u=0,0===d.materials.length&&(A=new THREE.MeshFaceMaterial),1<d.materials.length&&(A=new THREE.MeshFaceMaterial),d.morph?
|
|
|
-(e=new THREE.MorphAnimMesh(w,A),void 0!==d.duration&&(e.duration=d.duration),void 0!==d.time&&(e.time=d.time),void 0!==d.mirroredLoop&&(e.mirroredLoop=d.mirroredLoop),A.morphNormals&&w.computeMorphNormals()):e=new THREE.Mesh(w,A),e.name=c,p?(e.matrixAutoUpdate=!1,e.matrix.set(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15])):(e.position.set(t[0],t[1],t[2]),u?(e.quaternion.set(u[0],u[1],u[2],u[3]),e.useQuaternion=!0):e.rotation.set(B[0],B[1],B[2]),e.scale.set(r[0],
|
|
|
-r[1],r[2])),e.visible=d.visible,e.castShadow=d.castShadow,e.receiveShadow=d.receiveShadow,a.add(e),G.objects[c]=e}else"DirectionalLight"===d.type||"PointLight"===d.type||"AmbientLight"===d.type?(I=void 0!==d.color?d.color:16777215,L=void 0!==d.intensity?d.intensity:1,"DirectionalLight"===d.type?(t=d.direction,K=new THREE.DirectionalLight(I,L),K.position.set(t[0],t[1],t[2]),K.position.normalize()):"PointLight"===d.type?(t=d.position,s=d.distance,K=new THREE.PointLight(I,L,s),K.position.set(t[0],t[1],
|
|
|
-t[2])):"AmbientLight"===d.type&&(K=new THREE.AmbientLight(I)),a.add(K),K.name=c,G.lights[c]=K,G.objects[c]=K):(t=d.position,B=d.rotation,u=d.quaternion,r=d.scale,u=0,e=new THREE.Object3D,e.name=c,e.position.set(t[0],t[1],t[2]),u?(e.quaternion.set(u[0],u[1],u[2],u[3]),e.useQuaternion=!0):e.rotation.set(B[0],B[1],B[2]),e.scale.set(r[0],r[1],r[2]),e.visible=void 0!==d.visible?d.visible:!1,a.add(e),G.objects[c]=e,G.empties[c]=e);if(e){if(void 0!==d.properties)for(var g in d.properties)e.properties[g]=
|
|
|
-d.properties[g];void 0!==d.children&&f(e,d.children)}}}function e(a){return function(b){G.geometries[a]=b;f(G.scene,N.objects);H-=1;i.onLoadComplete();h()}}function g(a){return function(b){G.geometries[a]=b}}function h(){i.callbackProgress({totalModels:O,totalTextures:P,loadedModels:O-H,loadedTextures:P-J},G);i.onLoadProgress();0===H&&0===J&&b(G)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,n,m,o,q,p,s,t,B,u,r,y,z,w,A,F,C,D,K,I,L,H,J,O,P,G,N=a;for(y in this.geometryHandlerMap)this.geometryHandlerMap[y].loaderObject=
|
|
|
-new this.geometryHandlerMap[y].loaderClass;J=H=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,y=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]),y&&G.scene.scale.set(y[0],y[1],y[2]),a||c||y))G.scene.updateMatrix(),G.scene.updateMatrixWorld();a=function(a){return function(){J-=a;h();i.onLoadComplete()}};for(m in N.cameras)y=
|
|
|
-N.cameras[m],"perspective"===y.type?F=new THREE.PerspectiveCamera(y.fov,y.aspect,y.near,y.far):"ortho"===y.type&&(F=new THREE.OrthographicCamera(y.left,y.right,y.top,y.bottom,y.near,y.far)),t=y.position,c=y.target,y=y.up,F.position.set(t[0],t[1],t[2]),F.target=new THREE.Vector3(c[0],c[1],c[2]),y&&F.up.set(y[0],y[1],y[2]),G.cameras[m]=F;for(o in N.fogs)m=N.fogs[o],"linear"===m.type?C=new THREE.Fog(0,m.near,m.far):"exp2"===m.type&&(C=new THREE.FogExp2(0,m.density)),y=m.color,C.color.setRGB(y[0],y[1],
|
|
|
-y[2]),G.fogs[o]=C;G.cameras&&N.defaults.camera&&(G.currentCamera=G.cameras[N.defaults.camera]);G.fogs&&N.defaults.fog&&(G.scene.fog=G.fogs[N.defaults.fog]);y=N.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(y[0],y[1],y[2]);G.bgColorAlpha=N.defaults.bgalpha;for(l in N.geometries)o=N.geometries[l],o.type in this.geometryHandlerMap&&(H+=1,i.onLoadStart());O=H;for(l in N.geometries)if(o=N.geometries[l],"cube"===o.type)w=new THREE.CubeGeometry(o.width,o.height,o.depth,o.widthSegments,o.heightSegments,
|
|
|
-o.depthSegments,null,o.flipped,o.sides),G.geometries[l]=w;else if("plane"===o.type)w=new THREE.PlaneGeometry(o.width,o.height,o.widthSegments,o.heightSegments),G.geometries[l]=w;else if("sphere"===o.type)w=new THREE.SphereGeometry(o.radius,o.widthSegments,o.heightSegments),G.geometries[l]=w;else if("cylinder"===o.type)w=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),G.geometries[l]=w;else if("torus"===o.type)w=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),
|
|
|
-G.geometries[l]=w;else if("icosahedron"===o.type)w=new THREE.IcosahedronGeometry(o.radius,o.subdivisions),G.geometries[l]=w;else if(o.type in this.geometryHandlerMap){C={};for(D in o)"type"!==D&&"url"!==D&&(C[D]=o[D]);this.geometryHandlerMap[o.type].loaderObject.load(d(o.url,N.urlBaseType),e(l),C)}else"embedded"===o.type&&(o=N.embeds[o.id],o.metadata=N.metadata,o&&this.geometryHandlerMap.ascii.loaderObject.createModel(o,g(l),""));for(q in N.textures)if(l=N.textures[q],l.url instanceof Array){J+=l.url.length;
|
|
|
-for(D=0;D<l.url.length;D++)i.onLoadStart()}else J+=1,i.onLoadStart();P=J;for(q in N.textures){l=N.textures[q];void 0!==l.mapping&&void 0!==THREE[l.mapping]&&(l.mapping=new THREE[l.mapping]);if(l.url instanceof Array){o=l.url.length;C=[];for(D=0;D<o;D++)C[D]=d(l.url[D],N.urlBaseType);D=(D=C[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(C,l.mapping,a(o)):THREE.ImageUtils.loadTextureCube(C,l.mapping,a(o))}else{D=l.url.toLowerCase().endsWith(".dds");o=d(l.url,N.urlBaseType);C=a(1);D=
|
|
|
-D?THREE.ImageUtils.loadCompressedTexture(o,l.mapping,C):THREE.ImageUtils.loadTexture(o,l.mapping,C);void 0!==THREE[l.minFilter]&&(D.minFilter=THREE[l.minFilter]);void 0!==THREE[l.magFilter]&&(D.magFilter=THREE[l.magFilter]);l.anisotropy&&(D.anisotropy=l.anisotropy);if(l.repeat&&(D.repeat.set(l.repeat[0],l.repeat[1]),1!==l.repeat[0]&&(D.wrapS=THREE.RepeatWrapping),1!==l.repeat[1]))D.wrapT=THREE.RepeatWrapping;l.offset&&D.offset.set(l.offset[0],l.offset[1]);if(l.wrap&&(o={repeat:THREE.RepeatWrapping,
|
|
|
-mirror:THREE.MirroredRepeatWrapping},void 0!==o[l.wrap[0]]&&(D.wrapS=o[l.wrap[0]]),void 0!==o[l.wrap[1]]))D.wrapT=o[l.wrap[1]]}G.textures[q]=D}for(n in N.materials){p=N.materials[n];for(z in p.parameters)"envMap"===z||"map"===z||"lightMap"===z||"bumpMap"===z?p.parameters[z]=G.textures[p.parameters[z]]:"shading"===z?p.parameters[z]="flat"===p.parameters[z]?THREE.FlatShading:THREE.SmoothShading:"side"===z?p.parameters[z]="double"==p.parameters[z]?THREE.DoubleSide:"back"==p.parameters[z]?THREE.BackSide:
|
|
|
-THREE.FrontSide:"blending"===z?p.parameters[z]=p.parameters[z]in THREE?THREE[p.parameters[z]]:THREE.NormalBlending:"combine"===z?p.parameters[z]="MixOperation"==p.parameters[z]?THREE.MixOperation:THREE.MultiplyOperation:"vertexColors"===z?"face"==p.parameters[z]?p.parameters[z]=THREE.FaceColors:p.parameters[z]&&(p.parameters[z]=THREE.VertexColors):"wrapRGB"===z&&(q=p.parameters[z],p.parameters[z]=new THREE.Vector3(q[0],q[1],q[2]));void 0!==p.parameters.opacity&&1>p.parameters.opacity&&(p.parameters.transparent=
|
|
|
-!0);p.parameters.normalMap?(q=THREE.ShaderUtils.lib.normal,a=THREE.UniformsUtils.clone(q.uniforms),l=p.parameters.color,D=p.parameters.specular,o=p.parameters.ambient,C=p.parameters.shininess,a.tNormal.value=G.textures[p.parameters.normalMap],p.parameters.normalScale&&a.uNormalScale.value.set(p.parameters.normalScale[0],p.parameters.normalScale[1]),p.parameters.map&&(a.tDiffuse.value=p.parameters.map,a.enableDiffuse.value=!0),p.parameters.envMap&&(a.tCube.value=p.parameters.envMap,a.enableReflection.value=
|
|
|
-!0,a.uReflectivity.value=p.parameters.reflectivity),p.parameters.lightMap&&(a.tAO.value=p.parameters.lightMap,a.enableAO.value=!0),p.parameters.specularMap&&(a.tSpecular.value=G.textures[p.parameters.specularMap],a.enableSpecular.value=!0),p.parameters.displacementMap&&(a.tDisplacement.value=G.textures[p.parameters.displacementMap],a.enableDisplacement.value=!0,a.uDisplacementBias.value=p.parameters.displacementBias,a.uDisplacementScale.value=p.parameters.displacementScale),a.uDiffuseColor.value.setHex(l),
|
|
|
-a.uSpecularColor.value.setHex(D),a.uAmbientColor.value.setHex(o),a.uShininess.value=C,p.parameters.opacity&&(a.uOpacity.value=p.parameters.opacity),A=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:a,lights:!0,fog:!0})):A=new THREE[p.type](p.parameters);G.materials[n]=A}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=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};
|
|
|
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function f(a,b){for(var c in b)if(void 0===L.objects[c]){var d=b[c],e=null;if(void 0!==d.geometry){if(z=L.geometries[d.geometry])e=!1,C=L.materials[d.materials[0]],(e=C instanceof THREE.ShaderMaterial)&&z.computeTangents(),s=d.position,t=d.rotation,A=d.quaternion,u=d.scale,o=d.matrix,A=0,0===d.materials.length&&(C=new THREE.MeshFaceMaterial),1<d.materials.length&&(C=new THREE.MeshFaceMaterial),d.morph?
|
|
|
+(e=new THREE.MorphAnimMesh(z,C),void 0!==d.duration&&(e.duration=d.duration),void 0!==d.time&&(e.time=d.time),void 0!==d.mirroredLoop&&(e.mirroredLoop=d.mirroredLoop),C.morphNormals&&z.computeMorphNormals()):e=new THREE.Mesh(z,C),e.name=c,o?(e.matrixAutoUpdate=!1,e.matrix.set(o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],o[8],o[9],o[10],o[11],o[12],o[13],o[14],o[15])):(e.position.set(s[0],s[1],s[2]),A?(e.quaternion.set(A[0],A[1],A[2],A[3]),e.useQuaternion=!0):e.rotation.set(t[0],t[1],t[2]),e.scale.set(u[0],
|
|
|
+u[1],u[2])),e.visible=d.visible,e.castShadow=d.castShadow,e.receiveShadow=d.receiveShadow,a.add(e),L.objects[c]=e}else"DirectionalLight"===d.type||"PointLight"===d.type||"AmbientLight"===d.type?(M=void 0!==d.color?d.color:16777215,J=void 0!==d.intensity?d.intensity:1,"DirectionalLight"===d.type?(s=d.direction,G=new THREE.DirectionalLight(M,J),G.position.set(s[0],s[1],s[2]),G.position.normalize()):"PointLight"===d.type?(s=d.position,q=d.distance,G=new THREE.PointLight(M,J,q),G.position.set(s[0],s[1],
|
|
|
+s[2])):"AmbientLight"===d.type&&(G=new THREE.AmbientLight(M)),a.add(G),G.name=c,L.lights[c]=G,L.objects[c]=G):"PerspectiveCamera"===d.type||"OrthographicCamera"===d.type?("PerspectiveCamera"===d.type?D=new THREE.PerspectiveCamera(d.fov,d.aspect,d.near,d.far):"OrthographicCamera"===d.type&&(D=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),s=d.position,B=d.target,w=d.up,D.position.set(s[0],s[1],s[2]),D.target=new THREE.Vector3(B[0],B[1],B[2]),w&&D.up.set(w[0],w[1],w[2]),a.add(D),
|
|
|
+D.name=c,L.cameras[c]=D,L.objects[c]=D):(s=d.position,t=d.rotation,A=d.quaternion,u=d.scale,A=0,e=new THREE.Object3D,e.name=c,e.position.set(s[0],s[1],s[2]),A?(e.quaternion.set(A[0],A[1],A[2],A[3]),e.useQuaternion=!0):e.rotation.set(t[0],t[1],t[2]),e.scale.set(u[0],u[1],u[2]),e.visible=void 0!==d.visible?d.visible:!1,a.add(e),L.objects[c]=e,L.empties[c]=e);if(e){if(void 0!==d.properties)for(var g in d.properties)e.properties[g]=d.properties[g];void 0!==d.children&&f(e,d.children)}}}function e(a){return function(b){L.geometries[a]=
|
|
|
+b;f(L.scene,X.objects);K-=1;i.onLoadComplete();h()}}function g(a){return function(b){L.geometries[a]=b}}function h(){i.callbackProgress({totalModels:O,totalTextures:P,loadedModels:O-K,loadedTextures:P-N},L);i.onLoadProgress();0===K&&0===N&&b(L)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),l,m,n,p,o,q,s,t,A,u,r,B,y,w,z,C,D,F,I,G,M,J,K,N,O,P,L,X=a,H;for(H in this.geometryHandlerMap)this.geometryHandlerMap[H].loaderObject=new this.geometryHandlerMap[H].loaderClass;N=K=0;L={scene:new THREE.Scene,
|
|
|
+geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(X.transform&&(a=X.transform.position,c=X.transform.rotation,H=X.transform.scale,a&&L.scene.position.set(a[0],a[1],a[2]),c&&L.scene.rotation.set(c[0],c[1],c[2]),H&&L.scene.scale.set(H[0],H[1],H[2]),a||c||H))L.scene.updateMatrix(),L.scene.updateMatrixWorld();a=function(a){return function(){N-=a;h();i.onLoadComplete()}};for(n in X.fogs)c=X.fogs[n],"linear"===c.type?F=new THREE.Fog(0,c.near,c.far):"exp2"===c.type&&
|
|
|
+(F=new THREE.FogExp2(0,c.density)),r=c.color,F.color.setRGB(r[0],r[1],r[2]),L.fogs[n]=F;for(l in X.geometries)n=X.geometries[l],n.type in this.geometryHandlerMap&&(K+=1,i.onLoadStart());O=K;for(l in X.geometries)if(n=X.geometries[l],"cube"===n.type)z=new THREE.CubeGeometry(n.width,n.height,n.depth,n.widthSegments,n.heightSegments,n.depthSegments,null,n.flipped,n.sides),L.geometries[l]=z;else if("plane"===n.type)z=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),L.geometries[l]=
|
|
|
+z;else if("sphere"===n.type)z=new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),L.geometries[l]=z;else if("cylinder"===n.type)z=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),L.geometries[l]=z;else if("torus"===n.type)z=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),L.geometries[l]=z;else if("icosahedron"===n.type)z=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),L.geometries[l]=z;else if(n.type in this.geometryHandlerMap){F=
|
|
|
+{};for(I in n)"type"!==I&&"url"!==I&&(F[I]=n[I]);this.geometryHandlerMap[n.type].loaderObject.load(d(n.url,X.urlBaseType),e(l),F)}else"embedded"===n.type&&(n=X.embeds[n.id],n.metadata=X.metadata,n&&this.geometryHandlerMap.ascii.loaderObject.createModel(n,g(l),""));for(p in X.textures)if(l=X.textures[p],l.url instanceof Array){N+=l.url.length;for(I=0;I<l.url.length;I++)i.onLoadStart()}else N+=1,i.onLoadStart();P=N;for(p in X.textures){l=X.textures[p];void 0!==l.mapping&&void 0!==THREE[l.mapping]&&
|
|
|
+(l.mapping=new THREE[l.mapping]);if(l.url instanceof Array){n=l.url.length;F=[];for(I=0;I<n;I++)F[I]=d(l.url[I],X.urlBaseType);I=(I=F[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(F,l.mapping,a(n)):THREE.ImageUtils.loadTextureCube(F,l.mapping,a(n))}else{I=l.url.toLowerCase().endsWith(".dds");n=d(l.url,X.urlBaseType);F=a(1);I=I?THREE.ImageUtils.loadCompressedTexture(n,l.mapping,F):THREE.ImageUtils.loadTexture(n,l.mapping,F);void 0!==THREE[l.minFilter]&&(I.minFilter=THREE[l.minFilter]);
|
|
|
+void 0!==THREE[l.magFilter]&&(I.magFilter=THREE[l.magFilter]);l.anisotropy&&(I.anisotropy=l.anisotropy);if(l.repeat&&(I.repeat.set(l.repeat[0],l.repeat[1]),1!==l.repeat[0]&&(I.wrapS=THREE.RepeatWrapping),1!==l.repeat[1]))I.wrapT=THREE.RepeatWrapping;l.offset&&I.offset.set(l.offset[0],l.offset[1]);if(l.wrap&&(n={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==n[l.wrap[0]]&&(I.wrapS=n[l.wrap[0]]),void 0!==n[l.wrap[1]]))I.wrapT=n[l.wrap[1]]}L.textures[p]=I}for(m in X.materials){o=
|
|
|
+X.materials[m];for(y in o.parameters)"envMap"===y||"map"===y||"lightMap"===y||"bumpMap"===y?o.parameters[y]=L.textures[o.parameters[y]]:"shading"===y?o.parameters[y]="flat"===o.parameters[y]?THREE.FlatShading:THREE.SmoothShading:"side"===y?o.parameters[y]="double"==o.parameters[y]?THREE.DoubleSide:"back"==o.parameters[y]?THREE.BackSide:THREE.FrontSide:"blending"===y?o.parameters[y]=o.parameters[y]in THREE?THREE[o.parameters[y]]:THREE.NormalBlending:"combine"===y?o.parameters[y]="MixOperation"==o.parameters[y]?
|
|
|
+THREE.MixOperation:THREE.MultiplyOperation:"vertexColors"===y?"face"==o.parameters[y]?o.parameters[y]=THREE.FaceColors:o.parameters[y]&&(o.parameters[y]=THREE.VertexColors):"wrapRGB"===y&&(p=o.parameters[y],o.parameters[y]=new THREE.Vector3(p[0],p[1],p[2]));void 0!==o.parameters.opacity&&1>o.parameters.opacity&&(o.parameters.transparent=!0);o.parameters.normalMap?(p=THREE.ShaderUtils.lib.normal,a=THREE.UniformsUtils.clone(p.uniforms),l=o.parameters.color,I=o.parameters.specular,n=o.parameters.ambient,
|
|
|
+F=o.parameters.shininess,a.tNormal.value=L.textures[o.parameters.normalMap],o.parameters.normalScale&&a.uNormalScale.value.set(o.parameters.normalScale[0],o.parameters.normalScale[1]),o.parameters.map&&(a.tDiffuse.value=o.parameters.map,a.enableDiffuse.value=!0),o.parameters.envMap&&(a.tCube.value=o.parameters.envMap,a.enableReflection.value=!0,a.uReflectivity.value=o.parameters.reflectivity),o.parameters.lightMap&&(a.tAO.value=o.parameters.lightMap,a.enableAO.value=!0),o.parameters.specularMap&&
|
|
|
+(a.tSpecular.value=L.textures[o.parameters.specularMap],a.enableSpecular.value=!0),o.parameters.displacementMap&&(a.tDisplacement.value=L.textures[o.parameters.displacementMap],a.enableDisplacement.value=!0,a.uDisplacementBias.value=o.parameters.displacementBias,a.uDisplacementScale.value=o.parameters.displacementScale),a.uDiffuseColor.value.setHex(l),a.uSpecularColor.value.setHex(I),a.uAmbientColor.value.setHex(n),a.uShininess.value=F,o.parameters.opacity&&(a.uOpacity.value=o.parameters.opacity),
|
|
|
+C=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})):C=new THREE[o.type](o.parameters);L.materials[m]=C}f(L.scene,X.objects);L.cameras&&X.defaults.camera&&(L.currentCamera=L.cameras[X.defaults.camera]);L.fogs&&X.defaults.fog&&(L.scene.fog=L.fogs[X.defaults.fog]);r=X.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(r[0],r[1],r[2]);L.bgColorAlpha=X.defaults.bgalpha;i.callbackSync(L);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=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};
|
|
|
THREE.Material=function(){THREE.MaterialLibrary.push(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
|
THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color&&"number"===typeof c?d.setHex(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
|
|
|
THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
|
|
@@ -268,35 +268,35 @@ THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);THREE.Scene=function()
|
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){B!==a&&(B=p.globalAlpha=a)}function c(a){u!==a&&(a===THREE.NormalBlending?p.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?p.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(p.globalCompositeOperation="darker"),u=a)}function d(a){r!==a&&(r=p.strokeStyle=a)}function f(a){y!==a&&(y=p.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
|
|
|
-document.createElement("canvas"),n,m,o,q,p=l.getContext("2d"),s=new THREE.Color(0),t=0,B=1,u=0,r=null,y=null,z=null,w=null,A=null,F,C,D,K,I=new THREE.RenderableVertex,L=new THREE.RenderableVertex,H,J,O,P,G,N,na,M,Z,sa,R,ia,Q=new THREE.Color,fa=new THREE.Color,W=new THREE.Color,$=new THREE.Color,ea=new THREE.Color,Y=new THREE.Color,ca=new THREE.Color,Ia={},La={},Ea,ua,ra,Ma,kb,cb,Ua,gb,vb,Sb,ab=new THREE.Rectangle,Pa=new THREE.Rectangle,Ga=new THREE.Rectangle,lb=!1,Ja=new THREE.Color,bb=new THREE.Color,
|
|
|
-Ya=new THREE.Color,la=new THREE.Vector3,hb,db,Va,ya,ib,nb,a=16;hb=document.createElement("canvas");hb.width=hb.height=2;db=hb.getContext("2d");db.fillStyle="rgba(0,0,0,1)";db.fillRect(0,0,2,2);Va=db.getImageData(0,0,2,2);ya=Va.data;ib=document.createElement("canvas");ib.width=ib.height=a;nb=ib.getContext("2d");nb.translate(-a/2,-a/2);nb.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;m=b;o=
|
|
|
-Math.floor(n/2);q=Math.floor(m/2);l.width=n;l.height=m;ab.set(-o,-q,o,q);Pa.set(-o,-q,o,q);B=1;u=0;A=w=z=y=r=null};this.setClearColor=function(a,b){s.copy(a);t=void 0!==b?b:1;Pa.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){s.setHex(a);t=void 0!==b?b:1;Pa.set(-o,-q,o,q)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){p.setTransform(1,0,0,-1,o,q);!1===Pa.isEmpty()&&(Pa.minSelf(ab),Pa.inflate(2),1>t&&p.clearRect(Math.floor(Pa.getX()),Math.floor(Pa.getY()),Math.floor(Pa.getWidth()),
|
|
|
-Math.floor(Pa.getHeight())),0<t&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(255*s.r)+","+Math.floor(255*s.g)+","+Math.floor(255*s.b)+","+t+")"),p.fillRect(Math.floor(Pa.getX()),Math.floor(Pa.getY()),Math.floor(Pa.getWidth()),Math.floor(Pa.getHeight()))),Pa.empty())};this.render=function(a,l){function n(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);0>=k||(k*=e.intensity,c.r+=g.r*k,
|
|
|
-c.g+=g.g*k,c.b+=g.b*k)}else e instanceof THREE.PointLight&&(h=e.matrixWorld.getPosition(),k=b.dot(la.sub(h,a).normalize()),0>=k||(k*=0==e.distance?1:1-Math.min(a.distanceTo(h)/e.distance,1),0!=k&&(k*=e.intensity,c.r+=g.r*k,c.g+=g.g*k,c.b+=g.b*k)))}}function m(a,d,f,g,h,k,i,j){e.info.render.vertices+=3;e.info.render.faces++;b(j.opacity);c(j.blending);H=a.positionScreen.x;J=a.positionScreen.y;O=d.positionScreen.x;P=d.positionScreen.y;G=f.positionScreen.x;N=f.positionScreen.y;t(H,J,O,P,G,N);(j instanceof
|
|
|
-THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)&&null===j.map&&null===j.map?(Y.copy(j.color),ca.copy(j.emissive),j.vertexColors===THREE.FaceColors&&(Y.r*=i.color.r,Y.g*=i.color.g,Y.b*=i.color.b),!0===lb)?!1===j.wireframe&&j.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(fa.r=W.r=$.r=Ja.r,fa.g=W.g=$.g=Ja.g,fa.b=W.b=$.b=Ja.b,n(i.v1.positionWorld,i.vertexNormalsWorld[0],fa),n(i.v2.positionWorld,i.vertexNormalsWorld[1],W),n(i.v3.positionWorld,i.vertexNormalsWorld[2],$),fa.r=
|
|
|
-fa.r*Y.r+ca.r,fa.g=fa.g*Y.g+ca.g,fa.b=fa.b*Y.b+ca.b,W.r=W.r*Y.r+ca.r,W.g=W.g*Y.g+ca.g,W.b=W.b*Y.b+ca.b,$.r=$.r*Y.r+ca.r,$.g=$.g*Y.g+ca.g,$.b=$.b*Y.b+ca.b,ea.r=0.5*(W.r+$.r),ea.g=0.5*(W.g+$.g),ea.b=0.5*(W.b+$.b),ra=rc(fa,W,$,ea),wa(H,J,O,P,G,N,0,0,1,0,0,1,ra)):(Q.r=Ja.r,Q.g=Ja.g,Q.b=Ja.b,n(i.centroidWorld,i.normalWorld,Q),Q.r=Q.r*Y.r+ca.r,Q.g=Q.g*Y.g+ca.g,Q.b=Q.b*Y.b+ca.b,!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q)):!0===j.wireframe?s(j.color,j.wireframeLinewidth,
|
|
|
-j.wireframeLinecap,j.wireframeLinejoin):u(j.color):j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial?null!==j.map?j.map.mapping instanceof THREE.UVMapping&&(Ma=i.uvs[0],y(H,J,O,P,G,N,Ma[g].u,Ma[g].v,Ma[h].u,Ma[h].v,Ma[k].u,Ma[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,la.copy(i.vertexNormalsWorld[g]),kb=0.5*(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])+
|
|
|
-0.5,cb=0.5*(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])+0.5,la.copy(i.vertexNormalsWorld[h]),Ua=0.5*(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])+0.5,gb=0.5*(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])+0.5,la.copy(i.vertexNormalsWorld[k]),vb=0.5*(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])+0.5,Sb=0.5*(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])+0.5,y(H,J,O,P,G,N,kb,cb,Ua,gb,vb,Sb,j.envMap)):(Q.copy(j.color),j.vertexColors===THREE.FaceColors&&
|
|
|
-(Q.r*=i.color.r,Q.g*=i.color.g,Q.b*=i.color.b),!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q)):j instanceof THREE.MeshDepthMaterial?(Ea=l.near,ua=l.far,fa.r=fa.g=fa.b=1-wb(a.positionScreen.z,Ea,ua),W.r=W.g=W.b=1-wb(d.positionScreen.z,Ea,ua),$.r=$.g=$.b=1-wb(f.positionScreen.z,Ea,ua),ea.r=0.5*(W.r+$.r),ea.g=0.5*(W.g+$.g),ea.b=0.5*(W.b+$.b),ra=rc(fa,W,$,ea),wa(H,J,O,P,G,N,0,0,1,0,0,1,ra)):j instanceof THREE.MeshNormalMaterial&&(Q.r=ec(i.normalWorld.x),Q.g=ec(i.normalWorld.y),
|
|
|
-Q.b=ec(i.normalWorld.z),!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q))}function t(a,b,c,d,f,e){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(f,e);p.closePath()}function r(a,b,c,d,f,e,g,h){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(f,e);p.lineTo(g,h);p.closePath()}function s(a,b,c,f){z!==b&&(z=p.lineWidth=b);w!==c&&(w=p.lineCap=c);A!==f&&(A=p.lineJoin=f);d(a.getContextStyle());p.stroke();Ga.inflate(2*b)}function u(a){f(a.getContextStyle());p.fill()}
|
|
|
-function y(a,b,c,d,e,g,h,k,i,j,l,n,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0==m.image.width)){if(!0===m.needsUpdate){var wa=m.wrapS==THREE.RepeatWrapping,o=m.wrapT==THREE.RepeatWrapping;Ia[m.id]=p.createPattern(m.image,!0===wa&&!0===o?"repeat":!0===wa&&!1===o?"repeat-x":!1===wa&&!0===o?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ia[m.id]?f("rgba(0,0,0,1)"):f(Ia[m.id]);var wa=m.offset.x/m.repeat.x,o=m.offset.y/m.repeat.y,wb=m.image.width*m.repeat.x,q=m.image.height*m.repeat.y,
|
|
|
-h=(h+wa)*wb,k=(1-k+o)*q,c=c-a,d=d-b,e=e-a,g=g-b,i=(i+wa)*wb-h,j=(1-j+o)*q-k,l=(l+wa)*wb-h,n=(1-n+o)*q-k,wa=i*n-l*j;0===wa?(void 0===La[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),La[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=La[m.id],h=4*(Math.floor(h)+Math.floor(k)*m.image.width),Q.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255),u(Q)):(wa=1/wa,m=(n*c-j*e)*wa,j=(n*d-j*g)*wa,c=(i*e-l*c)*wa,d=(i*g-
|
|
|
-l*d)*wa,a=a-m*h-c*k,h=b-j*h-d*k,p.save(),p.transform(m,j,c,d,a,h),p.fill(),p.restore())}}function wa(a,b,c,d,f,e,g,h,k,i,j,l,m){var n,wa;n=m.width-1;wa=m.height-1;g*=n;h*=wa;c-=a;d-=b;f-=a;e-=b;k=k*n-g;i=i*wa-h;j=j*n-g;l=l*wa-h;wa=1/(k*l-j*i);n=(l*c-i*f)*wa;i=(l*d-i*e)*wa;c=(k*f-j*c)*wa;d=(k*e-j*d)*wa;a=a-n*g-c*h;b=b-i*g-d*h;p.save();p.transform(n,i,c,d,a,b);p.clip();p.drawImage(m,0,0);p.restore()}function rc(a,b,c,d){ya[0]=255*a.r|0;ya[1]=255*a.g|0;ya[2]=255*a.b|0;ya[4]=255*b.r|0;ya[5]=255*b.g|0;
|
|
|
-ya[6]=255*b.b|0;ya[8]=255*c.r|0;ya[9]=255*c.g|0;ya[10]=255*c.b|0;ya[12]=255*d.r|0;ya[13]=255*d.g|0;ya[14]=255*d.b|0;db.putImageData(Va,0,0);nb.drawImage(hb,0,0);return ib}function wb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ec(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Tb(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;0!==f&&(f=1/Math.sqrt(f),c*=f,d*=f,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===l instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
-else{var Ub,B,ja,aa;!0===this.autoClear?this.clear():p.setTransform(1,0,0,-1,o,q);e.info.render.vertices=0;e.info.render.faces=0;g=j.projectScene(a,l,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;lb=0<i.length;if(!0===lb){Ja.setRGB(0,0,0);bb.setRGB(0,0,0);Ya.setRGB(0,0,0);Ub=0;for(B=i.length;Ub<B;Ub++){aa=i[Ub];var ka=aa.color;aa instanceof THREE.AmbientLight?(Ja.r+=ka.r,Ja.g+=ka.g,Ja.b+=ka.b):aa instanceof THREE.DirectionalLight?(bb.r+=ka.r,bb.g+=ka.g,bb.b+=ka.b):aa instanceof THREE.PointLight&&
|
|
|
-(Ya.r+=ka.r,Ya.g+=ka.g,Ya.b+=ka.b)}}Ub=0;for(B=h.length;Ub<B;Ub++)if(ja=h[Ub],aa=ja.material,!(void 0===aa||!1===aa.visible)){Ga.empty();if(ja instanceof THREE.RenderableParticle){F=ja;F.x*=o;F.y*=q;var ka=F,Za=ja;b(aa.opacity);c(aa.blending);var tb=void 0,ub=void 0,ob=void 0,pb=void 0,fc=ja=void 0,Ec=void 0;aa instanceof THREE.ParticleBasicMaterial?null===aa.map?(ob=Za.object.scale.x,pb=Za.object.scale.y,ob*=Za.scale.x*o,pb*=Za.scale.y*q,Ga.set(ka.x-ob,ka.y-pb,ka.x+ob,ka.y+pb),!1!==ab.intersects(Ga)&&
|
|
|
-(f(aa.color.getContextStyle()),p.save(),p.translate(ka.x,ka.y),p.rotate(-Za.rotation),p.scale(ob,pb),p.fillRect(-1,-1,2,2),p.restore())):(ja=aa.map.image,fc=ja.width>>1,Ec=ja.height>>1,ob=Za.scale.x*o,pb=Za.scale.y*q,tb=ob*fc,ub=pb*Ec,Ga.set(ka.x-tb,ka.y-ub,ka.x+tb,ka.y+ub),!1!==ab.intersects(Ga)&&(p.save(),p.translate(ka.x,ka.y),p.rotate(-Za.rotation),p.scale(ob,-pb),p.translate(-fc,-Ec),p.drawImage(ja,0,0),p.restore())):aa instanceof THREE.ParticleCanvasMaterial&&(tb=Za.scale.x*o,ub=Za.scale.y*
|
|
|
-q,Ga.set(ka.x-tb,ka.y-ub,ka.x+tb,ka.y+ub),!1!==ab.intersects(Ga)&&(d(aa.color.getContextStyle()),f(aa.color.getContextStyle()),p.save(),p.translate(ka.x,ka.y),p.rotate(-Za.rotation),p.scale(tb,ub),aa.program(p),p.restore()))}else if(ja instanceof THREE.RenderableLine){if(F=ja.v1,C=ja.v2,F.positionScreen.x*=o,F.positionScreen.y*=q,C.positionScreen.x*=o,C.positionScreen.y*=q,Ga.addPoint(F.positionScreen.x,F.positionScreen.y),Ga.addPoint(C.positionScreen.x,C.positionScreen.y),!0===ab.intersects(Ga)&&
|
|
|
-(ka=F,Za=C,b(aa.opacity),c(aa.blending),p.beginPath(),p.moveTo(ka.positionScreen.x,ka.positionScreen.y),p.lineTo(Za.positionScreen.x,Za.positionScreen.y),aa instanceof THREE.LineBasicMaterial))ka=aa.linewidth,z!==ka&&(z=p.lineWidth=ka),ka=aa.linecap,w!==ka&&(w=p.lineCap=ka),ka=aa.linejoin,A!==ka&&(A=p.lineJoin=ka),d(aa.color.getContextStyle()),p.stroke(),Ga.inflate(2*aa.linewidth)}else if(ja instanceof THREE.RenderableFace3)F=ja.v1,C=ja.v2,D=ja.v3,F.positionScreen.x*=o,F.positionScreen.y*=q,C.positionScreen.x*=
|
|
|
-o,C.positionScreen.y*=q,D.positionScreen.x*=o,D.positionScreen.y*=q,!0===aa.overdraw&&(Tb(F.positionScreen,C.positionScreen),Tb(C.positionScreen,D.positionScreen),Tb(D.positionScreen,F.positionScreen)),Ga.add3Points(F.positionScreen.x,F.positionScreen.y,C.positionScreen.x,C.positionScreen.y,D.positionScreen.x,D.positionScreen.y),!0===ab.intersects(Ga)&&m(F,C,D,0,1,2,ja,aa,a);else if(ja instanceof THREE.RenderableFace4&&(F=ja.v1,C=ja.v2,D=ja.v3,K=ja.v4,F.positionScreen.x*=o,F.positionScreen.y*=q,C.positionScreen.x*=
|
|
|
-o,C.positionScreen.y*=q,D.positionScreen.x*=o,D.positionScreen.y*=q,K.positionScreen.x*=o,K.positionScreen.y*=q,I.positionScreen.copy(C.positionScreen),L.positionScreen.copy(K.positionScreen),!0===aa.overdraw&&(Tb(F.positionScreen,C.positionScreen),Tb(C.positionScreen,K.positionScreen),Tb(K.positionScreen,F.positionScreen),Tb(D.positionScreen,I.positionScreen),Tb(D.positionScreen,L.positionScreen)),Ga.addPoint(F.positionScreen.x,F.positionScreen.y),Ga.addPoint(C.positionScreen.x,C.positionScreen.y),
|
|
|
-Ga.addPoint(D.positionScreen.x,D.positionScreen.y),Ga.addPoint(K.positionScreen.x,K.positionScreen.y),!0===ab.intersects(Ga)))(ka=F,Za=C,tb=D,ub=K,ob=I,pb=L,fc=a,e.info.render.vertices+=4,e.info.render.faces++,b(aa.opacity),c(aa.blending),void 0!==aa.map&&null!==aa.map||void 0!==aa.envMap&&null!==aa.envMap)?(m(ka,Za,ub,0,1,3,ja,aa,fc),m(ob,tb,pb,1,2,3,ja,aa,fc)):(H=ka.positionScreen.x,J=ka.positionScreen.y,O=Za.positionScreen.x,P=Za.positionScreen.y,G=tb.positionScreen.x,N=tb.positionScreen.y,na=
|
|
|
-ub.positionScreen.x,M=ub.positionScreen.y,Z=ob.positionScreen.x,sa=ob.positionScreen.y,R=pb.positionScreen.x,ia=pb.positionScreen.y,aa instanceof THREE.MeshLambertMaterial||aa instanceof THREE.MeshPhongMaterial)?(Y.copy(aa.color),ca.copy(aa.emissive),aa.vertexColors===THREE.FaceColors&&(Y.r*=ja.color.r,Y.g*=ja.color.g,Y.b*=ja.color.b),!0===lb)?!1===aa.wireframe&&aa.shading==THREE.SmoothShading&&4==ja.vertexNormalsLength?(fa.r=W.r=$.r=ea.r=Ja.r,fa.g=W.g=$.g=ea.g=Ja.g,fa.b=W.b=$.b=ea.b=Ja.b,n(ja.v1.positionWorld,
|
|
|
-ja.vertexNormalsWorld[0],fa),n(ja.v2.positionWorld,ja.vertexNormalsWorld[1],W),n(ja.v4.positionWorld,ja.vertexNormalsWorld[3],$),n(ja.v3.positionWorld,ja.vertexNormalsWorld[2],ea),fa.r=fa.r*Y.r+ca.r,fa.g=fa.g*Y.g+ca.g,fa.b=fa.b*Y.b+ca.b,W.r=W.r*Y.r+ca.r,W.g=W.g*Y.g+ca.g,W.b=W.b*Y.b+ca.b,$.r=$.r*Y.r+ca.r,$.g=$.g*Y.g+ca.g,$.b=$.b*Y.b+ca.b,ea.r=ea.r*Y.r+ca.r,ea.g=ea.g*Y.g+ca.g,ea.b=ea.b*Y.b+ca.b,ra=rc(fa,W,$,ea),t(H,J,O,P,na,M),wa(H,J,O,P,na,M,0,0,1,0,0,1,ra),t(Z,sa,G,N,R,ia),wa(Z,sa,G,N,R,ia,1,0,1,
|
|
|
-1,0,1,ra)):(Q.r=Ja.r,Q.g=Ja.g,Q.b=Ja.b,n(ja.centroidWorld,ja.normalWorld,Q),Q.r=Q.r*Y.r+ca.r,Q.g=Q.g*Y.g+ca.g,Q.b=Q.b*Y.b+ca.b,r(H,J,O,P,G,N,na,M),!0===aa.wireframe?s(Q,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):u(Q)):(Q.r=Y.r+ca.r,Q.g=Y.g+ca.g,Q.b=Y.b+ca.b,r(H,J,O,P,G,N,na,M),!0===aa.wireframe?s(Q,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):u(Q)):aa instanceof THREE.MeshBasicMaterial?(Q.copy(aa.color),aa.vertexColors===THREE.FaceColors&&(Q.r*=ja.color.r,Q.g*=
|
|
|
-ja.color.g,Q.b*=ja.color.b),r(H,J,O,P,G,N,na,M),!0===aa.wireframe?s(Q,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):u(Q)):aa instanceof THREE.MeshNormalMaterial?(Q.r=ec(ja.normalWorld.x),Q.g=ec(ja.normalWorld.y),Q.b=ec(ja.normalWorld.z),r(H,J,O,P,G,N,na,M),!0===aa.wireframe?s(Q,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):u(Q)):aa instanceof THREE.MeshDepthMaterial&&(Ea=l.near,ua=l.far,fa.r=fa.g=fa.b=1-wb(ka.positionScreen.z,Ea,ua),W.r=W.g=W.b=1-wb(Za.positionScreen.z,
|
|
|
-Ea,ua),$.r=$.g=$.b=1-wb(ub.positionScreen.z,Ea,ua),ea.r=ea.g=ea.b=1-wb(tb.positionScreen.z,Ea,ua),ra=rc(fa,W,$,ea),t(H,J,O,P,na,M),wa(H,J,O,P,na,M,0,0,1,0,0,1,ra),t(Z,sa,G,N,R,ia),wa(Z,sa,G,N,R,ia,1,0,1,1,0,1,ra));Pa.addRectangle(Ga)}p.setTransform(1,0,0,1,0,0)}}};
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){A!==a&&(A=q.globalAlpha=a)}function c(a){u!==a&&(a===THREE.NormalBlending?q.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?q.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(q.globalCompositeOperation="darker"),u=a)}function d(a){r!==a&&(r=q.strokeStyle=a)}function f(a){B!==a&&(B=q.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},e=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
|
|
|
+document.createElement("canvas"),m,n,p,o,q=l.getContext("2d"),s=new THREE.Color(0),t=0,A=1,u=0,r=null,B=null,y=null,w=null,z=null,C,D,F,I,G=new THREE.RenderableVertex,M=new THREE.RenderableVertex,J,K,N,O,P,L,X,H,fa,sa,R,oa,Q=new THREE.Color,ha=new THREE.Color,W=new THREE.Color,aa=new THREE.Color,Z=new THREE.Color,$=new THREE.Color,da=new THREE.Color,Ka={},La={},Ea,ua,ra,Ma,kb,cb,Ua,gb,vb,Sb,ab=new THREE.Rectangle,Pa=new THREE.Rectangle,Ga=new THREE.Rectangle,lb=!1,Ia=new THREE.Color,bb=new THREE.Color,
|
|
|
+Ya=new THREE.Color,la=new THREE.Vector3,hb,db,Va,ya,ib,nb,a=16;hb=document.createElement("canvas");hb.width=hb.height=2;db=hb.getContext("2d");db.fillStyle="rgba(0,0,0,1)";db.fillRect(0,0,2,2);Va=db.getImageData(0,0,2,2);ya=Va.data;ib=document.createElement("canvas");ib.width=ib.height=a;nb=ib.getContext("2d");nb.translate(-a/2,-a/2);nb.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;n=b;p=
|
|
|
+Math.floor(m/2);o=Math.floor(n/2);l.width=m;l.height=n;ab.set(-p,-o,p,o);Pa.set(-p,-o,p,o);A=1;u=0;z=w=y=B=r=null};this.setClearColor=function(a,b){s.copy(a);t=void 0!==b?b:1;Pa.set(-p,-o,p,o)};this.setClearColorHex=function(a,b){s.setHex(a);t=void 0!==b?b:1;Pa.set(-p,-o,p,o)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){q.setTransform(1,0,0,-1,p,o);!1===Pa.isEmpty()&&(Pa.minSelf(ab),Pa.inflate(2),1>t&&q.clearRect(Math.floor(Pa.getX()),Math.floor(Pa.getY()),Math.floor(Pa.getWidth()),
|
|
|
+Math.floor(Pa.getHeight())),0<t&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(255*s.r)+","+Math.floor(255*s.g)+","+Math.floor(255*s.b)+","+t+")"),q.fillRect(Math.floor(Pa.getX()),Math.floor(Pa.getY()),Math.floor(Pa.getWidth()),Math.floor(Pa.getHeight()))),Pa.empty())};this.render=function(a,l){function n(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);0>=k||(k*=e.intensity,c.r+=g.r*k,
|
|
|
+c.g+=g.g*k,c.b+=g.b*k)}else e instanceof THREE.PointLight&&(h=e.matrixWorld.getPosition(),k=b.dot(la.sub(h,a).normalize()),0>=k||(k*=0==e.distance?1:1-Math.min(a.distanceTo(h)/e.distance,1),0!=k&&(k*=e.intensity,c.r+=g.r*k,c.g+=g.g*k,c.b+=g.b*k)))}}function m(a,d,f,g,h,k,i,j){e.info.render.vertices+=3;e.info.render.faces++;b(j.opacity);c(j.blending);J=a.positionScreen.x;K=a.positionScreen.y;N=d.positionScreen.x;O=d.positionScreen.y;P=f.positionScreen.x;L=f.positionScreen.y;r(J,K,N,O,P,L);(j instanceof
|
|
|
+THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)&&null===j.map&&null===j.map?($.copy(j.color),da.copy(j.emissive),j.vertexColors===THREE.FaceColors&&($.r*=i.color.r,$.g*=i.color.g,$.b*=i.color.b),!0===lb)?!1===j.wireframe&&j.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(ha.r=W.r=aa.r=Ia.r,ha.g=W.g=aa.g=Ia.g,ha.b=W.b=aa.b=Ia.b,n(i.v1.positionWorld,i.vertexNormalsWorld[0],ha),n(i.v2.positionWorld,i.vertexNormalsWorld[1],W),n(i.v3.positionWorld,i.vertexNormalsWorld[2],aa),ha.r=
|
|
|
+ha.r*$.r+da.r,ha.g=ha.g*$.g+da.g,ha.b=ha.b*$.b+da.b,W.r=W.r*$.r+da.r,W.g=W.g*$.g+da.g,W.b=W.b*$.b+da.b,aa.r=aa.r*$.r+da.r,aa.g=aa.g*$.g+da.g,aa.b=aa.b*$.b+da.b,Z.r=0.5*(W.r+aa.r),Z.g=0.5*(W.g+aa.g),Z.b=0.5*(W.b+aa.b),ra=rc(ha,W,aa,Z),wa(J,K,N,O,P,L,0,0,1,0,0,1,ra)):(Q.r=Ia.r,Q.g=Ia.g,Q.b=Ia.b,n(i.centroidWorld,i.normalWorld,Q),Q.r=Q.r*$.r+da.r,Q.g=Q.g*$.g+da.g,Q.b=Q.b*$.b+da.b,!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q)):!0===j.wireframe?s(j.color,j.wireframeLinewidth,
|
|
|
+j.wireframeLinecap,j.wireframeLinejoin):u(j.color):j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial?null!==j.map?j.map.mapping instanceof THREE.UVMapping&&(Ma=i.uvs[0],A(J,K,N,O,P,L,Ma[g].u,Ma[g].v,Ma[h].u,Ma[h].v,Ma[k].u,Ma[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,la.copy(i.vertexNormalsWorld[g]),kb=0.5*(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])+
|
|
|
+0.5,cb=0.5*(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])+0.5,la.copy(i.vertexNormalsWorld[h]),Ua=0.5*(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])+0.5,gb=0.5*(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])+0.5,la.copy(i.vertexNormalsWorld[k]),vb=0.5*(la.x*a.elements[0]+la.y*a.elements[4]+la.z*a.elements[8])+0.5,Sb=0.5*(la.x*a.elements[1]+la.y*a.elements[5]+la.z*a.elements[9])+0.5,A(J,K,N,O,P,L,kb,cb,Ua,gb,vb,Sb,j.envMap)):(Q.copy(j.color),j.vertexColors===THREE.FaceColors&&
|
|
|
+(Q.r*=i.color.r,Q.g*=i.color.g,Q.b*=i.color.b),!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q)):j instanceof THREE.MeshDepthMaterial?(Ea=l.near,ua=l.far,ha.r=ha.g=ha.b=1-wb(a.positionScreen.z,Ea,ua),W.r=W.g=W.b=1-wb(d.positionScreen.z,Ea,ua),aa.r=aa.g=aa.b=1-wb(f.positionScreen.z,Ea,ua),Z.r=0.5*(W.r+aa.r),Z.g=0.5*(W.g+aa.g),Z.b=0.5*(W.b+aa.b),ra=rc(ha,W,aa,Z),wa(J,K,N,O,P,L,0,0,1,0,0,1,ra)):j instanceof THREE.MeshNormalMaterial&&(Q.r=ec(i.normalWorld.x),Q.g=
|
|
|
+ec(i.normalWorld.y),Q.b=ec(i.normalWorld.z),!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q))}function r(a,b,c,d,f,e){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(f,e);q.closePath()}function t(a,b,c,d,f,e,g,h){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(f,e);q.lineTo(g,h);q.closePath()}function s(a,b,c,f){y!==b&&(y=q.lineWidth=b);w!==c&&(w=q.lineCap=c);z!==f&&(z=q.lineJoin=f);d(a.getContextStyle());q.stroke();Ga.inflate(2*b)}function u(a){f(a.getContextStyle());
|
|
|
+q.fill()}function A(a,b,c,d,e,g,h,k,i,j,l,n,m){if(!(m instanceof THREE.DataTexture||void 0===m.image||0==m.image.width)){if(!0===m.needsUpdate){var wa=m.wrapS==THREE.RepeatWrapping,o=m.wrapT==THREE.RepeatWrapping;Ka[m.id]=q.createPattern(m.image,!0===wa&&!0===o?"repeat":!0===wa&&!1===o?"repeat-x":!1===wa&&!0===o?"repeat-y":"no-repeat");m.needsUpdate=!1}void 0===Ka[m.id]?f("rgba(0,0,0,1)"):f(Ka[m.id]);var wa=m.offset.x/m.repeat.x,o=m.offset.y/m.repeat.y,p=m.image.width*m.repeat.x,wb=m.image.height*
|
|
|
+m.repeat.y,h=(h+wa)*p,k=(1-k+o)*wb,c=c-a,d=d-b,e=e-a,g=g-b,i=(i+wa)*p-h,j=(1-j+o)*wb-k,l=(l+wa)*p-h,n=(1-n+o)*wb-k,wa=i*n-l*j;0===wa?(void 0===La[m.id]&&(b=document.createElement("canvas"),b.width=m.image.width,b.height=m.image.height,b=b.getContext("2d"),b.drawImage(m.image,0,0),La[m.id]=b.getImageData(0,0,m.image.width,m.image.height).data),b=La[m.id],h=4*(Math.floor(h)+Math.floor(k)*m.image.width),Q.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255),u(Q)):(wa=1/wa,m=(n*c-j*e)*wa,j=(n*d-j*g)*wa,c=(i*e-l*c)*
|
|
|
+wa,d=(i*g-l*d)*wa,a=a-m*h-c*k,h=b-j*h-d*k,q.save(),q.transform(m,j,c,d,a,h),q.fill(),q.restore())}}function wa(a,b,c,d,f,e,g,h,k,i,j,l,n){var m,wa;m=n.width-1;wa=n.height-1;g*=m;h*=wa;c-=a;d-=b;f-=a;e-=b;k=k*m-g;i=i*wa-h;j=j*m-g;l=l*wa-h;wa=1/(k*l-j*i);m=(l*c-i*f)*wa;i=(l*d-i*e)*wa;c=(k*f-j*c)*wa;d=(k*e-j*d)*wa;a=a-m*g-c*h;b=b-i*g-d*h;q.save();q.transform(m,i,c,d,a,b);q.clip();q.drawImage(n,0,0);q.restore()}function rc(a,b,c,d){ya[0]=255*a.r|0;ya[1]=255*a.g|0;ya[2]=255*a.b|0;ya[4]=255*b.r|0;ya[5]=
|
|
|
+255*b.g|0;ya[6]=255*b.b|0;ya[8]=255*c.r|0;ya[9]=255*c.g|0;ya[10]=255*c.b|0;ya[12]=255*d.r|0;ya[13]=255*d.g|0;ya[14]=255*d.b|0;db.putImageData(Va,0,0);nb.drawImage(hb,0,0);return ib}function wb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ec(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Tb(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;0!==f&&(f=1/Math.sqrt(f),c*=f,d*=f,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===l instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
+else{var Ub,B,ja,ba;!0===this.autoClear?this.clear():q.setTransform(1,0,0,-1,p,o);e.info.render.vertices=0;e.info.render.faces=0;g=j.projectScene(a,l,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;lb=0<i.length;if(!0===lb){Ia.setRGB(0,0,0);bb.setRGB(0,0,0);Ya.setRGB(0,0,0);Ub=0;for(B=i.length;Ub<B;Ub++){ba=i[Ub];var ka=ba.color;ba instanceof THREE.AmbientLight?(Ia.r+=ka.r,Ia.g+=ka.g,Ia.b+=ka.b):ba instanceof THREE.DirectionalLight?(bb.r+=ka.r,bb.g+=ka.g,bb.b+=ka.b):ba instanceof THREE.PointLight&&
|
|
|
+(Ya.r+=ka.r,Ya.g+=ka.g,Ya.b+=ka.b)}}Ub=0;for(B=h.length;Ub<B;Ub++)if(ja=h[Ub],ba=ja.material,!(void 0===ba||!1===ba.visible)){Ga.empty();if(ja instanceof THREE.RenderableParticle){C=ja;C.x*=p;C.y*=o;var ka=C,Za=ja;b(ba.opacity);c(ba.blending);var tb=void 0,ub=void 0,ob=void 0,pb=void 0,fc=ja=void 0,Ec=void 0;ba instanceof THREE.ParticleBasicMaterial?null===ba.map?(ob=Za.object.scale.x,pb=Za.object.scale.y,ob*=Za.scale.x*p,pb*=Za.scale.y*o,Ga.set(ka.x-ob,ka.y-pb,ka.x+ob,ka.y+pb),!1!==ab.intersects(Ga)&&
|
|
|
+(f(ba.color.getContextStyle()),q.save(),q.translate(ka.x,ka.y),q.rotate(-Za.rotation),q.scale(ob,pb),q.fillRect(-1,-1,2,2),q.restore())):(ja=ba.map.image,fc=ja.width>>1,Ec=ja.height>>1,ob=Za.scale.x*p,pb=Za.scale.y*o,tb=ob*fc,ub=pb*Ec,Ga.set(ka.x-tb,ka.y-ub,ka.x+tb,ka.y+ub),!1!==ab.intersects(Ga)&&(q.save(),q.translate(ka.x,ka.y),q.rotate(-Za.rotation),q.scale(ob,-pb),q.translate(-fc,-Ec),q.drawImage(ja,0,0),q.restore())):ba instanceof THREE.ParticleCanvasMaterial&&(tb=Za.scale.x*p,ub=Za.scale.y*
|
|
|
+o,Ga.set(ka.x-tb,ka.y-ub,ka.x+tb,ka.y+ub),!1!==ab.intersects(Ga)&&(d(ba.color.getContextStyle()),f(ba.color.getContextStyle()),q.save(),q.translate(ka.x,ka.y),q.rotate(-Za.rotation),q.scale(tb,ub),ba.program(q),q.restore()))}else if(ja instanceof THREE.RenderableLine){if(C=ja.v1,D=ja.v2,C.positionScreen.x*=p,C.positionScreen.y*=o,D.positionScreen.x*=p,D.positionScreen.y*=o,Ga.addPoint(C.positionScreen.x,C.positionScreen.y),Ga.addPoint(D.positionScreen.x,D.positionScreen.y),!0===ab.intersects(Ga)&&
|
|
|
+(ka=C,Za=D,b(ba.opacity),c(ba.blending),q.beginPath(),q.moveTo(ka.positionScreen.x,ka.positionScreen.y),q.lineTo(Za.positionScreen.x,Za.positionScreen.y),ba instanceof THREE.LineBasicMaterial))ka=ba.linewidth,y!==ka&&(y=q.lineWidth=ka),ka=ba.linecap,w!==ka&&(w=q.lineCap=ka),ka=ba.linejoin,z!==ka&&(z=q.lineJoin=ka),d(ba.color.getContextStyle()),q.stroke(),Ga.inflate(2*ba.linewidth)}else if(ja instanceof THREE.RenderableFace3)C=ja.v1,D=ja.v2,F=ja.v3,C.positionScreen.x*=p,C.positionScreen.y*=o,D.positionScreen.x*=
|
|
|
+p,D.positionScreen.y*=o,F.positionScreen.x*=p,F.positionScreen.y*=o,!0===ba.overdraw&&(Tb(C.positionScreen,D.positionScreen),Tb(D.positionScreen,F.positionScreen),Tb(F.positionScreen,C.positionScreen)),Ga.add3Points(C.positionScreen.x,C.positionScreen.y,D.positionScreen.x,D.positionScreen.y,F.positionScreen.x,F.positionScreen.y),!0===ab.intersects(Ga)&&m(C,D,F,0,1,2,ja,ba,a);else if(ja instanceof THREE.RenderableFace4&&(C=ja.v1,D=ja.v2,F=ja.v3,I=ja.v4,C.positionScreen.x*=p,C.positionScreen.y*=o,D.positionScreen.x*=
|
|
|
+p,D.positionScreen.y*=o,F.positionScreen.x*=p,F.positionScreen.y*=o,I.positionScreen.x*=p,I.positionScreen.y*=o,G.positionScreen.copy(D.positionScreen),M.positionScreen.copy(I.positionScreen),!0===ba.overdraw&&(Tb(C.positionScreen,D.positionScreen),Tb(D.positionScreen,I.positionScreen),Tb(I.positionScreen,C.positionScreen),Tb(F.positionScreen,G.positionScreen),Tb(F.positionScreen,M.positionScreen)),Ga.addPoint(C.positionScreen.x,C.positionScreen.y),Ga.addPoint(D.positionScreen.x,D.positionScreen.y),
|
|
|
+Ga.addPoint(F.positionScreen.x,F.positionScreen.y),Ga.addPoint(I.positionScreen.x,I.positionScreen.y),!0===ab.intersects(Ga)))(ka=C,Za=D,tb=F,ub=I,ob=G,pb=M,fc=a,e.info.render.vertices+=4,e.info.render.faces++,b(ba.opacity),c(ba.blending),void 0!==ba.map&&null!==ba.map||void 0!==ba.envMap&&null!==ba.envMap)?(m(ka,Za,ub,0,1,3,ja,ba,fc),m(ob,tb,pb,1,2,3,ja,ba,fc)):(J=ka.positionScreen.x,K=ka.positionScreen.y,N=Za.positionScreen.x,O=Za.positionScreen.y,P=tb.positionScreen.x,L=tb.positionScreen.y,X=ub.positionScreen.x,
|
|
|
+H=ub.positionScreen.y,fa=ob.positionScreen.x,sa=ob.positionScreen.y,R=pb.positionScreen.x,oa=pb.positionScreen.y,ba instanceof THREE.MeshLambertMaterial||ba instanceof THREE.MeshPhongMaterial)?($.copy(ba.color),da.copy(ba.emissive),ba.vertexColors===THREE.FaceColors&&($.r*=ja.color.r,$.g*=ja.color.g,$.b*=ja.color.b),!0===lb)?!1===ba.wireframe&&ba.shading==THREE.SmoothShading&&4==ja.vertexNormalsLength?(ha.r=W.r=aa.r=Z.r=Ia.r,ha.g=W.g=aa.g=Z.g=Ia.g,ha.b=W.b=aa.b=Z.b=Ia.b,n(ja.v1.positionWorld,ja.vertexNormalsWorld[0],
|
|
|
+ha),n(ja.v2.positionWorld,ja.vertexNormalsWorld[1],W),n(ja.v4.positionWorld,ja.vertexNormalsWorld[3],aa),n(ja.v3.positionWorld,ja.vertexNormalsWorld[2],Z),ha.r=ha.r*$.r+da.r,ha.g=ha.g*$.g+da.g,ha.b=ha.b*$.b+da.b,W.r=W.r*$.r+da.r,W.g=W.g*$.g+da.g,W.b=W.b*$.b+da.b,aa.r=aa.r*$.r+da.r,aa.g=aa.g*$.g+da.g,aa.b=aa.b*$.b+da.b,Z.r=Z.r*$.r+da.r,Z.g=Z.g*$.g+da.g,Z.b=Z.b*$.b+da.b,ra=rc(ha,W,aa,Z),r(J,K,N,O,X,H),wa(J,K,N,O,X,H,0,0,1,0,0,1,ra),r(fa,sa,P,L,R,oa),wa(fa,sa,P,L,R,oa,1,0,1,1,0,1,ra)):(Q.r=Ia.r,Q.g=
|
|
|
+Ia.g,Q.b=Ia.b,n(ja.centroidWorld,ja.normalWorld,Q),Q.r=Q.r*$.r+da.r,Q.g=Q.g*$.g+da.g,Q.b=Q.b*$.b+da.b,t(J,K,N,O,P,L,X,H),!0===ba.wireframe?s(Q,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):u(Q)):(Q.r=$.r+da.r,Q.g=$.g+da.g,Q.b=$.b+da.b,t(J,K,N,O,P,L,X,H),!0===ba.wireframe?s(Q,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):u(Q)):ba instanceof THREE.MeshBasicMaterial?(Q.copy(ba.color),ba.vertexColors===THREE.FaceColors&&(Q.r*=ja.color.r,Q.g*=ja.color.g,Q.b*=ja.color.b),
|
|
|
+t(J,K,N,O,P,L,X,H),!0===ba.wireframe?s(Q,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):u(Q)):ba instanceof THREE.MeshNormalMaterial?(Q.r=ec(ja.normalWorld.x),Q.g=ec(ja.normalWorld.y),Q.b=ec(ja.normalWorld.z),t(J,K,N,O,P,L,X,H),!0===ba.wireframe?s(Q,ba.wireframeLinewidth,ba.wireframeLinecap,ba.wireframeLinejoin):u(Q)):ba instanceof THREE.MeshDepthMaterial&&(Ea=l.near,ua=l.far,ha.r=ha.g=ha.b=1-wb(ka.positionScreen.z,Ea,ua),W.r=W.g=W.b=1-wb(Za.positionScreen.z,Ea,ua),aa.r=aa.g=aa.b=
|
|
|
+1-wb(ub.positionScreen.z,Ea,ua),Z.r=Z.g=Z.b=1-wb(tb.positionScreen.z,Ea,ua),ra=rc(ha,W,aa,Z),r(J,K,N,O,X,H),wa(J,K,N,O,X,H,0,0,1,0,0,1,ra),r(fa,sa,P,L,R,oa),wa(fa,sa,P,L,R,oa,1,0,1,1,0,1,ra));Pa.addRectangle(Ga)}q.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",
|
|
@@ -341,67 +341,67 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
|
|
|
THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",
|
|
|
THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var g=1;"v2"===e.type?g=2:"v3"===e.type?g=3:"v4"===e.type?g=4:"c"===e.type&&(g=3);e.size=g;e.array=new Float32Array(c*g);e.buffer=k.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=!0}a.__webglCustomAttributesList.push(e)}}}
|
|
|
-function c(a,b){var c=b.geometry,g=a.faces3,h=a.faces4,i=3*g.length+4*h.length,j=1*g.length+2*h.length,h=3*g.length+4*h.length,g=d(b,a),l=e(g),m=f(g),n=g.vertexColors?g.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);m&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&(a.__colorArray=new Float32Array(3*i));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=
|
|
|
+function c(a,b){var c=b.geometry,g=a.faces3,h=a.faces4,i=3*g.length+4*h.length,j=1*g.length+2*h.length,h=3*g.length+4*h.length,g=d(b,a),l=e(g),n=f(g),m=g.vertexColors?g.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);n&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));m&&(a.__colorArray=new Float32Array(3*i));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=
|
|
|
new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*j);a.__lineArray=new Uint16Array(2*h);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<l;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*
|
|
|
i))}a.__webglFaceCount=3*j;a.__webglLineCount=2*h;if(g.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var o in g.attributes){var j=g.attributes[o],c={},p;for(p in j)c[p]=j[p];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,h=1,"v2"===c.type?h=2:"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=k.createBuffer(),c.buffer.belongsToAttribute=o,j.needsUpdate=!0,c.__original=j;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=
|
|
|
!0}function d(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a){var b,
|
|
|
-c,d;for(b in a.attributes)d="index"===b?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER,c=a.attributes[b],c.buffer=k.createBuffer(),k.bindBuffer(d,c.buffer),k.bufferData(d,c.array,k.STATIC_DRAW)}function h(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(hb);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)f=h[d],Va.copy(f),db.multiplyVector3(Va),
|
|
|
-n[d]=[Va.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)f=h[n[d][1]],e=3*d,l[e]=f.x,l[e+1]=f.y,l[e+2]=f.z;for(d=0;d<j;d++)e=3*d,f=i[n[d][1]],m[e]=f.r,m[e+1]=f.g,m[e+2]=f.b;if(q){i=0;for(j=q.length;i<j;i++)if(h=q[i],void 0===h.boundTo||"vertices"===h.boundTo)if(e=0,f=h.value.length,1===h.size)for(d=0;d<f;d++)g=n[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<f;d++)g=
|
|
|
-n[d][1],g=h.value[g],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(4===h.size)for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}}else{if(o)for(d=0;d<g;d++)f=h[d],e=3*d,l[e]=f.x,l[e+1]=f.y,l[e+2]=f.z;if(p)for(d=0;d<j;d++)f=i[d],e=3*d,m[e]=f.r,m[e+1]=f.g,m[e+2]=f.b;if(q){i=0;for(j=q.length;i<j;i++)if(h=q[i],h.needsUpdate&&(void 0===
|
|
|
+c,d;for(b in a.attributes)d="index"===b?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER,c=a.attributes[b],c.buffer=k.createBuffer(),k.bindBuffer(d,c.buffer),k.bufferData(d,c.array,k.STATIC_DRAW)}function h(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;var i=a.colors,j=i.length,l=a.__vertexArray,n=a.__colorArray,m=a.__sortArray,o=a.verticesNeedUpdate,p=a.colorsNeedUpdate,q=a.__webglCustomAttributesList;if(c.sortParticles){db.copy(hb);db.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)f=h[d],Va.copy(f),db.multiplyVector3(Va),
|
|
|
+m[d]=[Va.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)f=h[m[d][1]],e=3*d,l[e]=f.x,l[e+1]=f.y,l[e+2]=f.z;for(d=0;d<j;d++)e=3*d,f=i[m[d][1]],n[e]=f.r,n[e+1]=f.g,n[e+2]=f.b;if(q){i=0;for(j=q.length;i<j;i++)if(h=q[i],void 0===h.boundTo||"vertices"===h.boundTo)if(e=0,f=h.value.length,1===h.size)for(d=0;d<f;d++)g=m[d][1],h.array[d]=h.value[g];else if(2===h.size)for(d=0;d<f;d++)g=m[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<f;d++)g=
|
|
|
+m[d][1],g=h.value[g],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=m[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(4===h.size)for(d=0;d<f;d++)g=m[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}}else{if(o)for(d=0;d<g;d++)f=h[d],e=3*d,l[e]=f.x,l[e+1]=f.y,l[e+2]=f.z;if(p)for(d=0;d<j;d++)f=i[d],e=3*d,n[e]=f.r,n[e+1]=f.g,n[e+2]=f.b;if(q){i=0;for(j=q.length;i<j;i++)if(h=q[i],h.needsUpdate&&(void 0===
|
|
|
h.boundTo||"vertices"===h.boundTo))if(f=h.value.length,e=0,1===h.size)for(d=0;d<f;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(4===h.size)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+
|
|
|
-3]=g.w,e+=4}}if(o||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,l,b);if(p||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,m,b);if(q){i=0;for(j=q.length;i<j;i++)if(h=q[i],h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&void 0!==
|
|
|
+3]=g.w,e+=4}}if(o||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,l,b);if(p||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,n,b);if(q){i=0;for(j=q.length;i<j;i++)if(h=q[i],h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&void 0!==
|
|
|
e&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(k.bindBuffer(k.ARRAY_BUFFER,f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(k.bindBuffer(k.ARRAY_BUFFER,g.buffer),k.bufferData(k.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==h&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(k.bindBuffer(k.ARRAY_BUFFER,i.buffer),
|
|
|
-k.bufferData(k.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(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 j(a,b){return b.z-a.z}function l(a,b){return b[1]-a[1]}function n(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)Y=fa=null,$=ea=Ea=La=Ua=cb=ua=-1,ib=!0,a[d].render(b,c,bb,Ya),Y=fa=null,$=ea=Ea=La=Ua=cb=ua=-1,ib=!0}function m(a,b,c,d,e,f,g,h){var i,k,j,l;b?(k=a.length-1,l=b=-1):
|
|
|
-(k=0,b=a.length,l=1);for(var m=k;m!==b;m+=l)if(i=a[m],i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&R.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);R.setDepthTest(i.depthTest);R.setDepthWrite(i.depthWrite);A(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}R.setMaterialFaces(i);j instanceof THREE.BufferGeometry?R.renderBufferDirect(d,e,f,i,j,k):R.renderBuffer(d,e,f,i,j,k)}}function o(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++)if(h=a[k],i=
|
|
|
-h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&R.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);R.setDepthTest(h.depthTest);R.setDepthWrite(h.depthWrite);A(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}R.renderImmediateObject(c,d,e,h,i)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function p(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
|
|
|
-!1}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function B(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,e){Ia=0;d.needsUpdate&&(d.program&&R.deallocateMaterial(d),R.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==fa&&(k.useProgram(g),fa=g,f=!0);d.id!==$&&($=d.id,f=!0);if(f||
|
|
|
-a!==Y)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==Y&&(Y=a);if(d.skinning)if(ac&&e.useVertexTexture){if(null!==h.boneTexture){var j=r();k.uniform1i(h.boneTexture,j);R.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof
|
|
|
-THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ib){for(var l=0,m=0,n=0,o,p,q,t,s=nb,u=s.directional.colors,y=s.directional.positions,A=s.point.colors,B=s.point.positions,C=s.point.distances,F=s.spot.colors,I=s.spot.positions,G=s.spot.distances,J=s.spot.directions,Q=s.spot.angles,M=s.spot.exponents,K=s.hemi.skyColors,W=s.hemi.groundColors,N=s.hemi.positions,O=0,ca=0,P=0,ea=0,c=o=q=q=p=0,f=b.length;c<f;c++)j=b[c],!j.onlyShadow&&j.visible&&(o=j.color,t=j.intensity,p=j.distance,
|
|
|
-j instanceof THREE.AmbientLight?R.gammaInput?(l+=o.r*o.r,m+=o.g*o.g,n+=o.b*o.b):(l+=o.r,m+=o.g,n+=o.b):j instanceof THREE.DirectionalLight?(p=3*O,R.gammaInput?z(u,p,o,t*t):w(u,p,o,t),ya.copy(j.matrixWorld.getPosition()),ya.subSelf(j.target.matrixWorld.getPosition()),ya.normalize(),y[p]=ya.x,y[p+1]=ya.y,y[p+2]=ya.z,O+=1):j instanceof THREE.PointLight?(q=3*ca,R.gammaInput?z(A,q,o,t*t):w(A,q,o,t),t=j.matrixWorld.getPosition(),B[q]=t.x,B[q+1]=t.y,B[q+2]=t.z,C[ca]=p,ca+=1):j instanceof THREE.SpotLight?
|
|
|
-(q=3*P,R.gammaInput?z(F,q,o,t*t):w(F,q,o,t),t=j.matrixWorld.getPosition(),I[q]=t.x,I[q+1]=t.y,I[q+2]=t.z,G[P]=p,ya.copy(t),ya.subSelf(j.target.matrixWorld.getPosition()),ya.normalize(),J[q]=ya.x,J[q+1]=ya.y,J[q+2]=ya.z,Q[P]=Math.cos(j.angle),M[P]=j.exponent,P+=1):j instanceof THREE.HemisphereLight&&(p=j.color,q=j.groundColor,o=3*ea,R.gammaInput?(t*=t,z(K,o,p,t),z(W,o,q,t)):(w(K,o,p,t),w(W,o,q,t)),t=j.matrixWorld.getPosition(),N[o]=t.x,N[o+1]=t.y,N[o+2]=t.z,ea+=1));c=3*O;for(f=u.length;c<f;c++)u[c]=
|
|
|
-0;c=3*ca;for(f=A.length;c<f;c++)A[c]=0;c=3*P;for(f=F.length;c<f;c++)F[c]=0;c=3*ea;for(f=K.length;c<f;c++)K[c]=0;c=3*ea;for(f=W.length;c<f;c++)W[c]=0;s.directional.length=O;s.point.length=ca;s.spot.length=P;s.hemi.length=ea;s.ambient[0]=l;s.ambient[1]=m;s.ambient[2]=n;ib=!1}c=nb;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;
|
|
|
+k.bufferData(k.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(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 j(a,b){return b.z-a.z}function l(a,b){return b[1]-a[1]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)$=ha=null,aa=Z=Ea=La=Ua=cb=ua=-1,ib=!0,a[d].render(b,c,bb,Ya),$=ha=null,aa=Z=Ea=La=Ua=cb=ua=-1,ib=!0}function n(a,b,c,d,e,f,g,h){var i,k,j,l;b?(k=a.length-1,l=b=-1):
|
|
|
+(k=0,b=a.length,l=1);for(var n=k;n!==b;n+=l)if(i=a[n],i.render){k=i.object;j=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&R.setBlending(i.blending,i.blendEquation,i.blendSrc,i.blendDst);R.setDepthTest(i.depthTest);R.setDepthWrite(i.depthWrite);z(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}R.setMaterialFaces(i);j instanceof THREE.BufferGeometry?R.renderBufferDirect(d,e,f,i,j,k):R.renderBuffer(d,e,f,i,j,k)}}function p(a,b,c,d,e,f,g){for(var h,i,k=0,j=a.length;k<j;k++)if(h=a[k],i=
|
|
|
+h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&R.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);R.setDepthTest(h.depthTest);R.setDepthWrite(h.depthWrite);z(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}R.renderImmediateObject(c,d,e,h,i)}}function o(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!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
|
|
|
+!1}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function u(a,b,c,d,e){Ka=0;d.needsUpdate&&(d.program&&R.deallocateMaterial(d),R.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==ha&&(k.useProgram(g),ha=g,f=!0);d.id!==aa&&(aa=d.id,f=!0);if(f||
|
|
|
+a!==$)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==$&&($=a);if(d.skinning)if(ac&&e.useVertexTexture){if(null!==h.boneTexture){var j=r();k.uniform1i(h.boneTexture,j);R.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof
|
|
|
+THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ib){for(var l=0,n=0,m=0,o,p,q,t,s=nb,u=s.directional.colors,z=s.directional.positions,A=s.point.colors,B=s.point.positions,D=s.point.distances,C=s.spot.colors,G=s.spot.positions,I=s.spot.distances,H=s.spot.directions,Q=s.spot.angles,K=s.spot.exponents,W=s.hemi.skyColors,L=s.hemi.groundColors,N=s.hemi.positions,da=0,O=0,P=0,X=0,c=o=q=q=p=0,f=b.length;c<f;c++)j=b[c],!j.onlyShadow&&j.visible&&(o=j.color,t=j.intensity,p=j.distance,
|
|
|
+j instanceof THREE.AmbientLight?R.gammaInput?(l+=o.r*o.r,n+=o.g*o.g,m+=o.b*o.b):(l+=o.r,n+=o.g,m+=o.b):j instanceof THREE.DirectionalLight?(p=3*da,R.gammaInput?y(u,p,o,t*t):w(u,p,o,t),ya.copy(j.matrixWorld.getPosition()),ya.subSelf(j.target.matrixWorld.getPosition()),ya.normalize(),z[p]=ya.x,z[p+1]=ya.y,z[p+2]=ya.z,da+=1):j instanceof THREE.PointLight?(q=3*O,R.gammaInput?y(A,q,o,t*t):w(A,q,o,t),t=j.matrixWorld.getPosition(),B[q]=t.x,B[q+1]=t.y,B[q+2]=t.z,D[O]=p,O+=1):j instanceof THREE.SpotLight?
|
|
|
+(q=3*P,R.gammaInput?y(C,q,o,t*t):w(C,q,o,t),t=j.matrixWorld.getPosition(),G[q]=t.x,G[q+1]=t.y,G[q+2]=t.z,I[P]=p,ya.copy(t),ya.subSelf(j.target.matrixWorld.getPosition()),ya.normalize(),H[q]=ya.x,H[q+1]=ya.y,H[q+2]=ya.z,Q[P]=Math.cos(j.angle),K[P]=j.exponent,P+=1):j instanceof THREE.HemisphereLight&&(p=j.color,q=j.groundColor,o=3*X,R.gammaInput?(t*=t,y(W,o,p,t),y(L,o,q,t)):(w(W,o,p,t),w(L,o,q,t)),t=j.matrixWorld.getPosition(),N[o]=t.x,N[o+1]=t.y,N[o+2]=t.z,X+=1));c=3*da;for(f=u.length;c<f;c++)u[c]=
|
|
|
+0;c=3*O;for(f=A.length;c<f;c++)A[c]=0;c=3*P;for(f=C.length;c<f;c++)C[c]=0;c=3*X;for(f=W.length;c<f;c++)W[c]=0;c=3*X;for(f=L.length;c<f;c++)L[c]=0;s.directional.length=da;s.point.length=O;s.spot.length=P;s.hemi.length=X;s.ambient[0]=l;s.ambient[1]=n;s.ambient[2]=m;ib=!1}c=nb;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;R.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,
|
|
|
Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=
|
|
|
-d.opacity,i.size.value=d.size,i.scale.value=H.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
|
|
|
+d.opacity,i.size.value=d.size,i.scale.value=J.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(R.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),
|
|
|
i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[Z]=
|
|
|
j.shadowMap,i.shadowMapSize.value[Z]=j.shadowMapSize,i.shadowMatrix.value[Z]=j.shadowMatrix,i.shadowDarkness.value[Z]=j.shadowDarkness,i.shadowBias.value[Z]=j.shadowBias,Z++}b=d.uniformsList;i=0;for(Z=b.length;i<Z;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,j=c.value,"i"===l)k.uniform1i(f,j);else if("f"===l)k.uniform1f(f,j);else if("v2"===l)k.uniform2f(f,j.x,j.y);else if("v3"===l)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===l)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===l)k.uniform3f(f,j.r,j.g,
|
|
|
-j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(m=j.length;l<m;l++)n=2*l,c._array[n]=j[l].x,c._array[n+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(m=j.length;l<m;l++)n=3*l,c._array[n]=j[l].x,c._array[n+1]=j[l].y,c._array[n+2]=j[l].z;k.uniform3fv(f,
|
|
|
-c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(m=j.length;l<m;l++)n=4*l,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(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(m=j.length;l<m;l++)j[l].flattenToArrayOffset(c._array,16*
|
|
|
-l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(n=j,j=r(),k.uniform1i(f,j),n)if(n.image instanceof Array&&6===n.image.length){if(c=n,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture());k.activeTexture(k.TEXTURE0+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)R.autoScaleCubemaps&&!f?(m=j,n=l,s=c.image[l],y=
|
|
|
-Dc,s.width<=y&&s.height<=y||(A=Math.max(s.width,s.height),u=Math.floor(s.width*y/A),y=Math.floor(s.height*y/A),A=document.createElement("canvas"),A.width=u,A.height=y,A.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,y),s=A),m[n]=s):j[l]=c.image[l];l=j[0];m=0===(l.width&l.width-1)&&0===(l.height&l.height-1);n=L(c.format);s=L(c.type);D(k.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){y=j[l].mipmaps;A=0;for(B=y.length;A<B;A++)u=y[A],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,A,n,u.width,
|
|
|
-u.height,0,u.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,s,j[l]);c.generateMipmaps&&m&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(c=n,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):R.setTexture(n,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(m=c.value.length;l<
|
|
|
-m;l++)c._array[l]=r();k.uniform1iv(f,c._array);l=0;for(m=c.value.length;l<m;l++)n=c.value[l],j=c._array[l],n&&R.setTexture(n,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)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)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
-!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function r(){var a=Ia;a>=qc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+qc);Ia+=1;return a}function y(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(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 w(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a,b,c){gb!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),gb=a);if(a&&(vb!==b||Sb!==c))k.polygonOffset(b,c),vb=b,Sb=c}function F(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 C(a,b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,
|
|
|
-b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(F(b)),null):c}function D(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,L(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,L(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,L(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,L(b.minFilter))):(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,
|
|
|
-I(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,I(b.minFilter)));if(sb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,sb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,jc)),b.__oldAnisotropy=b.anisotropy}function K(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&
|
|
|
-b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function I(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function L(a){if(a===THREE.RepeatWrapping)return k.REPEAT;if(a===THREE.ClampToEdgeWrapping)return k.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return k.MIRRORED_REPEAT;
|
|
|
+j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(n=j.length;l<n;l++)m=2*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(n=j.length;l<n;l++)m=3*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y,c._array[m+2]=j[l].z;k.uniform3fv(f,
|
|
|
+c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(n=j.length;l<n;l++)m=4*l,c._array[m]=j[l].x,c._array[m+1]=j[l].y,c._array[m+2]=j[l].z,c._array[m+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(c._array,16*
|
|
|
+l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(m=j,j=r(),k.uniform1i(f,j),m)if(m.image instanceof Array&&6===m.image.length){if(c=m,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=k.createTexture());k.activeTexture(k.TEXTURE0+f);k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;j=[];for(l=0;6>l;l++)R.autoScaleCubemaps&&!f?(n=j,m=l,s=c.image[l],z=
|
|
|
+Dc,s.width<=z&&s.height<=z||(A=Math.max(s.width,s.height),u=Math.floor(s.width*z/A),z=Math.floor(s.height*z/A),A=document.createElement("canvas"),A.width=u,A.height=z,A.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,z),s=A),n[m]=s):j[l]=c.image[l];l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);m=M(c.format);s=M(c.type);F(k.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){z=j[l].mipmaps;A=0;for(B=z.length;A<B;A++)u=z[A],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,A,m,u.width,
|
|
|
+u.height,0,u.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m,m,s,j[l]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(c=m,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):R.setTexture(m,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<
|
|
|
+n;l++)c._array[l]=r();k.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)m=c.value[l],j=c._array[l],m&&R.setTexture(m,j)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)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)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray)}k.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
+!1,e._modelViewMatrix.elements);h.normalMatrix&&k.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function r(){var a=Ka;a>=qc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+qc);Ka+=1;return a}function B(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function y(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 w(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function z(a,b,c){gb!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),gb=a);if(a&&(vb!==b||Sb!==c))k.polygonOffset(b,c),vb=b,Sb=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 D(a,b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,
|
|
|
+b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(C(b)),null):c}function F(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,M(b.wrapS)),k.texParameteri(a,k.TEXTURE_WRAP_T,M(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,M(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,M(b.minFilter))):(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,
|
|
|
+G(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,G(b.minFilter)));if(sb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,sb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,jc)),b.__oldAnisotropy=b.anisotropy}function I(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&
|
|
|
+b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}function G(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?k.NEAREST:k.LINEAR}function M(a){if(a===THREE.RepeatWrapping)return k.REPEAT;if(a===THREE.ClampToEdgeWrapping)return k.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return k.MIRRORED_REPEAT;
|
|
|
if(a===THREE.NearestFilter)return k.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return k.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return k.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return k.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return k.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return k.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return k.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return k.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return k.UNSIGNED_SHORT_5_5_5_1;
|
|
|
if(a===THREE.UnsignedShort565Type)return k.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return k.BYTE;if(a===THREE.ShortType)return k.SHORT;if(a===THREE.UnsignedShortType)return k.UNSIGNED_SHORT;if(a===THREE.IntType)return k.INT;if(a===THREE.UnsignedIntType)return k.UNSIGNED_INT;if(a===THREE.FloatType)return k.FLOAT;if(a===THREE.AlphaFormat)return k.ALPHA;if(a===THREE.RGBFormat)return k.RGB;if(a===THREE.RGBAFormat)return k.RGBA;if(a===THREE.LuminanceFormat)return k.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return k.LUMINANCE_ALPHA;
|
|
|
if(a===THREE.AddEquation)return k.FUNC_ADD;if(a===THREE.SubtractEquation)return k.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return k.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return k.ZERO;if(a===THREE.OneFactor)return k.ONE;if(a===THREE.SrcColorFactor)return k.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return k.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return k.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return k.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return k.DST_ALPHA;
|
|
|
if(a===THREE.OneMinusDstAlphaFactor)return k.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return k.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return k.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(void 0!==mb){if(a===THREE.RGB_S3TC_DXT1_Format)return mb.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return mb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return mb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return mb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}
|
|
|
-console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},H=void 0!==a.canvas?a.canvas:document.createElement("canvas"),J=void 0!==a.precision?a.precision:"highp",O=void 0!==a.alpha?a.alpha:!0,P=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,G=void 0!==a.antialias?a.antialias:!1,N=void 0!==a.stencil?a.stencil:!0,na=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,M=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Z=void 0!==a.clearAlpha?a.clearAlpha:0,sa=
|
|
|
-void 0!==a.maxLights?a.maxLights:4;this.domElement=H;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
|
|
|
-[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var R=this,ia=[],Q=0,fa=null,W=null,$=-1,ea=null,Y=null,ca=0,Ia=0,La=-1,Ea=-1,ua=-1,ra=-1,Ma=-1,kb=-1,cb=-1,Ua=-1,gb=null,vb=null,Sb=null,ab=null,Pa=0,Ga=0,lb=0,Ja=0,bb=0,Ya=0,la=new THREE.Frustum,hb=new THREE.Matrix4,db=new THREE.Matrix4,Va=new THREE.Vector4,ya=new THREE.Vector3,ib=!0,nb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],
|
|
|
-positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,sb,mb;try{if(!(k=H.getContext("experimental-webgl",{alpha:O,premultipliedAlpha:P,antialias:G,stencil:N,preserveDrawingBuffer:na})))throw"Error creating WebGL context.";}catch(Cc){console.error(Cc)}a=k.getExtension("OES_texture_float");O=k.getExtension("OES_standard_derivatives");sb=k.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
-k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");mb=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");a||console.log("THREE.WebGLRenderer: Float textures not supported.");O||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");sb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");mb||
|
|
|
-console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(M.r,M.g,M.b,Z);this.context=k;var qc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),O=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);
|
|
|
-var Dc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),jc=sb?k.getParameter(sb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,dc=0<O,ac=dc&&a;mb&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);this.getContext=function(){return k};this.supportsVertexTextures=function(){return dc};this.getMaxAnisotropy=function(){return jc};this.setSize=function(a,b){H.width=a;H.height=b;this.setViewport(0,0,H.width,H.height)};this.setViewport=function(a,b,c,d){Pa=void 0!==a?a:0;Ga=void 0!==b?b:0;lb=void 0!==c?c:H.width;Ja=void 0!==d?
|
|
|
-d:H.height;k.viewport(Pa,Ga,lb,Ja)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){M.setHex(a);Z=b;k.clearColor(M.r,M.g,M.b,Z)};this.setClearColor=function(a,b){M.copy(a);Z=b;k.clearColor(M.r,M.g,M.b,Z)};this.getClearColor=function(){return M};this.getClearAlpha=function(){return Z};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=k.COLOR_BUFFER_BIT;if(void 0===
|
|
|
+console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},J=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K=void 0!==a.precision?a.precision:"highp",N=void 0!==a.alpha?a.alpha:!0,O=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,P=void 0!==a.antialias?a.antialias:!1,L=void 0!==a.stencil?a.stencil:!0,X=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,H=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),fa=void 0!==a.clearAlpha?a.clearAlpha:0,sa=
|
|
|
+void 0!==a.maxLights?a.maxLights:4;this.domElement=J;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=
|
|
|
+[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var R=this,oa=[],Q=0,ha=null,W=null,aa=-1,Z=null,$=null,da=0,Ka=0,La=-1,Ea=-1,ua=-1,ra=-1,Ma=-1,kb=-1,cb=-1,Ua=-1,gb=null,vb=null,Sb=null,ab=null,Pa=0,Ga=0,lb=0,Ia=0,bb=0,Ya=0,la=new THREE.Frustum,hb=new THREE.Matrix4,db=new THREE.Matrix4,Va=new THREE.Vector4,ya=new THREE.Vector3,ib=!0,nb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],
|
|
|
+positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],angles:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,sb,mb;try{if(!(k=J.getContext("experimental-webgl",{alpha:N,premultipliedAlpha:O,antialias:P,stencil:L,preserveDrawingBuffer:X})))throw"Error creating WebGL context.";}catch(Cc){console.error(Cc)}a=k.getExtension("OES_texture_float");N=k.getExtension("OES_standard_derivatives");sb=k.getExtension("EXT_texture_filter_anisotropic")||
|
|
|
+k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");mb=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");a||console.log("THREE.WebGLRenderer: Float textures not supported.");N||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");sb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");mb||
|
|
|
+console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(H.r,H.g,H.b,fa);this.context=k;var qc=k.getParameter(k.MAX_TEXTURE_IMAGE_UNITS),N=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS);k.getParameter(k.MAX_TEXTURE_SIZE);
|
|
|
+var Dc=k.getParameter(k.MAX_CUBE_MAP_TEXTURE_SIZE),jc=sb?k.getParameter(sb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,dc=0<N,ac=dc&&a;mb&&k.getParameter(k.COMPRESSED_TEXTURE_FORMATS);this.getContext=function(){return k};this.supportsVertexTextures=function(){return dc};this.getMaxAnisotropy=function(){return jc};this.setSize=function(a,b){J.width=a;J.height=b;this.setViewport(0,0,J.width,J.height)};this.setViewport=function(a,b,c,d){Pa=void 0!==a?a:0;Ga=void 0!==b?b:0;lb=void 0!==c?c:J.width;Ia=void 0!==d?
|
|
|
+d:J.height;k.viewport(Pa,Ga,lb,Ia)};this.setScissor=function(a,b,c,d){k.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.setClearColorHex=function(a,b){H.setHex(a);fa=b;k.clearColor(H.r,H.g,H.b,fa)};this.setClearColor=function(a,b){H.copy(a);fa=b;k.clearColor(H.r,H.g,H.b,fa)};this.getClearColor=function(){return H};this.getClearAlpha=function(){return fa};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=k.COLOR_BUFFER_BIT;if(void 0===
|
|
|
b||b)d|=k.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=k.STENCIL_BUFFER_BIT;k.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._modelMatrixArray,
|
|
|
a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];k.deleteBuffer(c.__webglVertexBuffer);k.deleteBuffer(c.__webglNormalBuffer);k.deleteBuffer(c.__webglTangentBuffer);k.deleteBuffer(c.__webglColorBuffer);k.deleteBuffer(c.__webglUVBuffer);k.deleteBuffer(c.__webglUV2Buffer);k.deleteBuffer(c.__webglSkinIndicesBuffer);k.deleteBuffer(c.__webglSkinWeightsBuffer);k.deleteBuffer(c.__webglFaceBuffer);k.deleteBuffer(c.__webglLineBuffer);var d=void 0,f=void 0;if(c.numMorphTargets){d=
|
|
|
0;for(f=c.numMorphTargets;d<f;d++)k.deleteBuffer(c.__webglMorphTargetsBuffers[d])}if(c.numMorphNormals){d=0;for(f=c.numMorphNormals;d<f;d++)k.deleteBuffer(c.__webglMorphNormalsBuffers[d])}if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)k.deleteBuffer(c.__webglCustomAttributesList[d].buffer);R.info.memory.geometries--}else a instanceof THREE.Ribbon?(a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--):a instanceof
|
|
|
THREE.Line?(a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--):a instanceof THREE.ParticleSystem&&(a=a.geometry,k.deleteBuffer(a.__webglVertexBuffer),k.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--)};this.deallocateTexture=function(a){a.__webglInit&&(a.__webglInit=!1,k.deleteTexture(a.__webglTexture),R.info.memory.textures--)};this.deallocateRenderTarget=function(a){if(a&&a.__webglTexture)if(k.deleteTexture(a.__webglTexture),
|
|
|
-a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer)};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,f=!1,a=0;for(c=ia.length;a<c;a++)if(d=ia[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(f=!0);break}if(f){f=[];a=0;for(c=ia.length;a<c;a++)d=ia[a],d.program!==b&&f.push(d);
|
|
|
-ia=f;k.deleteProgram(b);R.info.memory.programs--}}};this.updateShadowMap=function(a,b){fa=null;$=ea=Ua=cb=ua=-1;ib=!0;Ea=La=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=k.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=k.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=k.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=k.createBuffer());
|
|
|
-a.hasPositions&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,!1,0,0));if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,f,e,g,h,i,j,l,m,n,o,p=3*a.count;for(o=0;o<p;o+=9)n=a.normalArray,d=n[o],f=n[o+1],e=n[o+2],g=n[o+3],i=n[o+4],l=n[o+5],h=n[o+6],j=n[o+7],m=n[o+8],d=(d+g+h)/
|
|
|
-3,f=(f+i+j)/3,e=(e+l+m)/3,n[o]=d,n[o+1]=f,n[o+2]=e,n[o+3]=d,n[o+4]=f,n[o+5]=e,n[o+6]=d,n[o+7]=f,n[o+8]=e}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer),k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.uv),k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,!1,0,0));a.hasColors&&
|
|
|
-c.vertexColors!==THREE.NoColors&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.color),k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,!1,0,0));k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(!1!==d.visible)if(c=u(a,b,c,d,e),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+(d.wireframe?1:0),d!==ea&&(ea=d,b=!0),e instanceof THREE.Mesh){e=f.offsets;1<e.length&&
|
|
|
+a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer)};this.deallocateMaterial=function(a){var b=a.program;if(b){a.program=void 0;var c,d,f=!1,a=0;for(c=oa.length;a<c;a++)if(d=oa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(f=!0);break}if(f){f=[];a=0;for(c=oa.length;a<c;a++)d=oa[a],d.program!==b&&f.push(d);
|
|
|
+oa=f;k.deleteProgram(b);R.info.memory.programs--}}};this.updateShadowMap=function(a,b){ha=null;aa=Z=Ua=cb=ua=-1;ib=!0;Ea=La=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=k.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=k.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=k.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=k.createBuffer());
|
|
|
+a.hasPositions&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,a.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.position),k.vertexAttribPointer(b.attributes.position,3,k.FLOAT,!1,0,0));if(a.hasNormals){k.bindBuffer(k.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,f,e,g,h,i,j,l,n,m,o,p=3*a.count;for(o=0;o<p;o+=9)m=a.normalArray,d=m[o],f=m[o+1],e=m[o+2],g=m[o+3],i=m[o+4],l=m[o+5],h=m[o+6],j=m[o+7],n=m[o+8],d=(d+g+h)/
|
|
|
+3,f=(f+i+j)/3,e=(e+l+n)/3,m[o]=d,m[o+1]=f,m[o+2]=e,m[o+3]=d,m[o+4]=f,m[o+5]=e,m[o+6]=d,m[o+7]=f,m[o+8]=e}k.bufferData(k.ARRAY_BUFFER,a.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(b.attributes.normal);k.vertexAttribPointer(b.attributes.normal,3,k.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglUvBuffer),k.bufferData(k.ARRAY_BUFFER,a.uvArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.uv),k.vertexAttribPointer(b.attributes.uv,2,k.FLOAT,!1,0,0));a.hasColors&&
|
|
|
+c.vertexColors!==THREE.NoColors&&(k.bindBuffer(k.ARRAY_BUFFER,a.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,a.colorArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(b.attributes.color),k.vertexAttribPointer(b.attributes.color,3,k.FLOAT,!1,0,0));k.drawArrays(k.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(!1!==d.visible)if(c=u(a,b,c,d,e),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+(d.wireframe?1:0),d!==Z&&(Z=d,b=!0),e instanceof THREE.Mesh){e=f.offsets;1<e.length&&
|
|
|
(b=!0);d=0;for(c=e.length;d<c;++d){var g=e[d].index;if(b){var h=f.attributes.position,i=h.itemSize;k.bindBuffer(k.ARRAY_BUFFER,h.buffer);k.vertexAttribPointer(a.position,i,k.FLOAT,!1,0,4*g*i);h=f.attributes.normal;0<=a.normal&&h&&(i=h.itemSize,k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.vertexAttribPointer(a.normal,i,k.FLOAT,!1,0,4*g*i));h=f.attributes.uv;0<=a.uv&&h&&(h.buffer?(i=h.itemSize,k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.vertexAttribPointer(a.uv,i,k.FLOAT,!1,0,4*g*i),k.enableVertexAttribArray(a.uv)):
|
|
|
k.disableVertexAttribArray(a.uv));i=f.attributes.color;if(0<=a.color&&i){var j=i.itemSize;k.bindBuffer(k.ARRAY_BUFFER,i.buffer);k.vertexAttribPointer(a.color,j,k.FLOAT,!1,0,4*g*j)}h=f.attributes.tangent;0<=a.tangent&&h&&(i=h.itemSize,k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.vertexAttribPointer(a.tangent,i,k.FLOAT,!1,0,4*g*i));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.attributes.index.buffer)}k.drawElements(k.TRIANGLES,e[d].count,k.UNSIGNED_SHORT,2*e[d].start);R.info.render.calls++;R.info.render.vertices+=
|
|
|
e[d].count;R.info.render.faces+=e[d].count/3}}else e instanceof THREE.ParticleSystem&&b&&(h=f.attributes.position,i=h.itemSize,k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.vertexAttribPointer(a.position,i,k.FLOAT,!1,0,0),i=f.attributes.color,0<=a.color&&i&&(j=i.itemSize,k.bindBuffer(k.ARRAY_BUFFER,i.buffer),k.vertexAttribPointer(a.color,j,k.FLOAT,!1,0,0)),k.drawArrays(k.POINTS,0,h.numItems/3),R.info.render.calls++,R.info.render.points+=h.numItems/3)};this.renderBuffer=function(a,b,c,d,f,e){if(!1!==d.visible){var g,
|
|
|
-h,c=u(a,b,c,d,e),b=c.attributes,a=!1,c=16777215*f.id+2*c.id+(d.wireframe?1:0);c!==ea&&(ea=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(e.morphTargetBase){c=d.program.attributes;-1!==e.morphTargetBase?(k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer),
|
|
|
+h,c=u(a,b,c,d,e),b=c.attributes,a=!1,c=16777215*f.id+2*c.id+(d.wireframe?1:0);c!==Z&&(Z=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(e.morphTargetBase){c=d.program.attributes;-1!==e.morphTargetBase?(k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglVertexBuffer),
|
|
|
k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(e.morphTargetForcedOrder.length){var i=0;h=e.morphTargetForcedOrder;for(g=e.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h[i]]),k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[h[i]]),k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,!1,0,0)),e.__webglMorphTargetInfluences[i]=g[h[i]],
|
|
|
i++}else{h=[];g=e.morphTargetInfluences;var j,n=g.length;for(j=0;j<n;j++)i=g[j],0<i&&h.push([j,i]);h.length>d.numSupportedMorphTargets?(h.sort(l),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(l):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(j=h[i][0],k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j]),k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[j]),
|
|
|
k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,!1,0,0)),e.__webglMorphTargetInfluences[i]=g[j]):(k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,!1,0,0),e.__webglMorphTargetInfluences[i]=0),i++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList){g=0;for(h=f.__webglCustomAttributesList.length;g<h;g++)c=
|
|
@@ -409,78 +409,78 @@ f.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(k.bindBuffe
|
|
|
4,k.FLOAT,!1,0,0));0<=b.uv&&(f.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,f.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));0<=b.uv2&&(f.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,f.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));d.skinning&&(0<=b.skinIndex&&0<=b.skinWeight)&&(k.bindBuffer(k.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),
|
|
|
k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0))}e instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ab&&(k.lineWidth(d),ab=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),k.drawElements(k.LINES,f.__webglLineCount,k.UNSIGNED_SHORT,0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),k.drawElements(k.TRIANGLES,f.__webglFaceCount,k.UNSIGNED_SHORT,0)),
|
|
|
R.info.render.calls++,R.info.render.vertices+=f.__webglFaceCount,R.info.render.faces+=f.__webglFaceCount/3):e instanceof THREE.Line?(e=e.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==ab&&(k.lineWidth(d),ab=d),k.drawArrays(e,0,f.__webglLineCount),R.info.render.calls++):e instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,f.__webglParticleCount),R.info.render.calls++,R.info.render.points+=f.__webglParticleCount):e instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,f.__webglVertexCount),
|
|
|
-R.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var f,e,g,h,i=a.__lights,l=a.fog;$=-1;ib=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b._viewMatrixArray||(b._viewMatrixArray=new Float32Array(16));b._projectionMatrixArray||(b._projectionMatrixArray=new Float32Array(16));b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
|
|
|
-b.projectionMatrix.flattenToArray(b._projectionMatrixArray);hb.multiply(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(hb);this.autoUpdateObjects&&this.initWebGLObjects(a);n(this.renderPluginsPre,a,b);R.info.render.calls=0;R.info.render.vertices=0;R.info.render.faces=0;R.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++)if(e=h[d],g=e.object,e.render=!1,
|
|
|
-g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||la.contains(g))){y(g,b);var p=e,q=p.object,t=p.buffer,s=void 0,s=s=void 0,s=q.material;s instanceof THREE.MeshFaceMaterial?(s=t.materialIndex,0<=s&&(s=q.geometry.materials[s],s.transparent?(p.transparent=s,p.opaque=null):(p.opaque=s,p.transparent=null))):s&&(s.transparent?(p.transparent=s,p.opaque=null):(p.opaque=s,p.transparent=null));e.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?e.z=g.renderDepth:
|
|
|
-(Va.copy(g.matrixWorld.getPosition()),hb.multiplyVector3(Va),e.z=Va.z))}this.sortObjects&&h.sort(j);h=a.__webglObjectsImmediate;d=0;for(f=h.length;d<f;d++)e=h[d],g=e.object,g.visible&&(y(g,b),g=e.object.material,g.transparent?(e.transparent=g,e.opaque=null):(e.opaque=g,e.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),A(d.polygonOffset,d.polygonOffsetFactor,
|
|
|
-d.polygonOffsetUnits),m(a.__webglObjects,!1,"",b,i,l,!0,d),o(a.__webglObjectsImmediate,"",b,i,l,!1,d)):(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,i,l,!1),o(a.__webglObjectsImmediate,"opaque",b,i,l,!1),m(a.__webglObjects,!1,"transparent",b,i,l,!0),o(a.__webglObjectsImmediate,"transparent",b,i,l,!0));n(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(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)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,f){var e=u(a,b,c,d,f);ea=-1;R.setMaterialFaces(d);f.immediateRenderCallback?f.immediateRenderCallback(e,k,la):f.render(function(a){R.renderBufferImmediate(a,e,d)})};this.initWebGLObjects=function(a){a.__webglObjects||
|
|
|
-(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var j=a.__objectsAdded[0],l=a,n=void 0,m=void 0,o=void 0;if(!j.__webglInit)if(j.__webglInit=!0,j._modelViewMatrix=new THREE.Matrix4,j._normalMatrix=new THREE.Matrix3,j instanceof THREE.Mesh)if(m=j.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=m,u=void 0,y=void 0,w=void 0,z=void 0,A=void 0,C=void 0,D=void 0,F={},H=r.morphTargets.length,I=r.morphNormals.length;
|
|
|
-r.geometryGroups={};u=0;for(y=r.faces.length;u<y;u++)w=r.faces[u],z=w.materialIndex,C=void 0!==z?z:-1,void 0===F[C]&&(F[C]={hash:C,counter:0}),D=F[C].hash+"_"+F[C].counter,void 0===r.geometryGroups[D]&&(r.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:H,numMorphNormals:I}),A=w instanceof THREE.Face3?3:4,65535<r.geometryGroups[D].vertices+A&&(F[C].counter+=1,D=F[C].hash+"_"+F[C].counter,void 0===r.geometryGroups[D]&&(r.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,
|
|
|
-vertices:0,numMorphTargets:H,numMorphNormals:I})),w instanceof THREE.Face3?r.geometryGroups[D].faces3.push(u):r.geometryGroups[D].faces4.push(u),r.geometryGroups[D].vertices+=A;r.geometryGroupsList=[];var J=void 0;for(J in r.geometryGroups)r.geometryGroups[J].id=ca++,r.geometryGroupsList.push(r.geometryGroups[J])}for(n in m.geometryGroups)if(o=m.geometryGroups[n],!o.__webglVertexBuffer){var G=o;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 Q=void 0,K=void 0;if(G.numMorphTargets){G.__webglMorphTargetsBuffers=[];Q=0;for(K=G.numMorphTargets;Q<K;Q++)G.__webglMorphTargetsBuffers.push(k.createBuffer())}if(G.numMorphNormals){G.__webglMorphNormalsBuffers=[];Q=0;for(K=G.numMorphNormals;Q<
|
|
|
-K;Q++)G.__webglMorphNormalsBuffers.push(k.createBuffer())}R.info.memory.geometries++;c(o,j);m.verticesNeedUpdate=!0;m.morphTargetsNeedUpdate=!0;m.elementsNeedUpdate=!0;m.uvsNeedUpdate=!0;m.normalsNeedUpdate=!0;m.tangentsNeedUpdate=!0;m.colorsNeedUpdate=!0}}else m instanceof THREE.BufferGeometry&&g(m);else if(j instanceof THREE.Ribbon){if(m=j.geometry,!m.__webglVertexBuffer){var M=m;M.__webglVertexBuffer=k.createBuffer();M.__webglColorBuffer=k.createBuffer();R.info.memory.geometries++;var L=m,W=L.vertices.length;
|
|
|
-L.__vertexArray=new Float32Array(3*W);L.__colorArray=new Float32Array(3*W);L.__webglVertexCount=W;m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}}else if(j instanceof THREE.Line){if(m=j.geometry,!m.__webglVertexBuffer){var $=m;$.__webglVertexBuffer=k.createBuffer();$.__webglColorBuffer=k.createBuffer();R.info.memory.geometries++;var N=m,P=j,O=N.vertices.length;N.__vertexArray=new Float32Array(3*O);N.__colorArray=new Float32Array(3*O);N.__webglLineCount=O;b(N,P);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=
|
|
|
-!0}}else if(j instanceof THREE.ParticleSystem&&(m=j.geometry,!m.__webglVertexBuffer))if(m instanceof THREE.Geometry){var Y=m;Y.__webglVertexBuffer=k.createBuffer();Y.__webglColorBuffer=k.createBuffer();R.info.memory.geometries++;var fa=m,Z=j,ea=fa.vertices.length;fa.__vertexArray=new Float32Array(3*ea);fa.__colorArray=new Float32Array(3*ea);fa.__sortArray=[];fa.__webglParticleCount=ea;b(fa,Z);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&g(m);if(!j.__webglActive){if(j instanceof
|
|
|
-THREE.Mesh)if(m=j.geometry,m instanceof THREE.BufferGeometry)q(l.__webglObjects,m,j);else for(n in m.geometryGroups)o=m.geometryGroups[n],q(l.__webglObjects,o,j);else j instanceof THREE.Ribbon||j instanceof THREE.Line||j instanceof THREE.ParticleSystem?(m=j.geometry,q(l.__webglObjects,m,j)):j instanceof THREE.ImmediateRenderObject||j.immediateRenderCallback?l.__webglObjectsImmediate.push({object:j,opaque:null,transparent:null}):j instanceof THREE.Sprite?l.__webglSprites.push(j):j instanceof THREE.LensFlare&&
|
|
|
-l.__webglFlares.push(j);j.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var ia=a.__objectsRemoved[0],Ia=a;ia instanceof THREE.Mesh||ia instanceof THREE.ParticleSystem||ia instanceof THREE.Ribbon||ia instanceof THREE.Line?t(Ia.__webglObjects,ia):ia instanceof THREE.Sprite?B(Ia.__webglSprites,ia):ia instanceof THREE.LensFlare?B(Ia.__webglFlares,ia):(ia instanceof THREE.ImmediateRenderObject||ia.immediateRenderCallback)&&t(Ia.__webglObjectsImmediate,ia);ia.__webglActive=
|
|
|
-!1;a.__objectsRemoved.splice(0,1)}for(var na=0,ra=a.__webglObjects.length;na<ra;na++){var sa=a.__webglObjects[na].object,ga=sa.geometry,La=void 0,Ea=void 0,la=void 0;if(sa instanceof THREE.Mesh)if(ga instanceof THREE.BufferGeometry)(ga.verticesNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangentsNeedUpdate)&&i(ga,k.DYNAMIC_DRAW,!ga.dynamic),ga.verticesNeedUpdate=!1,ga.elementsNeedUpdate=!1,ga.uvsNeedUpdate=!1,ga.normalsNeedUpdate=!1,ga.colorsNeedUpdate=
|
|
|
-!1,ga.tangentsNeedUpdate=!1;else{for(var ya=0,Ga=ga.geometryGroupsList.length;ya<Ga;ya++)if(La=ga.geometryGroupsList[ya],la=d(sa,La),ga.buffersNeedUpdate&&c(La,sa),Ea=la.attributes&&p(la),ga.verticesNeedUpdate||ga.morphTargetsNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangentsNeedUpdate||Ea){var oa=La,Ja=sa,ua=k.DYNAMIC_DRAW,Pa=!ga.dynamic,Ma=la;if(oa.__inittedArrays){var cb=f(Ma),ab=Ma.vertexColors?Ma.vertexColors:!1,ib=e(Ma),kb=cb===THREE.SmoothShading,
|
|
|
-E=void 0,X=void 0,Ua=void 0,S=void 0,bb=void 0,Ya=void 0,xb=void 0,hb=void 0,Va=void 0,db=void 0,gb=void 0,T=void 0,U=void 0,V=void 0,ma=void 0,yb=void 0,zb=void 0,Ab=void 0,lb=void 0,Bb=void 0,Cb=void 0,Db=void 0,mb=void 0,Eb=void 0,Fb=void 0,Gb=void 0,nb=void 0,Hb=void 0,Ib=void 0,Jb=void 0,sb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,vb=void 0,ta=void 0,Sb=void 0,Vb=void 0,gc=void 0,hc=void 0,Qa=void 0,dc=void 0,Na=void 0,Oa=void 0,Wb=void 0,Ob=void 0,Fa=0,Ka=0,Pb=0,Qb=0,qb=0,Wa=0,xa=0,$a=0,Ha=0,da=
|
|
|
-0,ha=0,x=0,va=void 0,Ra=oa.__vertexArray,kc=oa.__uvArray,lc=oa.__uv2Array,rb=oa.__normalArray,Aa=oa.__tangentArray,Sa=oa.__colorArray,Ba=oa.__skinIndexArray,Ca=oa.__skinWeightArray,ac=oa.__morphTargetsArrays,Fc=oa.__morphNormalsArrays,Gc=oa.__webglCustomAttributesList,v=void 0,Nb=oa.__faceArray,jb=oa.__lineArray,eb=Ja.geometry,qc=eb.elementsNeedUpdate,jc=eb.uvsNeedUpdate,Cc=eb.normalsNeedUpdate,Dc=eb.tangentsNeedUpdate,Rc=eb.colorsNeedUpdate,Sc=eb.morphTargetsNeedUpdate,bc=eb.vertices,pa=oa.faces3,
|
|
|
-qa=oa.faces4,Xa=eb.faces,Hc=eb.faceVertexUvs[0],Ic=eb.faceVertexUvs[1],cc=eb.skinIndices,Xb=eb.skinWeights,Yb=eb.morphTargets,sc=eb.morphNormals;if(eb.verticesNeedUpdate){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],T=bc[S.a],U=bc[S.b],V=bc[S.c],Ra[Ka]=T.x,Ra[Ka+1]=T.y,Ra[Ka+2]=T.z,Ra[Ka+3]=U.x,Ra[Ka+4]=U.y,Ra[Ka+5]=U.z,Ra[Ka+6]=V.x,Ra[Ka+7]=V.y,Ra[Ka+8]=V.z,Ka+=9;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],T=bc[S.a],U=bc[S.b],V=bc[S.c],ma=bc[S.d],Ra[Ka]=T.x,Ra[Ka+1]=T.y,Ra[Ka+2]=T.z,Ra[Ka+3]=U.x,Ra[Ka+4]=
|
|
|
-U.y,Ra[Ka+5]=U.z,Ra[Ka+6]=V.x,Ra[Ka+7]=V.y,Ra[Ka+8]=V.z,Ra[Ka+9]=ma.x,Ra[Ka+10]=ma.y,Ra[Ka+11]=ma.z,Ka+=12;k.bindBuffer(k.ARRAY_BUFFER,oa.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ra,ua)}if(Sc){Qa=0;for(dc=Yb.length;Qa<dc;Qa++){E=ha=0;for(X=pa.length;E<X;E++)Wb=pa[E],S=Xa[Wb],T=Yb[Qa].vertices[S.a],U=Yb[Qa].vertices[S.b],V=Yb[Qa].vertices[S.c],Na=ac[Qa],Na[ha]=T.x,Na[ha+1]=T.y,Na[ha+2]=T.z,Na[ha+3]=U.x,Na[ha+4]=U.y,Na[ha+5]=U.z,Na[ha+6]=V.x,Na[ha+7]=V.y,Na[ha+8]=V.z,Ma.morphNormals&&(kb?(Ob=
|
|
|
-sc[Qa].vertexNormals[Wb],Bb=Ob.a,Cb=Ob.b,Db=Ob.c):Db=Cb=Bb=sc[Qa].faceNormals[Wb],Oa=Fc[Qa],Oa[ha]=Bb.x,Oa[ha+1]=Bb.y,Oa[ha+2]=Bb.z,Oa[ha+3]=Cb.x,Oa[ha+4]=Cb.y,Oa[ha+5]=Cb.z,Oa[ha+6]=Db.x,Oa[ha+7]=Db.y,Oa[ha+8]=Db.z),ha+=9;E=0;for(X=qa.length;E<X;E++)Wb=qa[E],S=Xa[Wb],T=Yb[Qa].vertices[S.a],U=Yb[Qa].vertices[S.b],V=Yb[Qa].vertices[S.c],ma=Yb[Qa].vertices[S.d],Na=ac[Qa],Na[ha]=T.x,Na[ha+1]=T.y,Na[ha+2]=T.z,Na[ha+3]=U.x,Na[ha+4]=U.y,Na[ha+5]=U.z,Na[ha+6]=V.x,Na[ha+7]=V.y,Na[ha+8]=V.z,Na[ha+9]=ma.x,
|
|
|
-Na[ha+10]=ma.y,Na[ha+11]=ma.z,Ma.morphNormals&&(kb?(Ob=sc[Qa].vertexNormals[Wb],Bb=Ob.a,Cb=Ob.b,Db=Ob.c,mb=Ob.d):mb=Db=Cb=Bb=sc[Qa].faceNormals[Wb],Oa=Fc[Qa],Oa[ha]=Bb.x,Oa[ha+1]=Bb.y,Oa[ha+2]=Bb.z,Oa[ha+3]=Cb.x,Oa[ha+4]=Cb.y,Oa[ha+5]=Cb.z,Oa[ha+6]=Db.x,Oa[ha+7]=Db.y,Oa[ha+8]=Db.z,Oa[ha+9]=mb.x,Oa[ha+10]=mb.y,Oa[ha+11]=mb.z),ha+=12;k.bindBuffer(k.ARRAY_BUFFER,oa.__webglMorphTargetsBuffers[Qa]);k.bufferData(k.ARRAY_BUFFER,ac[Qa],ua);Ma.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,oa.__webglMorphNormalsBuffers[Qa]),
|
|
|
-k.bufferData(k.ARRAY_BUFFER,Fc[Qa],ua))}}if(Xb.length){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],Hb=Xb[S.a],Ib=Xb[S.b],Jb=Xb[S.c],Ca[da]=Hb.x,Ca[da+1]=Hb.y,Ca[da+2]=Hb.z,Ca[da+3]=Hb.w,Ca[da+4]=Ib.x,Ca[da+5]=Ib.y,Ca[da+6]=Ib.z,Ca[da+7]=Ib.w,Ca[da+8]=Jb.x,Ca[da+9]=Jb.y,Ca[da+10]=Jb.z,Ca[da+11]=Jb.w,Kb=cc[S.a],Lb=cc[S.b],Mb=cc[S.c],Ba[da]=Kb.x,Ba[da+1]=Kb.y,Ba[da+2]=Kb.z,Ba[da+3]=Kb.w,Ba[da+4]=Lb.x,Ba[da+5]=Lb.y,Ba[da+6]=Lb.z,Ba[da+7]=Lb.w,Ba[da+8]=Mb.x,Ba[da+9]=Mb.y,Ba[da+10]=Mb.z,Ba[da+11]=Mb.w,da+=
|
|
|
-12;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],Hb=Xb[S.a],Ib=Xb[S.b],Jb=Xb[S.c],sb=Xb[S.d],Ca[da]=Hb.x,Ca[da+1]=Hb.y,Ca[da+2]=Hb.z,Ca[da+3]=Hb.w,Ca[da+4]=Ib.x,Ca[da+5]=Ib.y,Ca[da+6]=Ib.z,Ca[da+7]=Ib.w,Ca[da+8]=Jb.x,Ca[da+9]=Jb.y,Ca[da+10]=Jb.z,Ca[da+11]=Jb.w,Ca[da+12]=sb.x,Ca[da+13]=sb.y,Ca[da+14]=sb.z,Ca[da+15]=sb.w,Kb=cc[S.a],Lb=cc[S.b],Mb=cc[S.c],vb=cc[S.d],Ba[da]=Kb.x,Ba[da+1]=Kb.y,Ba[da+2]=Kb.z,Ba[da+3]=Kb.w,Ba[da+4]=Lb.x,Ba[da+5]=Lb.y,Ba[da+6]=Lb.z,Ba[da+7]=Lb.w,Ba[da+8]=Mb.x,Ba[da+9]=Mb.y,Ba[da+
|
|
|
-10]=Mb.z,Ba[da+11]=Mb.w,Ba[da+12]=vb.x,Ba[da+13]=vb.y,Ba[da+14]=vb.z,Ba[da+15]=vb.w,da+=16;0<da&&(k.bindBuffer(k.ARRAY_BUFFER,oa.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,Ba,ua),k.bindBuffer(k.ARRAY_BUFFER,oa.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Ca,ua))}if(Rc&&ab){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],xb=S.vertexColors,hb=S.color,3===xb.length&&ab===THREE.VertexColors?(Eb=xb[0],Fb=xb[1],Gb=xb[2]):Gb=Fb=Eb=hb,Sa[Ha]=Eb.r,Sa[Ha+1]=Eb.g,Sa[Ha+2]=Eb.b,Sa[Ha+3]=Fb.r,Sa[Ha+
|
|
|
-4]=Fb.g,Sa[Ha+5]=Fb.b,Sa[Ha+6]=Gb.r,Sa[Ha+7]=Gb.g,Sa[Ha+8]=Gb.b,Ha+=9;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],xb=S.vertexColors,hb=S.color,4===xb.length&&ab===THREE.VertexColors?(Eb=xb[0],Fb=xb[1],Gb=xb[2],nb=xb[3]):nb=Gb=Fb=Eb=hb,Sa[Ha]=Eb.r,Sa[Ha+1]=Eb.g,Sa[Ha+2]=Eb.b,Sa[Ha+3]=Fb.r,Sa[Ha+4]=Fb.g,Sa[Ha+5]=Fb.b,Sa[Ha+6]=Gb.r,Sa[Ha+7]=Gb.g,Sa[Ha+8]=Gb.b,Sa[Ha+9]=nb.r,Sa[Ha+10]=nb.g,Sa[Ha+11]=nb.b,Ha+=12;0<Ha&&(k.bindBuffer(k.ARRAY_BUFFER,oa.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,Sa,ua))}if(Dc&&
|
|
|
-eb.hasTangents){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],Va=S.vertexTangents,yb=Va[0],zb=Va[1],Ab=Va[2],Aa[xa]=yb.x,Aa[xa+1]=yb.y,Aa[xa+2]=yb.z,Aa[xa+3]=yb.w,Aa[xa+4]=zb.x,Aa[xa+5]=zb.y,Aa[xa+6]=zb.z,Aa[xa+7]=zb.w,Aa[xa+8]=Ab.x,Aa[xa+9]=Ab.y,Aa[xa+10]=Ab.z,Aa[xa+11]=Ab.w,xa+=12;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],Va=S.vertexTangents,yb=Va[0],zb=Va[1],Ab=Va[2],lb=Va[3],Aa[xa]=yb.x,Aa[xa+1]=yb.y,Aa[xa+2]=yb.z,Aa[xa+3]=yb.w,Aa[xa+4]=zb.x,Aa[xa+5]=zb.y,Aa[xa+6]=zb.z,Aa[xa+7]=zb.w,Aa[xa+8]=Ab.x,Aa[xa+
|
|
|
-9]=Ab.y,Aa[xa+10]=Ab.z,Aa[xa+11]=Ab.w,Aa[xa+12]=lb.x,Aa[xa+13]=lb.y,Aa[xa+14]=lb.z,Aa[xa+15]=lb.w,xa+=16;k.bindBuffer(k.ARRAY_BUFFER,oa.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,Aa,ua)}if(Cc&&cb){E=0;for(X=pa.length;E<X;E++)if(S=Xa[pa[E]],bb=S.vertexNormals,Ya=S.normal,3===bb.length&&kb)for(ta=0;3>ta;ta++)Vb=bb[ta],rb[Wa]=Vb.x,rb[Wa+1]=Vb.y,rb[Wa+2]=Vb.z,Wa+=3;else for(ta=0;3>ta;ta++)rb[Wa]=Ya.x,rb[Wa+1]=Ya.y,rb[Wa+2]=Ya.z,Wa+=3;E=0;for(X=qa.length;E<X;E++)if(S=Xa[qa[E]],bb=S.vertexNormals,
|
|
|
-Ya=S.normal,4===bb.length&&kb)for(ta=0;4>ta;ta++)Vb=bb[ta],rb[Wa]=Vb.x,rb[Wa+1]=Vb.y,rb[Wa+2]=Vb.z,Wa+=3;else for(ta=0;4>ta;ta++)rb[Wa]=Ya.x,rb[Wa+1]=Ya.y,rb[Wa+2]=Ya.z,Wa+=3;k.bindBuffer(k.ARRAY_BUFFER,oa.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,rb,ua)}if(jc&&Hc&&ib){E=0;for(X=pa.length;E<X;E++)if(Ua=pa[E],db=Hc[Ua],void 0!==db)for(ta=0;3>ta;ta++)gc=db[ta],kc[Pb]=gc.u,kc[Pb+1]=gc.v,Pb+=2;E=0;for(X=qa.length;E<X;E++)if(Ua=qa[E],db=Hc[Ua],void 0!==db)for(ta=0;4>ta;ta++)gc=db[ta],kc[Pb]=gc.u,
|
|
|
-kc[Pb+1]=gc.v,Pb+=2;0<Pb&&(k.bindBuffer(k.ARRAY_BUFFER,oa.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,kc,ua))}if(jc&&Ic&&ib){E=0;for(X=pa.length;E<X;E++)if(Ua=pa[E],gb=Ic[Ua],void 0!==gb)for(ta=0;3>ta;ta++)hc=gb[ta],lc[Qb]=hc.u,lc[Qb+1]=hc.v,Qb+=2;E=0;for(X=qa.length;E<X;E++)if(Ua=qa[E],gb=Ic[Ua],void 0!==gb)for(ta=0;4>ta;ta++)hc=gb[ta],lc[Qb]=hc.u,lc[Qb+1]=hc.v,Qb+=2;0<Qb&&(k.bindBuffer(k.ARRAY_BUFFER,oa.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,lc,ua))}if(qc){E=0;for(X=pa.length;E<X;E++)Nb[qb]=
|
|
|
-Fa,Nb[qb+1]=Fa+1,Nb[qb+2]=Fa+2,qb+=3,jb[$a]=Fa,jb[$a+1]=Fa+1,jb[$a+2]=Fa,jb[$a+3]=Fa+2,jb[$a+4]=Fa+1,jb[$a+5]=Fa+2,$a+=6,Fa+=3;E=0;for(X=qa.length;E<X;E++)Nb[qb]=Fa,Nb[qb+1]=Fa+1,Nb[qb+2]=Fa+3,Nb[qb+3]=Fa+1,Nb[qb+4]=Fa+2,Nb[qb+5]=Fa+3,qb+=6,jb[$a]=Fa,jb[$a+1]=Fa+1,jb[$a+2]=Fa,jb[$a+3]=Fa+3,jb[$a+4]=Fa+1,jb[$a+5]=Fa+2,jb[$a+6]=Fa+2,jb[$a+7]=Fa+3,$a+=8,Fa+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,oa.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Nb,ua);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,oa.__webglLineBuffer);
|
|
|
-k.bufferData(k.ELEMENT_ARRAY_BUFFER,jb,ua)}if(Gc){ta=0;for(Sb=Gc.length;ta<Sb;ta++)if(v=Gc[ta],v.__original.needsUpdate){x=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],v.array[x]=v.value[S.a],v.array[x+1]=v.value[S.b],v.array[x+2]=v.value[S.c],x+=3;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],v.array[x]=v.value[S.a],v.array[x+1]=v.value[S.b],v.array[x+2]=v.value[S.c],v.array[x+3]=v.value[S.d],x+=4}else{if("faces"===v.boundTo){E=0;for(X=pa.length;E<
|
|
|
-X;E++)va=v.value[pa[E]],v.array[x]=va,v.array[x+1]=va,v.array[x+2]=va,x+=3;E=0;for(X=qa.length;E<X;E++)va=v.value[qa[E]],v.array[x]=va,v.array[x+1]=va,v.array[x+2]=va,v.array[x+3]=va,x+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=V.x,v.array[x+5]=V.y,x+=6;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],T=v.value[S.a],U=
|
|
|
-v.value[S.b],V=v.value[S.c],ma=v.value[S.d],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=V.x,v.array[x+5]=V.y,v.array[x+6]=ma.x,v.array[x+7]=ma.y,x+=8}else{if("faces"===v.boundTo){E=0;for(X=pa.length;E<X;E++)V=U=T=va=v.value[pa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=V.x,v.array[x+5]=V.y,x+=6;E=0;for(X=qa.length;E<X;E++)ma=V=U=T=va=v.value[qa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+
|
|
|
-4]=V.x,v.array[x+5]=V.y,v.array[x+6]=ma.x,v.array[x+7]=ma.y,x+=8}}else if(3===v.size){var ba;ba="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],v.array[x]=T[ba[0]],v.array[x+1]=T[ba[1]],v.array[x+2]=T[ba[2]],v.array[x+3]=U[ba[0]],v.array[x+4]=U[ba[1]],v.array[x+5]=U[ba[2]],v.array[x+6]=V[ba[0]],v.array[x+7]=V[ba[1]],v.array[x+8]=V[ba[2]],x+=9;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],
|
|
|
-T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],ma=v.value[S.d],v.array[x]=T[ba[0]],v.array[x+1]=T[ba[1]],v.array[x+2]=T[ba[2]],v.array[x+3]=U[ba[0]],v.array[x+4]=U[ba[1]],v.array[x+5]=U[ba[2]],v.array[x+6]=V[ba[0]],v.array[x+7]=V[ba[1]],v.array[x+8]=V[ba[2]],v.array[x+9]=ma[ba[0]],v.array[x+10]=ma[ba[1]],v.array[x+11]=ma[ba[2]],x+=12}else if("faces"===v.boundTo){E=0;for(X=pa.length;E<X;E++)V=U=T=va=v.value[pa[E]],v.array[x]=T[ba[0]],v.array[x+1]=T[ba[1]],v.array[x+2]=T[ba[2]],v.array[x+3]=U[ba[0]],
|
|
|
-v.array[x+4]=U[ba[1]],v.array[x+5]=U[ba[2]],v.array[x+6]=V[ba[0]],v.array[x+7]=V[ba[1]],v.array[x+8]=V[ba[2]],x+=9;E=0;for(X=qa.length;E<X;E++)ma=V=U=T=va=v.value[qa[E]],v.array[x]=T[ba[0]],v.array[x+1]=T[ba[1]],v.array[x+2]=T[ba[2]],v.array[x+3]=U[ba[0]],v.array[x+4]=U[ba[1]],v.array[x+5]=U[ba[2]],v.array[x+6]=V[ba[0]],v.array[x+7]=V[ba[1]],v.array[x+8]=V[ba[2]],v.array[x+9]=ma[ba[0]],v.array[x+10]=ma[ba[1]],v.array[x+11]=ma[ba[2]],x+=12}else if("faceVertices"===v.boundTo){E=0;for(X=pa.length;E<
|
|
|
-X;E++)va=v.value[pa[E]],T=va[0],U=va[1],V=va[2],v.array[x]=T[ba[0]],v.array[x+1]=T[ba[1]],v.array[x+2]=T[ba[2]],v.array[x+3]=U[ba[0]],v.array[x+4]=U[ba[1]],v.array[x+5]=U[ba[2]],v.array[x+6]=V[ba[0]],v.array[x+7]=V[ba[1]],v.array[x+8]=V[ba[2]],x+=9;E=0;for(X=qa.length;E<X;E++)va=v.value[qa[E]],T=va[0],U=va[1],V=va[2],ma=va[3],v.array[x]=T[ba[0]],v.array[x+1]=T[ba[1]],v.array[x+2]=T[ba[2]],v.array[x+3]=U[ba[0]],v.array[x+4]=U[ba[1]],v.array[x+5]=U[ba[2]],v.array[x+6]=V[ba[0]],v.array[x+7]=V[ba[1]],
|
|
|
-v.array[x+8]=V[ba[2]],v.array[x+9]=ma[ba[0]],v.array[x+10]=ma[ba[1]],v.array[x+11]=ma[ba[2]],x+=12}}else if(4===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(X=pa.length;E<X;E++)S=Xa[pa[E]],T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,x+=12;E=0;for(X=qa.length;E<X;E++)S=Xa[qa[E]],
|
|
|
-T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],ma=v.value[S.d],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,v.array[x+12]=ma.x,v.array[x+13]=ma.y,v.array[x+14]=ma.z,v.array[x+15]=ma.w,x+=16}else if("faces"===v.boundTo){E=0;for(X=pa.length;E<X;E++)V=U=T=va=v.value[pa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+
|
|
|
-4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,x+=12;E=0;for(X=qa.length;E<X;E++)ma=V=U=T=va=v.value[qa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,v.array[x+12]=ma.x,v.array[x+13]=ma.y,v.array[x+14]=ma.z,v.array[x+15]=ma.w,x+=16}else if("faceVertices"===v.boundTo){E=
|
|
|
-0;for(X=pa.length;E<X;E++)va=v.value[pa[E]],T=va[0],U=va[1],V=va[2],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,x+=12;E=0;for(X=qa.length;E<X;E++)va=v.value[qa[E]],T=va[0],U=va[1],V=va[2],ma=va[3],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+
|
|
|
-8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,v.array[x+12]=ma.x,v.array[x+13]=ma.y,v.array[x+14]=ma.z,v.array[x+15]=ma.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,v.buffer);k.bufferData(k.ARRAY_BUFFER,v.array,ua)}}Pa&&(delete oa.__inittedArrays,delete oa.__colorArray,delete oa.__normalArray,delete oa.__tangentArray,delete oa.__uvArray,delete oa.__uv2Array,delete oa.__faceArray,delete oa.__vertexArray,delete oa.__lineArray,delete oa.__skinIndexArray,delete oa.__skinWeightArray)}}ga.verticesNeedUpdate=
|
|
|
+R.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var f,e,g,h,i=a.__lights,l=a.fog;aa=-1;ib=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b._viewMatrixArray||(b._viewMatrixArray=new Float32Array(16));b._projectionMatrixArray||(b._projectionMatrixArray=new Float32Array(16));b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);
|
|
|
+b.projectionMatrix.flattenToArray(b._projectionMatrixArray);hb.multiply(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(hb);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);R.info.render.calls=0;R.info.render.vertices=0;R.info.render.faces=0;R.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++)if(e=h[d],g=e.object,e.render=!1,
|
|
|
+g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||la.contains(g))){B(g,b);var o=e,q=o.object,t=o.buffer,s=void 0,s=s=void 0,s=q.material;s instanceof THREE.MeshFaceMaterial?(s=t.materialIndex,0<=s&&(s=q.geometry.materials[s],s.transparent?(o.transparent=s,o.opaque=null):(o.opaque=s,o.transparent=null))):s&&(s.transparent?(o.transparent=s,o.opaque=null):(o.opaque=s,o.transparent=null));e.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?e.z=g.renderDepth:
|
|
|
+(Va.copy(g.matrixWorld.getPosition()),hb.multiplyVector3(Va),e.z=Va.z))}this.sortObjects&&h.sort(j);h=a.__webglObjectsImmediate;d=0;for(f=h.length;d<f;d++)e=h[d],g=e.object,g.visible&&(B(g,b),g=e.object.material,g.transparent?(e.transparent=g,e.opaque=null):(e.opaque=g,e.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),z(d.polygonOffset,d.polygonOffsetFactor,
|
|
|
+d.polygonOffsetUnits),n(a.__webglObjects,!1,"",b,i,l,!0,d),p(a.__webglObjectsImmediate,"",b,i,l,!1,d)):(this.setBlending(THREE.NormalBlending),n(a.__webglObjects,!0,"opaque",b,i,l,!1),p(a.__webglObjectsImmediate,"opaque",b,i,l,!1),n(a.__webglObjects,!1,"transparent",b,i,l,!0),p(a.__webglObjectsImmediate,"transparent",b,i,l,!0));m(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(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)):(k.bindTexture(k.TEXTURE_2D,c.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,f){var e=u(a,b,c,d,f);Z=-1;R.setMaterialFaces(d);f.immediateRenderCallback?f.immediateRenderCallback(e,k,la):f.render(function(a){R.renderBufferImmediate(a,e,d)})};this.initWebGLObjects=function(a){a.__webglObjects||
|
|
|
+(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var j=a.__objectsAdded[0],l=a,n=void 0,m=void 0,p=void 0;if(!j.__webglInit)if(j.__webglInit=!0,j._modelViewMatrix=new THREE.Matrix4,j._normalMatrix=new THREE.Matrix3,j instanceof THREE.Mesh)if(m=j.geometry,m instanceof THREE.Geometry){if(void 0===m.geometryGroups){var r=m,u=void 0,y=void 0,w=void 0,z=void 0,B=void 0,C=void 0,D=void 0,F={},G=r.morphTargets.length,I=r.morphNormals.length;
|
|
|
+r.geometryGroups={};u=0;for(y=r.faces.length;u<y;u++)w=r.faces[u],z=w.materialIndex,C=void 0!==z?z:-1,void 0===F[C]&&(F[C]={hash:C,counter:0}),D=F[C].hash+"_"+F[C].counter,void 0===r.geometryGroups[D]&&(r.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:I}),B=w instanceof THREE.Face3?3:4,65535<r.geometryGroups[D].vertices+B&&(F[C].counter+=1,D=F[C].hash+"_"+F[C].counter,void 0===r.geometryGroups[D]&&(r.geometryGroups[D]={faces3:[],faces4:[],materialIndex:z,
|
|
|
+vertices:0,numMorphTargets:G,numMorphNormals:I})),w instanceof THREE.Face3?r.geometryGroups[D].faces3.push(u):r.geometryGroups[D].faces4.push(u),r.geometryGroups[D].vertices+=B;r.geometryGroupsList=[];var J=void 0;for(J in r.geometryGroups)r.geometryGroups[J].id=da++,r.geometryGroupsList.push(r.geometryGroups[J])}for(n in m.geometryGroups)if(p=m.geometryGroups[n],!p.__webglVertexBuffer){var H=p;H.__webglVertexBuffer=k.createBuffer();H.__webglNormalBuffer=k.createBuffer();H.__webglTangentBuffer=k.createBuffer();
|
|
|
+H.__webglColorBuffer=k.createBuffer();H.__webglUVBuffer=k.createBuffer();H.__webglUV2Buffer=k.createBuffer();H.__webglSkinIndicesBuffer=k.createBuffer();H.__webglSkinWeightsBuffer=k.createBuffer();H.__webglFaceBuffer=k.createBuffer();H.__webglLineBuffer=k.createBuffer();var Q=void 0,K=void 0;if(H.numMorphTargets){H.__webglMorphTargetsBuffers=[];Q=0;for(K=H.numMorphTargets;Q<K;Q++)H.__webglMorphTargetsBuffers.push(k.createBuffer())}if(H.numMorphNormals){H.__webglMorphNormalsBuffers=[];Q=0;for(K=H.numMorphNormals;Q<
|
|
|
+K;Q++)H.__webglMorphNormalsBuffers.push(k.createBuffer())}R.info.memory.geometries++;c(p,j);m.verticesNeedUpdate=!0;m.morphTargetsNeedUpdate=!0;m.elementsNeedUpdate=!0;m.uvsNeedUpdate=!0;m.normalsNeedUpdate=!0;m.tangentsNeedUpdate=!0;m.colorsNeedUpdate=!0}}else m instanceof THREE.BufferGeometry&&g(m);else if(j instanceof THREE.Ribbon){if(m=j.geometry,!m.__webglVertexBuffer){var M=m;M.__webglVertexBuffer=k.createBuffer();M.__webglColorBuffer=k.createBuffer();R.info.memory.geometries++;var W=m,L=W.vertices.length;
|
|
|
+W.__vertexArray=new Float32Array(3*L);W.__colorArray=new Float32Array(3*L);W.__webglVertexCount=L;m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}}else if(j instanceof THREE.Line){if(m=j.geometry,!m.__webglVertexBuffer){var aa=m;aa.__webglVertexBuffer=k.createBuffer();aa.__webglColorBuffer=k.createBuffer();R.info.memory.geometries++;var N=m,P=j,O=N.vertices.length;N.__vertexArray=new Float32Array(3*O);N.__colorArray=new Float32Array(3*O);N.__webglLineCount=O;b(N,P);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=
|
|
|
+!0}}else if(j instanceof THREE.ParticleSystem&&(m=j.geometry,!m.__webglVertexBuffer))if(m instanceof THREE.Geometry){var $=m;$.__webglVertexBuffer=k.createBuffer();$.__webglColorBuffer=k.createBuffer();R.info.memory.geometries++;var Z=m,ha=j,X=Z.vertices.length;Z.__vertexArray=new Float32Array(3*X);Z.__colorArray=new Float32Array(3*X);Z.__sortArray=[];Z.__webglParticleCount=X;b(Z,ha);m.verticesNeedUpdate=!0;m.colorsNeedUpdate=!0}else m instanceof THREE.BufferGeometry&&g(m);if(!j.__webglActive){if(j instanceof
|
|
|
+THREE.Mesh)if(m=j.geometry,m instanceof THREE.BufferGeometry)o(l.__webglObjects,m,j);else for(n in m.geometryGroups)p=m.geometryGroups[n],o(l.__webglObjects,p,j);else j instanceof THREE.Ribbon||j instanceof THREE.Line||j instanceof THREE.ParticleSystem?(m=j.geometry,o(l.__webglObjects,m,j)):j instanceof THREE.ImmediateRenderObject||j.immediateRenderCallback?l.__webglObjectsImmediate.push({object:j,opaque:null,transparent:null}):j instanceof THREE.Sprite?l.__webglSprites.push(j):j instanceof THREE.LensFlare&&
|
|
|
+l.__webglFlares.push(j);j.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var fa=a.__objectsRemoved[0],oa=a;fa instanceof THREE.Mesh||fa instanceof THREE.ParticleSystem||fa instanceof THREE.Ribbon||fa instanceof THREE.Line?t(oa.__webglObjects,fa):fa instanceof THREE.Sprite?A(oa.__webglSprites,fa):fa instanceof THREE.LensFlare?A(oa.__webglFlares,fa):(fa instanceof THREE.ImmediateRenderObject||fa.immediateRenderCallback)&&t(oa.__webglObjectsImmediate,fa);fa.__webglActive=
|
|
|
+!1;a.__objectsRemoved.splice(0,1)}for(var Ka=0,ra=a.__webglObjects.length;Ka<ra;Ka++){var sa=a.__webglObjects[Ka].object,ga=sa.geometry,La=void 0,Ea=void 0,la=void 0;if(sa instanceof THREE.Mesh)if(ga instanceof THREE.BufferGeometry)(ga.verticesNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangentsNeedUpdate)&&i(ga,k.DYNAMIC_DRAW,!ga.dynamic),ga.verticesNeedUpdate=!1,ga.elementsNeedUpdate=!1,ga.uvsNeedUpdate=!1,ga.normalsNeedUpdate=!1,ga.colorsNeedUpdate=
|
|
|
+!1,ga.tangentsNeedUpdate=!1;else{for(var ya=0,Ga=ga.geometryGroupsList.length;ya<Ga;ya++)if(La=ga.geometryGroupsList[ya],la=d(sa,La),ga.buffersNeedUpdate&&c(La,sa),Ea=la.attributes&&q(la),ga.verticesNeedUpdate||ga.morphTargetsNeedUpdate||ga.elementsNeedUpdate||ga.uvsNeedUpdate||ga.normalsNeedUpdate||ga.colorsNeedUpdate||ga.tangentsNeedUpdate||Ea){var na=La,Ia=sa,ua=k.DYNAMIC_DRAW,Pa=!ga.dynamic,Ma=la;if(na.__inittedArrays){var cb=f(Ma),ab=Ma.vertexColors?Ma.vertexColors:!1,ib=e(Ma),kb=cb===THREE.SmoothShading,
|
|
|
+E=void 0,Y=void 0,Ua=void 0,S=void 0,bb=void 0,Ya=void 0,xb=void 0,hb=void 0,Va=void 0,db=void 0,gb=void 0,T=void 0,U=void 0,V=void 0,ma=void 0,yb=void 0,zb=void 0,Ab=void 0,lb=void 0,Bb=void 0,Cb=void 0,Db=void 0,mb=void 0,Eb=void 0,Fb=void 0,Gb=void 0,nb=void 0,Hb=void 0,Ib=void 0,Jb=void 0,sb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,vb=void 0,ta=void 0,Sb=void 0,Vb=void 0,gc=void 0,hc=void 0,Qa=void 0,dc=void 0,Na=void 0,Oa=void 0,Wb=void 0,Ob=void 0,Fa=0,Ja=0,Pb=0,Qb=0,qb=0,Wa=0,xa=0,$a=0,Ha=0,ea=
|
|
|
+0,ia=0,x=0,va=void 0,Ra=na.__vertexArray,kc=na.__uvArray,lc=na.__uv2Array,rb=na.__normalArray,Aa=na.__tangentArray,Sa=na.__colorArray,Ba=na.__skinIndexArray,Ca=na.__skinWeightArray,ac=na.__morphTargetsArrays,Fc=na.__morphNormalsArrays,Gc=na.__webglCustomAttributesList,v=void 0,Nb=na.__faceArray,jb=na.__lineArray,eb=Ia.geometry,qc=eb.elementsNeedUpdate,jc=eb.uvsNeedUpdate,Cc=eb.normalsNeedUpdate,Dc=eb.tangentsNeedUpdate,Rc=eb.colorsNeedUpdate,Sc=eb.morphTargetsNeedUpdate,bc=eb.vertices,pa=na.faces3,
|
|
|
+qa=na.faces4,Xa=eb.faces,Hc=eb.faceVertexUvs[0],Ic=eb.faceVertexUvs[1],cc=eb.skinIndices,Xb=eb.skinWeights,Yb=eb.morphTargets,sc=eb.morphNormals;if(eb.verticesNeedUpdate){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],T=bc[S.a],U=bc[S.b],V=bc[S.c],Ra[Ja]=T.x,Ra[Ja+1]=T.y,Ra[Ja+2]=T.z,Ra[Ja+3]=U.x,Ra[Ja+4]=U.y,Ra[Ja+5]=U.z,Ra[Ja+6]=V.x,Ra[Ja+7]=V.y,Ra[Ja+8]=V.z,Ja+=9;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],T=bc[S.a],U=bc[S.b],V=bc[S.c],ma=bc[S.d],Ra[Ja]=T.x,Ra[Ja+1]=T.y,Ra[Ja+2]=T.z,Ra[Ja+3]=U.x,Ra[Ja+4]=
|
|
|
+U.y,Ra[Ja+5]=U.z,Ra[Ja+6]=V.x,Ra[Ja+7]=V.y,Ra[Ja+8]=V.z,Ra[Ja+9]=ma.x,Ra[Ja+10]=ma.y,Ra[Ja+11]=ma.z,Ja+=12;k.bindBuffer(k.ARRAY_BUFFER,na.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ra,ua)}if(Sc){Qa=0;for(dc=Yb.length;Qa<dc;Qa++){E=ia=0;for(Y=pa.length;E<Y;E++)Wb=pa[E],S=Xa[Wb],T=Yb[Qa].vertices[S.a],U=Yb[Qa].vertices[S.b],V=Yb[Qa].vertices[S.c],Na=ac[Qa],Na[ia]=T.x,Na[ia+1]=T.y,Na[ia+2]=T.z,Na[ia+3]=U.x,Na[ia+4]=U.y,Na[ia+5]=U.z,Na[ia+6]=V.x,Na[ia+7]=V.y,Na[ia+8]=V.z,Ma.morphNormals&&(kb?(Ob=
|
|
|
+sc[Qa].vertexNormals[Wb],Bb=Ob.a,Cb=Ob.b,Db=Ob.c):Db=Cb=Bb=sc[Qa].faceNormals[Wb],Oa=Fc[Qa],Oa[ia]=Bb.x,Oa[ia+1]=Bb.y,Oa[ia+2]=Bb.z,Oa[ia+3]=Cb.x,Oa[ia+4]=Cb.y,Oa[ia+5]=Cb.z,Oa[ia+6]=Db.x,Oa[ia+7]=Db.y,Oa[ia+8]=Db.z),ia+=9;E=0;for(Y=qa.length;E<Y;E++)Wb=qa[E],S=Xa[Wb],T=Yb[Qa].vertices[S.a],U=Yb[Qa].vertices[S.b],V=Yb[Qa].vertices[S.c],ma=Yb[Qa].vertices[S.d],Na=ac[Qa],Na[ia]=T.x,Na[ia+1]=T.y,Na[ia+2]=T.z,Na[ia+3]=U.x,Na[ia+4]=U.y,Na[ia+5]=U.z,Na[ia+6]=V.x,Na[ia+7]=V.y,Na[ia+8]=V.z,Na[ia+9]=ma.x,
|
|
|
+Na[ia+10]=ma.y,Na[ia+11]=ma.z,Ma.morphNormals&&(kb?(Ob=sc[Qa].vertexNormals[Wb],Bb=Ob.a,Cb=Ob.b,Db=Ob.c,mb=Ob.d):mb=Db=Cb=Bb=sc[Qa].faceNormals[Wb],Oa=Fc[Qa],Oa[ia]=Bb.x,Oa[ia+1]=Bb.y,Oa[ia+2]=Bb.z,Oa[ia+3]=Cb.x,Oa[ia+4]=Cb.y,Oa[ia+5]=Cb.z,Oa[ia+6]=Db.x,Oa[ia+7]=Db.y,Oa[ia+8]=Db.z,Oa[ia+9]=mb.x,Oa[ia+10]=mb.y,Oa[ia+11]=mb.z),ia+=12;k.bindBuffer(k.ARRAY_BUFFER,na.__webglMorphTargetsBuffers[Qa]);k.bufferData(k.ARRAY_BUFFER,ac[Qa],ua);Ma.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,na.__webglMorphNormalsBuffers[Qa]),
|
|
|
+k.bufferData(k.ARRAY_BUFFER,Fc[Qa],ua))}}if(Xb.length){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],Hb=Xb[S.a],Ib=Xb[S.b],Jb=Xb[S.c],Ca[ea]=Hb.x,Ca[ea+1]=Hb.y,Ca[ea+2]=Hb.z,Ca[ea+3]=Hb.w,Ca[ea+4]=Ib.x,Ca[ea+5]=Ib.y,Ca[ea+6]=Ib.z,Ca[ea+7]=Ib.w,Ca[ea+8]=Jb.x,Ca[ea+9]=Jb.y,Ca[ea+10]=Jb.z,Ca[ea+11]=Jb.w,Kb=cc[S.a],Lb=cc[S.b],Mb=cc[S.c],Ba[ea]=Kb.x,Ba[ea+1]=Kb.y,Ba[ea+2]=Kb.z,Ba[ea+3]=Kb.w,Ba[ea+4]=Lb.x,Ba[ea+5]=Lb.y,Ba[ea+6]=Lb.z,Ba[ea+7]=Lb.w,Ba[ea+8]=Mb.x,Ba[ea+9]=Mb.y,Ba[ea+10]=Mb.z,Ba[ea+11]=Mb.w,ea+=
|
|
|
+12;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],Hb=Xb[S.a],Ib=Xb[S.b],Jb=Xb[S.c],sb=Xb[S.d],Ca[ea]=Hb.x,Ca[ea+1]=Hb.y,Ca[ea+2]=Hb.z,Ca[ea+3]=Hb.w,Ca[ea+4]=Ib.x,Ca[ea+5]=Ib.y,Ca[ea+6]=Ib.z,Ca[ea+7]=Ib.w,Ca[ea+8]=Jb.x,Ca[ea+9]=Jb.y,Ca[ea+10]=Jb.z,Ca[ea+11]=Jb.w,Ca[ea+12]=sb.x,Ca[ea+13]=sb.y,Ca[ea+14]=sb.z,Ca[ea+15]=sb.w,Kb=cc[S.a],Lb=cc[S.b],Mb=cc[S.c],vb=cc[S.d],Ba[ea]=Kb.x,Ba[ea+1]=Kb.y,Ba[ea+2]=Kb.z,Ba[ea+3]=Kb.w,Ba[ea+4]=Lb.x,Ba[ea+5]=Lb.y,Ba[ea+6]=Lb.z,Ba[ea+7]=Lb.w,Ba[ea+8]=Mb.x,Ba[ea+9]=Mb.y,Ba[ea+
|
|
|
+10]=Mb.z,Ba[ea+11]=Mb.w,Ba[ea+12]=vb.x,Ba[ea+13]=vb.y,Ba[ea+14]=vb.z,Ba[ea+15]=vb.w,ea+=16;0<ea&&(k.bindBuffer(k.ARRAY_BUFFER,na.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,Ba,ua),k.bindBuffer(k.ARRAY_BUFFER,na.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Ca,ua))}if(Rc&&ab){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],xb=S.vertexColors,hb=S.color,3===xb.length&&ab===THREE.VertexColors?(Eb=xb[0],Fb=xb[1],Gb=xb[2]):Gb=Fb=Eb=hb,Sa[Ha]=Eb.r,Sa[Ha+1]=Eb.g,Sa[Ha+2]=Eb.b,Sa[Ha+3]=Fb.r,Sa[Ha+
|
|
|
+4]=Fb.g,Sa[Ha+5]=Fb.b,Sa[Ha+6]=Gb.r,Sa[Ha+7]=Gb.g,Sa[Ha+8]=Gb.b,Ha+=9;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],xb=S.vertexColors,hb=S.color,4===xb.length&&ab===THREE.VertexColors?(Eb=xb[0],Fb=xb[1],Gb=xb[2],nb=xb[3]):nb=Gb=Fb=Eb=hb,Sa[Ha]=Eb.r,Sa[Ha+1]=Eb.g,Sa[Ha+2]=Eb.b,Sa[Ha+3]=Fb.r,Sa[Ha+4]=Fb.g,Sa[Ha+5]=Fb.b,Sa[Ha+6]=Gb.r,Sa[Ha+7]=Gb.g,Sa[Ha+8]=Gb.b,Sa[Ha+9]=nb.r,Sa[Ha+10]=nb.g,Sa[Ha+11]=nb.b,Ha+=12;0<Ha&&(k.bindBuffer(k.ARRAY_BUFFER,na.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,Sa,ua))}if(Dc&&
|
|
|
+eb.hasTangents){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],Va=S.vertexTangents,yb=Va[0],zb=Va[1],Ab=Va[2],Aa[xa]=yb.x,Aa[xa+1]=yb.y,Aa[xa+2]=yb.z,Aa[xa+3]=yb.w,Aa[xa+4]=zb.x,Aa[xa+5]=zb.y,Aa[xa+6]=zb.z,Aa[xa+7]=zb.w,Aa[xa+8]=Ab.x,Aa[xa+9]=Ab.y,Aa[xa+10]=Ab.z,Aa[xa+11]=Ab.w,xa+=12;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],Va=S.vertexTangents,yb=Va[0],zb=Va[1],Ab=Va[2],lb=Va[3],Aa[xa]=yb.x,Aa[xa+1]=yb.y,Aa[xa+2]=yb.z,Aa[xa+3]=yb.w,Aa[xa+4]=zb.x,Aa[xa+5]=zb.y,Aa[xa+6]=zb.z,Aa[xa+7]=zb.w,Aa[xa+8]=Ab.x,Aa[xa+
|
|
|
+9]=Ab.y,Aa[xa+10]=Ab.z,Aa[xa+11]=Ab.w,Aa[xa+12]=lb.x,Aa[xa+13]=lb.y,Aa[xa+14]=lb.z,Aa[xa+15]=lb.w,xa+=16;k.bindBuffer(k.ARRAY_BUFFER,na.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,Aa,ua)}if(Cc&&cb){E=0;for(Y=pa.length;E<Y;E++)if(S=Xa[pa[E]],bb=S.vertexNormals,Ya=S.normal,3===bb.length&&kb)for(ta=0;3>ta;ta++)Vb=bb[ta],rb[Wa]=Vb.x,rb[Wa+1]=Vb.y,rb[Wa+2]=Vb.z,Wa+=3;else for(ta=0;3>ta;ta++)rb[Wa]=Ya.x,rb[Wa+1]=Ya.y,rb[Wa+2]=Ya.z,Wa+=3;E=0;for(Y=qa.length;E<Y;E++)if(S=Xa[qa[E]],bb=S.vertexNormals,
|
|
|
+Ya=S.normal,4===bb.length&&kb)for(ta=0;4>ta;ta++)Vb=bb[ta],rb[Wa]=Vb.x,rb[Wa+1]=Vb.y,rb[Wa+2]=Vb.z,Wa+=3;else for(ta=0;4>ta;ta++)rb[Wa]=Ya.x,rb[Wa+1]=Ya.y,rb[Wa+2]=Ya.z,Wa+=3;k.bindBuffer(k.ARRAY_BUFFER,na.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,rb,ua)}if(jc&&Hc&&ib){E=0;for(Y=pa.length;E<Y;E++)if(Ua=pa[E],db=Hc[Ua],void 0!==db)for(ta=0;3>ta;ta++)gc=db[ta],kc[Pb]=gc.u,kc[Pb+1]=gc.v,Pb+=2;E=0;for(Y=qa.length;E<Y;E++)if(Ua=qa[E],db=Hc[Ua],void 0!==db)for(ta=0;4>ta;ta++)gc=db[ta],kc[Pb]=gc.u,
|
|
|
+kc[Pb+1]=gc.v,Pb+=2;0<Pb&&(k.bindBuffer(k.ARRAY_BUFFER,na.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,kc,ua))}if(jc&&Ic&&ib){E=0;for(Y=pa.length;E<Y;E++)if(Ua=pa[E],gb=Ic[Ua],void 0!==gb)for(ta=0;3>ta;ta++)hc=gb[ta],lc[Qb]=hc.u,lc[Qb+1]=hc.v,Qb+=2;E=0;for(Y=qa.length;E<Y;E++)if(Ua=qa[E],gb=Ic[Ua],void 0!==gb)for(ta=0;4>ta;ta++)hc=gb[ta],lc[Qb]=hc.u,lc[Qb+1]=hc.v,Qb+=2;0<Qb&&(k.bindBuffer(k.ARRAY_BUFFER,na.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,lc,ua))}if(qc){E=0;for(Y=pa.length;E<Y;E++)Nb[qb]=
|
|
|
+Fa,Nb[qb+1]=Fa+1,Nb[qb+2]=Fa+2,qb+=3,jb[$a]=Fa,jb[$a+1]=Fa+1,jb[$a+2]=Fa,jb[$a+3]=Fa+2,jb[$a+4]=Fa+1,jb[$a+5]=Fa+2,$a+=6,Fa+=3;E=0;for(Y=qa.length;E<Y;E++)Nb[qb]=Fa,Nb[qb+1]=Fa+1,Nb[qb+2]=Fa+3,Nb[qb+3]=Fa+1,Nb[qb+4]=Fa+2,Nb[qb+5]=Fa+3,qb+=6,jb[$a]=Fa,jb[$a+1]=Fa+1,jb[$a+2]=Fa,jb[$a+3]=Fa+3,jb[$a+4]=Fa+1,jb[$a+5]=Fa+2,jb[$a+6]=Fa+2,jb[$a+7]=Fa+3,$a+=8,Fa+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,na.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Nb,ua);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,na.__webglLineBuffer);
|
|
|
+k.bufferData(k.ELEMENT_ARRAY_BUFFER,jb,ua)}if(Gc){ta=0;for(Sb=Gc.length;ta<Sb;ta++)if(v=Gc[ta],v.__original.needsUpdate){x=0;if(1===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],v.array[x]=v.value[S.a],v.array[x+1]=v.value[S.b],v.array[x+2]=v.value[S.c],x+=3;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],v.array[x]=v.value[S.a],v.array[x+1]=v.value[S.b],v.array[x+2]=v.value[S.c],v.array[x+3]=v.value[S.d],x+=4}else{if("faces"===v.boundTo){E=0;for(Y=pa.length;E<
|
|
|
+Y;E++)va=v.value[pa[E]],v.array[x]=va,v.array[x+1]=va,v.array[x+2]=va,x+=3;E=0;for(Y=qa.length;E<Y;E++)va=v.value[qa[E]],v.array[x]=va,v.array[x+1]=va,v.array[x+2]=va,v.array[x+3]=va,x+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=V.x,v.array[x+5]=V.y,x+=6;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],T=v.value[S.a],U=
|
|
|
+v.value[S.b],V=v.value[S.c],ma=v.value[S.d],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=V.x,v.array[x+5]=V.y,v.array[x+6]=ma.x,v.array[x+7]=ma.y,x+=8}else{if("faces"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)V=U=T=va=v.value[pa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+4]=V.x,v.array[x+5]=V.y,x+=6;E=0;for(Y=qa.length;E<Y;E++)ma=V=U=T=va=v.value[qa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=U.x,v.array[x+3]=U.y,v.array[x+
|
|
|
+4]=V.x,v.array[x+5]=V.y,v.array[x+6]=ma.x,v.array[x+7]=ma.y,x+=8}}else if(3===v.size){var ca;ca="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],v.array[x]=T[ca[0]],v.array[x+1]=T[ca[1]],v.array[x+2]=T[ca[2]],v.array[x+3]=U[ca[0]],v.array[x+4]=U[ca[1]],v.array[x+5]=U[ca[2]],v.array[x+6]=V[ca[0]],v.array[x+7]=V[ca[1]],v.array[x+8]=V[ca[2]],x+=9;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],
|
|
|
+T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],ma=v.value[S.d],v.array[x]=T[ca[0]],v.array[x+1]=T[ca[1]],v.array[x+2]=T[ca[2]],v.array[x+3]=U[ca[0]],v.array[x+4]=U[ca[1]],v.array[x+5]=U[ca[2]],v.array[x+6]=V[ca[0]],v.array[x+7]=V[ca[1]],v.array[x+8]=V[ca[2]],v.array[x+9]=ma[ca[0]],v.array[x+10]=ma[ca[1]],v.array[x+11]=ma[ca[2]],x+=12}else if("faces"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)V=U=T=va=v.value[pa[E]],v.array[x]=T[ca[0]],v.array[x+1]=T[ca[1]],v.array[x+2]=T[ca[2]],v.array[x+3]=U[ca[0]],
|
|
|
+v.array[x+4]=U[ca[1]],v.array[x+5]=U[ca[2]],v.array[x+6]=V[ca[0]],v.array[x+7]=V[ca[1]],v.array[x+8]=V[ca[2]],x+=9;E=0;for(Y=qa.length;E<Y;E++)ma=V=U=T=va=v.value[qa[E]],v.array[x]=T[ca[0]],v.array[x+1]=T[ca[1]],v.array[x+2]=T[ca[2]],v.array[x+3]=U[ca[0]],v.array[x+4]=U[ca[1]],v.array[x+5]=U[ca[2]],v.array[x+6]=V[ca[0]],v.array[x+7]=V[ca[1]],v.array[x+8]=V[ca[2]],v.array[x+9]=ma[ca[0]],v.array[x+10]=ma[ca[1]],v.array[x+11]=ma[ca[2]],x+=12}else if("faceVertices"===v.boundTo){E=0;for(Y=pa.length;E<
|
|
|
+Y;E++)va=v.value[pa[E]],T=va[0],U=va[1],V=va[2],v.array[x]=T[ca[0]],v.array[x+1]=T[ca[1]],v.array[x+2]=T[ca[2]],v.array[x+3]=U[ca[0]],v.array[x+4]=U[ca[1]],v.array[x+5]=U[ca[2]],v.array[x+6]=V[ca[0]],v.array[x+7]=V[ca[1]],v.array[x+8]=V[ca[2]],x+=9;E=0;for(Y=qa.length;E<Y;E++)va=v.value[qa[E]],T=va[0],U=va[1],V=va[2],ma=va[3],v.array[x]=T[ca[0]],v.array[x+1]=T[ca[1]],v.array[x+2]=T[ca[2]],v.array[x+3]=U[ca[0]],v.array[x+4]=U[ca[1]],v.array[x+5]=U[ca[2]],v.array[x+6]=V[ca[0]],v.array[x+7]=V[ca[1]],
|
|
|
+v.array[x+8]=V[ca[2]],v.array[x+9]=ma[ca[0]],v.array[x+10]=ma[ca[1]],v.array[x+11]=ma[ca[2]],x+=12}}else if(4===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)S=Xa[pa[E]],T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,x+=12;E=0;for(Y=qa.length;E<Y;E++)S=Xa[qa[E]],
|
|
|
+T=v.value[S.a],U=v.value[S.b],V=v.value[S.c],ma=v.value[S.d],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,v.array[x+12]=ma.x,v.array[x+13]=ma.y,v.array[x+14]=ma.z,v.array[x+15]=ma.w,x+=16}else if("faces"===v.boundTo){E=0;for(Y=pa.length;E<Y;E++)V=U=T=va=v.value[pa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+
|
|
|
+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,x+=12;E=0;for(Y=qa.length;E<Y;E++)ma=V=U=T=va=v.value[qa[E]],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,v.array[x+12]=ma.x,v.array[x+13]=ma.y,v.array[x+14]=ma.z,v.array[x+15]=ma.w,x+=16}else if("faceVertices"===v.boundTo){E=
|
|
|
+0;for(Y=pa.length;E<Y;E++)va=v.value[pa[E]],T=va[0],U=va[1],V=va[2],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,x+=12;E=0;for(Y=qa.length;E<Y;E++)va=v.value[qa[E]],T=va[0],U=va[1],V=va[2],ma=va[3],v.array[x]=T.x,v.array[x+1]=T.y,v.array[x+2]=T.z,v.array[x+3]=T.w,v.array[x+4]=U.x,v.array[x+5]=U.y,v.array[x+6]=U.z,v.array[x+7]=U.w,v.array[x+
|
|
|
+8]=V.x,v.array[x+9]=V.y,v.array[x+10]=V.z,v.array[x+11]=V.w,v.array[x+12]=ma.x,v.array[x+13]=ma.y,v.array[x+14]=ma.z,v.array[x+15]=ma.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,v.buffer);k.bufferData(k.ARRAY_BUFFER,v.array,ua)}}Pa&&(delete na.__inittedArrays,delete na.__colorArray,delete na.__normalArray,delete na.__tangentArray,delete na.__uvArray,delete na.__uv2Array,delete na.__faceArray,delete na.__vertexArray,delete na.__lineArray,delete na.__skinIndexArray,delete na.__skinWeightArray)}}ga.verticesNeedUpdate=
|
|
|
!1;ga.morphTargetsNeedUpdate=!1;ga.elementsNeedUpdate=!1;ga.uvsNeedUpdate=!1;ga.normalsNeedUpdate=!1;ga.colorsNeedUpdate=!1;ga.tangentsNeedUpdate=!1;ga.buffersNeedUpdate=!1;la.attributes&&s(la)}else if(sa instanceof THREE.Ribbon){if(ga.verticesNeedUpdate||ga.colorsNeedUpdate){var Zb=ga,Lc=k.DYNAMIC_DRAW,mc=void 0,nc=void 0,tc=void 0,$b=void 0,uc=void 0,Mc=Zb.vertices,Nc=Zb.colors,Tc=Mc.length,Uc=Nc.length,vc=Zb.__vertexArray,wc=Zb.__colorArray,Vc=Zb.colorsNeedUpdate;if(Zb.verticesNeedUpdate){for(mc=
|
|
|
-0;mc<Tc;mc++)tc=Mc[mc],$b=3*mc,vc[$b]=tc.x,vc[$b+1]=tc.y,vc[$b+2]=tc.z;k.bindBuffer(k.ARRAY_BUFFER,Zb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,vc,Lc)}if(Vc){for(nc=0;nc<Uc;nc++)uc=Nc[nc],$b=3*nc,wc[$b]=uc.r,wc[$b+1]=uc.g,wc[$b+2]=uc.b;k.bindBuffer(k.ARRAY_BUFFER,Zb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,wc,Lc)}}ga.verticesNeedUpdate=!1;ga.colorsNeedUpdate=!1}else if(sa instanceof THREE.Line){la=d(sa,La);Ea=la.attributes&&p(la);if(ga.verticesNeedUpdate||ga.colorsNeedUpdate||Ea){var Rb=
|
|
|
+0;mc<Tc;mc++)tc=Mc[mc],$b=3*mc,vc[$b]=tc.x,vc[$b+1]=tc.y,vc[$b+2]=tc.z;k.bindBuffer(k.ARRAY_BUFFER,Zb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,vc,Lc)}if(Vc){for(nc=0;nc<Uc;nc++)uc=Nc[nc],$b=3*nc,wc[$b]=uc.r,wc[$b+1]=uc.g,wc[$b+2]=uc.b;k.bindBuffer(k.ARRAY_BUFFER,Zb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,wc,Lc)}}ga.verticesNeedUpdate=!1;ga.colorsNeedUpdate=!1}else if(sa instanceof THREE.Line){la=d(sa,La);Ea=la.attributes&&q(la);if(ga.verticesNeedUpdate||ga.colorsNeedUpdate||Ea){var Rb=
|
|
|
ga,Jc=k.DYNAMIC_DRAW,oc=void 0,pc=void 0,xc=void 0,Da=void 0,yc=void 0,Oc=Rb.vertices,Pc=Rb.colors,Wc=Oc.length,Xc=Pc.length,zc=Rb.__vertexArray,Ac=Rb.__colorArray,Yc=Rb.colorsNeedUpdate,Kc=Rb.__webglCustomAttributesList,Bc=void 0,Qc=void 0,Ta=void 0,ic=void 0,fb=void 0,za=void 0;if(Rb.verticesNeedUpdate){for(oc=0;oc<Wc;oc++)xc=Oc[oc],Da=3*oc,zc[Da]=xc.x,zc[Da+1]=xc.y,zc[Da+2]=xc.z;k.bindBuffer(k.ARRAY_BUFFER,Rb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,zc,Jc)}if(Yc){for(pc=0;pc<Xc;pc++)yc=
|
|
|
Pc[pc],Da=3*pc,Ac[Da]=yc.r,Ac[Da+1]=yc.g,Ac[Da+2]=yc.b;k.bindBuffer(k.ARRAY_BUFFER,Rb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ac,Jc)}if(Kc){Bc=0;for(Qc=Kc.length;Bc<Qc;Bc++)if(za=Kc[Bc],za.needsUpdate&&(void 0===za.boundTo||"vertices"===za.boundTo)){Da=0;ic=za.value.length;if(1===za.size)for(Ta=0;Ta<ic;Ta++)za.array[Ta]=za.value[Ta];else if(2===za.size)for(Ta=0;Ta<ic;Ta++)fb=za.value[Ta],za.array[Da]=fb.x,za.array[Da+1]=fb.y,Da+=2;else if(3===za.size)if("c"===za.type)for(Ta=0;Ta<ic;Ta++)fb=
|
|
|
za.value[Ta],za.array[Da]=fb.r,za.array[Da+1]=fb.g,za.array[Da+2]=fb.b,Da+=3;else for(Ta=0;Ta<ic;Ta++)fb=za.value[Ta],za.array[Da]=fb.x,za.array[Da+1]=fb.y,za.array[Da+2]=fb.z,Da+=3;else if(4===za.size)for(Ta=0;Ta<ic;Ta++)fb=za.value[Ta],za.array[Da]=fb.x,za.array[Da+1]=fb.y,za.array[Da+2]=fb.z,za.array[Da+3]=fb.w,Da+=4;k.bindBuffer(k.ARRAY_BUFFER,za.buffer);k.bufferData(k.ARRAY_BUFFER,za.array,Jc)}}}ga.verticesNeedUpdate=!1;ga.colorsNeedUpdate=!1;la.attributes&&s(la)}else sa instanceof THREE.ParticleSystem&&
|
|
|
-(ga instanceof THREE.BufferGeometry?((ga.verticesNeedUpdate||ga.colorsNeedUpdate)&&i(ga,k.DYNAMIC_DRAW,!ga.dynamic),ga.verticesNeedUpdate=!1,ga.colorsNeedUpdate=!1):(la=d(sa,La),Ea=la.attributes&&p(la),(ga.verticesNeedUpdate||ga.colorsNeedUpdate||sa.sortParticles||Ea)&&h(ga,k.DYNAMIC_DRAW,sa),ga.verticesNeedUpdate=!1,ga.colorsNeedUpdate=!1,la.attributes&&s(la)))}};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 p,q,t;f=p=q=t=o=0;for(e=b.length;f<e;f++)g=b[f],g.onlyShadow||(g instanceof THREE.DirectionalLight&&
|
|
|
-p++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&t++,g instanceof THREE.HemisphereLight&&o++);q+t+p+o<=sa?f=p:(f=Math.ceil(sa*p/(q+p)),t=q=sa-f,o=f);e=q;g=t;h=o;o=p=0;for(t=b.length;o<t;o++)q=b[o],q.castShadow&&(q instanceof THREE.SpotLight&&p++,q instanceof THREE.DirectionalLight&&!q.shadowCascade&&p++);m=p;ac&&d&&d.useVertexTexture?l=1024:(b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,
|
|
|
-b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);var s;a:{q=a.fragmentShader;t=a.vertexShader;o=a.uniforms;b=a.attributes;p=a.defines;var 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:ac&&
|
|
|
+(ga instanceof THREE.BufferGeometry?((ga.verticesNeedUpdate||ga.colorsNeedUpdate)&&i(ga,k.DYNAMIC_DRAW,!ga.dynamic),ga.verticesNeedUpdate=!1,ga.colorsNeedUpdate=!1):(la=d(sa,La),Ea=la.attributes&&q(la),(ga.verticesNeedUpdate||ga.colorsNeedUpdate||sa.sortParticles||Ea)&&h(ga,k.DYNAMIC_DRAW,sa),ga.verticesNeedUpdate=!1,ga.colorsNeedUpdate=!1,la.attributes&&s(la)))}};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 p,q,s;f=p=q=s=o=0;for(e=b.length;f<e;f++)g=b[f],g.onlyShadow||(g instanceof THREE.DirectionalLight&&
|
|
|
+p++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&s++,g instanceof THREE.HemisphereLight&&o++);q+s+p+o<=sa?f=p:(f=Math.ceil(sa*p/(q+p)),s=q=sa-f,o=f);e=q;g=s;h=o;o=p=0;for(s=b.length;o<s;o++)q=b[o],q.castShadow&&(q instanceof THREE.SpotLight&&p++,q instanceof THREE.DirectionalLight&&!q.shadowCascade&&p++);m=p;ac&&d&&d.useVertexTexture?l=1024:(b=k.getParameter(k.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,
|
|
|
+b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);var t;a:{q=a.fragmentShader;s=a.vertexShader;o=a.uniforms;b=a.attributes;p=a.defines;var 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:ac&&
|
|
|
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},r,u,w,d=[];n?d.push(n):(d.push(q),d.push(t));for(u in p)d.push(u),d.push(p[u]);for(r in c)d.push(r),d.push(c[r]);n=d.join();r=0;for(u=ia.length;r<u;r++)if(d=ia[r],d.code===n){d.usedTimes++;s=d.program;break a}r=[];for(w in p)u=p[w],!1!==u&&(u="#define "+w+" "+u,r.push(u));u=r.join("\n");w=k.createProgram();r=["precision "+J+" float;",u,dc?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":
|
|
|
+perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},r,u,y,d=[];n?d.push(n):(d.push(q),d.push(s));for(u in p)d.push(u),d.push(p[u]);for(r in c)d.push(r),d.push(c[r]);n=d.join();r=0;for(u=oa.length;r<u;r++)if(d=oa[r],d.code===n){d.usedTimes++;t=d.program;break a}r=[];for(y in p)u=p[y],!1!==u&&(u="#define "+y+" "+u,r.push(u));u=r.join("\n");y=k.createProgram();r=["precision "+K+" float;",u,dc?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":
|
|
|
"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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");
|
|
|
-u=["precision "+J+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",u,"#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:"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
+u=["precision "+K+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",u,"#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:"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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");u=C("fragment",u+q);r=C("vertex",r+t);k.attachShader(w,r);k.attachShader(w,u);k.linkProgram(w);k.getProgramParameter(w,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(w,
|
|
|
-k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(u);k.deleteShader(r);w.uniforms={};w.attributes={};var y;r="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?r.push("boneTexture"):r.push("boneGlobalMatrices");for(y in o)r.push(y);y=r;r=0;for(u=y.length;r<u;r++)d=y[r],w.uniforms[d]=k.getUniformLocation(w,d);r="position normal uv uv2 tangent color skinIndex skinWeight".split(" ");for(y=0;y<c.maxMorphTargets;y++)r.push("morphTarget"+
|
|
|
-y);for(y=0;y<c.maxMorphNormals;y++)r.push("morphNormal"+y);for(s in b)r.push(s);s=r;y=0;for(r=s.length;y<r;y++)u=s[y],w.attributes[u]=k.getAttribLocation(w,u);w.id=Q++;ia.push({program:w,code:n,usedTimes:1});R.info.memory.programs=ia.length;s=w}a.program=s;s=a.program.attributes;0<=s.position&&k.enableVertexAttribArray(s.position);0<=s.color&&k.enableVertexAttribArray(s.color);0<=s.normal&&k.enableVertexAttribArray(s.normal);0<=s.tangent&&k.enableVertexAttribArray(s.tangent);a.skinning&&(0<=s.skinIndex&&
|
|
|
-0<=s.skinWeight)&&(k.enableVertexAttribArray(s.skinIndex),k.enableVertexAttribArray(s.skinWeight));if(a.attributes)for(j in a.attributes)void 0!==s[j]&&0<=s[j]&&k.enableVertexAttribArray(s[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;w="morphTarget";for(j=0;j<this.maxMorphTargets;j++)y=w+j,0<=s[y]&&(k.enableVertexAttribArray(s[y]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;w="morphNormal";for(j=0;j<this.maxMorphNormals;j++)y=w+j,0<=s[y]&&(k.enableVertexAttribArray(s[y]),
|
|
|
+"#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");u=D("fragment",u+q);r=D("vertex",r+s);k.attachShader(y,r);k.attachShader(y,u);k.linkProgram(y);k.getProgramParameter(y,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(y,
|
|
|
+k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");k.deleteShader(u);k.deleteShader(r);y.uniforms={};y.attributes={};var w;r="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?r.push("boneTexture"):r.push("boneGlobalMatrices");for(w in o)r.push(w);w=r;r=0;for(u=w.length;r<u;r++)d=w[r],y.uniforms[d]=k.getUniformLocation(y,d);r="position normal uv uv2 tangent color skinIndex skinWeight".split(" ");for(w=0;w<c.maxMorphTargets;w++)r.push("morphTarget"+
|
|
|
+w);for(w=0;w<c.maxMorphNormals;w++)r.push("morphNormal"+w);for(t in b)r.push(t);t=r;w=0;for(r=t.length;w<r;w++)u=t[w],y.attributes[u]=k.getAttribLocation(y,u);y.id=Q++;oa.push({program:y,code:n,usedTimes:1});R.info.memory.programs=oa.length;t=y}a.program=t;t=a.program.attributes;0<=t.position&&k.enableVertexAttribArray(t.position);0<=t.color&&k.enableVertexAttribArray(t.color);0<=t.normal&&k.enableVertexAttribArray(t.normal);0<=t.tangent&&k.enableVertexAttribArray(t.tangent);a.skinning&&(0<=t.skinIndex&&
|
|
|
+0<=t.skinWeight)&&(k.enableVertexAttribArray(t.skinIndex),k.enableVertexAttribArray(t.skinWeight));if(a.attributes)for(j in a.attributes)void 0!==t[j]&&0<=t[j]&&k.enableVertexAttribArray(t[j]);if(a.morphTargets){a.numSupportedMorphTargets=0;y="morphTarget";for(j=0;j<this.maxMorphTargets;j++)w=y+j,0<=t[w]&&(k.enableVertexAttribArray(t[w]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;y="morphNormal";for(j=0;j<this.maxMorphNormals;j++)w=y+j,0<=t[w]&&(k.enableVertexAttribArray(t[w]),
|
|
|
a.numSupportedMorphNormals++)}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?k.frontFace(k.CCW):k.frontFace(k.CW),"back"===a?k.cullFace(k.BACK):"front"===a?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;La!==b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),La=b);Ea!==a&&(a?k.frontFace(k.CW):
|
|
|
k.frontFace(k.CCW),Ea=a)};this.setDepthTest=function(a){cb!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),cb=a)};this.setDepthWrite=function(a){Ua!==a&&(k.depthMask(a),Ua=a)};this.setBlending=function(a,b,c,d){a!==ua&&(a===THREE.NoBlending?k.disable(k.BLEND):a===THREE.AdditiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.SRC_ALPHA,k.ONE)):a===THREE.SubtractiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?
|
|
|
-(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(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)),ua=a);if(a===THREE.CustomBlending){if(b!==ra&&(k.blendEquation(L(b)),ra=b),c!==Ma||d!==kb)k.blendFunc(L(c),L(d)),Ma=c,kb=d}else kb=Ma=ra=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.__webglTexture=
|
|
|
-k.createTexture(),R.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=0===(c.width&c.width-1)&&0===(c.height&c.height-1),f=L(a.format),e=L(a.type);D(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var e=a.mipmaps,g=0,h=e.length;g<h;g++)c=e[g],k.compressedTexImage2D(k.TEXTURE_2D,g,f,c.width,c.height,0,c.data);
|
|
|
+(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(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)),ua=a);if(a===THREE.CustomBlending){if(b!==ra&&(k.blendEquation(M(b)),ra=b),c!==Ma||d!==kb)k.blendFunc(M(c),M(d)),Ma=c,kb=d}else kb=Ma=ra=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.__webglTexture=
|
|
|
+k.createTexture(),R.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=0===(c.width&c.width-1)&&0===(c.height&c.height-1),f=M(a.format),e=M(a.type);F(k.TEXTURE_2D,a,d);if(a instanceof THREE.CompressedTexture)for(var e=a.mipmaps,g=0,h=e.length;g<h;g++)c=e[g],k.compressedTexImage2D(k.TEXTURE_2D,g,f,c.width,c.height,0,c.data);
|
|
|
else a instanceof THREE.DataTexture?k.texImage2D(k.TEXTURE_2D,0,f,c.width,c.height,0,f,e,c.data):k.texImage2D(k.TEXTURE_2D,0,f,f,e,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=
|
|
|
-!0);a.__webglTexture=k.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=L(a.format),f=L(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);D(k.TEXTURE_CUBE_MAP,a,c);for(var e=0;6>e;e++){a.__webglFramebuffer[e]=k.createFramebuffer();a.__webglRenderbuffer[e]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,d,a.width,a.height,0,d,f,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+e;k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
-a.__webglFramebuffer[e]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);K(a.__webglRenderbuffer[e],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),D(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,
|
|
|
-d,a.__webglTexture,0),K(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=lb,a=Ja,d=Pa,f=Ga);b!==W&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,f,c,a),W=b);bb=c;Ya=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);
|
|
|
+!0);a.__webglTexture=k.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=M(a.format),f=M(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);F(k.TEXTURE_CUBE_MAP,a,c);for(var e=0;6>e;e++){a.__webglFramebuffer[e]=k.createFramebuffer();a.__webglRenderbuffer[e]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,d,a.width,a.height,0,d,f,null);var g=a,h=k.TEXTURE_CUBE_MAP_POSITIVE_X+e;k.bindFramebuffer(k.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer[e]);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,h,g.__webglTexture,0);I(a.__webglRenderbuffer[e],a)}c&&k.generateMipmap(k.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=k.createFramebuffer(),a.__webglRenderbuffer=k.createRenderbuffer(),k.bindTexture(k.TEXTURE_2D,a.__webglTexture),F(k.TEXTURE_2D,a,c),k.texImage2D(k.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=k.TEXTURE_2D,k.bindFramebuffer(k.FRAMEBUFFER,a.__webglFramebuffer),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,
|
|
|
+d,a.__webglTexture,0),I(a.__webglRenderbuffer,a),c&&k.generateMipmap(k.TEXTURE_2D);b?k.bindTexture(k.TEXTURE_CUBE_MAP,null):k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=d=0):(b=null,c=lb,a=Ia,d=Pa,f=Ga);b!==W&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,f,c,a),W=b);bb=c;Ya=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);
|
|
|
this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
|
|
@@ -491,35 +491,35 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
|
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;0>c&&(c+=1);1<c&&(c-=1)}void 0===b&&(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,j=e.faces,l=a.faceVertexUvs[0],n=e.faceVertexUvs[0],m={},o=0;o<a.materials.length;o++)m[a.materials[o].id]=o;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var o=0,q=h.length;o<q;o++){var p=h[o].clone();c&&c.multiplyVector3(p);g.push(p)}o=0;for(q=j.length;o<q;o++){var g=j[o],
|
|
|
-s,t,B=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?s=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(s=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));s.normal.copy(g.normal);d&&d.multiplyVector3(s.normal);h=0;for(p=B.length;h<p;h++)t=B[h].clone(),d&&d.multiplyVector3(t),s.vertexNormals.push(t);s.color.copy(g.color);h=0;for(p=u.length;h<p;h++)t=u[h],s.vertexColors.push(t.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],p=h.id,u=m[p],void 0===u&&(u=a.materials.length,
|
|
|
-m[p]=u,a.materials.push(h)),s.materialIndex=u);s.centroid.copy(g.centroid);c&&c.multiplyVector3(s.centroid);i.push(s)}o=0;for(q=n.length;o<q;o++){c=n[o];d=[];h=0;for(p=c.length;h<p;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];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<
|
|
|
+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,j=e.faces,l=a.faceVertexUvs[0],m=e.faceVertexUvs[0],n={},p=0;p<a.materials.length;p++)n[a.materials[p].id]=p;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale));for(var p=0,o=h.length;p<o;p++){var q=h[p].clone();c&&c.multiplyVector3(q);g.push(q)}p=0;for(o=j.length;p<o;p++){var g=j[p],
|
|
|
+s,t,A=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?s=new THREE.Face3(g.a+f,g.b+f,g.c+f):g instanceof THREE.Face4&&(s=new THREE.Face4(g.a+f,g.b+f,g.c+f,g.d+f));s.normal.copy(g.normal);d&&d.multiplyVector3(s.normal);h=0;for(q=A.length;h<q;h++)t=A[h].clone(),d&&d.multiplyVector3(t),s.vertexNormals.push(t);s.color.copy(g.color);h=0;for(q=u.length;h<q;h++)t=u[h],s.vertexColors.push(t.clone());void 0!==g.materialIndex&&(h=e.materials[g.materialIndex],q=h.id,u=n[q],void 0===u&&(u=a.materials.length,
|
|
|
+n[q]=u,a.materials.push(h)),s.materialIndex=u);s.centroid.copy(g.centroid);c&&c.multiplyVector3(s.centroid);i.push(s)}p=0;for(o=m.length;p<o;p++){c=m[p];d=[];h=0;for(q=c.length;h<q;h++)d.push(new THREE.UV(c[h].u,c[h].v));l.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,e=a.faceVertexUvs[0];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();1<d+f&&(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)return d=
|
|
|
b.vertices[a.a],f=b.vertices[a.b],e=b.vertices[a.c],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;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,f,b),g=THREE.GeometryUtils.triangleArea(f,e,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,
|
|
|
-f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],l,n,m,o;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(l=g[d.a],n=g[d.b],m=g[d.c],d._area=THREE.GeometryUtils.triangleArea(l,n,m)):d instanceof THREE.Face4&&(l=g[d.a],n=g[d.b],m=g[d.c],o=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,
|
|
|
-n,o),d._area2=THREE.GeometryUtils.triangleArea(n,m,o),d._area=d._area1+d._area2),i+=d._area,j[f]=i;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,
|
|
|
+f,b):THREE.GeometryUtils.randomPointInTriangle(f,e,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,e=a.faces,g=a.vertices,h=e.length,i=0,j=[],l,m,n,p;for(f=0;f<h;f++)d=e[f],d instanceof THREE.Face3?(l=g[d.a],m=g[d.b],n=g[d.c],d._area=THREE.GeometryUtils.triangleArea(l,m,n)):d instanceof THREE.Face4&&(l=g[d.a],m=g[d.b],n=g[d.c],p=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,
|
|
|
+m,p),d._area2=THREE.GeometryUtils.triangleArea(m,n,p),d._area=d._area1+d._area2),i+=d._area,j[f]=i;d=[];for(f=0;f<b;f++)g=THREE.GeometryUtils.random()*i,g=c(g),d[f]=THREE.GeometryUtils.randomPointInFace(e[g],a,!0);return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,
|
|
|
b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,e=d.length;f<e;f++)if(1!==d[f].u&&(d[f].u-=Math.floor(d[f].u)),1!==d[f].v)d[f].v-=Math.floor(d[f].v)},triangulateQuads:function(a){var b,c,d,f,e=[],g=[],h=[];b=0;for(c=a.faceUvs.length;b<c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=
|
|
|
-a.faces[b],d instanceof THREE.Face4){f=d.a;var i=d.b,j=d.c,l=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=l;m.a=i;m.b=j;m.c=l;4===d.vertexColors.length&&(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++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],j=n[2],l=n[3],n=[n[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(n,i));d=0;for(f=a.faceUvs.length;d<f;d++)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=
|
|
|
+a.faces[b],d instanceof THREE.Face4){f=d.a;var i=d.b,j=d.c,l=d.d,m=new THREE.Face3,n=new THREE.Face3;m.color.copy(d.color);n.color.copy(d.color);m.materialIndex=d.materialIndex;n.materialIndex=d.materialIndex;m.a=f;m.b=i;m.c=l;n.a=i;n.b=j;n.c=l;4===d.vertexColors.length&&(m.vertexColors[0]=d.vertexColors[0].clone(),m.vertexColors[1]=d.vertexColors[1].clone(),m.vertexColors[2]=d.vertexColors[3].clone(),n.vertexColors[0]=d.vertexColors[1].clone(),n.vertexColors[1]=d.vertexColors[2].clone(),n.vertexColors[2]=
|
|
|
+d.vertexColors[3].clone());e.push(m,n);d=0;for(f=a.faceVertexUvs.length;d<f;d++)a.faceVertexUvs[d].length&&(m=a.faceVertexUvs[d][b],i=m[1],j=m[2],l=m[3],m=[m[0].clone(),i.clone(),l.clone()],i=[i.clone(),j.clone(),l.clone()],h[d].push(m,i));d=0;for(f=a.faceUvs.length;d<f;d++)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],j=a.vertices[e.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.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,j,l,n,m,o,q,p,s,t,B,u,r,y=[],z=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],l=a.vertices[g],n=a.vertices[h],o=j.distanceTo(l),q=l.distanceTo(n),m=j.distanceTo(n),o>b||q>b||m>b){i=a.vertices.length;u=f.clone();r=f.clone();o>=q&&
|
|
|
-o>=m?(j=j.clone(),j.lerpSelf(l,0.5),u.a=e,u.b=i,u.c=h,r.a=i,r.b=g,r.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),u.vertexNormals[1].copy(e),r.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),u.vertexColors[1].copy(e),r.vertexColors[0].copy(e)),f=0):q>=o&&q>=m?(j=l.clone(),j.lerpSelf(n,0.5),u.a=e,u.b=g,u.c=i,r.a=i,r.b=h,r.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),
|
|
|
-e.lerpSelf(f.vertexNormals[2],0.5),u.vertexNormals[2].copy(e),r.vertexNormals[0].copy(e),r.vertexNormals[1].copy(f.vertexNormals[2]),r.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),u.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):(j=j.clone(),j.lerpSelf(n,0.5),u.a=e,u.b=g,u.c=i,r.a=i,r.b=g,r.c=h,3===f.vertexNormals.length&&
|
|
|
-(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),u.vertexNormals[2].copy(e),r.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),u.vertexColors[2].copy(e),r.vertexColors[0].copy(e)),f=2);y.push(u,r);a.vertices.push(j);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],r=j[0],h=j[1],u=j[2],0===f?(l=r.clone(),l.lerpSelf(h,0.5),j=[r.clone(),l.clone(),u.clone()],h=[l.clone(),h.clone(),
|
|
|
-u.clone()]):1===f?(l=h.clone(),l.lerpSelf(u,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),u.clone(),r.clone()]):(l=r.clone(),l.lerpSelf(u,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),u.clone()]),z[e].push(j,h))}else{y.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)z[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],l=a.vertices[g],n=a.vertices[h],m=a.vertices[i],o=j.distanceTo(l),q=l.distanceTo(n),p=n.distanceTo(m),s=j.distanceTo(m),o>b||q>b||
|
|
|
-p>b||s>b){t=a.vertices.length;B=a.vertices.length+1;u=f.clone();r=f.clone();o>=q&&o>=p&&o>=s||p>=q&&p>=o&&p>=s?(o=j.clone(),o.lerpSelf(l,0.5),l=n.clone(),l.lerpSelf(m,0.5),u.a=e,u.b=t,u.c=B,u.d=i,r.a=t,r.b=g,r.c=h,r.d=B,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),u.vertexNormals[1].copy(e),u.vertexNormals[2].copy(g),r.vertexNormals[0].copy(e),r.vertexNormals[3].copy(g)),4===f.vertexColors.length&&
|
|
|
-(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),u.vertexColors[1].copy(e),u.vertexColors[2].copy(g),r.vertexColors[0].copy(e),r.vertexColors[3].copy(g)),f=0):(o=l.clone(),o.lerpSelf(n,0.5),l=m.clone(),l.lerpSelf(j,0.5),u.a=e,u.b=g,u.c=t,u.d=B,r.a=B,r.b=t,r.c=h,r.d=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),
|
|
|
-u.vertexNormals[2].copy(e),u.vertexNormals[3].copy(g),r.vertexNormals[0].copy(g),r.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),u.vertexColors[2].copy(e),u.vertexColors[3].copy(g),r.vertexColors[0].copy(g),r.vertexColors[1].copy(e)),f=1);y.push(u,r);a.vertices.push(o,l);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],r=j[0],
|
|
|
-h=j[1],u=j[2],j=j[3],0===f?(l=r.clone(),l.lerpSelf(h,0.5),n=u.clone(),n.lerpSelf(j,0.5),r=[r.clone(),l.clone(),n.clone(),j.clone()],h=[l.clone(),h.clone(),u.clone(),n.clone()]):(l=h.clone(),l.lerpSelf(u,0.5),n=j.clone(),n.lerpSelf(r,0.5),r=[r.clone(),h.clone(),l.clone(),n.clone()],h=[n.clone(),l.clone(),u.clone(),j.clone()]),z[e].push(r,h))}else{y.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)z[e].push(a.faceVertexUvs[e][c])}a.faces=y;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
|
+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,j,l,m,n,p,o,q,s,t,A,u,r,B=[],y=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)y[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(f=a.faces[c],f instanceof THREE.Face3)if(e=f.a,g=f.b,h=f.c,j=a.vertices[e],l=a.vertices[g],m=a.vertices[h],p=j.distanceTo(l),o=l.distanceTo(m),n=j.distanceTo(m),p>b||o>b||n>b){i=a.vertices.length;u=f.clone();r=f.clone();p>=o&&
|
|
|
+p>=n?(j=j.clone(),j.lerpSelf(l,0.5),u.a=e,u.b=i,u.c=h,r.a=i,r.b=g,r.c=h,3===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),u.vertexNormals[1].copy(e),r.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),u.vertexColors[1].copy(e),r.vertexColors[0].copy(e)),f=0):o>=p&&o>=n?(j=l.clone(),j.lerpSelf(m,0.5),u.a=e,u.b=g,u.c=i,r.a=i,r.b=h,r.c=e,3===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),
|
|
|
+e.lerpSelf(f.vertexNormals[2],0.5),u.vertexNormals[2].copy(e),r.vertexNormals[0].copy(e),r.vertexNormals[1].copy(f.vertexNormals[2]),r.vertexNormals[2].copy(f.vertexNormals[0])),3===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),u.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):(j=j.clone(),j.lerpSelf(m,0.5),u.a=e,u.b=g,u.c=i,r.a=i,r.b=g,r.c=h,3===f.vertexNormals.length&&
|
|
|
+(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[2],0.5),u.vertexNormals[2].copy(e),r.vertexNormals[0].copy(e)),3===f.vertexColors.length&&(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[2],0.5),u.vertexColors[2].copy(e),r.vertexColors[0].copy(e)),f=2);B.push(u,r);a.vertices.push(j);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],r=j[0],h=j[1],u=j[2],0===f?(l=r.clone(),l.lerpSelf(h,0.5),j=[r.clone(),l.clone(),u.clone()],h=[l.clone(),h.clone(),
|
|
|
+u.clone()]):1===f?(l=h.clone(),l.lerpSelf(u,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),u.clone(),r.clone()]):(l=r.clone(),l.lerpSelf(u,0.5),j=[r.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),u.clone()]),y[e].push(j,h))}else{B.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}else if(e=f.a,g=f.b,h=f.c,i=f.d,j=a.vertices[e],l=a.vertices[g],m=a.vertices[h],n=a.vertices[i],p=j.distanceTo(l),o=l.distanceTo(m),q=m.distanceTo(n),s=j.distanceTo(n),p>b||o>b||
|
|
|
+q>b||s>b){t=a.vertices.length;A=a.vertices.length+1;u=f.clone();r=f.clone();p>=o&&p>=q&&p>=s||q>=o&&q>=p&&q>=s?(p=j.clone(),p.lerpSelf(l,0.5),l=m.clone(),l.lerpSelf(n,0.5),u.a=e,u.b=t,u.c=A,u.d=i,r.a=t,r.b=g,r.c=h,r.d=A,4===f.vertexNormals.length&&(e=f.vertexNormals[0].clone(),e.lerpSelf(f.vertexNormals[1],0.5),g=f.vertexNormals[2].clone(),g.lerpSelf(f.vertexNormals[3],0.5),u.vertexNormals[1].copy(e),u.vertexNormals[2].copy(g),r.vertexNormals[0].copy(e),r.vertexNormals[3].copy(g)),4===f.vertexColors.length&&
|
|
|
+(e=f.vertexColors[0].clone(),e.lerpSelf(f.vertexColors[1],0.5),g=f.vertexColors[2].clone(),g.lerpSelf(f.vertexColors[3],0.5),u.vertexColors[1].copy(e),u.vertexColors[2].copy(g),r.vertexColors[0].copy(e),r.vertexColors[3].copy(g)),f=0):(p=l.clone(),p.lerpSelf(m,0.5),l=n.clone(),l.lerpSelf(j,0.5),u.a=e,u.b=g,u.c=t,u.d=A,r.a=A,r.b=t,r.c=h,r.d=i,4===f.vertexNormals.length&&(e=f.vertexNormals[1].clone(),e.lerpSelf(f.vertexNormals[2],0.5),g=f.vertexNormals[3].clone(),g.lerpSelf(f.vertexNormals[0],0.5),
|
|
|
+u.vertexNormals[2].copy(e),u.vertexNormals[3].copy(g),r.vertexNormals[0].copy(g),r.vertexNormals[1].copy(e)),4===f.vertexColors.length&&(e=f.vertexColors[1].clone(),e.lerpSelf(f.vertexColors[2],0.5),g=f.vertexColors[3].clone(),g.lerpSelf(f.vertexColors[0],0.5),u.vertexColors[2].copy(e),u.vertexColors[3].copy(g),r.vertexColors[0].copy(g),r.vertexColors[1].copy(e)),f=1);B.push(u,r);a.vertices.push(p,l);e=0;for(g=a.faceVertexUvs.length;e<g;e++)a.faceVertexUvs[e].length&&(j=a.faceVertexUvs[e][c],r=j[0],
|
|
|
+h=j[1],u=j[2],j=j[3],0===f?(l=r.clone(),l.lerpSelf(h,0.5),m=u.clone(),m.lerpSelf(j,0.5),r=[r.clone(),l.clone(),m.clone(),j.clone()],h=[l.clone(),h.clone(),u.clone(),m.clone()]):(l=h.clone(),l.lerpSelf(u,0.5),m=j.clone(),m.lerpSelf(r,0.5),r=[r.clone(),h.clone(),l.clone(),m.clone()],h=[m.clone(),l.clone(),u.clone(),j.clone()]),y[e].push(r,h))}else{B.push(f);e=0;for(g=a.faceVertexUvs.length;e<g;e++)y[e].push(a.faceVertexUvs[e][c])}a.faces=B;a.faceVertexUvs=y}};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=!0;c&&c(e)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,f);e.sourceFile=a;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,
|
|
|
!0);f.format=a.format;f.mipmaps=a.mipmaps;f.image.width=a.width;f.image.height=a.height;f.generateMipmaps=!1;f.needsUpdate=!0;c&&c(f)};e.onerror=d;e.open("GET",a,!0);e.responseType="arraybuffer";e.send(null);return f},loadTextureCube:function(a,b,c,d){var f=[];f.loadCount=0;var e=new THREE.Texture;e.image=f;void 0!==b&&(e.mapping=b);e.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;f[b]=h;h.onload=function(){f.loadCount=f.loadCount+1;if(f.loadCount===6){e.needsUpdate=true;c&&c()}};h.onerror=
|
|
|
d;h.crossOrigin=this.crossOrigin;h.src=a[b]}return e},loadCompressedTextureCube:function(a,b,c,d){var f=[];f.loadCount=0;var e=new THREE.CompressedTexture;e.image=f;void 0!==b&&(e.mapping=b);e.flipY=!1;e.generateMipmaps=!1;for(var b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,true);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;f.loadCount=f.loadCount+1;if(f.loadCount===6){e.format=d.format;e.needsUpdate=true;c&&c()}}},g=0,h=a.length;g<h;++g){var i=
|
|
|
{};f[g]=i;var j=new XMLHttpRequest;j.onload=b(j,i);j.onerror=d;j.open("GET",a[g],!0);j.responseType="arraybuffer";j.send(null)}return e},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(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
|
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:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(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 j=Math.max(4,e)/
|
|
|
-4*Math.max(4,g)/4*f,l={data:new Uint8Array(a,h,j),width:e,height:g};d.mipmaps.push(l);h+=j;e=Math.max(0.5*e,1);g=Math.max(0.5*g,1)}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),j=i.data,l=0;l<d;l++)for(var n=0;n<f;n++){var m=
|
|
|
-0>n-1?0:n-1,o=n+1>f-1?f-1:n+1,q=0>l-1?0:l-1,p=l+1>d-1?d-1:l+1,s=[],t=[0,0,h[4*(n*d+l)]/255*b];s.push([-1,0,h[4*(n*d+q)]/255*b]);s.push([-1,-1,h[4*(m*d+q)]/255*b]);s.push([0,-1,h[4*(m*d+l)]/255*b]);s.push([1,-1,h[4*(m*d+p)]/255*b]);s.push([1,0,h[4*(n*d+p)]/255*b]);s.push([1,1,h[4*(o*d+p)]/255*b]);s.push([0,1,h[4*(o*d+l)]/255*b]);s.push([-1,1,h[4*(o*d+q)]/255*b]);m=[];q=s.length;for(o=0;o<q;o++){var p=s[o],B=s[(o+1)%q],p=[p[0]-t[0],p[1]-t[1],p[2]-t[2]],B=[B[0]-t[0],B[1]-t[1],B[2]-t[2]];m.push(c([p[1]*
|
|
|
-B[2]-p[2]*B[1],p[2]*B[0]-p[0]*B[2],p[0]*B[1]-p[1]*B[0]]))}s=[0,0,0];for(o=0;o<m.length;o++)s[0]+=m[o][0],s[1]+=m[o][1],s[2]+=m[o][2];s[0]/=m.length;s[1]/=m.length;s[2]/=m.length;t=4*(n*d+l);j[t]=255*((s[0]+1)/2)|0;j[t+1]=255*((s[1]+1)/2)|0;j[t+2]=255*s[2]|0;j[t+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(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,
|
|
|
+4*Math.max(4,g)/4*f,l={data:new Uint8Array(a,h,j),width:e,height:g};d.mipmaps.push(l);h+=j;e=Math.max(0.5*e,1);g=Math.max(0.5*g,1)}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),j=i.data,l=0;l<d;l++)for(var m=0;m<f;m++){var n=
|
|
|
+0>m-1?0:m-1,p=m+1>f-1?f-1:m+1,o=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,s=[],t=[0,0,h[4*(m*d+l)]/255*b];s.push([-1,0,h[4*(m*d+o)]/255*b]);s.push([-1,-1,h[4*(n*d+o)]/255*b]);s.push([0,-1,h[4*(n*d+l)]/255*b]);s.push([1,-1,h[4*(n*d+q)]/255*b]);s.push([1,0,h[4*(m*d+q)]/255*b]);s.push([1,1,h[4*(p*d+q)]/255*b]);s.push([0,1,h[4*(p*d+l)]/255*b]);s.push([-1,1,h[4*(p*d+o)]/255*b]);n=[];o=s.length;for(p=0;p<o;p++){var q=s[p],A=s[(p+1)%o],q=[q[0]-t[0],q[1]-t[1],q[2]-t[2]],A=[A[0]-t[0],A[1]-t[1],A[2]-t[2]];n.push(c([q[1]*
|
|
|
+A[2]-q[2]*A[1],q[2]*A[0]-q[0]*A[2],q[0]*A[1]-q[1]*A[0]]))}s=[0,0,0];for(p=0;p<n.length;p++)s[0]+=n[p][0],s[1]+=n[p][1],s[2]+=n[p][2];s[0]/=n.length;s[1]/=n.length;s[2]/=n.length;t=4*(m*d+l);j[t]=255*((s[0]+1)/2)|0;j[t+1]=255*((s[1]+1)/2)|0;j[t+2]=255*s[2]|0;j[t+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(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)f[3*h]=e,f[3*h+1]=g,f[3*h+2]=c;a=new THREE.DataTexture(f,
|
|
|
a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,f=b.length;d<f;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
|
|
|
THREE.WebGLRenderer&&(THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = modelMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
@@ -531,12 +531,12 @@ 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,j,l,n,m,o,q,p,s,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;f.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;f.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
-c+d;l=b[a++]*c;o=b[a++]*c+d;q=b[a++]*c;f.quadraticCurveTo(o,q,i,l);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var B=g/h;THREE.Shape.Utils.b2(B,n,o,i);THREE.Shape.Utils.b2(B,m,q,l)}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;o=b[a++]*c+d;q=b[a++]*-c;p=b[a++]*c+d;s=b[a++]*-c;f.bezierCurveTo(i,l,o,q,p,s);if(g=e[e.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){B=g/h;THREE.Shape.Utils.b3(B,n,o,p,i);THREE.Shape.Utils.b3(B,m,q,s,l)}}}}}return{offset:t.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,j,l,m,n,p,o,q,s,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;l=b[a++]*c;f.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;f.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
+c+d;l=b[a++]*c;p=b[a++]*c+d;o=b[a++]*c;f.quadraticCurveTo(p,o,i,l);if(g=e[e.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){var A=g/h;THREE.Shape.Utils.b2(A,m,p,i);THREE.Shape.Utils.b2(A,n,o,l)}}break;case "b":i=b[a++]*c+d;l=b[a++]*c;p=b[a++]*c+d;o=b[a++]*-c;q=b[a++]*c+d;s=b[a++]*-c;f.bezierCurveTo(i,l,p,o,q,s);if(g=e[e.length-1]){m=g.x;n=g.y;g=1;for(h=this.divisions;g<=h;g++){A=g/h;THREE.Shape.Utils.b3(A,m,p,q,i);THREE.Shape.Utils.b3(A,n,o,s,l)}}}}}return{offset:t.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,j,l;if(b(a)>0)for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var n=2*f;for(j=f-1;f>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);l=j+1;f<=l&&(l=0);var m;a:{m=a;var o=i,q=j,p=l,s=f,t=g,B=void 0,u=void 0,r=void 0,y=void 0,z=void 0,
|
|
|
-w=void 0,A=void 0,F=void 0,C=void 0,u=m[t[o]].x,r=m[t[o]].y,y=m[t[q]].x,z=m[t[q]].y,w=m[t[p]].x,A=m[t[p]].y;if(1E-10>(y-u)*(A-r)-(z-r)*(w-u))m=false;else{for(B=0;B<s;B++)if(!(B==o||B==q||B==p)){var F=m[t[B]].x,C=m[t[B]].y,D=void 0,K=void 0,I=void 0,L=void 0,H=void 0,J=void 0,O=void 0,P=void 0,G=void 0,N=void 0,na=void 0,M=void 0,D=I=H=void 0,D=w-y,K=A-z,I=u-w,L=r-A,H=y-u,J=z-r,O=F-u,P=C-r,G=F-y,N=C-z,na=F-w,M=C-A,D=D*N-K*G,H=H*P-J*O,I=I*M-L*na;if(D>=0&&I>=0&&H>=0){m=false;break a}}m=true}}if(m){e.push([a[g[i]],
|
|
|
-a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<f;i++,l++)g[i]=g[l];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)};
|
|
|
+(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,j,l;if(b(a)>0)for(j=0;j<f;j++)g[j]=j;else for(j=0;j<f;j++)g[j]=f-1-j;var m=2*f;for(j=f-1;f>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);l=j+1;f<=l&&(l=0);var n;a:{n=a;var p=i,o=j,q=l,s=f,t=g,A=void 0,u=void 0,r=void 0,B=void 0,y=void 0,
|
|
|
+w=void 0,z=void 0,C=void 0,D=void 0,u=n[t[p]].x,r=n[t[p]].y,B=n[t[o]].x,y=n[t[o]].y,w=n[t[q]].x,z=n[t[q]].y;if(1E-10>(B-u)*(z-r)-(y-r)*(w-u))n=false;else{for(A=0;A<s;A++)if(!(A==p||A==o||A==q)){var C=n[t[A]].x,D=n[t[A]].y,F=void 0,I=void 0,G=void 0,M=void 0,J=void 0,K=void 0,N=void 0,O=void 0,P=void 0,L=void 0,X=void 0,H=void 0,F=G=J=void 0,F=w-B,I=z-y,G=u-w,M=r-z,J=B-u,K=y-r,N=C-u,O=D-r,P=C-B,L=D-y,X=C-w,H=D-z,F=F*L-I*P,J=J*O-K*N,G=G*H-M*X;if(F>=0&&G>=0&&J>=0){n=false;break a}}n=true}}if(n){e.push([a[g[i]],
|
|
|
+a[g[j]],a[g[l]]]);h.push([g[i],g[j],g[l]]);i=j;for(l=j+1;l<f;i++,l++)g[i]=g[l];f--;m=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()};
|
|
|
THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,e;e=b?b:a*c[f-1];for(var g=0,h=f-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-e;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==e)return d/(f-1);g=c[d];return c=(d+(e-g)/(c[d+1]-g))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
@@ -557,7 +557,7 @@ THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]
|
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
|
|
|
THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b){b=c[a]-b;a=this.curves[a];b=1-b/a.getLength();return a.getPointAt(b)}a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++){b=b+this.curves[c].getLength();a.push(b)}return this.cacheLengths=a};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f,e,g;b=c=Number.NEGATIVE_INFINITY;f=e=Number.POSITIVE_INFINITY;var h,i,j,l,n=a[0]instanceof THREE.Vector3;l=n?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++){h=a[i];if(h.x>b)b=h.x;else if(h.x<f)f=h.x;if(h.y>c)c=h.y;else if(h.y<e)e=h.y;if(n)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;l.addSelf(h)}a={minX:f,minY:e,maxX:b,maxY:c,centroid:l.divideScalar(j)};if(n){a.maxZ=d;a.minZ=g}return a};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f,e,g;b=c=Number.NEGATIVE_INFINITY;f=e=Number.POSITIVE_INFINITY;var h,i,j,l,m=a[0]instanceof THREE.Vector3;l=m?new THREE.Vector3:new THREE.Vector2;i=0;for(j=a.length;i<j;i++){h=a[i];if(h.x>b)b=h.x;else if(h.x<f)f=h.x;if(h.y>c)c=h.y;else if(h.y<e)e=h.y;if(m)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;l.addSelf(h)}a={minX:f,minY:e,maxX:b,maxY:c,centroid:l.divideScalar(j)};if(m){a.maxZ=d;a.minZ=g}return a};
|
|
|
THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,true);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,true);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,f;if(!b)b=this.bends;d=0;for(f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;d=0;for(f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
|
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,e,g,h,i;d=0;for(f=a.length;d<f;d++){e=a[d];g=e.x;h=e.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);e.x=g.x+h.x;e.y=g.y+h.y}return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -570,17 +570,17 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,e){var g=Array.prototype.s
|
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,f,e){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,f,e)};
|
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,f,e){this.absellipse(a,b,c,c,d,f,e)};THREE.Path.prototype.ellipse=function(a,b,c,d,f,e,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,f,e,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,f,e,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,f,e,g);this.curves.push(i);i=i.getPoint(g?1:0);h.push(i.x);h.push(i.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
|
|
|
-THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,j,l,n,m,o,q,p;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];n=e[0];m=e[1];if(c.length>0){g=c[c.length-1];
|
|
|
-o=g.x;q=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){p=e/a;g=THREE.Shape.Utils.b2(p,o,n,h);p=THREE.Shape.Utils.b2(p,q,m,i);c.push(new THREE.Vector2(g,p))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];m=e[1];j=e[2];l=e[3];if(c.length>0){g=c[c.length-1];o=g.x;q=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];q=g[g.length-1]}for(e=1;e<=a;e++){p=e/a;g=THREE.Shape.Utils.b3(p,o,n,j,h);p=THREE.Shape.Utils.b3(p,q,m,l,i);c.push(new THREE.Vector2(g,
|
|
|
-p))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;p=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;p=p.concat(e[0]);p=new THREE.SplineCurve(p);for(e=1;e<=g;e++)c.push(p.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];m=e[2];j=e[3];g=e[4];n=!!e[5];o=g-j;q=a*2;for(e=1;e<=q;e++){p=e/q;n||(p=1-p);p=j+p*o;g=h+m*Math.cos(p);p=i+m*Math.sin(p);c.push(new THREE.Vector2(g,p))}break;case THREE.PathActions.ELLIPSE:h=e[0];i=e[1];m=e[2];l=e[3];j=e[4];g=e[5];
|
|
|
-n=!!e[6];o=g-j;q=a*2;for(e=1;e<=q;e++){p=e/q;n||(p=1-p);p=j+p*o;g=h+m*Math.cos(p);p=i+l*Math.sin(p);c.push(new THREE.Vector2(g,p))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1E-10&&Math.abs(d.y-c[0].y)<1E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,f,e,g,h,i,j,l,m,n,p,o,q;d=0;for(f=this.actions.length;d<f;d++){e=this.actions[d];g=e.action;e=e.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];m=e[0];n=e[1];if(c.length>0){g=c[c.length-1];
|
|
|
+p=g.x;o=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];o=g[g.length-1]}for(e=1;e<=a;e++){q=e/a;g=THREE.Shape.Utils.b2(q,p,m,h);q=THREE.Shape.Utils.b2(q,o,n,i);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];m=e[0];n=e[1];j=e[2];l=e[3];if(c.length>0){g=c[c.length-1];p=g.x;o=g.y}else{g=this.actions[d-1].args;p=g[g.length-2];o=g[g.length-1]}for(e=1;e<=a;e++){q=e/a;g=THREE.Shape.Utils.b3(q,p,m,j,h);q=THREE.Shape.Utils.b3(q,o,n,l,i);c.push(new THREE.Vector2(g,
|
|
|
+q))}break;case THREE.PathActions.CSPLINE_THRU:g=this.actions[d-1].args;q=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*e[0].length;q=q.concat(e[0]);q=new THREE.SplineCurve(q);for(e=1;e<=g;e++)c.push(q.getPointAt(e/g));break;case THREE.PathActions.ARC:h=e[0];i=e[1];n=e[2];j=e[3];g=e[4];m=!!e[5];p=g-j;o=a*2;for(e=1;e<=o;e++){q=e/o;m||(q=1-q);q=j+q*p;g=h+n*Math.cos(q);q=i+n*Math.sin(q);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.ELLIPSE:h=e[0];i=e[1];n=e[2];l=e[3];j=e[4];g=e[5];
|
|
|
+m=!!e[6];p=g-j;o=a*2;for(e=1;e<=o;e++){q=e/o;m||(q=1-q);q=j+q*p;g=h+n*Math.cos(q);q=i+l*Math.sin(q);c.push(new THREE.Vector2(g,q))}}}d=c[c.length-1];Math.abs(d.x-c[0].x)<1E-10&&Math.abs(d.y-c[0].y)<1E-10&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],e=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++){c=this.actions[a];d=c.args;c=c.action;if(c==THREE.PathActions.MOVE_TO&&e.actions.length!=0){f.push(e);e=new THREE.Path}e[c].apply(e,d)}e.actions.length!=0&&f.push(e);if(f.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(f.length==1){e=f[0];g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=f.length;a<
|
|
|
b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g.actions=e.actions;g.curves=e.curves;d.push(g);g=new THREE.Shape}else g.holes.push(e)}}else{a=0;for(b=f.length;a<b;a++){e=f[a];if(THREE.Shape.Utils.isClockWise(e.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=e.actions;g.curves=e.curves}else g.holes.push(e)}d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);
|
|
|
THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
|
|
|
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,j,l,n,m,o,q=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){m=j[f];o=[];for(n=0;n<c.length;n++){l=c[n];l=m.distanceToSquared(l);o.push(l);if(l<e){e=l;g=f;h=n}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;var p=[j[g],c[h],c[f]];n=THREE.FontUtils.Triangulate.area(p);var s=[j[g],j[e],c[h]];m=THREE.FontUtils.Triangulate.area(s);o=h;l=g;h=h+1;g=g+
|
|
|
--1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;p=[j[g],c[h],c[f]];p=THREE.FontUtils.Triangulate.area(p);s=[j[g],j[e],c[h]];s=THREE.FontUtils.Triangulate.area(s);if(n+m>p+s){h=o;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1}n=c.slice(0,h);m=c.slice(h);o=j.slice(g);l=j.slice(0,g);e=[j[g],j[e],c[h]];q.push([j[g],c[h],c[f]]);q.push(e);c=n.concat(o).concat(l).concat(m)}return{shape:c,
|
|
|
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,j={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,e,g,h,i,j,l,m,n,p,o=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);e=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){n=j[f];p=[];for(m=0;m<c.length;m++){l=c[m];l=n.distanceToSquared(l);p.push(l);if(l<e){e=l;g=f;h=m}}}f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;var q=[j[g],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(q);var s=[j[g],j[e],c[h]];n=THREE.FontUtils.Triangulate.area(s);p=h;l=g;h=h+1;g=g+
|
|
|
+-1;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1;q=[j[g],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(q);s=[j[g],j[e],c[h]];s=THREE.FontUtils.Triangulate.area(s);if(m+n>q+s){h=p;g=l;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;f=h-1>=0?h-1:c.length-1;e=g-1>=0?g-1:j.length-1}m=c.slice(0,h);n=c.slice(h);p=j.slice(g);l=j.slice(0,g);e=[j[g],j[e],c[h]];o.push([j[g],c[h],c[f]]);o.push(e);c=m.concat(p).concat(l).concat(n)}return{shape:c,
|
|
|
+isolatedPts:o,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),e,g,h,i,j={};e=0;for(g=d.length;e<g;e++){i=d[e].x+":"+d[e].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=e}e=0;for(g=c.length;e<g;e++){h=c[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}e=0;for(g=f.length;e<g;e++){h=f[e];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}return c.concat(f)},
|
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,f)}};
|
|
|
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==true){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<0)a.hierarchy[c].keys[d].time=
|
|
@@ -591,9 +591,9 @@ a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hie
|
|
|
THREE.Animation.prototype.play=function(a,b){if(this.isPlaying===false){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=true;f.matrixAutoUpdate=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
|
|
|
f instanceof THREE.Bone?f.skinMatrix:f.matrix}var e=f.animationCache.prevKey;f=f.animationCache.nextKey;e.pos=this.data.hierarchy[c].keys[0];e.rot=this.data.hierarchy[c].keys[0];e.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused===true?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this)};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,f,e,g,h,i,j,l;l=this.currentTime=this.currentTime+a*this.timeScale;j=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,m=this.hierarchy.length;n<m;n++){a=this.hierarchy[n];i=a.animationCache;for(var o=0;o<3;o++){c=b[o];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(j<l)if(this.loop){g=this.data.hierarchy[n].keys[0];
|
|
|
-for(h=this.getNextKeyWith(c,n,1);h.time<j;){g=h;h=this.getNextKeyWith(c,n,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,n,h.index+1)}while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(j-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+
|
|
|
-(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,f,e,g,h,i,j,l;l=this.currentTime=this.currentTime+a*this.timeScale;j=this.currentTime=this.currentTime%this.data.length;parseInt(Math.min(j*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,n=this.hierarchy.length;m<n;m++){a=this.hierarchy[m];i=a.animationCache;for(var p=0;p<3;p++){c=b[p];g=i.prevKey[c];h=i.nextKey[c];if(h.time<=l){if(j<l)if(this.loop){g=this.data.hierarchy[m].keys[0];
|
|
|
+for(h=this.getNextKeyWith(c,m,1);h.time<j;){g=h;h=this.getNextKeyWith(c,m,h.index+1)}}else{this.stop();return}else{do{g=h;h=this.getNextKeyWith(c,m,h.index+1)}while(h.time<j)}i.prevKey[c]=g;i.nextKey[c]=h}a.matrixAutoUpdate=true;a.matrixWorldNeedsUpdate=true;d=(j-g.time)/(h.time-g.time);f=g[c];e=h[c];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+m);d=d<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=f[0]+
|
|
|
+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",m,g.index-1).pos;this.points[1]=f;this.points[2]=e;this.points[3]=this.getNextKeyWith("pos",m,h.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);c.x=f[0];c.y=f[1];c.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
|
|
|
this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(c==="rot")THREE.Quaternion.slerp(f,e,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=f[0]+(e[0]-f[0])*d;c.y=f[1]+(e[1]-f[1])*d;c.z=f[2]+(e[2]-f[2])*d}}}}};
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,e,g,h,i,j;f=(a.length-1)*b;e=Math.floor(f);f=f-e;c[0]=e===0?e:e-1;c[1]=e;c[2]=e>a.length-2?e:e+1;c[3]=e>a.length-3?e:e+2;e=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;g=f*c;d[0]=this.interpolate(e[0],h[0],i[0],j[0],f,c,g);d[1]=this.interpolate(e[1],h[1],i[1],j[1],f,c,g);d[2]=this.interpolate(e[2],h[2],i[2],j[2],f,c,g);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(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};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
|
|
@@ -604,13 +604,13 @@ THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.is
|
|
|
f.skinMatrix:f.matrix}f=this.data.hierarchy[c].keys;if(f.length){e.animationCache.prevKey=f[0];e.animationCache.nextKey=f[1];this.startTime=Math.min(f[0].time,this.startTime);this.endTime=Math.max(f[f.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=false;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;if(b instanceof THREE.Bone){d.copy(b.skinMatrix);b.skinMatrix=d}else{d.copy(b.matrix);b.matrix=d}delete c.animationCache}}};
|
|
|
THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,e=this.data.JIT.hierarchy,g,h,i;h=this.currentTime=this.currentTime+a*this.timeScale;g=this.currentTime=this.currentTime%this.data.length;if(g<this.startTimeMs)g=this.currentTime=this.startTimeMs+g;f=parseInt(Math.min(g*this.data.fps,this.data.length*this.data.fps),10);if((i=g<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var l=this.data.hierarchy[a].keys,e=this.data.hierarchy[a].sids;d=l.length-1;f=
|
|
|
-this.hierarchy[a];if(l.length){for(l=0;l<e.length;l++){g=e[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,n=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
|
|
|
-true}else if(l.length){if(this.JITCompile&&n)d instanceof THREE.Bone?d.skinMatrix=n.originalMatrix:d.matrix=n.originalMatrix;b=n.prevKey;c=n.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var m=l.length-1;c.time<g&&c.index!==m;){b=c;c=l[b.index+1]}n.prevKey=b;n.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
+this.hierarchy[a];if(l.length){for(l=0;l<e.length;l++){g=e[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=true}}this.stop()}else if(!(g<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var l=b.keys,m=b.animationCache;if(this.JITCompile&&e[a][f]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=e[a][f];d.matrixWorldNeedsUpdate=false}else{d.matrix=e[a][f];d.matrixWorldNeedsUpdate=
|
|
|
+true}else if(l.length){if(this.JITCompile&&m)d instanceof THREE.Bone?d.skinMatrix=m.originalMatrix:d.matrix=m.originalMatrix;b=m.prevKey;c=m.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=l[0];for(c=l[1];c.time<g;){b=c;c=l[b.index+1]}}else if(!i)for(var n=l.length-1;c.time<g&&c.index!==n;){b=c;c=l[b.index+1]}m.prevKey=b;m.nextKey=c}c.time>=g?b.interpolate(c,g):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}if(this.JITCompile&&e[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
for(a=0;a<this.hierarchy.length;a++)e[a][f]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
|
|
|
THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
|
|
|
THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,-1,0);f.lookAt(new THREE.Vector3(-1,0,0));this.add(f);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,0,1);e.lookAt(new THREE.Vector3(0,1,0));this.add(e);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
|
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,m=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,f,c);c.activeCubeFace=
|
|
|
-2;a.render(b,e,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,f,e,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,e,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,f);this.zoom=1;this.toPerspective()};
|
|
|
+1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var i=new THREE.PerspectiveCamera(90,1,a,b);i.up.set(0,-1,0);i.lookAt(new THREE.Vector3(0,0,-1));this.add(i);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,n=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,f,c);c.activeCubeFace=
|
|
|
+2;a.render(b,e,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=n;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,f,e,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,e,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,f);this.zoom=1;this.toPerspective()};
|
|
|
THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=true;this.inOrthographicMode=false};
|
|
|
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2,b=Math.tan(this.fov/2)*b,a=2*b*a/2,b=b/this.zoom,a=a/this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPerspectiveMode=false;this.inOrthographicMode=true};
|
|
|
THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2};THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){if(this.inPerspectiveMode)this.toPerspective();else{this.toPerspective();this.toOrthographic()}};
|
|
@@ -619,25 +619,25 @@ THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rota
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=false};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=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,d,f,e,g,h){var i,l=j.widthSegments,m=j.heightSegments,n=f/2,o=e/2,p=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")i="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){i="y";m=j.depthSegments}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){i="x";l=j.depthSegments}var q=l+1,s=m+1,O=f/l,P=e/m,G=new THREE.Vector3;G[i]=g>0?1:-1;for(f=0;f<s;f++)for(e=0;e<q;e++){var N=new THREE.Vector3;N[a]=(e*O-n)*c;N[b]=(f*P-o)*d;N[i]=g;j.vertices.push(N)}for(f=
|
|
|
-0;f<m;f++)for(e=0;e<l;e++){a=new THREE.Face4(e+q*f+p,e+q*(f+1)+p,e+1+q*(f+1)+p,e+1+q*f+p);a.normal.copy(G);a.vertexNormals.push(G.clone(),G.clone(),G.clone(),G.clone());a.materialIndex=h;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(e/l,1-f/m),new THREE.UV(e/l,1-(f+1)/m),new THREE.UV((e+1)/l,1-(f+1)/m),new THREE.UV((e+1)/l,1-f/m)])}}THREE.Geometry.call(this);var j=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=f||1;this.depthSegments=e||1;var a=this.width/
|
|
|
-2,b=this.height/2,c=this.depth/2,l,n,m,o,q,p;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(g)}l=0;o=1;n=2;q=3;m=4;p=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var s in h)this.sides[s]!==void 0&&(this.sides[s]=h[s]);this.sides.px&&i("z","y",-1,-1,this.depth,this.height,a,l);this.sides.nx&&i("z","y",1,-1,this.depth,this.height,-a,o);this.sides.py&&i("x","z",1,1,this.width,this.depth,
|
|
|
-b,n);this.sides.ny&&i("x","z",1,-1,this.width,this.depth,-b,q);this.sides.pz&&i("x","y",1,-1,this.width,this.height,c,m);this.sides.nz&&i("x","y",-1,-1,this.width,this.height,-c,p);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,j=[],l=[];for(i=0;i<=f;i++){var n=[],m=[],o=i/f,q=o*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,s=new THREE.Vector3;s.x=q*Math.sin(p*Math.PI*2);s.y=-o*c+g;s.z=q*Math.cos(p*Math.PI*2);this.vertices.push(s);n.push(this.vertices.length-1);m.push(new THREE.UV(p,1-o))}j.push(n);l.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){n=this.vertices[j[0][h]].clone();m=
|
|
|
-this.vertices[j[0][h+1]].clone()}else{n=this.vertices[j[1][h]].clone();m=this.vertices[j[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 o=j[i][h],q=j[i+1][h],p=j[i+1][h+1],s=j[i][h+1],t=n.clone(),B=n.clone(),u=m.clone(),r=m.clone(),y=l[i][h].clone(),z=l[i+1][h].clone(),w=l[i+1][h+1].clone(),A=l[i][h+1].clone();this.faces.push(new THREE.Face4(o,q,p,s,[t,B,u,r]));this.faceVertexUvs[0].push([y,z,w,A])}}if(!e&&a>
|
|
|
-0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){o=j[0][h];q=j[0][h+1];p=this.vertices.length-1;t=new THREE.Vector3(0,1,0);B=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);y=l[0][h].clone();z=l[0][h+1].clone();w=new THREE.UV(z.u,0);this.faces.push(new THREE.Face3(o,q,p,[t,B,u]));this.faceVertexUvs[0].push([y,z,w])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){o=j[i][h+1];q=j[i][h];p=this.vertices.length-1;t=new THREE.Vector3(0,-1,0);B=new THREE.Vector3(0,
|
|
|
--1,0);u=new THREE.Vector3(0,-1,0);y=l[i][h+1].clone();z=l[i][h].clone();w=new THREE.UV(z.u,1);this.faces.push(new THREE.Face3(o,q,p,[t,B,u]));this.faceVertexUvs[0].push([y,z,w])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,f,e,g,h){function i(a,b,c,d,f,e,g,h){var i,l=j.widthSegments,n=j.heightSegments,m=f/2,o=e/2,p=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")i="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x"){i="y";n=j.depthSegments}else if(a==="z"&&b==="y"||a==="y"&&b==="z"){i="x";l=j.depthSegments}var q=l+1,s=n+1,N=f/l,O=e/n,P=new THREE.Vector3;P[i]=g>0?1:-1;for(f=0;f<s;f++)for(e=0;e<q;e++){var L=new THREE.Vector3;L[a]=(e*N-m)*c;L[b]=(f*O-o)*d;L[i]=g;j.vertices.push(L)}for(f=
|
|
|
+0;f<n;f++)for(e=0;e<l;e++){a=new THREE.Face4(e+q*f+p,e+q*(f+1)+p,e+1+q*(f+1)+p,e+1+q*f+p);a.normal.copy(P);a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.clone());a.materialIndex=h;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(e/l,1-f/n),new THREE.UV(e/l,1-(f+1)/n),new THREE.UV((e+1)/l,1-(f+1)/n),new THREE.UV((e+1)/l,1-f/n)])}}THREE.Geometry.call(this);var j=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=f||1;this.depthSegments=e||1;var a=this.width/
|
|
|
+2,b=this.height/2,c=this.depth/2,l,m,n,p,o,q;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(l=0;l<6;l++)this.materials.push(g)}l=0;p=1;m=2;o=3;n=4;q=5}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var s in h)this.sides[s]!==void 0&&(this.sides[s]=h[s]);this.sides.px&&i("z","y",-1,-1,this.depth,this.height,a,l);this.sides.nx&&i("z","y",1,-1,this.depth,this.height,-a,p);this.sides.py&&i("x","z",1,1,this.width,this.depth,
|
|
|
+b,m);this.sides.ny&&i("x","z",1,-1,this.width,this.depth,-b,o);this.sides.pz&&i("x","y",1,-1,this.width,this.height,c,n);this.sides.nz&&i("x","y",-1,-1,this.width,this.height,-c,q);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,j=[],l=[];for(i=0;i<=f;i++){var m=[],n=[],p=i/f,o=p*(b-a)+a;for(h=0;h<=d;h++){var q=h/d,s=new THREE.Vector3;s.x=o*Math.sin(q*Math.PI*2);s.y=-p*c+g;s.z=o*Math.cos(q*Math.PI*2);this.vertices.push(s);m.push(this.vertices.length-1);n.push(new THREE.UV(q,1-p))}j.push(m);l.push(n)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){m=this.vertices[j[0][h]].clone();n=
|
|
|
+this.vertices[j[0][h+1]].clone()}else{m=this.vertices[j[1][h]].clone();n=this.vertices[j[1][h+1]].clone()}m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<f;i++){var p=j[i][h],o=j[i+1][h],q=j[i+1][h+1],s=j[i][h+1],t=m.clone(),A=m.clone(),u=n.clone(),r=n.clone(),B=l[i][h].clone(),y=l[i+1][h].clone(),w=l[i+1][h+1].clone(),z=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,o,q,s,[t,A,u,r]));this.faceVertexUvs[0].push([B,y,w,z])}}if(!e&&a>
|
|
|
+0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){p=j[0][h];o=j[0][h+1];q=this.vertices.length-1;t=new THREE.Vector3(0,1,0);A=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);B=l[0][h].clone();y=l[0][h+1].clone();w=new THREE.UV(y.u,0);this.faces.push(new THREE.Face3(p,o,q,[t,A,u]));this.faceVertexUvs[0].push([B,y,w])}}if(!e&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){p=j[i][h+1];o=j[i][h];q=this.vertices.length-1;t=new THREE.Vector3(0,-1,0);A=new THREE.Vector3(0,
|
|
|
+-1,0);u=new THREE.Vector3(0,-1,0);B=l[i][h+1].clone();y=l[i][h].clone();w=new THREE.UV(y.u,1);this.faces.push(new THREE.Face3(p,o,q,[t,A,u]));this.faceVertexUvs[0].push([B,y,w])}}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,f=THREE.ExtrudeGeometry.__v2,e=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);f.set(a.x-c.x,a.y-c.y);d=d.normalize();f=f.normalize();e.set(-d.y,d.x);g.set(f.y,-f.x);h.copy(a).addSelf(e);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);if(e===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/e;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 f,e;for(M=c.length;--M>=0;){f=M;e=M-1;e<0&&(e=
|
|
|
-c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=G*g,j=G*(g+1),n=d+f+i,i=d+e+i,o=d+e+j,j=d+f+j,p=c,q=g,s=h,r=f,u=e,n=n+D,i=i+D,o=o+D,j=j+D;C.faces.push(new THREE.Face4(n,i,o,j,null,null,t));n=B.generateSideWallUV(C,a,p,b,n,i,o,j,q,s,r,u);C.faceVertexUvs[0].push(n)}}}function e(a,b,c){C.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+D;d=d+D;e=e+D;C.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?B.generateBottomUV(C,a,b,c,d,e):B.generateTopUV(C,a,b,c,d,e);C.faceVertexUvs[0].push(c)}
|
|
|
-var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:true,m=b.steps!==void 0?b.steps:1,o=b.extrudePath,q,p=false,s=b.material,t=b.extrudeMaterial,B=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,u,r,y,z;if(o){q=o.getSpacedPoints(m);p=true;n=false;u=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(o,m,
|
|
|
-false);r=new THREE.Vector3;y=new THREE.Vector3;z=new THREE.Vector3}if(!n)j=i=l=0;var w,A,F,C=this,D=this.vertices.length,o=a.extractPoints(),K=o.shape,o=o.holes,I=!THREE.Shape.Utils.isClockWise(K);if(I){K=K.reverse();A=0;for(F=o.length;A<F;A++){w=o[A];THREE.Shape.Utils.isClockWise(w)&&(o[A]=w.reverse())}I=false}var L=THREE.Shape.Utils.triangulateShape(K,o),I=K;A=0;for(F=o.length;A<F;A++){w=o[A];K=K.concat(w)}var H,J,O,P,G=K.length,N=L.length,na=[],M=0,Z=I.length;H=Z-1;for(J=M+1;M<Z;M++,H++,J++){H===
|
|
|
-Z&&(H=0);J===Z&&(J=0);na[M]=d(I[M],I[H],I[J])}var sa=[],R,ia=na.concat();A=0;for(F=o.length;A<F;A++){w=o[A];R=[];M=0;Z=w.length;H=Z-1;for(J=M+1;M<Z;M++,H++,J++){H===Z&&(H=0);J===Z&&(J=0);R[M]=d(w[M],w[H],w[J])}sa.push(R);ia=ia.concat(R)}for(H=0;H<l;H++){w=H/l;O=i*(1-w);J=j*Math.sin(w*Math.PI/2);M=0;for(Z=I.length;M<Z;M++){P=c(I[M],na[M],J);e(P.x,P.y,-O)}A=0;for(F=o.length;A<F;A++){w=o[A];R=sa[A];M=0;for(Z=w.length;M<Z;M++){P=c(w[M],R[M],J);e(P.x,P.y,-O)}}}J=j;for(M=0;M<G;M++){P=n?c(K[M],ia[M],J):
|
|
|
-K[M];if(p){y.copy(u.normals[0]).multiplyScalar(P.x);r.copy(u.binormals[0]).multiplyScalar(P.y);z.copy(q[0]).addSelf(y).addSelf(r);e(z.x,z.y,z.z)}else e(P.x,P.y,0)}for(w=1;w<=m;w++)for(M=0;M<G;M++){P=n?c(K[M],ia[M],J):K[M];if(p){y.copy(u.normals[w]).multiplyScalar(P.x);r.copy(u.binormals[w]).multiplyScalar(P.y);z.copy(q[w]).addSelf(y).addSelf(r);e(z.x,z.y,z.z)}else e(P.x,P.y,h/m*w)}for(H=l-1;H>=0;H--){w=H/l;O=i*(1-w);J=j*Math.sin(w*Math.PI/2);M=0;for(Z=I.length;M<Z;M++){P=c(I[M],na[M],J);e(P.x,P.y,
|
|
|
-h+O)}A=0;for(F=o.length;A<F;A++){w=o[A];R=sa[A];M=0;for(Z=w.length;M<Z;M++){P=c(w[M],R[M],J);p?e(P.x,P.y+q[m-1].y,q[m-1].x+O):e(P.x,P.y,h+O)}}}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+l*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(I,h);h=h+I.length;A=0;for(F=o.length;A<F;A++){w=o[A];f(w,h);h=h+w.length}};
|
|
|
+h.copy(b).addSelf(e);i.copy(c).addSelf(g);e=d.dot(g);g=i.subSelf(h).dot(g);if(e===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/e;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 f,e;for(H=c.length;--H>=0;){f=H;e=H-1;e<0&&(e=
|
|
|
+c.length-1);for(var g=0,h=n+l*2,g=0;g<h;g++){var i=P*g,j=P*(g+1),m=d+f+i,i=d+e+i,o=d+e+j,j=d+f+j,p=c,q=g,r=h,s=f,u=e,m=m+F,i=i+F,o=o+F,j=j+F;D.faces.push(new THREE.Face4(m,i,o,j,null,null,t));m=A.generateSideWallUV(D,a,p,b,m,i,o,j,q,r,s,u);D.faceVertexUvs[0].push(m)}}}function e(a,b,c){D.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+F;d=d+F;e=e+F;D.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?A.generateBottomUV(D,a,b,c,d,e):A.generateTopUV(D,a,b,c,d,e);D.faceVertexUvs[0].push(c)}
|
|
|
+var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,l=b.bevelSegments!==void 0?b.bevelSegments:3,m=b.bevelEnabled!==void 0?b.bevelEnabled:true,n=b.steps!==void 0?b.steps:1,p=b.extrudePath,o,q=false,s=b.material,t=b.extrudeMaterial,A=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,u,r,B,y;if(p){o=p.getSpacedPoints(n);q=true;m=false;u=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(p,n,
|
|
|
+false);r=new THREE.Vector3;B=new THREE.Vector3;y=new THREE.Vector3}if(!m)j=i=l=0;var w,z,C,D=this,F=this.vertices.length,p=a.extractPoints(),I=p.shape,p=p.holes,G=!THREE.Shape.Utils.isClockWise(I);if(G){I=I.reverse();z=0;for(C=p.length;z<C;z++){w=p[z];THREE.Shape.Utils.isClockWise(w)&&(p[z]=w.reverse())}G=false}var M=THREE.Shape.Utils.triangulateShape(I,p),G=I;z=0;for(C=p.length;z<C;z++){w=p[z];I=I.concat(w)}var J,K,N,O,P=I.length,L=M.length,X=[],H=0,fa=G.length;J=fa-1;for(K=H+1;H<fa;H++,J++,K++){J===
|
|
|
+fa&&(J=0);K===fa&&(K=0);X[H]=d(G[H],G[J],G[K])}var sa=[],R,oa=X.concat();z=0;for(C=p.length;z<C;z++){w=p[z];R=[];H=0;fa=w.length;J=fa-1;for(K=H+1;H<fa;H++,J++,K++){J===fa&&(J=0);K===fa&&(K=0);R[H]=d(w[H],w[J],w[K])}sa.push(R);oa=oa.concat(R)}for(J=0;J<l;J++){w=J/l;N=i*(1-w);K=j*Math.sin(w*Math.PI/2);H=0;for(fa=G.length;H<fa;H++){O=c(G[H],X[H],K);e(O.x,O.y,-N)}z=0;for(C=p.length;z<C;z++){w=p[z];R=sa[z];H=0;for(fa=w.length;H<fa;H++){O=c(w[H],R[H],K);e(O.x,O.y,-N)}}}K=j;for(H=0;H<P;H++){O=m?c(I[H],oa[H],
|
|
|
+K):I[H];if(q){B.copy(u.normals[0]).multiplyScalar(O.x);r.copy(u.binormals[0]).multiplyScalar(O.y);y.copy(o[0]).addSelf(B).addSelf(r);e(y.x,y.y,y.z)}else e(O.x,O.y,0)}for(w=1;w<=n;w++)for(H=0;H<P;H++){O=m?c(I[H],oa[H],K):I[H];if(q){B.copy(u.normals[w]).multiplyScalar(O.x);r.copy(u.binormals[w]).multiplyScalar(O.y);y.copy(o[w]).addSelf(B).addSelf(r);e(y.x,y.y,y.z)}else e(O.x,O.y,h/n*w)}for(J=l-1;J>=0;J--){w=J/l;N=i*(1-w);K=j*Math.sin(w*Math.PI/2);H=0;for(fa=G.length;H<fa;H++){O=c(G[H],X[H],K);e(O.x,
|
|
|
+O.y,h+N)}z=0;for(C=p.length;z<C;z++){w=p[z];R=sa[z];H=0;for(fa=w.length;H<fa;H++){O=c(w[H],R[H],K);q?e(O.x,O.y+o[n-1].y,o[n-1].x+N):e(O.x,O.y,h+N)}}}if(m){i=P*0;for(H=0;H<L;H++){h=M[H];g(h[2]+i,h[1]+i,h[0]+i,true)}i=P*(n+l*2);for(H=0;H<L;H++){h=M[H];g(h[0]+i,h[1]+i,h[2]+i,false)}}else{for(H=0;H<L;H++){h=M[H];g(h[2],h[1],h[0],true)}for(H=0;H<L;H++){h=M[H];g(h[0]+P*n,h[1]+P*n,h[2]+P*n,false)}}h=0;f(G,h);h=h+G.length;z=0;for(C=p.length;z<C;z++){w=p[z];f(w,h);h=h+w.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,j=a.vertices[g].x,l=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(j,1-g),new THREE.UV(n,1-a)]:[new THREE.UV(c,1-f),new THREE.UV(i,1-e),new THREE.UV(l,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;
|
|
|
+g=a.vertices[g].z,m=a.vertices[h].x,n=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(j,1-g),new THREE.UV(m,1-a)]:[new THREE.UV(c,1-f),new THREE.UV(i,1-e),new THREE.UV(l,1-g),new THREE.UV(n,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);a instanceof Array===false&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
|
THREE.ShapeGeometry.prototype.addShape=function(a,b){b===void 0&&(b={});var c=b.material,d=b.UVGenerator===void 0?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,f,e,g,h=this.vertices.length;f=a.extractPoints();var i=f.shape,j=f.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();f=0;for(e=j.length;f<e;f++){g=j[f];THREE.Shape.Utils.isClockWise(g)&&(j[f]=g.reverse())}}var l=THREE.Shape.Utils.triangulateShape(i,j);f=0;for(e=j.length;f<e;f++){g=j[f];i=i.concat(g)}j=i.length;e=l.length;for(f=
|
|
|
0;f<j;f++){g=i[f];this.vertices.push(new THREE.Vector3(g.x,g.y,0))}for(f=0;f<e;f++){j=l[f];i=j[0]+h;g=j[1]+h;j=j[2]+h;this.faces.push(new THREE.Face3(i,g,j,null,null,c));this.faceVertexUvs[0].push(d.generateBottomUV(this,a,b,i,g,j))}};
|
|
@@ -645,9 +645,9 @@ THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=
|
|
|
(c+1)/b,d/f),new THREE.UV(1-(c+1)/b,(d+1)/f),new THREE.UV(1-c/b,(d+1)/f)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.width=a;this.height=b;this.widthSegments=c||1;this.heightSegments=d||1;for(var c=a/2,f=b/2,d=this.widthSegments,e=this.heightSegments,g=d+1,h=e+1,i=this.width/d,j=this.height/e,l=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-c,-(a*j-f),0));for(a=0;a<e;a++)for(b=0;b<d;b++){c=new THREE.Face4(b+g*a,b+g*(a+1),b+1+g*(a+1),b+1+g*a);c.normal.copy(l);c.vertexNormals.push(l.clone(),l.clone(),
|
|
|
l.clone(),l.clone());this.faces.push(c);this.faceVertexUvs[0].push([new THREE.UV(b/d,1-a/e),new THREE.UV(b/d,1-(a+1)/e),new THREE.UV((b+1)/d,1-(a+1)/e),new THREE.UV((b+1)/d,1-a/e)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);this.radius=a||50;this.widthSegments=Math.max(3,Math.floor(b)||8);this.heightSegments=Math.max(2,Math.floor(c)||6);for(var 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,c=[],h=[],b=0;b<=this.heightSegments;b++){for(var i=[],j=[],a=0;a<=this.widthSegments;a++){var l=a/this.widthSegments,n=b/this.heightSegments,m=new THREE.Vector3;m.x=-this.radius*Math.cos(d+l*f)*Math.sin(e+n*g);m.y=this.radius*
|
|
|
-Math.cos(e+n*g);m.z=this.radius*Math.sin(d+l*f)*Math.sin(e+n*g);this.vertices.push(m);i.push(this.vertices.length-1);j.push(new THREE.UV(l,1-n))}c.push(i);h.push(j)}for(b=0;b<this.heightSegments;b++)for(a=0;a<this.widthSegments;a++){var d=c[b][a+1],f=c[b][a],e=c[b+1][a],g=c[b+1][a+1],i=this.vertices[d].clone().normalize(),j=this.vertices[f].clone().normalize(),l=this.vertices[e].clone().normalize(),n=this.vertices[g].clone().normalize(),m=h[b][a+1].clone(),o=h[b][a].clone(),q=h[b+1][a].clone(),p=
|
|
|
-h[b+1][a+1].clone();if(Math.abs(this.vertices[d].y)===this.radius){this.faces.push(new THREE.Face3(d,e,g,[i,l,n]));this.faceVertexUvs[0].push([m,q,p])}else if(Math.abs(this.vertices[e].y)===this.radius){this.faces.push(new THREE.Face3(d,f,e,[i,j,l]));this.faceVertexUvs[0].push([m,o,q])}else{this.faces.push(new THREE.Face4(d,f,e,g,[i,j,l,n]));this.faceVertexUvs[0].push([m,o,q,p])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:this.radius}};
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,f,e,g){THREE.Geometry.call(this);this.radius=a||50;this.widthSegments=Math.max(3,Math.floor(b)||8);this.heightSegments=Math.max(2,Math.floor(c)||6);for(var 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,c=[],h=[],b=0;b<=this.heightSegments;b++){for(var i=[],j=[],a=0;a<=this.widthSegments;a++){var l=a/this.widthSegments,m=b/this.heightSegments,n=new THREE.Vector3;n.x=-this.radius*Math.cos(d+l*f)*Math.sin(e+m*g);n.y=this.radius*
|
|
|
+Math.cos(e+m*g);n.z=this.radius*Math.sin(d+l*f)*Math.sin(e+m*g);this.vertices.push(n);i.push(this.vertices.length-1);j.push(new THREE.UV(l,1-m))}c.push(i);h.push(j)}for(b=0;b<this.heightSegments;b++)for(a=0;a<this.widthSegments;a++){var d=c[b][a+1],f=c[b][a],e=c[b+1][a],g=c[b+1][a+1],i=this.vertices[d].clone().normalize(),j=this.vertices[f].clone().normalize(),l=this.vertices[e].clone().normalize(),m=this.vertices[g].clone().normalize(),n=h[b][a+1].clone(),p=h[b][a].clone(),o=h[b+1][a].clone(),q=
|
|
|
+h[b+1][a+1].clone();if(Math.abs(this.vertices[d].y)===this.radius){this.faces.push(new THREE.Face3(d,e,g,[i,l,m]));this.faceVertexUvs[0].push([n,o,q])}else if(Math.abs(this.vertices[e].y)===this.radius){this.faces.push(new THREE.Face3(d,f,e,[i,j,l]));this.faceVertexUvs[0].push([n,p,o])}else{this.faces.push(new THREE.Face4(d,f,e,g,[i,j,l,m]));this.faceVertexUvs[0].push([n,p,o,q])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:this.radius}};
|
|
|
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.radialSegments=c||8;this.tubularSegments=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var e=d/this.tubularSegments*this.arc,g=c/this.radialSegments*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.tubularSegments,c/this.radialSegments));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var f=(this.tubularSegments+1)*c+d-1,e=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+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]);
|
|
@@ -656,20 +656,20 @@ THREE.TorusKnotGeometry=function(a,b,c,d,f,e,g){function h(a,b,c,d,e,f){var g=Ma
|
|
|
Array(this.tubularSegments);for(b=0;b<this.tubularSegments;++b){var i=a/this.radialSegments*2*this.p*Math.PI,g=b/this.tubularSegments*2*Math.PI,e=h(i,g,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,g,this.q,this.p,this.radius,this.heightScale);c.sub(i,e);d.add(i,e);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);e.x=e.x+(i*d.x+g*f.x);e.y=e.y+(i*d.y+g*f.y);e.z=e.z+(i*d.z+g*f.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(e.x,
|
|
|
e.y,e.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var f=(a+1)%this.radialSegments,e=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][e],e=this.grid[a][e],g=new THREE.UV(a/this.radialSegments,b/this.tubularSegments),i=new THREE.UV((a+1)/this.radialSegments,b/this.tubularSegments),j=new THREE.UV((a+1)/this.radialSegments,(b+1)/this.tubularSegments),l=new THREE.UV(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
|
|
|
d,f,e));this.faceVertexUvs[0].push([g,i,j,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,j,l,n=new THREE.Vector3,m,o,q,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);m=b.tangents;o=b.normals;q=b.binormals;this.tangents=m;this.normals=o;this.binormals=q;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);l=a.getPointAt(d);d=m[b];g=o[b];h=q[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
-l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.radiusSegments;d++){i=d/this.radiusSegments*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);n.copy(l);n.x=n.x+(j*g.x+i*h.x);n.y=n.y+(j*g.y+i*h.y);n.z=n.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(n.x,n.y,n.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++){e=f?(b+1)%this.segments:b+1;n=(d+1)%this.radiusSegments;
|
|
|
-a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][n];n=this.grid[b][n];m=new THREE.UV(b/this.segments,d/this.radiusSegments);o=new THREE.UV((b+1)/this.segments,d/this.radiusSegments);q=new THREE.UV((b+1)/this.segments,(d+1)/this.radiusSegments);g=new THREE.UV(b/this.segments,(d+1)/this.radiusSegments);this.faces.push(new THREE.Face4(a,c,e,n));this.faceVertexUvs[0].push([m,o,q,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,n;this.tangents=f;this.normals=e;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);f[j]=a.getTangentAt(l);f[j].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(f[0].x);l=Math.abs(f[0].y);n=Math.abs(f[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}n<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,f,e){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=f||false;if(e)this.debug=new THREE.Object3D;this.grid=[];var g,h,e=this.segments+1,i,j,l,m=new THREE.Vector3,n,p,o,b=new THREE.TubeGeometry.FrenetFrames(a,b,f);n=b.tangents;p=b.normals;o=b.binormals;this.tangents=n;this.normals=p;this.binormals=o;for(b=0;b<e;b++){this.grid[b]=[];d=b/(e-1);l=a.getPointAt(d);d=n[b];g=p[b];h=o[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
+l,c,255));this.debug.add(new THREE.ArrowHelper(g,l,c,16711680));this.debug.add(new THREE.ArrowHelper(h,l,c,65280))}for(d=0;d<this.radiusSegments;d++){i=d/this.radiusSegments*2*Math.PI;j=-this.radius*Math.cos(i);i=this.radius*Math.sin(i);m.copy(l);m.x=m.x+(j*g.x+i*h.x);m.y=m.y+(j*g.y+i*h.y);m.z=m.z+(j*g.z+i*h.z);this.grid[b][d]=this.vertices.push(new THREE.Vector3(m.x,m.y,m.z))-1}}for(b=0;b<this.segments;b++)for(d=0;d<this.radiusSegments;d++){e=f?(b+1)%this.segments:b+1;m=(d+1)%this.radiusSegments;
|
|
|
+a=this.grid[b][d];c=this.grid[e][d];e=this.grid[e][m];m=this.grid[b][m];n=new THREE.UV(b/this.segments,d/this.radiusSegments);p=new THREE.UV((b+1)/this.segments,d/this.radiusSegments);o=new THREE.UV((b+1)/this.segments,(d+1)/this.radiusSegments);g=new THREE.UV(b/this.segments,(d+1)/this.radiusSegments);this.faces.push(new THREE.Face4(a,c,e,m));this.faceVertexUvs[0].push([n,p,o,g])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THREE.Vector3;new THREE.Vector3;var f=[],e=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,m;this.tangents=f;this.normals=e;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);f[j]=a.getTangentAt(l);f[j].normalize()}e[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(f[0].x);l=Math.abs(f[0].y);m=Math.abs(f[0].z);if(j<=a){a=j;d.set(1,0,0)}if(l<=a){a=l;d.set(0,1,0)}m<=a&&d.set(0,0,1);h.cross(f[0],d).normalize();
|
|
|
e[0].cross(f[0],h);g[0].cross(f[0],e[0]);for(j=1;j<b;j++){e[j]=e[j-1].clone();g[j]=g[j-1].clone();h.cross(f[j-1],f[j]);if(h.length()>1E-4){h.normalize();d=Math.acos(f[j-1].dot(f[j]));i.makeRotationAxis(h,d).multiplyVector3(e[j])}g[j].cross(f[j],e[j])}if(c){d=Math.acos(e[0].dot(e[b-1]));d=d/(b-1);f[0].dot(h.cross(e[0],e[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(f[j],d*j).multiplyVector3(e[j]);g[j].cross(f[j],e[j])}}};
|
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,1-a);return b}function e(a,b,c,d){if(d<1){d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.addSelf(a).addSelf(b).addSelf(c).divideScalar(3);d.normal=d.centroid.clone().normalize();i.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);
|
|
|
-i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;e(a,g(a,b),g(a,c),d);e(g(a,b),b,g(b,c),d);e(g(a,c),g(b,c),c,d);e(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){n[a.index]||(n[a.index]=[]);n[b.index]||(n[b.index]=[]);var c=n[a.index][b.index];c===void 0&&(n[a.index][b.index]=n[b.index][a.index]=c=f((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
|
|
|
-for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var n=[],a=this.vertices,j=0,l=b.length;j<l;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;e(a,g(a,b),g(a,c),d);e(g(a,b),b,g(b,c),d);e(g(a,c),g(b,c),c,d);e(g(a,b),g(b,c),g(a,c),d)}}function g(a,b){m[a.index]||(m[a.index]=[]);m[b.index]||(m[b.index]=[]);var c=m[a.index][b.index];c===void 0&&(m[a.index][b.index]=m[b.index][a.index]=c=f((new THREE.Vector3).add(a,b).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);
|
|
|
+for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var m=[],a=this.vertices,j=0,l=b.length;j<l;j++)e(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(l=this.vertices.length;j<l;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var f=this.vertices,e=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,l,n=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,l);f.push(j)}}var m,o,q,p;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*n+i;f=h*n+i+1;l=(h+1)*n+i;j=(h+1)*n+i+1;m=new THREE.UV(i/b,h/c);o=new THREE.UV((i+1)/b,h/c);q=new THREE.UV(i/b,(h+1)/c);p=new THREE.UV((i+1)/b,(h+1)/c);if(d){e.push(new THREE.Face3(a,f,l));e.push(new THREE.Face3(f,j,l));g.push([m,
|
|
|
-o,q]);g.push([o,p,q])}else{e.push(new THREE.Face4(a,f,j,l));g.push([m,o,p,q])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
-THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var f=d,e=a[f].clone(),g=e.length();e.x=e.x+g*(Math.random()-0.5)*2E-6;e.y=e.y+g*(Math.random()-0.5)*2E-6;e.z=e.z+g*(Math.random()-0.5)*2E-6;for(var g=[],h=0;h<c.length;){var i=c[h],j=e,l=a[i[0]],n;n=l;var m=a[i[1]],o=a[i[2]],q=new THREE.Vector3,p=new THREE.Vector3;q.sub(o,m);p.sub(n,m);q.crossSelf(p);q.isZero()||q.normalize();n=
|
|
|
-q;l=n.dot(l);if(n.dot(j)>=l){for(j=0;j<3;j++){l=[i[j],i[(j+1)%3]];n=true;for(m=0;m<g.length;m++)if(g[m][0]===l[1]&&g[m][1]===l[0]){g[m]=g[g.length-1];g.pop();n=false;break}n&&g.push(l)}c[h]=c[c.length-1];c.pop()}else h++}for(m=0;m<g.length;m++)c.push([g[m][0],g[m][1],f])}f=0;e=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;h<3;h++){if(e[g[h]]===void 0){e[g[h]]=f++;this.vertices.push(a[g[h]])}g[h]=e[g[h]]}}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=
|
|
|
+THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var f=this.vertices,e=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,l,m=b+1;for(h=0;h<=c;h++){l=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,l);f.push(j)}}var n,p,o,q;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*m+i;f=h*m+i+1;l=(h+1)*m+i;j=(h+1)*m+i+1;n=new THREE.UV(i/b,h/c);p=new THREE.UV((i+1)/b,h/c);o=new THREE.UV(i/b,(h+1)/c);q=new THREE.UV((i+1)/b,(h+1)/c);if(d){e.push(new THREE.Face3(a,f,l));e.push(new THREE.Face3(f,j,l));g.push([n,
|
|
|
+p,o]);g.push([p,q,o])}else{e.push(new THREE.Face4(a,f,j,l));g.push([n,p,q,o])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
+THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.UV(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var f=d,e=a[f].clone(),g=e.length();e.x=e.x+g*(Math.random()-0.5)*2E-6;e.y=e.y+g*(Math.random()-0.5)*2E-6;e.z=e.z+g*(Math.random()-0.5)*2E-6;for(var g=[],h=0;h<c.length;){var i=c[h],j=e,l=a[i[0]],m;m=l;var n=a[i[1]],p=a[i[2]],o=new THREE.Vector3,q=new THREE.Vector3;o.sub(p,n);q.sub(m,n);o.crossSelf(q);o.isZero()||o.normalize();m=
|
|
|
+o;l=m.dot(l);if(m.dot(j)>=l){for(j=0;j<3;j++){l=[i[j],i[(j+1)%3]];m=true;for(n=0;n<g.length;n++)if(g[n][0]===l[1]&&g[n][1]===l[0]){g[n]=g[g.length-1];g.pop();m=false;break}m&&g.push(l)}c[h]=c[c.length-1];c.pop()}else h++}for(n=0;n<g.length;n++)c.push([g[n][0],g[n][1],f])}f=0;e=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;h<3;h++){if(e[g[h]]===void 0){e[g[h]]=f++;this.vertices.push(a[g[h]])}g[h]=e[g[h]]}}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=
|
|
|
0;d<this.faces.length;d++){g=this.faces[d];this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.AxisHelper=function(a){var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a||1,0,0),new THREE.Vector3,new THREE.Vector3(0,a||1,0),new THREE.Vector3,new THREE.Vector3(0,0,a||1));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);
|
|
@@ -683,15 +683,15 @@ 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.GeometryUtils.orderedKey=function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)};
|
|
|
THREE.GeometryUtils.computeEdgeFaces=function(a){function b(a,b){g[a]===void 0&&(g[a]=[]);g[a].push(b)}var c,d,f,e,g={},h=THREE.GeometryUtils.orderedKey;c=0;for(d=a.faces.length;c<d;c++){f=a.faces[c];if(f instanceof THREE.Face3){e=h(f.a,f.b);b(e,c);e=h(f.b,f.c);b(e,c);e=h(f.c,f.a);b(e,c)}else if(f instanceof THREE.Face4){e=h(f.a,f.b);b(e,c);e=h(f.b,f.c);b(e,c);e=h(f.c,f.d);b(e,c);e=h(f.d,f.a);b(e,c)}}return g};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&(console&&console.assert)&&console.assert.apply(console,arguments)}function c(){l.debug&&console.log.apply(console,arguments)}function d(){console&&console.log.apply(console,arguments)}function f(a,b,d,f,g,h,n){var m=new THREE.Face4(a,b,d,f,null,g.color,g.materialIndex);if(l.useOldVertexColors){m.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;m.vertexColors[r]=o}}i.push(m);if(l.supportUVs){g=[e(a,""),e(b,n),e(d,n),e(f,n)];g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",f+":"+n):c("c :( ",d+":"+n):c("b :( ",b+":"+n):c("a :( ",a+":"+n)}}function e(a,b){var e=a+":"+b,f=u[e];if(!f){a>=p&&a<p+q.length?c("face pt"):c("edge pt");d("warning, UV not found for",e);return null}return f}function g(a,b,c){var e=a+":"+b;e in u?d("dup vertexNo",a,"oldFaceNo",b,"value",
|
|
|
-c,"key",e,u[e]):u[e]=c}var h=[],i=[],j=[],l=this,n=THREE.GeometryUtils.orderedKey,m=THREE.GeometryUtils.computeEdgeFaces,o=a.vertices,q=a.faces,p=o.length,h=o.concat(),s=[],t={},B={},u={},r,y,z,w,A,F=a.faceVertexUvs[0],C;c("originalFaces, uvs, originalVerticesLength",q.length,F.length,p);if(l.supportUVs){r=0;for(y=F.length;r<y;r++){z=0;for(w=F[r].length;z<w;z++){C=q[r]["abcd".charAt(z)];g(C,r,F[r][z])}}}if(F.length==0)l.supportUVs=false;r=0;for(var D in u)r++;if(!r){l.supportUVs=false;c("no uvs")}r=
|
|
|
-0;for(y=q.length;r<y;r++){A=q[r];s.push(A.centroid);h.push(A.centroid);if(l.supportUVs){w=new THREE.UV;if(A instanceof THREE.Face3){w.u=e(A.a,r).u+e(A.b,r).u+e(A.c,r).u;w.v=e(A.a,r).v+e(A.b,r).v+e(A.c,r).v;w.u=w.u/3;w.v=w.v/3}else if(A instanceof THREE.Face4){w.u=e(A.a,r).u+e(A.b,r).u+e(A.c,r).u+e(A.d,r).u;w.v=e(A.a,r).v+e(A.b,r).v+e(A.c,r).v+e(A.d,r).v;w.u=w.u/4;w.v=w.v/4}g(p+r,"",w)}}var m=m(a),K;y=0;var I,L;D={};F={};for(r in m){C=m[r];I=r.split("_");L=I[0];I=I[1];z=L;A=[L,I];D[z]===void 0&&(D[z]=
|
|
|
-[]);D[z].push(A);z=I;A=[L,I];D[z]===void 0&&(D[z]=[]);D[z].push(A);z=0;for(w=C.length;z<w;z++){A=C[z];K=L;var H=A,J=r;F[K]===void 0&&(F[K]={});F[K][H]=J;K=I;H=r;F[K]===void 0&&(F[K]={});F[K][A]=H}C.length<2&&(B[r]=true)}for(r in m){C=m[r];A=C[0];K=C[1];I=r.split("_");L=I[0];I=I[1];w=new THREE.Vector3;b(C.length>0,"an edge without faces?!");if(C.length==1){w.addSelf(o[L]);w.addSelf(o[I]);w.multiplyScalar(0.5)}else{w.addSelf(s[A]);w.addSelf(s[K]);w.addSelf(o[L]);w.addSelf(o[I]);w.multiplyScalar(0.25)}t[r]=
|
|
|
-p+q.length+y;h.push(w);y++;if(l.supportUVs){w=new THREE.UV;w.u=e(L,A).u+e(I,A).u;w.v=e(L,A).v+e(I,A).v;w.u=w.u/2;w.v=w.v/2;g(t[r],A,w);if(C.length>=2){b(C.length==2,"did we plan for more than 2 edges?");w=new THREE.UV;w.u=e(L,K).u+e(I,K).u;w.v=e(L,K).v+e(I,K).v;w.u=w.u/2;w.v=w.v/2;g(t[r],K,w)}}}c("-- Step 2 done");var O,P;w=["123","12","2","23"];K=["123","23","3","31"];var H=["123","31","1","12"],J=["1234","12","2","23"],G=["1234","23","3","34"],N=["1234","34","4","41"],na=["1234","41","1","12"];
|
|
|
-r=0;for(y=s.length;r<y;r++){A=q[r];C=p+r;if(A instanceof THREE.Face3){L=n(A.a,A.b);I=n(A.b,A.c);O=n(A.c,A.a);f(C,t[L],A.b,t[I],A,w,r);f(C,t[I],A.c,t[O],A,K,r);f(C,t[O],A.a,t[L],A,H,r)}else if(A instanceof THREE.Face4){L=n(A.a,A.b);I=n(A.b,A.c);O=n(A.c,A.d);P=n(A.d,A.a);f(C,t[L],A.b,t[I],A,J,r);f(C,t[I],A.c,t[O],A,G,r);f(C,t[O],A.d,t[P],A,N,r);f(C,t[P],A.a,t[L],A,na,r)}else c("face should be a face!",A)}t=new THREE.Vector3;A=new THREE.Vector3;r=0;for(y=o.length;r<y;r++)if(D[r]!==void 0){t.set(0,0,
|
|
|
-0);A.set(0,0,0);I=new THREE.Vector3(0,0,0);C=0;for(z in F[r]){t.addSelf(s[z]);C++}K=0;L=D[r].length;w=C!=L;for(z=0;z<L;z++)B[n(D[r][z][0],D[r][z][1])]&&K++;t.divideScalar(C);K=0;if(w){for(z=0;z<L;z++){C=D[r][z];if(H=m[n(C[0],C[1])].length==1){C=o[C[0]].clone().addSelf(o[C[1]]).divideScalar(2);A.addSelf(C);K++}}A.divideScalar(4);b(K==2,"should have only 2 boundary edges")}else{for(z=0;z<L;z++){C=D[r][z];C=o[C[0]].clone().addSelf(o[C[1]]).divideScalar(2);A.addSelf(C)}A.divideScalar(L)}I.addSelf(o[r]);
|
|
|
-if(w){I.divideScalar(2);I.addSelf(A)}else{I.multiplyScalar(L-3);I.addSelf(t);I.addSelf(A.multiplyScalar(2));I.divideScalar(L)}h[r]=I}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=j;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.SubdivisionModifier.prototype.smooth=function(a){function b(){l.debug&&(console&&console.assert)&&console.assert.apply(console,arguments)}function c(){l.debug&&console.log.apply(console,arguments)}function d(){console&&console.log.apply(console,arguments)}function f(a,b,d,f,g,h,m){var n=new THREE.Face4(a,b,d,f,null,g.color,g.materialIndex);if(l.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(l.supportUVs){g=[e(a,""),e(b,m),e(d,m),e(f,m)];g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",f+":"+m):c("c :( ",d+":"+m):c("b :( ",b+":"+m):c("a :( ",a+":"+m)}}function e(a,b){var e=a+":"+b,f=u[e];if(!f){a>=q&&a<q+o.length?c("face pt"):c("edge pt");d("warning, UV not found for",e);return null}return f}function g(a,b,c){var e=a+":"+b;e in u?d("dup vertexNo",a,"oldFaceNo",b,"value",
|
|
|
+c,"key",e,u[e]):u[e]=c}var h=[],i=[],j=[],l=this,m=THREE.GeometryUtils.orderedKey,n=THREE.GeometryUtils.computeEdgeFaces,p=a.vertices,o=a.faces,q=p.length,h=p.concat(),s=[],t={},A={},u={},r,B,y,w,z,C=a.faceVertexUvs[0],D;c("originalFaces, uvs, originalVerticesLength",o.length,C.length,q);if(l.supportUVs){r=0;for(B=C.length;r<B;r++){y=0;for(w=C[r].length;y<w;y++){D=o[r]["abcd".charAt(y)];g(D,r,C[r][y])}}}if(C.length==0)l.supportUVs=false;r=0;for(var F in u)r++;if(!r){l.supportUVs=false;c("no uvs")}r=
|
|
|
+0;for(B=o.length;r<B;r++){z=o[r];s.push(z.centroid);h.push(z.centroid);if(l.supportUVs){w=new THREE.UV;if(z instanceof THREE.Face3){w.u=e(z.a,r).u+e(z.b,r).u+e(z.c,r).u;w.v=e(z.a,r).v+e(z.b,r).v+e(z.c,r).v;w.u=w.u/3;w.v=w.v/3}else if(z instanceof THREE.Face4){w.u=e(z.a,r).u+e(z.b,r).u+e(z.c,r).u+e(z.d,r).u;w.v=e(z.a,r).v+e(z.b,r).v+e(z.c,r).v+e(z.d,r).v;w.u=w.u/4;w.v=w.v/4}g(q+r,"",w)}}var n=n(a),I;B=0;var G,M;F={};C={};for(r in n){D=n[r];G=r.split("_");M=G[0];G=G[1];y=M;z=[M,G];F[y]===void 0&&(F[y]=
|
|
|
+[]);F[y].push(z);y=G;z=[M,G];F[y]===void 0&&(F[y]=[]);F[y].push(z);y=0;for(w=D.length;y<w;y++){z=D[y];I=M;var J=z,K=r;C[I]===void 0&&(C[I]={});C[I][J]=K;I=G;J=r;C[I]===void 0&&(C[I]={});C[I][z]=J}D.length<2&&(A[r]=true)}for(r in n){D=n[r];z=D[0];I=D[1];G=r.split("_");M=G[0];G=G[1];w=new THREE.Vector3;b(D.length>0,"an edge without faces?!");if(D.length==1){w.addSelf(p[M]);w.addSelf(p[G]);w.multiplyScalar(0.5)}else{w.addSelf(s[z]);w.addSelf(s[I]);w.addSelf(p[M]);w.addSelf(p[G]);w.multiplyScalar(0.25)}t[r]=
|
|
|
+q+o.length+B;h.push(w);B++;if(l.supportUVs){w=new THREE.UV;w.u=e(M,z).u+e(G,z).u;w.v=e(M,z).v+e(G,z).v;w.u=w.u/2;w.v=w.v/2;g(t[r],z,w);if(D.length>=2){b(D.length==2,"did we plan for more than 2 edges?");w=new THREE.UV;w.u=e(M,I).u+e(G,I).u;w.v=e(M,I).v+e(G,I).v;w.u=w.u/2;w.v=w.v/2;g(t[r],I,w)}}}c("-- Step 2 done");var N,O;w=["123","12","2","23"];I=["123","23","3","31"];var J=["123","31","1","12"],K=["1234","12","2","23"],P=["1234","23","3","34"],L=["1234","34","4","41"],X=["1234","41","1","12"];r=
|
|
|
+0;for(B=s.length;r<B;r++){z=o[r];D=q+r;if(z instanceof THREE.Face3){M=m(z.a,z.b);G=m(z.b,z.c);N=m(z.c,z.a);f(D,t[M],z.b,t[G],z,w,r);f(D,t[G],z.c,t[N],z,I,r);f(D,t[N],z.a,t[M],z,J,r)}else if(z instanceof THREE.Face4){M=m(z.a,z.b);G=m(z.b,z.c);N=m(z.c,z.d);O=m(z.d,z.a);f(D,t[M],z.b,t[G],z,K,r);f(D,t[G],z.c,t[N],z,P,r);f(D,t[N],z.d,t[O],z,L,r);f(D,t[O],z.a,t[M],z,X,r)}else c("face should be a face!",z)}t=new THREE.Vector3;z=new THREE.Vector3;r=0;for(B=p.length;r<B;r++)if(F[r]!==void 0){t.set(0,0,0);
|
|
|
+z.set(0,0,0);G=new THREE.Vector3(0,0,0);D=0;for(y in C[r]){t.addSelf(s[y]);D++}I=0;M=F[r].length;w=D!=M;for(y=0;y<M;y++)A[m(F[r][y][0],F[r][y][1])]&&I++;t.divideScalar(D);I=0;if(w){for(y=0;y<M;y++){D=F[r][y];if(J=n[m(D[0],D[1])].length==1){D=p[D[0]].clone().addSelf(p[D[1]]).divideScalar(2);z.addSelf(D);I++}}z.divideScalar(4);b(I==2,"should have only 2 boundary edges")}else{for(y=0;y<M;y++){D=F[r][y];D=p[D[0]].clone().addSelf(p[D[1]]).divideScalar(2);z.addSelf(D)}z.divideScalar(M)}G.addSelf(p[r]);
|
|
|
+if(w){G.divideScalar(2);G.addSelf(z)}else{G.multiplyScalar(M-3);G.addSelf(t);G.addSelf(z.multiplyScalar(2));G.divideScalar(M)}h[r]=G}a.vertices=h;a.faces=i;a.faceVertexUvs[0]=j;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})};
|
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(a=0;a<b;a++){c=this.lensFlares[a];c.x=this.positionScreen.x+d*c.distance;c.y=this.positionScreen.y+f*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|
|
@@ -703,38 +703,38 @@ THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.ani
|
|
|
THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];if(b){b.time=0;b.active=true}else console.warn("animation["+a+"] undefined")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=false};
|
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var f=d.duration/d.length;d.time=d.time+d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||d.time<0){d.direction=d.direction*-1;if(d.time>d.duration){d.time=d.duration;d.directionBackwards=true}if(d.time<0){d.time=0;d.directionBackwards=false}}}else{d.time=d.time%d.duration;if(d.time<0)d.time=d.time+d.duration}var e=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
|
|
|
f),0,d.length-1),g=d.weight;if(e!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[e]=0;d.lastFrame=d.currentFrame;d.currentFrame=e}f=d.time%f/f;d.directionBackwards&&(f=1-f);this.morphTargetInfluences[d.currentFrame]=f*g;this.morphTargetInfluences[d.lastFrame]=(1-f)*g}}};
|
|
|
-THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,j,l,n,m,o;this.init=function(q){b=q.context;c=q;d=new Float32Array(16);f=new Uint16Array(6);q=0;d[q++]=-1;d[q++]=-1;d[q++]=0;d[q++]=0;d[q++]=1;d[q++]=-1;d[q++]=1;d[q++]=
|
|
|
-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,
|
|
|
+THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,e,g,h,i,j,l,m,n,p;this.init=function(o){b=o.context;c=o;d=new Float32Array(16);f=new Uint16Array(6);o=0;d[o++]=-1;d[o++]=-1;d[o++]=0;d[o++]=0;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=
|
|
|
+0;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=1;d[o++]=-1;d[o++]=1;d[o++]=0;d[o++]=1;o=0;f[o++]=0;f[o++]=1;f[o++]=2;f[o++]=0;f[o++]=2;f[o++]=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){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};m={};n.vertex=b.getAttribLocation(l,"position");n.uv=b.getAttribLocation(l,"uv");m.renderType=b.getUniformLocation(l,"renderType");m.map=b.getUniformLocation(l,"map");m.occlusionMap=b.getUniformLocation(l,"occlusionMap");m.opacity=b.getUniformLocation(l,"opacity");m.color=b.getUniformLocation(l,
|
|
|
-"color");m.scale=b.getUniformLocation(l,"scale");m.rotation=b.getUniformLocation(l,"rotation");m.screenPosition=b.getUniformLocation(l,"screenPosition");o=false};this.render=function(a,d,f,t){var a=a.__webglFlares,B=a.length;if(B){var u=new THREE.Vector3,r=t/f,y=f*0.5,z=t*0.5,w=16/t,A=new THREE.Vector2(w*r,w),F=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1),D=m,w=n;b.useProgram(l);if(!o){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);o=true}b.uniform1i(D.occlusionMap,0);b.uniform1i(D.map,
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(w.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(w.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var K,I,L,H,J;for(K=0;K<B;K++){w=16/t;A.set(w*r,w);H=a[K];u.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(u);d.projectionMatrix.multiplyVector3(u);F.copy(u);C.x=F.x*y+y;C.y=F.y*z+z;if(j||C.x>0&&C.x<f&&C.y>0&&
|
|
|
-C.y<t){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,C.x-8,C.y-8,16,16,0);b.uniform1i(D.renderType,0);b.uniform2f(D.scale,A.x,A.y);b.uniform3f(D.screenPosition,F.x,F.y,F.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,C.x-8,C.y-8,16,16,0);b.uniform1i(D.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);H.positionScreen.copy(F);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();b.uniform1i(D.renderType,2);b.enable(b.BLEND);I=0;for(L=H.lensFlares.length;I<L;I++){J=H.lensFlares[I];if(J.opacity>0.001&&J.scale>0.001){F.x=J.x;F.y=J.y;F.z=J.z;w=J.size*J.scale/t;A.x=w*r;A.y=w;b.uniform3f(D.screenPosition,F.x,F.y,F.z);b.uniform2f(D.scale,A.x,A.y);b.uniform1f(D.rotation,J.rotation);b.uniform1f(D.opacity,J.opacity);
|
|
|
-b.uniform3f(D.color,J.color.r,J.color.g,J.color.b);c.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst);c.setTexture(J.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
+b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);if(b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){j=false;l=a(THREE.ShaderFlares.lensFlare)}else{j=true;l=a(THREE.ShaderFlares.lensFlareVertexTexture)}m={};n={};m.vertex=b.getAttribLocation(l,"position");m.uv=b.getAttribLocation(l,"uv");n.renderType=b.getUniformLocation(l,"renderType");n.map=b.getUniformLocation(l,"map");n.occlusionMap=b.getUniformLocation(l,"occlusionMap");n.opacity=b.getUniformLocation(l,"opacity");n.color=b.getUniformLocation(l,
|
|
|
+"color");n.scale=b.getUniformLocation(l,"scale");n.rotation=b.getUniformLocation(l,"rotation");n.screenPosition=b.getUniformLocation(l,"screenPosition");p=false};this.render=function(a,d,f,t){var a=a.__webglFlares,A=a.length;if(A){var u=new THREE.Vector3,r=t/f,B=f*0.5,y=t*0.5,w=16/t,z=new THREE.Vector2(w*r,w),C=new THREE.Vector3(1,1,0),D=new THREE.Vector2(1,1),F=n,w=m;b.useProgram(l);if(!p){b.enableVertexAttribArray(m.vertex);b.enableVertexAttribArray(m.uv);p=true}b.uniform1i(F.occlusionMap,0);b.uniform1i(F.map,
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(w.vertex,2,b.FLOAT,false,16,0);b.vertexAttribPointer(w.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(false);var I,G,M,J,K;for(I=0;I<A;I++){w=16/t;z.set(w*r,w);J=a[I];u.set(J.matrixWorld.elements[12],J.matrixWorld.elements[13],J.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(u);d.projectionMatrix.multiplyVector3(u);C.copy(u);D.x=C.x*B+B;D.y=C.y*y+y;if(j||D.x>0&&D.x<f&&D.y>0&&
|
|
|
+D.y<t){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,D.x-8,D.y-8,16,16,0);b.uniform1i(F.renderType,0);b.uniform2f(F.scale,z.x,z.y);b.uniform3f(F.screenPosition,C.x,C.y,C.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,D.x-8,D.y-8,16,16,0);b.uniform1i(F.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(C);J.customUpdateCallback?J.customUpdateCallback(J):J.updateLensFlares();b.uniform1i(F.renderType,2);b.enable(b.BLEND);G=0;for(M=J.lensFlares.length;G<M;G++){K=J.lensFlares[G];if(K.opacity>0.001&&K.scale>0.001){C.x=K.x;C.y=K.y;C.z=K.z;w=K.size*K.scale/t;z.x=w*r;z.y=w;b.uniform3f(F.screenPosition,C.x,C.y,C.z);b.uniform2f(F.scale,z.x,z.y);b.uniform1f(F.rotation,K.rotation);b.uniform1f(F.opacity,K.opacity);
|
|
|
+b.uniform3f(F.color,K.color.r,K.color.g,K.color.b);c.setBlending(K.blending,K.blendEquation,K.blendSrc,K.blendDst);c.setTexture(K.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,j=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(l,n){var m,o,q,p,s,t,B,u,r,y=[];p=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(o=l.__lights.length;m<o;m++){q=l.__lights[m];if(q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(s=0;s<q.shadowCascadeCount;s++){var z;if(q.shadowCascadeArray[s])z=q.shadowCascadeArray[s];else{r=q;B=s;z=new THREE.DirectionalLight;z.isVirtual=true;z.onlyShadow=true;z.castShadow=true;z.shadowCameraNear=r.shadowCameraNear;z.shadowCameraFar=r.shadowCameraFar;z.shadowCameraLeft=r.shadowCameraLeft;z.shadowCameraRight=
|
|
|
-r.shadowCameraRight;z.shadowCameraBottom=r.shadowCameraBottom;z.shadowCameraTop=r.shadowCameraTop;z.shadowCameraVisible=r.shadowCameraVisible;z.shadowDarkness=r.shadowDarkness;z.shadowBias=r.shadowCascadeBias[B];z.shadowMapWidth=r.shadowCascadeWidth[B];z.shadowMapHeight=r.shadowCascadeHeight[B];z.pointsWorld=[];z.pointsFrustum=[];u=z.pointsWorld;t=z.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;t[w]=new THREE.Vector3}u=r.shadowCascadeNearZ[B];r=r.shadowCascadeFarZ[B];t[0].set(-1,-1,u);
|
|
|
-t[1].set(1,-1,u);t[2].set(-1,1,u);t[3].set(1,1,u);t[4].set(-1,-1,r);t[5].set(1,-1,r);t[6].set(-1,1,r);t[7].set(1,1,r);z.originalCamera=n;t=new THREE.Gyroscope;t.position=q.shadowCascadeOffset;t.add(z);t.add(z.target);n.add(t);q.shadowCascadeArray[s]=z;console.log("Created virtualLight",z)}B=q;u=s;r=B.shadowCascadeArray[u];r.position.copy(B.position);r.target.position.copy(B.target.position);r.lookAt(r.target);r.shadowCameraVisible=B.shadowCameraVisible;r.shadowDarkness=B.shadowDarkness;r.shadowBias=
|
|
|
-B.shadowCascadeBias[u];t=B.shadowCascadeNearZ[u];B=B.shadowCascadeFarZ[u];r=r.pointsFrustum;r[0].z=t;r[1].z=t;r[2].z=t;r[3].z=t;r[4].z=B;r[5].z=B;r[6].z=B;r[7].z=B;y[p]=z;p++}else{y[p]=q;p++}}m=0;for(o=y.length;m<o;m++){q=y[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}l.add(q.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}if(q.shadowCameraVisible&&
|
|
|
-!q.cameraHelper){q.cameraHelper=new THREE.CameraHelper(q.shadowCamera);q.shadowCamera.add(q.cameraHelper)}if(q.isVirtual&&z.originalCamera==n){s=n;p=q.shadowCamera;t=q.pointsFrustum;r=q.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(B=0;B<8;B++){u=r[B];u.copy(t[B]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,s);p.matrixWorldInverse.multiplyVector3(u);if(u.x<i.x)i.x=u.x;if(u.x>j.x)j.x=u.x;if(u.y<i.y)i.y=u.y;if(u.y>j.y)j.y=u.y;if(u.z<i.z)i.z=u.z;if(u.z>
|
|
|
-j.z)j.z=u.z}p.left=i.x;p.right=j.x;p.top=j.y;p.bottom=i.y;p.updateProjectionMatrix()}p=q.shadowMap;t=q.shadowMatrix;s=q.shadowCamera;s.position.copy(q.matrixWorld.getPosition());s.lookAt(q.target.matrixWorld.getPosition());s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);if(q.cameraHelper)q.cameraHelper.visible=q.shadowCameraVisible;q.shadowCameraVisible&&q.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(s.projectionMatrix);t.multiplySelf(s.matrixWorldInverse);
|
|
|
-if(!s._viewMatrixArray)s._viewMatrixArray=new Float32Array(16);if(!s._projectionMatrixArray)s._projectionMatrixArray=new Float32Array(16);s.matrixWorldInverse.flattenToArray(s._viewMatrixArray);s.projectionMatrix.flattenToArray(s._projectionMatrixArray);h.multiply(s.projectionMatrix,s.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(p);b.clear();r=l.__webglObjects;q=0;for(p=r.length;q<p;q++){B=r[q];t=B.object;B.render=false;if(t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh)||!t.frustumCulled||
|
|
|
-g.contains(t))){t._modelViewMatrix.multiply(s.matrixWorldInverse,t.matrixWorld);B.render=true}}q=0;for(p=r.length;q<p;q++){B=r[q];if(B.render){t=B.object;B=B.buffer;w=t.material instanceof THREE.MeshFaceMaterial?t.geometry.materials[0]:t.material;u=t.geometry.morphTargets.length>0&&w.morphTargets;w=t instanceof THREE.SkinnedMesh&&w.skinning;u=t.customDepthMaterial?t.customDepthMaterial:w?u?e:f:u?d:c;B instanceof THREE.BufferGeometry?b.renderBufferDirect(s,l.__lights,null,u,B,t):b.renderBuffer(s,l.__lights,
|
|
|
-null,u,B,t)}}r=l.__webglObjectsImmediate;q=0;for(p=r.length;q<p;q++){B=r[q];t=B.object;if(t.visible&&t.castShadow){t._modelViewMatrix.multiply(s.matrixWorldInverse,t.matrixWorld);b.renderImmediateObject(s,l.__lights,null,c,t)}}}m=b.getClearColor();o=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
+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(l,m){var n,p,o,q,s,t,A,u,r,B=[];q=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);n=0;for(p=l.__lights.length;n<p;n++){o=l.__lights[n];if(o.castShadow)if(o instanceof THREE.DirectionalLight&&o.shadowCascade)for(s=0;s<o.shadowCascadeCount;s++){var y;if(o.shadowCascadeArray[s])y=o.shadowCascadeArray[s];else{r=o;A=s;y=new THREE.DirectionalLight;y.isVirtual=true;y.onlyShadow=true;y.castShadow=true;y.shadowCameraNear=r.shadowCameraNear;y.shadowCameraFar=r.shadowCameraFar;y.shadowCameraLeft=r.shadowCameraLeft;y.shadowCameraRight=
|
|
|
+r.shadowCameraRight;y.shadowCameraBottom=r.shadowCameraBottom;y.shadowCameraTop=r.shadowCameraTop;y.shadowCameraVisible=r.shadowCameraVisible;y.shadowDarkness=r.shadowDarkness;y.shadowBias=r.shadowCascadeBias[A];y.shadowMapWidth=r.shadowCascadeWidth[A];y.shadowMapHeight=r.shadowCascadeHeight[A];y.pointsWorld=[];y.pointsFrustum=[];u=y.pointsWorld;t=y.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;t[w]=new THREE.Vector3}u=r.shadowCascadeNearZ[A];r=r.shadowCascadeFarZ[A];t[0].set(-1,-1,u);
|
|
|
+t[1].set(1,-1,u);t[2].set(-1,1,u);t[3].set(1,1,u);t[4].set(-1,-1,r);t[5].set(1,-1,r);t[6].set(-1,1,r);t[7].set(1,1,r);y.originalCamera=m;t=new THREE.Gyroscope;t.position=o.shadowCascadeOffset;t.add(y);t.add(y.target);m.add(t);o.shadowCascadeArray[s]=y;console.log("Created virtualLight",y)}A=o;u=s;r=A.shadowCascadeArray[u];r.position.copy(A.position);r.target.position.copy(A.target.position);r.lookAt(r.target);r.shadowCameraVisible=A.shadowCameraVisible;r.shadowDarkness=A.shadowDarkness;r.shadowBias=
|
|
|
+A.shadowCascadeBias[u];t=A.shadowCascadeNearZ[u];A=A.shadowCascadeFarZ[u];r=r.pointsFrustum;r[0].z=t;r[1].z=t;r[2].z=t;r[3].z=t;r[4].z=A;r[5].z=A;r[6].z=A;r[7].z=A;B[q]=y;q++}else{B[q]=o;q++}}n=0;for(p=B.length;n<p;n++){o=B[n];if(!o.shadowMap){o.shadowMap=new THREE.WebGLRenderTarget(o.shadowMapWidth,o.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});o.shadowMapSize=new THREE.Vector2(o.shadowMapWidth,o.shadowMapHeight);o.shadowMatrix=new THREE.Matrix4}if(!o.shadowCamera){if(o instanceof
|
|
|
+THREE.SpotLight)o.shadowCamera=new THREE.PerspectiveCamera(o.shadowCameraFov,o.shadowMapWidth/o.shadowMapHeight,o.shadowCameraNear,o.shadowCameraFar);else if(o instanceof THREE.DirectionalLight)o.shadowCamera=new THREE.OrthographicCamera(o.shadowCameraLeft,o.shadowCameraRight,o.shadowCameraTop,o.shadowCameraBottom,o.shadowCameraNear,o.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}l.add(o.shadowCamera);b.autoUpdateScene&&l.updateMatrixWorld()}if(o.shadowCameraVisible&&
|
|
|
+!o.cameraHelper){o.cameraHelper=new THREE.CameraHelper(o.shadowCamera);o.shadowCamera.add(o.cameraHelper)}if(o.isVirtual&&y.originalCamera==m){s=m;q=o.shadowCamera;t=o.pointsFrustum;r=o.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(A=0;A<8;A++){u=r[A];u.copy(t[A]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,s);q.matrixWorldInverse.multiplyVector3(u);if(u.x<i.x)i.x=u.x;if(u.x>j.x)j.x=u.x;if(u.y<i.y)i.y=u.y;if(u.y>j.y)j.y=u.y;if(u.z<i.z)i.z=u.z;if(u.z>
|
|
|
+j.z)j.z=u.z}q.left=i.x;q.right=j.x;q.top=j.y;q.bottom=i.y;q.updateProjectionMatrix()}q=o.shadowMap;t=o.shadowMatrix;s=o.shadowCamera;s.position.copy(o.matrixWorld.getPosition());s.lookAt(o.target.matrixWorld.getPosition());s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);if(o.cameraHelper)o.cameraHelper.visible=o.shadowCameraVisible;o.shadowCameraVisible&&o.cameraHelper.update();t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(s.projectionMatrix);t.multiplySelf(s.matrixWorldInverse);
|
|
|
+if(!s._viewMatrixArray)s._viewMatrixArray=new Float32Array(16);if(!s._projectionMatrixArray)s._projectionMatrixArray=new Float32Array(16);s.matrixWorldInverse.flattenToArray(s._viewMatrixArray);s.projectionMatrix.flattenToArray(s._projectionMatrixArray);h.multiply(s.projectionMatrix,s.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();r=l.__webglObjects;o=0;for(q=r.length;o<q;o++){A=r[o];t=A.object;A.render=false;if(t.visible&&t.castShadow&&(!(t instanceof THREE.Mesh)||!t.frustumCulled||
|
|
|
+g.contains(t))){t._modelViewMatrix.multiply(s.matrixWorldInverse,t.matrixWorld);A.render=true}}o=0;for(q=r.length;o<q;o++){A=r[o];if(A.render){t=A.object;A=A.buffer;w=t.material instanceof THREE.MeshFaceMaterial?t.geometry.materials[0]:t.material;u=t.geometry.morphTargets.length>0&&w.morphTargets;w=t instanceof THREE.SkinnedMesh&&w.skinning;u=t.customDepthMaterial?t.customDepthMaterial:w?u?e:f:u?d:c;A instanceof THREE.BufferGeometry?b.renderBufferDirect(s,l.__lights,null,u,A,t):b.renderBuffer(s,l.__lights,
|
|
|
+null,u,A,t)}}r=l.__webglObjectsImmediate;o=0;for(q=r.length;o<q;o++){A=r[o];t=A.object;if(t.visible&&t.castShadow){t._modelViewMatrix.multiply(s.matrixWorldInverse,t.matrixWorld);b.renderImmediateObject(s,l.__lights,null,c,t)}}}n=b.getClearColor();p=b.getClearAlpha();a.clearColor(n.r,n.g,n.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,j,l;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(),o=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(q,a.vertexShader);b.compileShader(o);b.compileShader(q);b.attachShader(m,o);b.attachShader(m,q);b.linkProgram(m);h=m;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
|
|
|
+g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),o=b.createShader(b.VERTEX_SHADER);b.shaderSource(p,a.fragmentShader);b.shaderSource(o,a.vertexShader);b.compileShader(p);b.compileShader(o);b.attachShader(n,p);b.attachShader(n,o);b.linkProgram(n);h=n;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
|
|
|
"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
|
|
|
-j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,f,o,q){var d=d.__webglSprites,p=d.length;if(p){var s=i,t=j,B=q/o,o=o*0.5,u=q*0.5,r=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(s.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
-g);b.uniformMatrix4fv(t.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);for(var y,z=[],s=0;s<p;s++){y=d[s];if(y.visible&&y.opacity!==0)if(y.useScreenCoordinates)y.z=-y.position.z;else{y._modelViewMatrix.multiply(f.matrixWorldInverse,y.matrixWorld);y.z=-y._modelViewMatrix.elements[14]}}d.sort(a);for(s=0;s<p;s++){y=d[s];if(y.visible&&y.opacity!==0&&y.map&&y.map.image&&y.map.image.width){if(y.useScreenCoordinates){b.uniform1i(t.useScreenCoordinates,1);
|
|
|
-b.uniform3f(t.screenPosition,(y.position.x-o)/o,(u-y.position.y)/u,Math.max(0,Math.min(1,y.position.z)))}else{b.uniform1i(t.useScreenCoordinates,0);b.uniform1i(t.affectedByDistance,y.affectedByDistance?1:0);b.uniformMatrix4fv(t.modelViewMatrix,false,y._modelViewMatrix.elements)}f=1/(y.scaleByViewport?q:1);z[0]=f*B*y.scale.x;z[1]=f*y.scale.y;b.uniform2f(t.uvScale,y.uvScale.x,y.uvScale.y);b.uniform2f(t.uvOffset,y.uvOffset.x,y.uvOffset.y);b.uniform2f(t.alignment,y.alignment.x,y.alignment.y);b.uniform1f(t.opacity,
|
|
|
-y.opacity);b.uniform3f(t.color,y.color.r,y.color.g,y.color.b);b.uniform1f(t.rotation,y.rotation);b.uniform2fv(t.scale,z);if(y.mergeWith3D&&!r){b.enable(b.DEPTH_TEST);r=true}else if(!y.mergeWith3D&&r){b.disable(b.DEPTH_TEST);r=false}c.setBlending(y.blending,y.blendEquation,y.blendSrc,y.blendDst);c.setTexture(y.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
|
+j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");l=false};this.render=function(d,f,p,o){var d=d.__webglSprites,q=d.length;if(q){var s=i,t=j,A=o/p,p=p*0.5,u=o*0.5,r=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,e);b.vertexAttribPointer(s.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+g);b.uniformMatrix4fv(t.projectionMatrix,false,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(t.map,0);for(var B,y=[],s=0;s<q;s++){B=d[s];if(B.visible&&B.opacity!==0)if(B.useScreenCoordinates)B.z=-B.position.z;else{B._modelViewMatrix.multiply(f.matrixWorldInverse,B.matrixWorld);B.z=-B._modelViewMatrix.elements[14]}}d.sort(a);for(s=0;s<q;s++){B=d[s];if(B.visible&&B.opacity!==0&&B.map&&B.map.image&&B.map.image.width){if(B.useScreenCoordinates){b.uniform1i(t.useScreenCoordinates,1);
|
|
|
+b.uniform3f(t.screenPosition,(B.position.x-p)/p,(u-B.position.y)/u,Math.max(0,Math.min(1,B.position.z)))}else{b.uniform1i(t.useScreenCoordinates,0);b.uniform1i(t.affectedByDistance,B.affectedByDistance?1:0);b.uniformMatrix4fv(t.modelViewMatrix,false,B._modelViewMatrix.elements)}f=1/(B.scaleByViewport?o:1);y[0]=f*A*B.scale.x;y[1]=f*B.scale.y;b.uniform2f(t.uvScale,B.uvScale.x,B.uvScale.y);b.uniform2f(t.uvOffset,B.uvOffset.x,B.uvOffset.y);b.uniform2f(t.alignment,B.alignment.x,B.alignment.y);b.uniform1f(t.opacity,
|
|
|
+B.opacity);b.uniform3f(t.color,B.color.r,B.color.g,B.color.b);b.uniform1f(t.rotation,B.rotation);b.uniform2fv(t.scale,y);if(B.mergeWith3D&&!r){b.enable(b.DEPTH_TEST);r=true}else if(!B.mergeWith3D&&r){b.disable(b.DEPTH_TEST);r=false}c.setBlending(B.blending,B.blendEquation,B.blendSrc,B.blendDst);c.setTexture(B.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,j,l,n,m,o;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();o=g.__webglObjects;i=0;for(j=o.length;i<j;i++){l=o[i];m=l.object;l.render=false;if(m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m))){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);l.render=true}}i=0;for(j=o.length;i<j;i++){l=o[i];if(l.render){m=l.object;l=l.buffer;m.material&&b.setMaterialFaces(m.material);n=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
|
|
|
-d:c;l instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,n,l,m):b.renderBuffer(h,g.__lights,null,n,l,m)}}o=g.__webglObjectsImmediate;i=0;for(j=o.length;i<j;i++){l=o[i];m=l.object;if(m.visible&&m.castShadow){m._modelViewMatrix.multiply(h.matrixWorldInverse,m.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,m)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
+function(a,b){this.enabled&&this.update(a,b)};this.update=function(g,h){var i,j,l,m,n,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(j=p.length;i<j;i++){l=p[i];n=l.object;l.render=false;if(n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||f.contains(n))){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);l.render=true}}i=0;for(j=p.length;i<j;i++){l=p[i];if(l.render){n=l.object;l=l.buffer;n.material&&b.setMaterialFaces(n.material);m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?
|
|
|
+d:c;l instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,m,l,n):b.renderBuffer(h,g.__lights,null,m,l,n)}}p=g.__webglObjectsImmediate;i=0;for(j=p.length;i<j;i++){l=p[i];n=l.object;if(n.visible&&n.castShadow){n._modelViewMatrix.multiply(h.matrixWorldInverse,n.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,n)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|
|
|
lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
|
|
|
THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
|