|
@@ -19,8 +19,8 @@ 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):
|
|
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+=
|
|
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.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,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],m=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(-f,e)):(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(-m,e),this.z=0)):"ZXY"===b?(this.x=Math.asin(c(n)),0.99999>Math.abs(n)?(this.y=Math.atan2(-m,d),this.z=Math.atan2(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(m)),0.99999>Math.abs(m)?(this.x=Math.atan2(n,d),this.z=Math.atan2(h,e)):(this.x=0,this.z=Math.atan2(-f,i))):"YZX"===b?(this.z=Math.asin(c(h)),0.99999>Math.abs(h)?(this.x=Math.atan2(-j,i),this.y=Math.atan2(-m,e)):(this.x=0,this.y=Math.atan2(g,d))):
|
|
|
|
|
|
+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,e=d[0],f=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(-f,e)):(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,e),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(-f,i)):(this.y=0,this.z=Math.atan2(h,e))):"ZYX"===b?(this.y=Math.asin(-c(l)),0.99999>Math.abs(l)?(this.x=Math.atan2(n,d),this.z=Math.atan2(h,e)):(this.x=0,this.z=Math.atan2(-f,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,e)):(this.x=0,this.y=Math.atan2(g,d))):
|
|
"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(n,i),this.y=Math.atan2(g,e)):(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,e=a.y*a.y,f=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-e+f),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-e-f)):"YXZ"===b?(this.x=Math.asin(c(2*(a.x*a.w-a.y*a.z))),this.y=Math.atan2(2*
|
|
"XZY"===b&&(this.z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this.x=Math.atan2(n,i),this.y=Math.atan2(g,e)):(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,e=a.y*a.y,f=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-e+f),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-e-f)):"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-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"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-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),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-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),this.z=Math.asin(c(2*(a.x*a.y+
|
|
(a.x*a.z+a.y*a.w),g-d-e+f),this.z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-d+e-f)):"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-e+f),this.z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-d+e-f)):"ZYX"===b?(this.x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-d-e+f),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-e-f)):"YZX"===b?(this.x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-d+e-f),this.y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+d-e-f),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+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),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},
|
|
a.z*a.w)))):"XZY"===b&&(this.x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-d+e-f),this.y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+d-e-f),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},
|
|
@@ -31,41 +31,41 @@ 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,e=a[0];d=a[4];var f=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(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/
|
|
(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,e=a[0];d=a[4];var f=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(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+g)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+h+j-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;j=(j+1)/2;d=(d+g)/4;f=(f+c)/4;i=(i+b)/4;e>h&&e>j?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/
|
|
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=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
|
|
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=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d));0.001>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+j-1)/2);return this}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=b[0]*c+b[3]*d+b[6]*e;a.y=b[1]*c+b[4]*d+b[7]*e;a.z=b[2]*c+b[5]*d+b[8]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix3.__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},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],e=-b[10]*
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=b[0]*c+b[3]*d+b[6]*e;a.y=b[1]*c+b[4]*d+b[7]*e;a.z=b[2]*c+b[5]*d+b[8]*e;return a},multiplyVector3Array:function(a){for(var b=THREE.Matrix3.__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},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],e=-b[10]*
|
|
-b[4]+b[6]*b[8],f=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]*e+b[2]*h;0===b&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,m=this.elements;m[0]=b*a;m[1]=b*c;m[2]=b*d;m[3]=b*e;m[4]=b*f;m[5]=b*g;m[6]=b*h;m[7]=b*i;m[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.Matrix3.__v1=new THREE.Vector3;THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,m,n,l,o,p,q){this.elements=new Float32Array(16);this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,j||0,void 0!==m?m:1,n||0,l||0,o||0,p||0,void 0!==q?q:1)};
|
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,m,n,l,o,p,q){var t=this.elements;t[0]=a;t[4]=b;t[8]=c;t[12]=d;t[1]=e;t[5]=f;t[9]=g;t[13]=h;t[2]=i;t[6]=j;t[10]=m;t[14]=n;t[3]=l;t[7]=o;t[11]=p;t[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,
|
|
|
|
-e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],m=c[5],n=c[9],l=c[13],o=c[2],p=c[6],q=c[10],t=c[14],r=c[3],A=c[7],u=c[11],c=c[15],s=d[0],D=d[4],z=d[8],
|
|
|
|
-w=d[12],v=d[1],C=d[5],E=d[9],G=d[13],L=d[2],B=d[6],J=d[10],H=d[14],I=d[3],O=d[7],N=d[11],d=d[15];e[0]=f*s+g*v+h*L+i*I;e[4]=f*D+g*C+h*B+i*O;e[8]=f*z+g*E+h*J+i*N;e[12]=f*w+g*G+h*H+i*d;e[1]=j*s+m*v+n*L+l*I;e[5]=j*D+m*C+n*B+l*O;e[9]=j*z+m*E+n*J+l*N;e[13]=j*w+m*G+n*H+l*d;e[2]=o*s+p*v+q*L+t*I;e[6]=o*D+p*C+q*B+t*O;e[10]=o*z+p*E+q*J+t*N;e[14]=o*w+p*G+q*H+t*d;e[3]=r*s+A*v+u*L+c*I;e[7]=r*D+A*C+u*B+c*O;e[11]=r*z+A*E+u*J+c*N;e[15]=r*w+A*G+u*H+c*d;return this},multiplySelf:function(a){return this.multiply(this,
|
|
|
|
|
|
+b[4]+b[6]*b[8],f=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]*e+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*e;l[4]=b*f;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.Matrix3.__v1=new THREE.Vector3;THREE.Matrix4=function(a,b,c,d,e,f,g,h,i,j,l,n,m,p,o,q){this.elements=new Float32Array(16);this.set(void 0!==a?a:1,b||0,c||0,d||0,e||0,void 0!==f?f:1,g||0,h||0,i||0,j||0,void 0!==l?l:1,n||0,m||0,p||0,o||0,void 0!==q?q:1)};
|
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,i,j,l,n,m,p,o,q){var s=this.elements;s[0]=a;s[4]=b;s[8]=c;s[12]=d;s[1]=e;s[5]=f;s[9]=g;s[13]=h;s[2]=i;s[6]=j;s[10]=l;s[14]=n;s[3]=m;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,
|
|
|
|
+e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],l=c[5],n=c[9],m=c[13],p=c[2],o=c[6],q=c[10],s=c[14],r=c[3],A=c[7],u=c[11],c=c[15],t=d[0],D=d[4],z=d[8],
|
|
|
|
+w=d[12],v=d[1],C=d[5],E=d[9],G=d[13],L=d[2],B=d[6],J=d[10],H=d[14],I=d[3],O=d[7],N=d[11],d=d[15];e[0]=f*t+g*v+h*L+i*I;e[4]=f*D+g*C+h*B+i*O;e[8]=f*z+g*E+h*J+i*N;e[12]=f*w+g*G+h*H+i*d;e[1]=j*t+l*v+n*L+m*I;e[5]=j*D+l*C+n*B+m*O;e[9]=j*z+l*E+n*J+m*N;e[13]=j*w+l*G+n*H+m*d;e[2]=p*t+o*v+q*L+s*I;e[6]=p*D+o*C+q*B+s*O;e[10]=p*z+o*E+q*J+s*N;e[14]=p*w+o*G+q*H+s*d;e[3]=r*t+A*v+u*L+c*I;e[7]=r*D+A*C+u*B+c*O;e[11]=r*z+A*E+u*J+c*N;e[15]=r*w+A*G+u*H+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,
|
|
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,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;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],
|
|
c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;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,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*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.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,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*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],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],m=a[6],n=a[10],l=a[14],o=a[3],p=a[7],q=a[11],a=a[15];return e*h*m*o-d*i*m*o-e*g*n*o+c*i*n*o+d*g*l*o-c*h*l*o-e*h*j*p+d*i*j*p+e*f*n*p-b*i*n*p-d*f*l*p+b*h*l*p+e*g*j*q-c*i*j*q-e*f*m*q+b*i*m*q+c*f*l*q-b*g*l*q-d*g*j*a+c*h*j*a+d*f*m*a-b*h*m*a-c*f*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],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],l=a[6],n=a[10],m=a[14],p=a[3],o=a[7],q=a[11],a=a[15];return e*h*l*p-d*i*l*p-e*g*n*p+c*i*n*p+d*g*m*p-c*h*m*p-e*h*j*o+d*i*j*o+e*f*n*o-b*i*n*o-d*f*m*o+b*h*m*o+e*g*j*q-c*i*j*q-e*f*l*q+b*i*l*q+c*f*m*q-b*g*m*q-d*g*j*a+c*h*j*a+d*f*l*a-b*h*l*a-c*f*n*a+b*g*n*a},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=
|
|
a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+
|
|
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=
|
|
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],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],j=c[9],m=c[13],n=c[2],l=c[6],o=c[10],p=c[14],q=c[3],t=c[7],r=c[11],c=c[15];b[0]=j*p*t-m*o*t+m*l*r-i*p*r-j*l*c+i*o*c;b[4]=g*o*t-f*p*t-g*l*r+e*p*r+f*l*c-e*o*c;b[8]=f*m*t-g*j*t+g*i*r-e*m*r-f*i*c+e*j*c;b[12]=g*j*l-f*m*l-g*i*o+e*m*o+f*i*p-e*j*p;b[1]=m*o*q-j*p*q-m*n*r+h*p*r+j*n*c-h*o*c;b[5]=f*p*q-g*o*q+g*n*r-d*p*r-f*n*c+d*o*c;b[9]=g*j*q-f*m*q-g*h*r+d*m*r+f*h*c-d*j*c;b[13]=f*m*n-g*j*n+g*h*o-d*m*o-f*h*p+d*j*p;b[2]=i*p*q-m*l*q+m*n*t-h*p*
|
|
|
|
-t-i*n*c+h*l*c;b[6]=g*l*q-e*p*q-g*n*t+d*p*t+e*n*c-d*l*c;b[10]=e*m*q-g*i*q+g*h*t-d*m*t-e*h*c+d*i*c;b[14]=g*i*n-e*m*n-g*h*l+d*m*l+e*h*p-d*i*p;b[3]=j*l*q-i*o*q-j*n*t+h*o*t+i*n*r-h*l*r;b[7]=e*o*q-f*l*q+f*n*t-d*o*t-e*n*r+d*l*r;b[11]=f*i*q-e*j*q-f*h*t+d*j*t+e*h*r-d*i*r;b[15]=e*j*n-f*i*n+f*h*l-d*j*l-e*h*o+d*i*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=
|
|
|
|
-Math.sin(f);if(void 0===b||"XYZ"===b){var j=g*i,m=g*f,n=d*i,l=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+n*e;c[5]=j-l*e;c[9]=-d*h;c[2]=l-j*e;c[6]=n+m*e;c[10]=g*h}else"YXZ"===b?(j=h*i,m=h*f,n=e*i,l=e*f,c[0]=j+l*d,c[4]=n*d-m,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=m*d-n,c[6]=l+j*d,c[10]=g*h):"ZXY"===b?(j=h*i,m=h*f,n=e*i,l=e*f,c[0]=j-l*d,c[4]=-g*f,c[8]=n+m*d,c[1]=m+n*d,c[5]=g*i,c[9]=l-j*d,c[2]=-g*e,c[6]=d,c[10]=g*h):"ZYX"===b?(j=g*i,m=g*f,n=d*i,l=d*f,c[0]=h*i,c[4]=n*e-m,c[8]=j*e+l,c[1]=h*f,c[5]=l*e+j,c[9]=
|
|
|
|
-m*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,m=g*e,n=d*h,l=d*e,c[0]=h*i,c[4]=l-j*f,c[8]=n*f+m,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=m*f+n,c[10]=j-l*f):"XZY"===b&&(j=g*h,m=g*e,n=d*h,l=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=j*f+l,c[5]=g*i,c[9]=m*f-n,c[2]=n*f-m,c[6]=d*i,c[10]=l*f+j);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,m=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(m+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+
|
|
|
|
-e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.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=
|
|
|
|
|
|
+this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],i=c[5],j=c[9],l=c[13],n=c[2],m=c[6],p=c[10],o=c[14],q=c[3],s=c[7],r=c[11],c=c[15];b[0]=j*o*s-l*p*s+l*m*r-i*o*r-j*m*c+i*p*c;b[4]=g*p*s-f*o*s-g*m*r+e*o*r+f*m*c-e*p*c;b[8]=f*l*s-g*j*s+g*i*r-e*l*r-f*i*c+e*j*c;b[12]=g*j*m-f*l*m-g*i*p+e*l*p+f*i*o-e*j*o;b[1]=l*p*q-j*o*q-l*n*r+h*o*r+j*n*c-h*p*c;b[5]=f*o*q-g*p*q+g*n*r-d*o*r-f*n*c+d*p*c;b[9]=g*j*q-f*l*q-g*h*r+d*l*r+f*h*c-d*j*c;b[13]=f*l*n-g*j*n+g*h*p-d*l*p-f*h*o+d*j*o;b[2]=i*o*q-l*m*q+l*n*s-h*o*
|
|
|
|
+s-i*n*c+h*m*c;b[6]=g*m*q-e*o*q-g*n*s+d*o*s+e*n*c-d*m*c;b[10]=e*l*q-g*i*q+g*h*s-d*l*s-e*h*c+d*i*c;b[14]=g*i*n-e*l*n-g*h*m+d*l*m+e*h*o-d*i*o;b[3]=j*m*q-i*p*q-j*n*s+h*p*s+i*n*r-h*m*r;b[7]=e*p*q-f*m*q+f*n*s-d*p*s-e*n*r+d*m*r;b[11]=f*i*q-e*j*q-f*h*s+d*j*s+e*h*r-d*i*r;b[15]=e*j*n-f*i*n+f*h*m-d*j*m-e*h*p+d*i*p;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=
|
|
|
|
+Math.sin(f);if(void 0===b||"XYZ"===b){var j=g*i,l=g*f,n=d*i,m=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=l+n*e;c[5]=j-m*e;c[9]=-d*h;c[2]=m-j*e;c[6]=n+l*e;c[10]=g*h}else"YXZ"===b?(j=h*i,l=h*f,n=e*i,m=e*f,c[0]=j+m*d,c[4]=n*d-l,c[8]=g*e,c[1]=g*f,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*f,n=e*i,m=e*f,c[0]=j-m*d,c[4]=-g*f,c[8]=n+l*d,c[1]=l+n*d,c[5]=g*i,c[9]=m-j*d,c[2]=-g*e,c[6]=d,c[10]=g*h):"ZYX"===b?(j=g*i,l=g*f,n=d*i,m=d*f,c[0]=h*i,c[4]=n*e-l,c[8]=j*e+m,c[1]=h*f,c[5]=m*e+j,c[9]=
|
|
|
|
+l*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(j=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=m-j*f,c[8]=n*f+l,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=l*f+n,c[10]=j-m*f):"XZY"===b&&(j=g*h,l=g*e,n=d*h,m=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=j*f+m,c[5]=g*i,c[9]=l*f-n,c[2]=n*f-l,c[6]=d*i,c[10]=m*f+j);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e,a=c*g,j=c*h,c=c*i,l=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(l+e);b[4]=j-f;b[8]=c+h;b[1]=j+f;b[5]=1-(a+
|
|
|
|
+e);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,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.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=e.length();c.y=f.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]=
|
|
b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.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(),e=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]*e;b[5]=a[5]*e;b[6]=a[6]*e;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];
|
|
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(),e=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]*e;b[5]=a[5]*e;b[6]=a[6]*e;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],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],j=b[11],m=Math.cos(a),a=Math.sin(a);b[4]=m*c+a*g;b[5]=m*d+a*h;b[6]=m*e+a*i;b[7]=m*f+a*j;b[8]=m*g-a*c;b[9]=m*h-a*d;b[10]=m*i-a*e;b[11]=m*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],j=b[11],m=Math.cos(a),a=Math.sin(a);b[0]=m*c-a*g;b[1]=m*d-a*h;b[2]=m*e-a*i;b[3]=m*f-a*j;b[8]=m*g+a*c;b[9]=m*h+a*d;b[10]=
|
|
|
|
-m*i+a*e;b[11]=m*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],m=Math.cos(a),a=Math.sin(a);b[0]=m*c+a*g;b[1]=m*d+a*h;b[2]=m*e+a*i;b[3]=m*f+a*j;b[4]=m*g-a*c;b[5]=m*h-a*d;b[6]=m*i-a*e;b[7]=m*j-a*f;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,e=a.y,f=a.z,
|
|
|
|
-g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),m=Math.sin(b),n=1-j,l=d*e*n,o=d*f*n,n=e*f*n,d=d*m,p=e*m,m=f*m,f=g+(1-g)*j,g=l+m,e=o-p,l=l-m,h=h+(1-h)*j,m=n+d,o=o+p,n=n-d,i=i+(1-i)*j,j=c[0],d=c[1],p=c[2],q=c[3],t=c[4],r=c[5],A=c[6],u=c[7],s=c[8],D=c[9],z=c[10],w=c[11];c[0]=f*j+g*t+e*s;c[1]=f*d+g*r+e*D;c[2]=f*p+g*A+e*z;c[3]=f*q+g*u+e*w;c[4]=l*j+h*t+m*s;c[5]=l*d+h*r+m*D;c[6]=l*p+h*A+m*z;c[7]=l*q+h*u+m*w;c[8]=o*j+n*t+i*s;c[9]=o*d+n*r+i*D;c[10]=o*p+n*A+i*z;c[11]=o*q+n*u+i*w;
|
|
|
|
|
|
+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],e=b[6],f=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*e+a*i;b[7]=l*f+a*j;b[8]=l*g-a*c;b[9]=l*h-a*d;b[10]=l*i-a*e;b[11]=l*j-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=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*e-a*i;b[3]=l*f-a*j;b[8]=l*g+a*c;b[9]=l*h+a*d;b[10]=
|
|
|
|
+l*i+a*e;b[11]=l*j+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=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*e+a*i;b[3]=l*f+a*j;b[4]=l*g-a*c;b[5]=l*h-a*d;b[6]=l*i-a*e;b[7]=l*j-a*f;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,e=a.y,f=a.z,
|
|
|
|
+g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,j=Math.cos(b),l=Math.sin(b),n=1-j,m=d*e*n,p=d*f*n,n=e*f*n,d=d*l,o=e*l,l=f*l,f=g+(1-g)*j,g=m+l,e=p-o,m=m-l,h=h+(1-h)*j,l=n+d,p=p+o,n=n-d,i=i+(1-i)*j,j=c[0],d=c[1],o=c[2],q=c[3],s=c[4],r=c[5],A=c[6],u=c[7],t=c[8],D=c[9],z=c[10],w=c[11];c[0]=f*j+g*s+e*t;c[1]=f*d+g*r+e*D;c[2]=f*o+g*A+e*z;c[3]=f*q+g*u+e*w;c[4]=m*j+h*s+l*t;c[5]=m*d+h*r+l*D;c[6]=m*o+h*A+l*z;c[7]=m*q+h*u+l*w;c[8]=p*j+n*s+i*t;c[9]=p*d+n*r+i*D;c[10]=p*o+n*A+i*z;c[11]=p*q+n*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);
|
|
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),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,
|
|
this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*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,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);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),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;g[0]=2/
|
|
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,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);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),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,j=f-e;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]=-((f+e)/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;
|
|
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]=-((f+e)/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.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],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],m=c[8],n=c[9],l=c[10],o=c[11],p=c[12],q=c[13],t=c[14],c=c[15];b[0].set(f-a,j-g,o-m,c-p);b[1].set(f+a,j+g,o+m,c+p);b[2].set(f+d,j+h,o+n,c+q);b[3].set(f-d,j-h,o-n,c-q);b[4].set(f-e,j-i,o-l,c-t);b[5].set(f+e,j+i,o+l,c+t);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],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],l=c[8],n=c[9],m=c[10],p=c[11],o=c[12],q=c[13],s=c[14],c=c[15];b[0].set(f-a,j-g,p-l,c-o);b[1].set(f+a,j+g,p+l,c+o);b[2].set(f+d,j+h,p+n,c+q);b[3].set(f-d,j-h,p-n,c-q);b[4].set(f-e,j-i,p-m,c-s);b[5].set(f+e,j+i,p+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.contains=function(a){for(var b=0,c=this.planes,b=a.matrixWorld,d=b.elements,a=-a.geometry.boundingSphere.radius*b.getMaxScaleOnAxis(),e=0;6>e;e++)if(b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w,b<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
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(),e=0;6>e;e++)if(b=c[e].x*d[12]+c[e].y*d[13]+c[e].z*d[14]+c[e].w,b<=a)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
|
|
-(function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;new a.Vector3;var f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=new a.Vector3,j=new a.Vector3,m=new a.Vector3,n=function(a,b,c){i.sub(c,a);var d=i.dot(b),a=j.add(a,m.copy(b).multiplyScalar(d));return c.distanceTo(a)},l=function(a,b,c,d){i.sub(d,b);j.sub(c,b);m.sub(a,
|
|
|
|
-b);var a=i.dot(i),b=i.dot(j),c=i.dot(m),e=j.dot(j),d=j.dot(m),f=1/(a*e-b*b),e=(e*c-b*d)*f,a=(a*d-b*c)*f;return 0<=e&&0<=a&&1>e+a},o=function(h,i,j){if(h instanceof a.Particle){var m=n(i.origin,i.direction,h.matrixWorld.getPosition());if(m>h.scale.x)return j;j.push({distance:m,point:h.position,face:null,object:h})}else if(h instanceof a.Mesh){var o=h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis(),m=n(i.origin,i.direction,h.matrixWorld.getPosition());if(m>o)return j;var o=h.geometry,
|
|
|
|
-p=o.vertices,D=h.geometry.materials,z=h.material instanceof a.MeshFaceMaterial,m=h.material.side,w,v,C,E=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var G=0,L=o.faces.length;G<L;G++){var B=o.faces[G],m=!0===z?D[B.materialIndex]:h.material;if(void 0!==m&&(m=m.side,e.sub(B.centroid,c),v=B.normal,w=d.dot(v),!(Math.abs(w)<E)&&(v=v.dot(e)/w,!(0>v)&&(m===a.DoubleSide||
|
|
|
|
-(m===a.FrontSide?0>w:0<w)))))if(f.add(c,d.multiplyScalar(v)),B instanceof a.Face3)m=p[B.a],w=p[B.b],v=p[B.c],l(f,m,w,v)&&(w=h.matrixWorld.multiplyVector3(f.clone()),m=b.distanceTo(w),m<i.near||m>i.far||j.push({distance:m,point:w,face:B,faceIndex:G,object:h}));else if(B instanceof a.Face4&&(m=p[B.a],w=p[B.b],v=p[B.c],C=p[B.d],l(f,m,w,C)||l(f,w,v,C)))w=h.matrixWorld.multiplyVector3(f.clone()),m=b.distanceTo(w),m<i.near||m>i.far||j.push({distance:m,point:w,face:B,faceIndex:G,object:h})}}},p=function(a,
|
|
|
|
-b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;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&&p(a,this,c);o(a,this,c);c.sort(h);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)o(a[d],this,c),!0===b&&p(a[d],this,c);c.sort(h);return c}})(THREE);
|
|
|
|
-THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,m,n){h=!1;b=f;c=g;d=m;e=n;a()};this.addPoint=function(f,g){!0===h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>
|
|
|
|
-g?e:g);a()};this.add3Points=function(f,g,m,n,l,o){!0===h?(h=!1,b=f<m?f<l?f:l:m<l?m:l,c=g<n?g<o?g:o:n<o?n:o,d=f>m?f>l?f:l:m>l?m:l,e=g>n?g>o?g:o:n>o?n:o):(b=f<m?f<l?f<b?f:b:l<b?l:b:m<l?m<b?m:b:l<b?l: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=f>m?f>l?f>d?f:d:l>d?l:d:m>l?m>d?m:d:l>d?l:d,e=g>n?g>o?g>e?g:e:o>e?o:e:n>o?n>e?n:e:o>e?o:e);a()};this.addRectangle=function(f){!0===h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),
|
|
|
|
|
|
+(function(a){a.Ray=function(b,c,d,e){this.origin=b||new a.Vector3;this.direction=c||new a.Vector3;this.near=d||0;this.far=e||Infinity};var b=new a.Vector3,c=new a.Vector3,d=new a.Vector3,e=new a.Vector3;new a.Vector3;var f=new a.Vector3,g=new a.Matrix4,h=function(a,b){return a.distance-b.distance},i=new a.Vector3,j=new a.Vector3,l=new a.Vector3,n=function(a,b,c){i.sub(c,a);var d=i.dot(b),a=j.add(a,l.copy(b).multiplyScalar(d));return c.distanceTo(a)},m=function(a,b,c,d){i.sub(d,b);j.sub(c,b);l.sub(a,
|
|
|
|
+b);var a=i.dot(i),b=i.dot(j),c=i.dot(l),e=j.dot(j),d=j.dot(l),f=1/(a*e-b*b),e=(e*c-b*d)*f,a=(a*d-b*c)*f;return 0<=e&&0<=a&&1>e+a},p=function(h,i,j){if(h instanceof a.Particle){var l=n(i.origin,i.direction,h.matrixWorld.getPosition());if(l>h.scale.x)return j;j.push({distance:l,point:h.position,face:null,object:h})}else if(h instanceof a.Mesh){var o=h.geometry.boundingSphere.radius*h.matrixWorld.getMaxScaleOnAxis(),l=n(i.origin,i.direction,h.matrixWorld.getPosition());if(l>o)return j;var o=h.geometry,
|
|
|
|
+p=o.vertices,D=h.geometry.materials,z=h.material instanceof a.MeshFaceMaterial,l=h.material.side,w,v,C,E=i.precision;h.matrixRotationWorld.extractRotation(h.matrixWorld);b.copy(i.origin);g.getInverse(h.matrixWorld);c.copy(b);g.multiplyVector3(c);d.copy(i.direction);g.rotateAxis(d).normalize();for(var G=0,L=o.faces.length;G<L;G++){var B=o.faces[G],l=!0===z?D[B.materialIndex]:h.material;if(void 0!==l&&(l=l.side,e.sub(B.centroid,c),v=B.normal,w=d.dot(v),!(Math.abs(w)<E)&&(v=v.dot(e)/w,!(0>v)&&(l===a.DoubleSide||
|
|
|
|
+(l===a.FrontSide?0>w:0<w)))))if(f.add(c,d.multiplyScalar(v)),B instanceof a.Face3)l=p[B.a],w=p[B.b],v=p[B.c],m(f,l,w,v)&&(w=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(w),l<i.near||l>i.far||j.push({distance:l,point:w,face:B,faceIndex:G,object:h}));else if(B instanceof a.Face4&&(l=p[B.a],w=p[B.b],v=p[B.c],C=p[B.d],m(f,l,w,C)||m(f,w,v,C)))w=h.matrixWorld.multiplyVector3(f.clone()),l=b.distanceTo(w),l<i.near||l>i.far||j.push({distance:l,point:w,face:B,faceIndex:G,object:h})}}},o=function(a,
|
|
|
|
+b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)p(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&&o(a,this,c);p(a,this,c);c.sort(h);return c};a.Ray.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)p(a[d],this,c),!0===b&&o(a[d],this,c);c.sort(h);return c}})(THREE);
|
|
|
|
+THREE.Rectangle=function(){function a(){f=d-b;g=e-c}var b=0,c=0,d=0,e=0,f=0,g=0,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return g};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(f,g,l,n){h=!1;b=f;c=g;d=l;e=n;a()};this.addPoint=function(f,g){!0===h?(h=!1,b=f,c=g,d=f,e=g):(b=b<f?b:f,c=c<g?c:g,d=d>f?d:f,e=e>
|
|
|
|
+g?e:g);a()};this.add3Points=function(f,g,l,n,m,p){!0===h?(h=!1,b=f<l?f<m?f:m:l<m?l:m,c=g<n?g<p?g:p:n<p?n:p,d=f>l?f>m?f:m:l>m?l:m,e=g>n?g>p?g:p:n>p?n:p):(b=f<l?f<m?f<b?f:b:m<b?m:b:l<m?l<b?l:b:m<b?m:b,c=g<n?g<p?g<c?g:c:p<c?p:c:n<p?n<c?n:c:p<c?p:c,d=f>l?f>m?f>d?f:d:m>d?m:d:l>m?l>d?l:d:m>d?m:d,e=g>n?g>p?g>e?g:e:p>e?p:e:n>p?n>e?n:e:p>e?p:e);a()};this.addRectangle=function(f){!0===h?(h=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),e=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),
|
|
d=d>f.getRight()?d:f.getRight(),e=e>f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
d=d>f.getRight()?d:f.getRight(),e=e>f.getBottom()?e:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;e+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();e=e<f.getBottom()?e:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||e<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){h=!0;e=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,e){return d+(a-b)*(e-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.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,e){return d+(a-b)*(e-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=
|
|
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=
|
|
@@ -78,24 +78,24 @@ traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.chi
|
|
this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){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);
|
|
this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){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;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());
|
|
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;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());
|
|
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=[];
|
|
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(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(j===n){var a=new THREE.RenderableVertex;m.push(a);n++;j++;return a}return m[j++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
|
-c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,j,m=[],n=0,l,o,p=[],q=0,t,r=[],A=0,u,s,D=[],z=0,w,v,C=[],E=0,G={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,B=new THREE.Vector4,J=new THREE.Matrix4,H=new THREE.Matrix4,I=new THREE.Matrix3,O=new THREE.Frustum,N=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};
|
|
|
|
-this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.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,S){var $=h.near,K=h.far,ja=!1,Q,ha,da,Y,aa,ba,ia,ya,Na,za,Oa,Aa,pa,xb,Va;v=s=t=o=0;G.elements.length=0;g.updateMatrixWorld();
|
|
|
|
|
|
+THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}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,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
|
|
+c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,j,l=[],n=0,m,p,o=[],q=0,s,r=[],A=0,u,t,D=[],z=0,w,v,C=[],E=0,G={objects:[],sprites:[],lights:[],elements:[]},L=new THREE.Vector3,B=new THREE.Vector4,J=new THREE.Matrix4,H=new THREE.Matrix4,I=new THREE.Matrix3,O=new THREE.Frustum,N=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};
|
|
|
|
+this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.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,S){var $=h.near,K=h.far,ja=!1,Q,ha,da,Y,aa,ba,ia,ya,Na,za,Oa,Aa,pa,xb,Va;v=t=s=p=0;G.elements.length=0;g.updateMatrixWorld();
|
|
void 0===h.parent&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);J.multiply(h.projectionMatrix,h.matrixWorldInverse);O.setFromMatrix(J);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var fb=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)G.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===O.contains(f))e=a(),e.object=f,null!==f.renderDepth?
|
|
void 0===h.parent&&h.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);J.multiply(h.projectionMatrix,h.matrixWorldInverse);O.setFromMatrix(J);f=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var fb=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)G.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===f.frustumCulled||!0===O.contains(f))e=a(),e.object=f,null!==f.renderDepth?
|
|
e.z=f.renderDepth:(L.copy(f.matrixWorld.getPosition()),J.multiplyVector3(L),e.z=L.z),G.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(L.copy(f.matrixWorld.getPosition()),J.multiplyVector3(L),e.z=L.z),G.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(L.copy(f.matrixWorld.getPosition()),J.multiplyVector3(L),e.z=L.z),G.objects.push(e));fb(f)}}};fb(g);!0===n&&G.objects.sort(c);g=0;for(n=G.objects.length;g<
|
|
e.z=f.renderDepth:(L.copy(f.matrixWorld.getPosition()),J.multiplyVector3(L),e.z=L.z),G.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(L.copy(f.matrixWorld.getPosition()),J.multiplyVector3(L),e.z=L.z),G.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(L.copy(f.matrixWorld.getPosition()),J.multiplyVector3(L),e.z=L.z),G.objects.push(e));fb(f)}}};fb(g);!0===n&&G.objects.sort(c);g=0;for(n=G.objects.length;g<
|
|
n;g++)if(ya=G.objects[g].object,Na=ya.matrixWorld,j=0,ya instanceof THREE.Mesh){za=ya.geometry;Oa=ya.geometry.materials;da=za.vertices;Aa=za.faces;za=za.faceVertexUvs;I.getInverse(Na);I.transpose();xb=ya.material instanceof THREE.MeshFaceMaterial;Q=0;for(ha=da.length;Q<ha;Q++)i=b(),i.positionWorld.copy(da[Q]),Na.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),J.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=
|
|
n;g++)if(ya=G.objects[g].object,Na=ya.matrixWorld,j=0,ya instanceof THREE.Mesh){za=ya.geometry;Oa=ya.geometry.materials;da=za.vertices;Aa=za.faces;za=za.faceVertexUvs;I.getInverse(Na);I.transpose();xb=ya.material instanceof THREE.MeshFaceMaterial;Q=0;for(ha=da.length;Q<ha;Q++)i=b(),i.positionWorld.copy(da[Q]),Na.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),J.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=
|
|
-i.positionScreen.z>$&&i.positionScreen.z<K;da=0;for(Q=Aa.length;da<Q;da++)if(ha=Aa[da],Va=!0===xb?Oa[ha.materialIndex]:ya.material,void 0!==Va){ba=Va.side;if(ha instanceof THREE.Face3)if(Y=m[ha.a],aa=m[ha.b],ia=m[ha.c],!0===Y.visible&&!0===aa.visible&&!0===ia.visible)if(ja=0>(ia.positionScreen.x-Y.positionScreen.x)*(aa.positionScreen.y-Y.positionScreen.y)-(ia.positionScreen.y-Y.positionScreen.y)*(aa.positionScreen.x-Y.positionScreen.x),ba===THREE.DoubleSide||ja===(ba===THREE.FrontSide))o===q?(pa=
|
|
|
|
-new THREE.RenderableFace3,p.push(pa),q++,o++,l=pa):l=p[o++],l.v1.copy(Y),l.v2.copy(aa),l.v3.copy(ia);else continue;else continue;else if(ha instanceof THREE.Face4)if(Y=m[ha.a],aa=m[ha.b],ia=m[ha.c],pa=m[ha.d],!0===Y.visible&&!0===aa.visible&&!0===ia.visible&&!0===pa.visible)if(ja=0>(pa.positionScreen.x-Y.positionScreen.x)*(aa.positionScreen.y-Y.positionScreen.y)-(pa.positionScreen.y-Y.positionScreen.y)*(aa.positionScreen.x-Y.positionScreen.x)||0>(aa.positionScreen.x-ia.positionScreen.x)*(pa.positionScreen.y-
|
|
|
|
-ia.positionScreen.y)-(aa.positionScreen.y-ia.positionScreen.y)*(pa.positionScreen.x-ia.positionScreen.x),ba===THREE.DoubleSide||ja===(ba===THREE.FrontSide)){if(t===A){var kb=new THREE.RenderableFace4;r.push(kb);A++;t++;l=kb}else l=r[t++];l.v1.copy(Y);l.v2.copy(aa);l.v3.copy(ia);l.v4.copy(pa)}else continue;else continue;l.normalWorld.copy(ha.normal);!1===ja&&(ba===THREE.BackSide||ba===THREE.DoubleSide)&&l.normalWorld.negate();I.multiplyVector3(l.normalWorld).normalize();l.centroidWorld.copy(ha.centroid);
|
|
|
|
-Na.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);J.multiplyVector3(l.centroidScreen);ia=ha.vertexNormals;Y=0;for(aa=ia.length;Y<aa;Y++)pa=l.vertexNormalsWorld[Y],pa.copy(ia[Y]),!1===ja&&(ba===THREE.BackSide||ba===THREE.DoubleSide)&&pa.negate(),I.multiplyVector3(pa).normalize();l.vertexNormalsLength=ia.length;Y=0;for(aa=za.length;Y<aa;Y++)if(pa=za[Y][da],void 0!==pa){ba=0;for(ia=pa.length;ba<ia;ba++)l.uvs[Y][ba]=pa[ba]}l.color=ha.color;l.material=Va;l.z=l.centroidScreen.z;
|
|
|
|
-G.elements.push(l)}}else if(ya instanceof THREE.Line){H.multiply(J,Na);da=ya.geometry.vertices;Y=b();Y.positionScreen.copy(da[0]);H.multiplyVector4(Y.positionScreen);Na=ya.type===THREE.LinePieces?2:1;Q=1;for(ha=da.length;Q<ha;Q++)Y=b(),Y.positionScreen.copy(da[Q]),H.multiplyVector4(Y.positionScreen),0<(Q+1)%Na||(aa=m[j-2],N.copy(Y.positionScreen),M.copy(aa.positionScreen),!0===d(N,M)&&(N.multiplyScalar(1/N.w),M.multiplyScalar(1/M.w),s===z?(Oa=new THREE.RenderableLine,D.push(Oa),z++,s++,u=Oa):u=D[s++],
|
|
|
|
|
|
+i.positionScreen.z>$&&i.positionScreen.z<K;da=0;for(Q=Aa.length;da<Q;da++)if(ha=Aa[da],Va=!0===xb?Oa[ha.materialIndex]:ya.material,void 0!==Va){ba=Va.side;if(ha instanceof THREE.Face3)if(Y=l[ha.a],aa=l[ha.b],ia=l[ha.c],!0===Y.visible&&!0===aa.visible&&!0===ia.visible)if(ja=0>(ia.positionScreen.x-Y.positionScreen.x)*(aa.positionScreen.y-Y.positionScreen.y)-(ia.positionScreen.y-Y.positionScreen.y)*(aa.positionScreen.x-Y.positionScreen.x),ba===THREE.DoubleSide||ja===(ba===THREE.FrontSide))p===q?(pa=
|
|
|
|
+new THREE.RenderableFace3,o.push(pa),q++,p++,m=pa):m=o[p++],m.v1.copy(Y),m.v2.copy(aa),m.v3.copy(ia);else continue;else continue;else if(ha instanceof THREE.Face4)if(Y=l[ha.a],aa=l[ha.b],ia=l[ha.c],pa=l[ha.d],!0===Y.visible&&!0===aa.visible&&!0===ia.visible&&!0===pa.visible)if(ja=0>(pa.positionScreen.x-Y.positionScreen.x)*(aa.positionScreen.y-Y.positionScreen.y)-(pa.positionScreen.y-Y.positionScreen.y)*(aa.positionScreen.x-Y.positionScreen.x)||0>(aa.positionScreen.x-ia.positionScreen.x)*(pa.positionScreen.y-
|
|
|
|
+ia.positionScreen.y)-(aa.positionScreen.y-ia.positionScreen.y)*(pa.positionScreen.x-ia.positionScreen.x),ba===THREE.DoubleSide||ja===(ba===THREE.FrontSide)){if(s===A){var kb=new THREE.RenderableFace4;r.push(kb);A++;s++;m=kb}else m=r[s++];m.v1.copy(Y);m.v2.copy(aa);m.v3.copy(ia);m.v4.copy(pa)}else continue;else continue;m.normalWorld.copy(ha.normal);!1===ja&&(ba===THREE.BackSide||ba===THREE.DoubleSide)&&m.normalWorld.negate();I.multiplyVector3(m.normalWorld).normalize();m.centroidWorld.copy(ha.centroid);
|
|
|
|
+Na.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);J.multiplyVector3(m.centroidScreen);ia=ha.vertexNormals;Y=0;for(aa=ia.length;Y<aa;Y++)pa=m.vertexNormalsWorld[Y],pa.copy(ia[Y]),!1===ja&&(ba===THREE.BackSide||ba===THREE.DoubleSide)&&pa.negate(),I.multiplyVector3(pa).normalize();m.vertexNormalsLength=ia.length;Y=0;for(aa=za.length;Y<aa;Y++)if(pa=za[Y][da],void 0!==pa){ba=0;for(ia=pa.length;ba<ia;ba++)m.uvs[Y][ba]=pa[ba]}m.color=ha.color;m.material=Va;m.z=m.centroidScreen.z;
|
|
|
|
+G.elements.push(m)}}else if(ya instanceof THREE.Line){H.multiply(J,Na);da=ya.geometry.vertices;Y=b();Y.positionScreen.copy(da[0]);H.multiplyVector4(Y.positionScreen);Na=ya.type===THREE.LinePieces?2:1;Q=1;for(ha=da.length;Q<ha;Q++)Y=b(),Y.positionScreen.copy(da[Q]),H.multiplyVector4(Y.positionScreen),0<(Q+1)%Na||(aa=l[j-2],N.copy(Y.positionScreen),M.copy(aa.positionScreen),!0===d(N,M)&&(N.multiplyScalar(1/N.w),M.multiplyScalar(1/M.w),t===z?(Oa=new THREE.RenderableLine,D.push(Oa),z++,t++,u=Oa):u=D[t++],
|
|
u.v1.positionScreen.copy(N),u.v2.positionScreen.copy(M),u.z=Math.max(N.z,M.z),u.material=ya.material,G.elements.push(u)))}g=0;for(n=G.sprites.length;g<n;g++)ya=G.sprites[g].object,Na=ya.matrixWorld,ya instanceof THREE.Particle&&(B.set(Na.elements[12],Na.elements[13],Na.elements[14],1),J.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z&&(v===E?($=new THREE.RenderableParticle,C.push($),E++,v++,w=$):w=C[v++],w.object=ya,w.x=B.x/B.w,w.y=B.y/B.w,w.z=B.z,w.rotation=ya.rotation.z,w.scale.x=ya.scale.x*Math.abs(w.x-
|
|
u.v1.positionScreen.copy(N),u.v2.positionScreen.copy(M),u.z=Math.max(N.z,M.z),u.material=ya.material,G.elements.push(u)))}g=0;for(n=G.sprites.length;g<n;g++)ya=G.sprites[g].object,Na=ya.matrixWorld,ya instanceof THREE.Particle&&(B.set(Na.elements[12],Na.elements[13],Na.elements[14],1),J.multiplyVector4(B),B.z/=B.w,0<B.z&&1>B.z&&(v===E?($=new THREE.RenderableParticle,C.push($),E++,v++,w=$):w=C[v++],w.object=ya,w.x=B.x/B.w,w.y=B.y/B.w,w.z=B.z,w.rotation=ya.rotation.z,w.scale.x=ya.scale.x*Math.abs(w.x-
|
|
(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),w.scale.y=ya.scale.y*Math.abs(w.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),w.material=ya.material,G.elements.push(w)));!0===S&&G.elements.sort(c);return G}};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};
|
|
(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),w.scale.y=ya.scale.y*Math.abs(w.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),w.material=ya.material,G.elements.push(w)));!0===S&&G.elements.sort(c);return G}};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),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*
|
|
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),e=Math.cos(a.z/2),f=Math.sin(a.x/2),g=Math.sin(a.y/2),h=Math.sin(a.z/2);void 0===b||"XYZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"YXZ"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*
|
|
h-f*g*e,this.w=c*d*e+f*g*h):"ZXY"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"ZYX"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e+f*g*h):"YZX"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e-f*g*h):"XZY"===b&&(this.x=f*d*e-c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e+f*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);
|
|
h-f*g*e,this.w=c*d*e+f*g*h):"ZXY"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e-f*g*h):"ZYX"===b?(this.x=f*d*e-c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e+f*g*h):"YZX"===b?(this.x=f*d*e+c*g*h,this.y=c*g*e+f*d*h,this.z=c*d*h-f*g*e,this.w=c*d*e-f*g*h):"XZY"===b&&(this.x=f*d*e-c*g*h,this.y=c*g*e-f*d*h,this.z=c*d*h+f*g*e,this.w=c*d*e+f*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],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+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=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+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=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this.w=(i-g)/c,this.x=0.25*c,this.y=(a+e)/c,this.z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this.w=(d-h)/c,this.x=(a+e)/c,this.y=0.25*c,this.z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this.w=(e-a)/c,this.x=(d+h)/c,this.y=(g+i)/c,this.z=0.25*c);return this},inverse:function(){this.conjugate().normalize();
|
|
return this},conjugate: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.z=this.y=this.x=0,this.w=1):(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,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+d*i-e*h+f*g;this.y=-c*i+d*j+e*g+f*h;this.z=c*h-
|
|
return this},conjugate: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.z=this.y=this.x=0,this.w=1):(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,e=a.z,f=a.w,g=b.x,h=b.y,i=b.z,j=b.w;this.x=c*j+d*i-e*h+f*g;this.y=-c*i+d*j+e*g+f*h;this.z=c*h-
|
|
-d*g+e*j+f*i;this.w=-c*g-d*h-e*i+f*j;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,m=i*d+h*c-f*e,n=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+m*-h-n*-g;b.y=m*i+c*-g+n*-f-j*-h;b.z=n*i+c*-h+j*-g-m*-f;return b},slerpSelf:function(a,b){var c=
|
|
|
|
|
|
+d*g+e*j+f*i;this.w=-c*g-d*h-e*i+f*j;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,i=this.w,j=i*c+g*e-h*d,l=i*d+h*c-f*e,n=i*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=j*i+c*-f+l*-h-n*-g;b.y=l*i+c*-g+n*-f-j*-h;b.z=n*i+c*-h+j*-g-l*-f;return b},slerpSelf:function(a,b){var c=
|
|
this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*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=f,this.x=c,this.y=d,this.z=e,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*g+this.z*h;return this},clone:function(){return new THREE.Quaternion(this.x,
|
|
this.x,d=this.y,e=this.z,f=this.w,g=f*a.w+c*a.x+d*a.y+e*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=f,this.x=c,this.y=d,this.z=e,this;var h=Math.acos(g),i=Math.sqrt(1-g*g);if(0.001>Math.abs(i))return this.w=0.5*(f+this.w),this.x=0.5*(c+this.x),this.y=0.5*(d+this.y),this.z=0.5*(e+this.z),this;g=Math.sin((1-b)*h)/i;h=Math.sin(b*h)/i;this.w=f*g+this.w*h;this.x=c*g+this.x*h;this.y=d*g+this.y*h;this.z=e*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 e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var b=Math.acos(e),f=Math.sqrt(1-e*e);if(0.001>Math.abs(f))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;e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+c.z*d;return c};
|
|
this.y,this.z,this.w)}};THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>e?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(1<=Math.abs(e))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var b=Math.acos(e),f=Math.sqrt(1-e*e);if(0.001>Math.abs(f))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;e=Math.sin((1-d)*b)/f;d=Math.sin(d*b)/f;c.w=a.w*e+c.w*d;c.x=a.x*e+c.x*d;c.y=a.y*e+c.y*d;c.z=a.z*e+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,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
|
|
@@ -108,14 +108,14 @@ this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsN
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix3;b.getInverse(a).transpose();for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal).normalize();for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]).normalize();a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix3;b.getInverse(a).transpose();for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c]);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];b.multiplyVector3(e.normal).normalize();for(var f=0,g=e.vertexNormals.length;f<g;f++)b.multiplyVector3(e.vertexNormals[f]).normalize();a.multiplyVector3(e.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=
|
|
this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a]),c.centroid.addSelf(this.vertices[c.b]),c.centroid.addSelf(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a]),c.centroid.addSelf(this.vertices[c.b]),c.centroid.addSelf(this.vertices[c.c]),c.centroid.addSelf(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;
|
|
this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a]),c.centroid.addSelf(this.vertices[c.b]),c.centroid.addSelf(this.vertices[c.c]),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a]),c.centroid.addSelf(this.vertices[c.b]),c.centroid.addSelf(this.vertices[c.c]),c.centroid.addSelf(this.vertices[c.d]),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,b,c,d,e,f,g=new THREE.Vector3,h=new THREE.Vector3;
|
|
a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f,e),h.sub(d,e),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,
|
|
a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],f=this.vertices[c.c],g.sub(f,e),h.sub(d,e),g.crossSelf(h),g.isZero()||g.normalize(),c.normal.copy(g)},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,
|
|
-new THREE.Vector3]:d instanceof THREE.Face4&&(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,l=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.sub(g,f),j.sub(a,f),i.crossSelf(j),
|
|
|
|
-e[d.a].addSelf(i),e[d.b].addSelf(i),e[d.c].addSelf(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],m.sub(h,f),j.sub(a,f),m.crossSelf(j),e[d.a].addSelf(m),e[d.b].addSelf(m),e[d.d].addSelf(m),n.sub(h,g),l.sub(f,g),n.crossSelf(l),e[d.b].addSelf(n),e[d.c].addSelf(n),e[d.d].addSelf(n))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):
|
|
|
|
|
|
+new THREE.Vector3]:d instanceof THREE.Face4&&(d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,g,h,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],i.sub(g,f),j.sub(a,f),i.crossSelf(j),
|
|
|
|
+e[d.a].addSelf(i),e[d.b].addSelf(i),e[d.c].addSelf(i)):d instanceof THREE.Face4&&(a=this.vertices[d.a],f=this.vertices[d.b],g=this.vertices[d.c],h=this.vertices[d.d],l.sub(h,f),j.sub(a,f),l.crossSelf(j),e[d.a].addSelf(l),e[d.b].addSelf(l),e[d.d].addSelf(l),n.sub(h,g),m.sub(f,g),n.crossSelf(m),e[d.b].addSelf(n),e[d.c].addSelf(n),e[d.d].addSelf(n))}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):
|
|
d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},
|
|
d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal))}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},
|
|
computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<
|
|
computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<
|
|
b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(j)}g=this.morphNormals[a];f.vertices=
|
|
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++)e=this.faces[c],i=new THREE.Vector3,j=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(j)}g=this.morphNormals[a];f.vertices=
|
|
this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
|
|
this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],j=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2])):(j.a.copy(e.vertexNormals[0]),j.b.copy(e.vertexNormals[1]),j.c.copy(e.vertexNormals[2]),j.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
|
|
-e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,v){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];m=g[e];n=g[f];l=g[v];o=i.x-h.x;p=j.x-h.x;q=i.y-h.y;t=j.y-h.y;r=i.z-h.z;A=j.z-h.z;u=n.u-m.u;s=l.u-m.u;D=n.v-m.v;z=l.v-m.v;w=1/(u*z-s*D);G.set((z*o-D*p)*w,(z*q-D*t)*w,(z*r-D*A)*w);L.set((u*p-s*o)*w,(u*t-s*q)*w,(u*A-s*r)*w);C[b].addSelf(G);C[c].addSelf(G);C[d].addSelf(G);E[b].addSelf(L);E[c].addSelf(L);E[d].addSelf(L)}var b,c,d,e,f,g,h,i,j,m,n,l,o,p,q,t,r,A,
|
|
|
|
-u,s,D,z,w,v,C=[],E=[],G=new THREE.Vector3,L=new THREE.Vector3,B=new THREE.Vector3,J=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,E[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
|
|
|
|
|
|
+e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,v){h=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=g[e];n=g[f];m=g[v];p=i.x-h.x;o=j.x-h.x;q=i.y-h.y;s=j.y-h.y;r=i.z-h.z;A=j.z-h.z;u=n.u-l.u;t=m.u-l.u;D=n.v-l.v;z=m.v-l.v;w=1/(u*z-t*D);G.set((z*p-D*o)*w,(z*q-D*s)*w,(z*r-D*A)*w);L.set((u*o-t*p)*w,(u*s-t*q)*w,(u*A-t*r)*w);C[b].addSelf(G);C[c].addSelf(G);C[d].addSelf(G);E[b].addSelf(L);E[c].addSelf(L);E[d].addSelf(L)}var b,c,d,e,f,g,h,i,j,l,n,m,p,o,q,s,r,A,
|
|
|
|
+u,t,D,z,w,v,C=[],E=[],G=new THREE.Vector3,L=new THREE.Vector3,B=new THREE.Vector3,J=new THREE.Vector3,H=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)C[b]=new THREE.Vector3,E[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var I=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
|
|
f.vertexNormals.length;d++)H.copy(f.vertexNormals[d]),e=f[I[d]],v=C[e],B.copy(v),B.subSelf(H.multiplyScalar(H.dot(v))).normalize(),J.cross(f.vertexNormals[d],v),e=J.dot(E[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3});
|
|
f.vertexNormals.length;d++)H.copy(f.vertexNormals[d]),e=f[I[d]],v=C[e],B.copy(v),B.subSelf(H.multiplyScalar(H.dot(v))).normalize(),J.cross(f.vertexNormals[d],v),e=J.dot(E[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){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,e=this.vertices.length;d<e;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=
|
|
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,e=this.vertices.length;d<e;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,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];
|
|
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,e=Math.pow(10,4),f,g,h,i;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];f=0;for(g=this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];
|
|
@@ -124,14 +124,14 @@ 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=
|
|
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.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3(Infinity,
|
|
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.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),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,e,f=0,g=a.length;f<g;f+=3)(c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z)?b.min.z=e:e>b.max.z&&(b.max.z=e);if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){this.boundingSphere||(this.boundingSphere={radius:0});
|
|
Infinity,Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)});var a=this.attributes.position.array;if(a)for(var b=this.boundingBox,c,d,e,f=0,g=a.length;f<g;f+=3)(c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z)?b.min.z=e:e>b.max.z&&(b.max.z=e);if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){this.boundingSphere||(this.boundingSphere={radius:0});
|
|
var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position&&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]=
|
|
var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position&&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 e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,m,n,l,o,p=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,A=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var u=e[c].index;a=b;for(b+=i;a<b;a+=3)i=u+f[a],j=u+f[a+1],m=u+f[a+2],n=g[3*i],l=g[3*i+1],o=g[3*i+2],p.set(n,l,o),n=g[3*j],l=g[3*j+1],o=g[3*j+2],q.set(n,l,o),n=g[3*m],l=g[3*m+1],o=g[3*m+2],t.set(n,l,o),r.sub(t,q),A.sub(p,
|
|
|
|
-q),r.crossSelf(A),h[3*i]+=r.x,h[3*i+1]+=r.y,h[3*i+2]+=r.z,h[3*j]+=r.x,h[3*j+1]+=r.y,h[3*j+2]+=r.z,h[3*m]+=r.x,h[3*m+1]+=r.y,h[3*m+2]+=r.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){T.x=d[3*a];T.y=d[3*a+1];T.z=d[3*a+2];R.copy(T);S=i[a];N.copy(S);N.subSelf(T.multiplyScalar(T.dot(S))).normalize();
|
|
|
|
|
|
+0}var e=this.offsets,f=this.attributes.index.array,g=this.attributes.position.array,h=this.attributes.normal.array,i,j,l,n,m,p,o=new THREE.Vector3,q=new THREE.Vector3,s=new THREE.Vector3,r=new THREE.Vector3,A=new THREE.Vector3;c=0;for(d=e.length;c<d;++c){b=e[c].start;i=e[c].count;var u=e[c].index;a=b;for(b+=i;a<b;a+=3)i=u+f[a],j=u+f[a+1],l=u+f[a+2],n=g[3*i],m=g[3*i+1],p=g[3*i+2],o.set(n,m,p),n=g[3*j],m=g[3*j+1],p=g[3*j+2],q.set(n,m,p),n=g[3*l],m=g[3*l+1],p=g[3*l+2],s.set(n,m,p),r.sub(s,q),A.sub(o,
|
|
|
|
+q),r.crossSelf(A),h[3*i]+=r.x,h[3*i+1]+=r.y,h[3*i+2]+=r.z,h[3*j]+=r.x,h[3*j+1]+=r.y,h[3*j+2]+=r.z,h[3*l]+=r.x,h[3*l+1]+=r.y,h[3*l+2]+=r.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){T.x=d[3*a];T.y=d[3*a+1];T.z=d[3*a+2];R.copy(T);S=i[a];N.copy(S);N.subSelf(T.multiplyScalar(T.dot(S))).normalize();
|
|
M.cross(R,S);$=M.dot(j[a]);P=0>$?-1:1;h[4*a]=N.x;h[4*a+1]=N.y;h[4*a+2]=N.z;h[4*a+3]=P}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=
|
|
M.cross(R,S);$=M.dot(j[a]);P=0>$?-1:1;h[4*a]=N.x;h[4*a+1]=N.y;h[4*a+2]=N.z;h[4*a+3]=P}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=
|
|
-4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var m,n,l,o,p,q,t,r,A,u,s,D,z,w,v,f=new THREE.Vector3,g=new THREE.Vector3,C,E,G,L,B,J,H,I=this.offsets;G=0;for(L=I.length;G<L;++G){E=I[G].start;B=I[G].count;var O=I[G].index;C=E;for(E+=B;C<E;C+=3)B=O+b[C],J=O+b[C+1],H=O+b[C+2],m=c[3*B],n=c[3*B+1],l=c[3*B+2],o=c[3*J],p=c[3*J+1],q=c[3*J+2],t=c[3*H],r=c[3*H+1],A=c[3*
|
|
|
|
-H+2],u=e[2*B],s=e[2*B+1],D=e[2*J],z=e[2*J+1],w=e[2*H],v=e[2*H+1],o-=m,m=t-m,p-=n,n=r-n,q-=l,l=A-l,D-=u,u=w-u,z-=s,s=v-s,v=1/(D*s-u*z),f.set((s*o-z*m)*v,(s*p-z*n)*v,(s*q-z*l)*v),g.set((D*m-u*o)*v,(D*n-u*p)*v,(D*l-u*q)*v),i[B].addSelf(f),i[J].addSelf(f),i[H].addSelf(f),j[B].addSelf(g),j[J].addSelf(g),j[H].addSelf(g)}var N=new THREE.Vector3,M=new THREE.Vector3,T=new THREE.Vector3,R=new THREE.Vector3,P,S,$;G=0;for(L=I.length;G<L;++G){E=I[G].start;B=I[G].count;O=I[G].index;C=E;for(E+=B;C<E;C+=3)B=O+b[C],
|
|
|
|
|
|
+4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],j=[],g=0;g<f;g++)i[g]=new THREE.Vector3,j[g]=new THREE.Vector3;var l,n,m,p,o,q,s,r,A,u,t,D,z,w,v,f=new THREE.Vector3,g=new THREE.Vector3,C,E,G,L,B,J,H,I=this.offsets;G=0;for(L=I.length;G<L;++G){E=I[G].start;B=I[G].count;var O=I[G].index;C=E;for(E+=B;C<E;C+=3)B=O+b[C],J=O+b[C+1],H=O+b[C+2],l=c[3*B],n=c[3*B+1],m=c[3*B+2],p=c[3*J],o=c[3*J+1],q=c[3*J+2],s=c[3*H],r=c[3*H+1],A=c[3*
|
|
|
|
+H+2],u=e[2*B],t=e[2*B+1],D=e[2*J],z=e[2*J+1],w=e[2*H],v=e[2*H+1],p-=l,l=s-l,o-=n,n=r-n,q-=m,m=A-m,D-=u,u=w-u,z-=t,t=v-t,v=1/(D*t-u*z),f.set((t*p-z*l)*v,(t*o-z*n)*v,(t*q-z*m)*v),g.set((D*l-u*p)*v,(D*n-u*o)*v,(D*m-u*q)*v),i[B].addSelf(f),i[J].addSelf(f),i[H].addSelf(f),j[B].addSelf(g),j[J].addSelf(g),j[H].addSelf(g)}var N=new THREE.Vector3,M=new THREE.Vector3,T=new THREE.Vector3,R=new THREE.Vector3,P,S,$;G=0;for(L=I.length;G<L;++G){E=I[G].start;B=I[G].count;O=I[G].index;C=E;for(E+=B;C<E;C+=3)B=O+b[C],
|
|
J=O+b[C+1],H=O+b[C+2],a(B),a(J),a(H)}this.tangentsNeedUpdate=this.hasTangents=!0}},deallocate:function(){var a=THREE.GeometryLibrary.indexOf(this);-1!==a&&THREE.GeometryLibrary.splice(a,1)}};
|
|
J=O+b[C+1],H=O+b[C+2],a(B),a(J),a(H)}this.tangentsNeedUpdate=this.hasTangents=!0}},deallocate:function(){var a=THREE.GeometryLibrary.indexOf(this);-1!==a&&THREE.GeometryLibrary.splice(a,1)}};
|
|
-THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,i,j,m,n,l;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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
|
-f+2;j=this.points[c[0]];m=this.points[c[1]];n=this.points[c[2]];l=this.points[c[3]];h=g*g;i=g*h;d.x=b(j.x,m.x,n.x,l.x,g,h,i);d.y=b(j.y,m.y,n.y,l.y,g,h,i);d.z=b(j.z,m.z,n.z,l.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,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
|
|
|
|
+THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,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){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
|
|
|
|
+f+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,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
|
|
a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),d=this.getPoint(d),
|
|
a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];g=Math.ceil(a*c/j.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+c*(1/g)*(f-e),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);
|
|
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&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};
|
|
THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};
|
|
@@ -146,8 +146,8 @@ THREE.SpotLight=function(a,b,c,d,e){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(){}};
|
|
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/
|
|
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=
|
|
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 e(a,e,f,h,i,j,t){var r=f.toLowerCase().endsWith(".dds"),A=b+"/"+f;if(r){var u=THREE.ImageUtils.loadCompressedTexture(A);a[e]=u}else u=document.createElement("canvas"),a[e]=new THREE.Texture(u);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,
|
|
|
|
-mirror:THREE.MirroredRepeatWrapping},void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]))a[e].wrapT=f[j[1]];t&&(a[e].anisotropy=t);if(!r){var s=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);s.image.width=a;s.image.height=b;s.image.getContext("2d").drawImage(this,0,0,a,b)}else s.image=this;s.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=A}}function f(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 e(a,e,f,h,i,j,s){var r=f.toLowerCase().endsWith(".dds"),A=b+"/"+f;if(r){var u=THREE.ImageUtils.loadCompressedTexture(A);a[e]=u}else u=document.createElement("canvas"),a[e]=new THREE.Texture(u);a[e].sourceFile=f;if(h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]))a[e].wrapT=THREE.RepeatWrapping;i&&a[e].offset.set(i[0],i[1]);if(j&&(f={repeat:THREE.RepeatWrapping,
|
|
|
|
+mirror:THREE.MirroredRepeatWrapping},void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]))a[e].wrapT=f[j[1]];s&&(a[e].anisotropy=s);if(!r){var t=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);t.image.width=a;t.image.height=b;t.image.getContext("2d").drawImage(this,0,0,a,b)}else t.image=this;t.needsUpdate=true};a.crossOrigin=g.crossOrigin;a.src=A}}function f(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!==
|
|
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=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=
|
|
a.flipSided&&(i.side=THREE.BackSide);void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=
|
|
a.specularCoef);a.mapDiffuse&&b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",
|
|
a.specularCoef);a.mapDiffuse&&b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",
|
|
@@ -157,60 +157,60 @@ THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBas
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){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,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.send(null)};
|
|
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){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,e,d,f)}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,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var c=f.response;void 0===c&&(c=(new Uint8Array(f.responseBody)).buffer);THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else 3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var c=f.response;void 0===c&&(c=(new Uint8Array(f.responseBody)).buffer);THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else 3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):
|
|
2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
|
|
2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);f.responseType="arraybuffer";f.send(null)};
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,m,n,l,o,p,q,t,r,A,u,s;function D(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 v(b,c){var d,e,f,g,h,i,j,m,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=O[2*e];e=O[2*e+1];i=O[2*f];j=O[2*f+1];f=O[2*g];m=O[2*g+1];g=J.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,
|
|
|
|
-m));g.push(n)}}function C(b,c){var d,e,f,g,h,i,j,m,l,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=O[2*e];e=O[2*e+1];j=O[2*f];l=O[2*f+1];m=O[2*g];n=O[2*g+1];g=O[2*h];f=O[2*h+1];h=J.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,l));p.push(new THREE.UV(m,n));p.push(new THREE.UV(g,f));h.push(p)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
|
-J.faces.push(new THREE.Face3(e,f,g,null,null,h))}function G(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],J.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function L(b,c,d,e){for(var f,g,h,i,j,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];m=d[3*e+1];l=d[3*e+2];i=n[e];var o=I[3*m],p=I[3*m+1];m=I[3*m+2];var q=I[3*l],r=
|
|
|
|
-I[3*l+1];l=I[3*l+2];J.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(I[3*j],I[3*j+1],I[3*j+2]),new THREE.Vector3(o,p,m),new THREE.Vector3(q,r,l)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,m,l,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];m=d[4*e];l=d[4*e+1];n=d[4*e+2];o=d[4*e+3];j=p[e];var q=I[3*l],r=I[3*l+1];l=I[3*l+2];var t=I[3*n],s=I[3*n+1];n=I[3*n+2];var u=I[3*o],v=I[3*o+1];o=I[3*o+2];J.faces.push(new THREE.Face4(f,
|
|
|
|
-g,h,i,[new THREE.Vector3(I[3*m],I[3*m+1],I[3*m+2]),new THREE.Vector3(q,r,l),new THREE.Vector3(t,s,n),new THREE.Vector3(u,v,o)],null,j))}}var J=this,H=0,I=[],O=[],N,M,T;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(J,d,b);s=a;M=H;b=new Uint8Array(s,M,12);q="";for(A=0;12>A;A++)q+=String.fromCharCode(b[M+A]);c=z(s,M+12);z(s,M+13);z(s,M+14);z(s,M+15);e=z(s,M+16);i=z(s,M+17);j=z(s,M+18);m=z(s,M+19);n=w(s,M+20);l=w(s,M+20+4);o=w(s,M+20+8);p=w(s,M+20+12);q=w(s,M+20+16);t=w(s,M+20+20);r=
|
|
|
|
-w(s,M+20+24);A=w(s,M+20+28);b=w(s,M+20+32);u=w(s,M+20+36);s=w(s,M+20+40);H+=c;M=3*e+m;T=4*e+m;N=p*M;c=q*(M+3*i);e=t*(M+3*j);m=r*(M+3*i+3*j);M=A*T;i=b*(T+4*i);j=u*(T+4*j);T=H;var H=new Float32Array(a,H,3*n),R,P,S,$;for(R=0;R<n;R++)P=H[3*R],S=H[3*R+1],$=H[3*R+2],J.vertices.push(new THREE.Vector3(P,S,$));n=H=T+3*n*Float32Array.BYTES_PER_ELEMENT;if(l){H=new Int8Array(a,H,3*l);for(T=0;T<l;T++)R=H[3*T],P=H[3*T+1],S=H[3*T+2],I.push(R/127,P/127,S/127)}H=n+3*l*Int8Array.BYTES_PER_ELEMENT;l=H+=D(3*l);if(o){H=
|
|
|
|
-new Float32Array(a,H,2*o);for(n=0;n<o;n++)T=H[2*n],R=H[2*n+1],O.push(T,R)}o=H=l+2*o*Float32Array.BYTES_PER_ELEMENT;N=o+N+D(2*p);l=N+c+D(2*q);c=l+e+D(2*t);e=c+m+D(2*r);M=e+M+D(2*A);m=M+i+D(2*b);i=m+j+D(2*u);t&&(j=l+3*t*Uint32Array.BYTES_PER_ELEMENT,E(t,l,j+3*t*Uint32Array.BYTES_PER_ELEMENT),v(t,j));r&&(t=c+3*r*Uint32Array.BYTES_PER_ELEMENT,j=t+3*r*Uint32Array.BYTES_PER_ELEMENT,L(r,c,t,j+3*r*Uint32Array.BYTES_PER_ELEMENT),v(r,j));u&&(r=m+4*u*Uint32Array.BYTES_PER_ELEMENT,G(u,m,r+4*u*Uint32Array.BYTES_PER_ELEMENT),
|
|
|
|
-C(u,r));s&&(u=i+4*s*Uint32Array.BYTES_PER_ELEMENT,r=u+4*s*Uint32Array.BYTES_PER_ELEMENT,B(s,i,u,r+4*s*Uint32Array.BYTES_PER_ELEMENT),C(s,r));p&&E(p,o,o+3*p*Uint32Array.BYTES_PER_ELEMENT);q&&(p=N+3*q*Uint32Array.BYTES_PER_ELEMENT,L(q,N,p,p+3*q*Uint32Array.BYTES_PER_ELEMENT));A&&G(A,e,e+4*A*Uint32Array.BYTES_PER_ELEMENT);b&&(q=M+4*b*Uint32Array.BYTES_PER_ELEMENT,B(b,M,q,q+4*b*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,n,m,p,o,q,s,r,A,u,t;function D(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 v(b,c){var d,e,f,g,h,i,j,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=O[2*e];e=O[2*e+1];i=O[2*f];j=O[2*f+1];f=O[2*g];l=O[2*g+1];g=J.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));n.push(new THREE.UV(f,
|
|
|
|
+l));g.push(n)}}function C(b,c){var d,e,f,g,h,i,j,l,m,n,o=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=o[4*d];f=o[4*d+1];g=o[4*d+2];h=o[4*d+3];i=O[2*e];e=O[2*e+1];j=O[2*f];m=O[2*f+1];l=O[2*g];n=O[2*g+1];g=O[2*h];f=O[2*h+1];h=J.faceVertexUvs[0];var p=[];p.push(new THREE.UV(i,e));p.push(new THREE.UV(j,m));p.push(new THREE.UV(l,n));p.push(new THREE.UV(g,f));h.push(p)}}function E(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],
|
|
|
|
+J.faces.push(new THREE.Face3(e,f,g,null,null,h))}function G(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=j[d],J.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function L(b,c,d,e){for(var f,g,h,i,j,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];j=d[3*e];l=d[3*e+1];m=d[3*e+2];i=n[e];var o=I[3*l],p=I[3*l+1];l=I[3*l+2];var q=I[3*m],r=
|
|
|
|
+I[3*m+1];m=I[3*m+2];J.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(I[3*j],I[3*j+1],I[3*j+2]),new THREE.Vector3(o,p,l),new THREE.Vector3(q,r,m)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,j,l,m,n,o,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];l=d[4*e];m=d[4*e+1];n=d[4*e+2];o=d[4*e+3];j=p[e];var q=I[3*m],r=I[3*m+1];m=I[3*m+2];var s=I[3*n],t=I[3*n+1];n=I[3*n+2];var u=I[3*o],v=I[3*o+1];o=I[3*o+2];J.faces.push(new THREE.Face4(f,
|
|
|
|
+g,h,i,[new THREE.Vector3(I[3*l],I[3*l+1],I[3*l+2]),new THREE.Vector3(q,r,m),new THREE.Vector3(s,t,n),new THREE.Vector3(u,v,o)],null,j))}}var J=this,H=0,I=[],O=[],N,M,T;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(J,d,b);t=a;M=H;b=new Uint8Array(t,M,12);q="";for(A=0;12>A;A++)q+=String.fromCharCode(b[M+A]);c=z(t,M+12);z(t,M+13);z(t,M+14);z(t,M+15);e=z(t,M+16);i=z(t,M+17);j=z(t,M+18);l=z(t,M+19);n=w(t,M+20);m=w(t,M+20+4);p=w(t,M+20+8);o=w(t,M+20+12);q=w(t,M+20+16);s=w(t,M+20+20);r=
|
|
|
|
+w(t,M+20+24);A=w(t,M+20+28);b=w(t,M+20+32);u=w(t,M+20+36);t=w(t,M+20+40);H+=c;M=3*e+l;T=4*e+l;N=o*M;c=q*(M+3*i);e=s*(M+3*j);l=r*(M+3*i+3*j);M=A*T;i=b*(T+4*i);j=u*(T+4*j);T=H;var H=new Float32Array(a,H,3*n),R,P,S,$;for(R=0;R<n;R++)P=H[3*R],S=H[3*R+1],$=H[3*R+2],J.vertices.push(new THREE.Vector3(P,S,$));n=H=T+3*n*Float32Array.BYTES_PER_ELEMENT;if(m){H=new Int8Array(a,H,3*m);for(T=0;T<m;T++)R=H[3*T],P=H[3*T+1],S=H[3*T+2],I.push(R/127,P/127,S/127)}H=n+3*m*Int8Array.BYTES_PER_ELEMENT;m=H+=D(3*m);if(p){H=
|
|
|
|
+new Float32Array(a,H,2*p);for(n=0;n<p;n++)T=H[2*n],R=H[2*n+1],O.push(T,R)}p=H=m+2*p*Float32Array.BYTES_PER_ELEMENT;N=p+N+D(2*o);m=N+c+D(2*q);c=m+e+D(2*s);e=c+l+D(2*r);M=e+M+D(2*A);l=M+i+D(2*b);i=l+j+D(2*u);s&&(j=m+3*s*Uint32Array.BYTES_PER_ELEMENT,E(s,m,j+3*s*Uint32Array.BYTES_PER_ELEMENT),v(s,j));r&&(s=c+3*r*Uint32Array.BYTES_PER_ELEMENT,j=s+3*r*Uint32Array.BYTES_PER_ELEMENT,L(r,c,s,j+3*r*Uint32Array.BYTES_PER_ELEMENT),v(r,j));u&&(r=l+4*u*Uint32Array.BYTES_PER_ELEMENT,G(u,l,r+4*u*Uint32Array.BYTES_PER_ELEMENT),
|
|
|
|
+C(u,r));t&&(u=i+4*t*Uint32Array.BYTES_PER_ELEMENT,r=u+4*t*Uint32Array.BYTES_PER_ELEMENT,B(t,i,u,r+4*t*Uint32Array.BYTES_PER_ELEMENT),C(t,r));o&&E(o,p,p+3*o*Uint32Array.BYTES_PER_ELEMENT);q&&(o=N+3*q*Uint32Array.BYTES_PER_ELEMENT,L(q,N,o,o+3*q*Uint32Array.BYTES_PER_ELEMENT));A&&G(A,e,e+4*A*Uint32Array.BYTES_PER_ELEMENT);b&&(q=M+4*b*Uint32Array.BYTES_PER_ELEMENT,B(b,M,q,q+4*b*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};
|
|
e.prototype=Object.create(THREE.Geometry.prototype);b(new e(c))};THREE.ImageLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
e.prototype=Object.create(THREE.Geometry.prototype);b(new e(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);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);
|
|
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);this.withCredentials=!1};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.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,e){var f=new XMLHttpRequest,g=0;f.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.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+"] ["+f.status+"]");else f.readyState===
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.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+"] ["+f.status+"]");else f.readyState===
|
|
f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.send(null)};
|
|
f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.send(null)};
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);var f,g,h,i,j,m,n,l,o,p,q,t,r,A,u=a.faces;o=a.vertices;var s=a.normals,D=a.colors,z=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&z++;for(f=0;f<z;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];c=0;for(i=o.length;c<i;)j=new THREE.Vector3,j.x=o[c++]*e,j.y=o[c++]*e,j.z=o[c++]*e,d.vertices.push(j);c=0;for(i=u.length;c<i;){o=u[c++];j=o&1;h=o&2;f=o&4;g=o&8;n=o&16;
|
|
|
|
-m=o&32;p=o&64;o&=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(f)for(f=0;f<z;f++)t=a.uvs[f],l=u[c++],A=t[2*l],l=t[2*l+1],d.faceUvs[f][h]=new THREE.UV(A,l);if(g)for(f=0;f<z;f++){t=a.uvs[f];r=[];for(g=0;g<j;g++)l=u[c++],A=t[2*l],l=t[2*l+1],r[g]=new THREE.UV(A,l);d.faceVertexUvs[f][h]=r}n&&(n=3*u[c++],g=new THREE.Vector3,g.x=s[n++],g.y=s[n++],g.z=s[n],q.normal=g);if(m)for(f=
|
|
|
|
-0;f<j;f++)n=3*u[c++],g=new THREE.Vector3,g.x=s[n++],g.y=s[n++],g.z=s[n],q.vertexNormals.push(g);p&&(m=u[c++],m=new THREE.Color(D[m]),q.color=m);if(o)for(f=0;f<j;f++)m=u[c++],m=new THREE.Color(D[m]),q.vertexColors.push(m);d.faces.push(q)}if(a.skinWeights){c=0;for(i=a.skinWeights.length;c<i;c+=2)u=a.skinWeights[c],s=a.skinWeights[c+1],d.skinWeights.push(new THREE.Vector4(u,s,0,0))}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c+=2)u=a.skinIndices[c],s=a.skinIndices[c+1],d.skinIndices.push(new THREE.Vector4(u,
|
|
|
|
-s,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=[];D=d.morphTargets[c].vertices;z=a.morphTargets[c].vertices;u=0;for(s=z.length;u<s;u+=3)o=new THREE.Vector3,o.x=z[u]*e,o.y=z[u+1]*e,o.z=z[u+2]*e,D.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=
|
|
|
|
-[];s=d.morphColors[c].colors;D=a.morphColors[c].colors;e=0;for(u=D.length;e<u;e+=3)z=new THREE.Color(16755200),z.setRGB(D[e],D[e+1],D[e+2]),s.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,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);var f,g,h,i,j,l,n,m,p,o,q,s,r,A,u=a.faces;p=a.vertices;var t=a.normals,D=a.colors,z=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&z++;for(f=0;f<z;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];c=0;for(i=p.length;c<i;)j=new THREE.Vector3,j.x=p[c++]*e,j.y=p[c++]*e,j.z=p[c++]*e,d.vertices.push(j);c=0;for(i=u.length;c<i;){p=u[c++];j=p&1;h=p&2;f=p&4;g=p&8;n=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(f)for(f=0;f<z;f++)s=a.uvs[f],m=u[c++],A=s[2*m],m=s[2*m+1],d.faceUvs[f][h]=new THREE.UV(A,m);if(g)for(f=0;f<z;f++){s=a.uvs[f];r=[];for(g=0;g<j;g++)m=u[c++],A=s[2*m],m=s[2*m+1],r[g]=new THREE.UV(A,m);d.faceVertexUvs[f][h]=r}n&&(n=3*u[c++],g=new THREE.Vector3,g.x=t[n++],g.y=t[n++],g.z=t[n],q.normal=g);if(l)for(f=
|
|
|
|
+0;f<j;f++)n=3*u[c++],g=new THREE.Vector3,g.x=t[n++],g.y=t[n++],g.z=t[n],q.vertexNormals.push(g);o&&(l=u[c++],l=new THREE.Color(D[l]),q.color=l);if(p)for(f=0;f<j;f++)l=u[c++],l=new THREE.Color(D[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],t=a.skinWeights[c+1],d.skinWeights.push(new THREE.Vector4(u,t,0,0))}if(a.skinIndices){c=0;for(i=a.skinIndices.length;c<i;c+=2)u=a.skinIndices[c],t=a.skinIndices[c+1],d.skinIndices.push(new THREE.Vector4(u,
|
|
|
|
+t,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=[];D=d.morphTargets[c].vertices;z=a.morphTargets[c].vertices;u=0;for(t=z.length;u<t;u+=3)p=new THREE.Vector3,p.x=z[u]*e,p.y=z[u+1]*e,p.z=z[u+2]*e,D.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=
|
|
|
|
+[];t=d.morphColors[c].colors;D=a.morphColors[c].colors;e=0;for(u=D.length;e<u;e+=3)z=new THREE.Color(16755200),z.setRGB(D[e],D[e+1],D[e+2]),t.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.GeometryLoader=function(){THREE.EventTarget.call(this);this.path=this.crossOrigin=null};
|
|
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),e):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,
|
|
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),e):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 e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],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,e,f,g,j){a[d]=new THREE.Texture;a[d].sourceFile=
|
|
!0);d.send(null);var e=new THREE.LoadingMonitor;e.addEventListener("load",function(){b.dispatchEvent({type:"load",content:c})});e.add(d)},parse:function(a,b){var c=this,d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;if(a.materials){d.materials=[];for(var f=0;f<a.materials.length;++f){var g=a.materials[f],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,e,f,g,j){a[d]=new THREE.Texture;a[d].sourceFile=
|
|
-e;if(f&&(a[d].repeat.set(f[0],f[1]),1!==f[0]&&(a[d].wrapS=THREE.RepeatWrapping),1!==f[1]))a[d].wrapT=THREE.RepeatWrapping;g&&a[d].offset.set(g[0],g[1]);if(j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==f[j[0]]&&(a[d].wrapS=f[j[0]]),void 0!==f[j[1]]))a[d].wrapT=f[j[1]];var m=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);m.image=document.createElement("canvas");m.image.width=
|
|
|
|
-b;m.image.height=c;m.image.getContext("2d").drawImage(a,0,0,b,c)}else m.image=a;m.needsUpdate=!0});a.crossOrigin=c.crossOrigin;a.load(c.path+"/"+e);b&&b.add(a)},m=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},n="MeshLambertMaterial",l={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]&&
|
|
|
|
-(l.blending=THREE[g.blending]);if(void 0!==g.transparent||1>g.opacity)l.transparent=g.transparent;void 0!==g.depthTest&&(l.depthTest=g.depthTest);void 0!==g.depthWrite&&(l.depthWrite=g.depthWrite);void 0!==g.vertexColors&&("face"==g.vertexColors?l.vertexColors=THREE.FaceColors:g.vertexColors&&(l.vertexColors=THREE.VertexColors));g.colorDiffuse?l.color=m(g.colorDiffuse):g.DbgColor&&(l.color=g.DbgColor);g.colorSpecular&&(l.specular=m(g.colorSpecular));g.colorAmbient&&(l.ambient=m(g.colorAmbient));g.transparency&&
|
|
|
|
-(l.opacity=g.transparency);g.specularCoef&&(l.shininess=g.specularCoef);void 0!==g.visible&&(l.visible=g.visible);void 0!==g.flipSided&&(l.side=THREE.BackSide);void 0!==g.doubleSided&&(l.side=THREE.DoubleSide);void 0!==g.wireframe&&(l.wireframe=g.wireframe);g.mapDiffuse&&j(l,"map",g.mapDiffuse,g.mapDiffuseRepeat,g.mapDiffuseOffset,g.mapDiffuseWrap);g.mapLight&&j(l,"lightMap",g.mapLight,g.mapLightRepeat,g.mapLightOffset,g.mapLightWrap);g.mapBump&&j(l,"bumpMap",g.mapBump,g.mapBumpRepeat,g.mapBumpOffset,
|
|
|
|
-g.mapBumpWrap);g.mapNormal&&j(l,"normalMap",g.mapNormal,g.mapNormalRepeat,g.mapNormalOffset,g.mapNormalWrap);g.mapSpecular&&j(l,"specularMap",g.mapSpecular,g.mapSpecularRepeat,g.mapSpecularOffset,g.mapSpecularWrap);g.mapNormal?(j=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(j.uniforms),m.tNormal.value=l.normalMap,g.mapNormalFactor&&m.uNormalScale.value.set(g.mapNormalFactor,g.mapNormalFactor),l.map&&(m.tDiffuse.value=l.map,m.enableDiffuse.value=!0),l.specularMap&&(m.tSpecular.value=l.specularMap,
|
|
|
|
-m.enableSpecular.value=!0),l.lightMap&&(m.tAO.value=l.lightMap,m.enableAO.value=!0),m.uDiffuseColor.value.setHex(l.color),m.uSpecularColor.value.setHex(l.specular),m.uAmbientColor.value.setHex(l.ambient),m.uShininess.value=l.shininess,void 0!==l.opacity&&(m.uOpacity.value=l.opacity),l=new THREE.ShaderMaterial({fragmentShader:j.fragmentShader,vertexShader:j.vertexShader,uniforms:m,lights:!0,fog:!0})):l=new THREE[n](l);void 0!==g.DbgName&&(l.name=g.DbgName);d.materials[f]=l}}var g=a.faces,p=a.vertices,
|
|
|
|
-l=a.normals,j=a.colors,m=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&m++;for(f=0;f<m;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];n=0;for(o=p.length;n<o;){var q=new THREE.Vector3;q.x=p[n++]*e;q.y=p[n++]*e;q.z=p[n++]*e;d.vertices.push(q)}n=0;for(o=g.length;n<o;){var t=g[n++],r=t&2,f=t&4,A=t&8,u=t&16,p=t&32,s=t&64,q=t&128;if(t&1){t=new THREE.Face4;t.a=g[n++];t.b=g[n++];t.c=g[n++];t.d=g[n++];var D=4}else t=new THREE.Face3,t.a=g[n++],t.b=g[n++],t.c=g[n++],D=3;r&&(r=g[n++],t.materialIndex=r);var z=
|
|
|
|
-d.faces.length;if(f)for(f=0;f<m;f++){var w=a.uvs[f],r=g[n++],v=w[2*r],r=w[2*r+1];d.faceUvs[f][z]=new THREE.UV(v,r)}if(A)for(f=0;f<m;f++){for(var w=a.uvs[f],A=[],C=0;C<D;C++)r=g[n++],v=w[2*r],r=w[2*r+1],A[C]=new THREE.UV(v,r);d.faceVertexUvs[f][z]=A}u&&(u=3*g[n++],r=new THREE.Vector3,r.x=l[u++],r.y=l[u++],r.z=l[u],t.normal=r);if(p)for(f=0;f<D;f++)u=3*g[n++],r=new THREE.Vector3,r.x=l[u++],r.y=l[u++],r.z=l[u],t.vertexNormals.push(r);s&&(p=g[n++],t.color=new THREE.Color(j[p]));if(q)for(f=0;f<D;f++)p=
|
|
|
|
-g[n++],t.vertexColors.push(new THREE.Color(j[p]));d.faces.push(t)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2)l=0,d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],l,0))}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;
|
|
|
|
-d.morphTargets[f].vertices=[];l=d.morphTargets[f].vertices;j=a.morphTargets[f].vertices;r=0;for(m=j.length;r<m;r+=3)q=new THREE.Vector3,q.x=j[r]*e,q.y=j[r+1]*e,q.z=j[r+2]*e,l.push(q)}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]={};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;j=a.morphColors[f].colors;l=0;for(m=j.length;l<m;l+=3)n=new THREE.Color(16755200),n.setRGB(j[l],j[l+1],j[l+2]),e.push(n)}}d.computeCentroids();
|
|
|
|
|
|
+e;if(f&&(a[d].repeat.set(f[0],f[1]),1!==f[0]&&(a[d].wrapS=THREE.RepeatWrapping),1!==f[1]))a[d].wrapT=THREE.RepeatWrapping;g&&a[d].offset.set(g[0],g[1]);if(j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==f[j[0]]&&(a[d].wrapS=f[j[0]]),void 0!==f[j[1]]))a[d].wrapT=f[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+"/"+e);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 p=g.shading.toLowerCase();"phong"===p?n="MeshPhongMaterial":"basic"===p&&(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[f]=m}}var g=a.faces,o=a.vertices,
|
|
|
|
+m=a.normals,j=a.colors,l=0;if(a.uvs)for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&l++;for(f=0;f<l;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];n=0;for(p=o.length;n<p;){var q=new THREE.Vector3;q.x=o[n++]*e;q.y=o[n++]*e;q.z=o[n++]*e;d.vertices.push(q)}n=0;for(p=g.length;n<p;){var s=g[n++],r=s&2,f=s&4,A=s&8,u=s&16,o=s&32,t=s&64,q=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 D=4}else s=new THREE.Face3,s.a=g[n++],s.b=g[n++],s.c=g[n++],D=3;r&&(r=g[n++],s.materialIndex=r);var z=
|
|
|
|
+d.faces.length;if(f)for(f=0;f<l;f++){var w=a.uvs[f],r=g[n++],v=w[2*r],r=w[2*r+1];d.faceUvs[f][z]=new THREE.UV(v,r)}if(A)for(f=0;f<l;f++){for(var w=a.uvs[f],A=[],C=0;C<D;C++)r=g[n++],v=w[2*r],r=w[2*r+1],A[C]=new THREE.UV(v,r);d.faceVertexUvs[f][z]=A}u&&(u=3*g[n++],r=new THREE.Vector3,r.x=m[u++],r.y=m[u++],r.z=m[u],s.normal=r);if(o)for(f=0;f<D;f++)u=3*g[n++],r=new THREE.Vector3,r.x=m[u++],r.y=m[u++],r.z=m[u],s.vertexNormals.push(r);t&&(o=g[n++],s.color=new THREE.Color(j[o]));if(q)for(f=0;f<D;f++)o=
|
|
|
|
+g[n++],s.vertexColors.push(new THREE.Color(j[o]));d.faces.push(s)}if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2)d.skinWeights.push(new THREE.Vector4(a.skinWeights[f],a.skinWeights[f+1],0,0))}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2)m=0,d.skinIndices.push(new THREE.Vector4(a.skinIndices[f],a.skinIndices[f+1],m,0))}d.bones=a.bones;d.animation=a.animation;if(a.morphTargets){f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;
|
|
|
|
+d.morphTargets[f].vertices=[];m=d.morphTargets[f].vertices;j=a.morphTargets[f].vertices;r=0;for(l=j.length;r<l;r+=3)q=new THREE.Vector3,q.x=j[r]*e,q.y=j[r+1]*e,q.z=j[r+2]*e,m.push(q)}}if(a.morphColors){f=0;for(g=a.morphColors.length;f<g;f++){d.morphColors[f]={};d.morphColors[f].name=a.morphColors[f].name;d.morphColors[f].colors=[];e=d.morphColors[f].colors;j=a.morphColors[f].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]),e.push(n)}}d.computeCentroids();
|
|
d.computeFaceNormals();return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader);this.addGeometryHandler("binary",THREE.BinaryLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
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.hierarchyHandlerMap={};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 e=JSON.parse(d.responseText);c.parse(e,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.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 e=JSON.parse(d.responseText);c.parse(e,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.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(R.scene,S.objects)}function f(a,b){for(var c in b)if(void 0===R.objects[c]){var e=b[c],g=null;if(e.type&&e.type in m.hierarchyHandlerMap&&void 0===e.loading){var i={},j;for(j in t)"type"!==j&&"url"!==j&&(i[j]=t[j]);E=R.materials[e.materials[0]];e.loading=!0;var l=m.hierarchyHandlerMap[e.type].loaderObject;l.addEventListener?(l.addEventListener("load",h(c,a,E,e)),l.load(d(e.url,S.urlBaseType))):
|
|
|
|
-l.options?l.load(d(e.url,S.urlBaseType),h(c,a,E,e)):l.load(d(e.url,S.urlBaseType),h(c,a,E,e),i)}else if(void 0!==e.geometry){if(C=R.geometries[e.geometry])g=!1,E=R.materials[e.materials[0]],(g=E instanceof THREE.ShaderMaterial)&&C.computeTangents(),u=e.position,s=e.rotation,D=e.quaternion,z=e.scale,r=e.matrix,D=0,0===e.materials.length&&(E=new THREE.MeshFaceMaterial),1<e.materials.length&&(E=new THREE.MeshFaceMaterial),e.skin?g=new THREE.SkinnedMesh(C,E):e.morph?(g=new THREE.MorphAnimMesh(C,E),void 0!==
|
|
|
|
-e.duration&&(g.duration=e.duration),void 0!==e.time&&(g.time=e.time),void 0!==e.mirroredLoop&&(g.mirroredLoop=e.mirroredLoop),E.morphNormals&&C.computeMorphNormals()):g=new THREE.Mesh(C,E),g.name=c,r?(g.matrixAutoUpdate=!1,g.matrix.set(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])):(g.position.set(u[0],u[1],u[2]),D?(g.quaternion.set(D[0],D[1],D[2],D[3]),g.useQuaternion=!0):g.rotation.set(s[0],s[1],s[2]),g.scale.set(z[0],z[1],z[2])),g.visible=e.visible,g.castShadow=
|
|
|
|
|
|
+THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(R.scene,S.objects)}function f(a,b){for(var c in b)if(void 0===R.objects[c]){var e=b[c],g=null;if(e.type&&e.type in l.hierarchyHandlerMap&&void 0===e.loading){var i={},j;for(j in s)"type"!==j&&"url"!==j&&(i[j]=s[j]);E=R.materials[e.materials[0]];e.loading=!0;var m=l.hierarchyHandlerMap[e.type].loaderObject;m.addEventListener?(m.addEventListener("load",h(c,a,E,e)),m.load(d(e.url,S.urlBaseType))):
|
|
|
|
+m.options?m.load(d(e.url,S.urlBaseType),h(c,a,E,e)):m.load(d(e.url,S.urlBaseType),h(c,a,E,e),i)}else if(void 0!==e.geometry){if(C=R.geometries[e.geometry])g=!1,E=R.materials[e.materials[0]],(g=E instanceof THREE.ShaderMaterial)&&C.computeTangents(),u=e.position,t=e.rotation,D=e.quaternion,z=e.scale,r=e.matrix,D=0,0===e.materials.length&&(E=new THREE.MeshFaceMaterial),1<e.materials.length&&(E=new THREE.MeshFaceMaterial),e.skin?g=new THREE.SkinnedMesh(C,E):e.morph?(g=new THREE.MorphAnimMesh(C,E),void 0!==
|
|
|
|
+e.duration&&(g.duration=e.duration),void 0!==e.time&&(g.time=e.time),void 0!==e.mirroredLoop&&(g.mirroredLoop=e.mirroredLoop),E.morphNormals&&C.computeMorphNormals()):g=new THREE.Mesh(C,E),g.name=c,r?(g.matrixAutoUpdate=!1,g.matrix.set(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])):(g.position.set(u[0],u[1],u[2]),D?(g.quaternion.set(D[0],D[1],D[2],D[3]),g.useQuaternion=!0):g.rotation.set(t[0],t[1],t[2]),g.scale.set(z[0],z[1],z[2])),g.visible=e.visible,g.castShadow=
|
|
e.castShadow,g.receiveShadow=e.receiveShadow,a.add(g),R.objects[c]=g}else"DirectionalLight"===e.type||"PointLight"===e.type||"AmbientLight"===e.type?(H=void 0!==e.color?e.color:16777215,I=void 0!==e.intensity?e.intensity:1,"DirectionalLight"===e.type?(u=e.direction,J=new THREE.DirectionalLight(H,I),J.position.set(u[0],u[1],u[2]),e.target&&(P.push({object:J,targetName:e.target}),J.target=null)):"PointLight"===e.type?(u=e.position,A=e.distance,J=new THREE.PointLight(H,I,A),J.position.set(u[0],u[1],
|
|
e.castShadow,g.receiveShadow=e.receiveShadow,a.add(g),R.objects[c]=g}else"DirectionalLight"===e.type||"PointLight"===e.type||"AmbientLight"===e.type?(H=void 0!==e.color?e.color:16777215,I=void 0!==e.intensity?e.intensity:1,"DirectionalLight"===e.type?(u=e.direction,J=new THREE.DirectionalLight(H,I),J.position.set(u[0],u[1],u[2]),e.target&&(P.push({object:J,targetName:e.target}),J.target=null)):"PointLight"===e.type?(u=e.position,A=e.distance,J=new THREE.PointLight(H,I,A),J.position.set(u[0],u[1],
|
|
-u[2])):"AmbientLight"===e.type&&(J=new THREE.AmbientLight(H)),a.add(J),J.name=c,R.lights[c]=J,R.objects[c]=J):"PerspectiveCamera"===e.type||"OrthographicCamera"===e.type?("PerspectiveCamera"===e.type?G=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far):"OrthographicCamera"===e.type&&(G=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far)),u=e.position,G.position.set(u[0],u[1],u[2]),a.add(G),G.name=c,R.cameras[c]=G,R.objects[c]=G):(u=e.position,s=e.rotation,D=e.quaternion,
|
|
|
|
-z=e.scale,D=0,g=new THREE.Object3D,g.name=c,g.position.set(u[0],u[1],u[2]),D?(g.quaternion.set(D[0],D[1],D[2],D[3]),g.useQuaternion=!0):g.rotation.set(s[0],s[1],s[2]),g.scale.set(z[0],z[1],z[2]),g.visible=void 0!==e.visible?e.visible:!1,a.add(g),R.objects[c]=g,R.empties[c]=g);if(g){if(void 0!==e.properties)for(var n in e.properties)g.properties[n]=e.properties[n];void 0!==e.children&&f(g,e.children)}}}function g(a){return function(b){R.geometries[a]=b;e();O-=1;m.onLoadComplete();j()}}function h(a,
|
|
|
|
-b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,l=d.scale;f.position.set(g[0],g[1],g[2]);i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(l[0],l[1],l[2]);c&&f.traverse(function(a){a.material=c});b.add(f);R.objects[a]=f;e();O-=1;m.onLoadComplete();j()}}function i(a){return function(b){R.geometries[a]=b}}function j(){m.callbackProgress({totalModels:M,totalTextures:T,loadedModels:M-O,loadedTextures:T-
|
|
|
|
-N},R);m.onLoadProgress();if(0===O&&0===N){for(var a=0;a<P.length;a++){var c=P[a],d=R.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,R.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(R)}}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),l,o,p,q,t,r,A,u,s,D,z,w,v,C,E,G,L,B,J,H,I,O,N,M,T,R,P=[],S=a,$;for($ in this.geometryHandlerMap)a=this.geometryHandlerMap[$].loaderClass,this.geometryHandlerMap[$].loaderObject=new a;for($ in this.hierarchyHandlerMap)a=
|
|
|
|
|
|
+u[2])):"AmbientLight"===e.type&&(J=new THREE.AmbientLight(H)),a.add(J),J.name=c,R.lights[c]=J,R.objects[c]=J):"PerspectiveCamera"===e.type||"OrthographicCamera"===e.type?("PerspectiveCamera"===e.type?G=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far):"OrthographicCamera"===e.type&&(G=new THREE.OrthographicCamera(w.left,w.right,w.top,w.bottom,w.near,w.far)),u=e.position,G.position.set(u[0],u[1],u[2]),a.add(G),G.name=c,R.cameras[c]=G,R.objects[c]=G):(u=e.position,t=e.rotation,D=e.quaternion,
|
|
|
|
+z=e.scale,D=0,g=new THREE.Object3D,g.name=c,g.position.set(u[0],u[1],u[2]),D?(g.quaternion.set(D[0],D[1],D[2],D[3]),g.useQuaternion=!0):g.rotation.set(t[0],t[1],t[2]),g.scale.set(z[0],z[1],z[2]),g.visible=void 0!==e.visible?e.visible:!1,a.add(g),R.objects[c]=g,R.empties[c]=g);if(g){if(void 0!==e.properties)for(var n in e.properties)g.properties[n]=e.properties[n];void 0!==e.children&&f(g,e.children)}}}function g(a){return function(b){R.geometries[a]=b;e();O-=1;l.onLoadComplete();j()}}function h(a,
|
|
|
|
+b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,m=d.scale;f.position.set(g[0],g[1],g[2]);i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(m[0],m[1],m[2]);c&&f.traverse(function(a){a.material=c});b.add(f);R.objects[a]=f;e();O-=1;l.onLoadComplete();j()}}function i(a){return function(b){R.geometries[a]=b}}function j(){l.callbackProgress({totalModels:M,totalTextures:T,loadedModels:M-O,loadedTextures:T-
|
|
|
|
+N},R);l.onLoadProgress();if(0===O&&0===N){for(var a=0;a<P.length;a++){var c=P[a],d=R.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,R.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(R)}}var l=this,n=THREE.Loader.prototype.extractUrlBase(c),m,p,o,q,s,r,A,u,t,D,z,w,v,C,E,G,L,B,J,H,I,O,N,M,T,R,P=[],S=a,$;for($ in this.geometryHandlerMap)a=this.geometryHandlerMap[$].loaderClass,this.geometryHandlerMap[$].loaderObject=new a;for($ in this.hierarchyHandlerMap)a=
|
|
this.hierarchyHandlerMap[$].loaderClass,this.hierarchyHandlerMap[$].loaderObject=new a;N=O=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(S.transform&&($=S.transform.position,a=S.transform.rotation,c=S.transform.scale,$&&R.scene.position.set($[0],$[1],$[2]),a&&R.scene.rotation.set(a[0],a[1],a[2]),c&&R.scene.scale.set(c[0],c[1],c[2]),$||a||c))R.scene.updateMatrix(),R.scene.updateMatrixWorld();$=function(a){return function(){N-=
|
|
this.hierarchyHandlerMap[$].loaderClass,this.hierarchyHandlerMap[$].loaderObject=new a;N=O=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(S.transform&&($=S.transform.position,a=S.transform.rotation,c=S.transform.scale,$&&R.scene.position.set($[0],$[1],$[2]),a&&R.scene.rotation.set(a[0],a[1],a[2]),c&&R.scene.scale.set(c[0],c[1],c[2]),$||a||c))R.scene.updateMatrix(),R.scene.updateMatrixWorld();$=function(a){return function(){N-=
|
|
-a;j();m.onLoadComplete()}};for(p in S.fogs)a=S.fogs[p],"linear"===a.type?L=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(L=new THREE.FogExp2(0,a.density)),w=a.color,L.color.setRGB(w[0],w[1],w[2]),R.fogs[p]=L;for(l in S.geometries)t=S.geometries[l],t.type in this.geometryHandlerMap&&(O+=1,m.onLoadStart());for(var K in S.objects)p=S.objects[K],p.type&&p.type in this.hierarchyHandlerMap&&(O+=1,m.onLoadStart());M=O;for(l in S.geometries)if(t=S.geometries[l],"cube"===t.type)C=new THREE.CubeGeometry(t.width,
|
|
|
|
-t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments,null,t.flipped,t.sides),R.geometries[l]=C;else if("plane"===t.type)C=new THREE.PlaneGeometry(t.width,t.height,t.widthSegments,t.heightSegments),R.geometries[l]=C;else if("sphere"===t.type)C=new THREE.SphereGeometry(t.radius,t.widthSegments,t.heightSegments),R.geometries[l]=C;else if("cylinder"===t.type)C=new THREE.CylinderGeometry(t.topRad,t.botRad,t.height,t.radSegs,t.heightSegs),R.geometries[l]=C;else if("torus"===t.type)C=new THREE.TorusGeometry(t.radius,
|
|
|
|
-t.tube,t.segmentsR,t.segmentsT),R.geometries[l]=C;else if("icosahedron"===t.type)C=new THREE.IcosahedronGeometry(t.radius,t.subdivisions),R.geometries[l]=C;else if(t.type in this.geometryHandlerMap){K={};for(B in t)"type"!==B&&"url"!==B&&(K[B]=t[B]);this.geometryHandlerMap[t.type].loaderObject.load(d(t.url,S.urlBaseType),g(l),K)}else"embedded"===t.type&&(K=S.embeds[t.id],K.metadata=S.metadata,K&&this.geometryHandlerMap.ascii.loaderObject.createModel(K,i(l),""));for(q in S.textures)if(l=S.textures[q],
|
|
|
|
-l.url instanceof Array){N+=l.url.length;for(B=0;B<l.url.length;B++)m.onLoadStart()}else N+=1,m.onLoadStart();T=N;for(q in S.textures){l=S.textures[q];void 0!==l.mapping&&void 0!==THREE[l.mapping]&&(l.mapping=new THREE[l.mapping]);if(l.url instanceof Array){K=l.url.length;p=[];for(B=0;B<K;B++)p[B]=d(l.url[B],S.urlBaseType);B=(B=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,l.mapping,$(K)):THREE.ImageUtils.loadTextureCube(p,l.mapping,$(K))}else{B=l.url.toLowerCase().endsWith(".dds");
|
|
|
|
-K=d(l.url,S.urlBaseType);p=$(1);B=B?THREE.ImageUtils.loadCompressedTexture(K,l.mapping,p):THREE.ImageUtils.loadTexture(K,l.mapping,p);void 0!==THREE[l.minFilter]&&(B.minFilter=THREE[l.minFilter]);void 0!==THREE[l.magFilter]&&(B.magFilter=THREE[l.magFilter]);l.anisotropy&&(B.anisotropy=l.anisotropy);if(l.repeat&&(B.repeat.set(l.repeat[0],l.repeat[1]),1!==l.repeat[0]&&(B.wrapS=THREE.RepeatWrapping),1!==l.repeat[1]))B.wrapT=THREE.RepeatWrapping;l.offset&&B.offset.set(l.offset[0],l.offset[1]);if(l.wrap&&
|
|
|
|
-(K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==K[l.wrap[0]]&&(B.wrapS=K[l.wrap[0]]),void 0!==K[l.wrap[1]]))B.wrapT=K[l.wrap[1]]}R.textures[q]=B}for(o in S.materials){r=S.materials[o];for(v in r.parameters)"envMap"===v||"map"===v||"lightMap"===v||"bumpMap"===v?r.parameters[v]=R.textures[r.parameters[v]]:"shading"===v?r.parameters[v]="flat"===r.parameters[v]?THREE.FlatShading:THREE.SmoothShading:"side"===v?r.parameters[v]="double"==r.parameters[v]?THREE.DoubleSide:"back"==
|
|
|
|
|
|
+a;j();l.onLoadComplete()}};for(o in S.fogs)a=S.fogs[o],"linear"===a.type?L=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(L=new THREE.FogExp2(0,a.density)),w=a.color,L.color.setRGB(w[0],w[1],w[2]),R.fogs[o]=L;for(m in S.geometries)s=S.geometries[m],s.type in this.geometryHandlerMap&&(O+=1,l.onLoadStart());for(var K in S.objects)o=S.objects[K],o.type&&o.type in this.hierarchyHandlerMap&&(O+=1,l.onLoadStart());M=O;for(m in S.geometries)if(s=S.geometries[m],"cube"===s.type)C=new THREE.CubeGeometry(s.width,
|
|
|
|
+s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments,null,s.flipped,s.sides),R.geometries[m]=C;else if("plane"===s.type)C=new THREE.PlaneGeometry(s.width,s.height,s.widthSegments,s.heightSegments),R.geometries[m]=C;else if("sphere"===s.type)C=new THREE.SphereGeometry(s.radius,s.widthSegments,s.heightSegments),R.geometries[m]=C;else if("cylinder"===s.type)C=new THREE.CylinderGeometry(s.topRad,s.botRad,s.height,s.radSegs,s.heightSegs),R.geometries[m]=C;else if("torus"===s.type)C=new THREE.TorusGeometry(s.radius,
|
|
|
|
+s.tube,s.segmentsR,s.segmentsT),R.geometries[m]=C;else if("icosahedron"===s.type)C=new THREE.IcosahedronGeometry(s.radius,s.subdivisions),R.geometries[m]=C;else if(s.type in this.geometryHandlerMap){K={};for(B in s)"type"!==B&&"url"!==B&&(K[B]=s[B]);this.geometryHandlerMap[s.type].loaderObject.load(d(s.url,S.urlBaseType),g(m),K)}else"embedded"===s.type&&(K=S.embeds[s.id],K.metadata=S.metadata,K&&this.geometryHandlerMap.ascii.loaderObject.createModel(K,i(m),""));for(q in S.textures)if(m=S.textures[q],
|
|
|
|
+m.url instanceof Array){N+=m.url.length;for(B=0;B<m.url.length;B++)l.onLoadStart()}else N+=1,l.onLoadStart();T=N;for(q in S.textures){m=S.textures[q];void 0!==m.mapping&&void 0!==THREE[m.mapping]&&(m.mapping=new THREE[m.mapping]);if(m.url instanceof Array){K=m.url.length;o=[];for(B=0;B<K;B++)o[B]=d(m.url[B],S.urlBaseType);B=(B=o[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(o,m.mapping,$(K)):THREE.ImageUtils.loadTextureCube(o,m.mapping,$(K))}else{B=m.url.toLowerCase().endsWith(".dds");
|
|
|
|
+K=d(m.url,S.urlBaseType);o=$(1);B=B?THREE.ImageUtils.loadCompressedTexture(K,m.mapping,o):THREE.ImageUtils.loadTexture(K,m.mapping,o);void 0!==THREE[m.minFilter]&&(B.minFilter=THREE[m.minFilter]);void 0!==THREE[m.magFilter]&&(B.magFilter=THREE[m.magFilter]);m.anisotropy&&(B.anisotropy=m.anisotropy);if(m.repeat&&(B.repeat.set(m.repeat[0],m.repeat[1]),1!==m.repeat[0]&&(B.wrapS=THREE.RepeatWrapping),1!==m.repeat[1]))B.wrapT=THREE.RepeatWrapping;m.offset&&B.offset.set(m.offset[0],m.offset[1]);if(m.wrap&&
|
|
|
|
+(K={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==K[m.wrap[0]]&&(B.wrapS=K[m.wrap[0]]),void 0!==K[m.wrap[1]]))B.wrapT=K[m.wrap[1]]}R.textures[q]=B}for(p in S.materials){r=S.materials[p];for(v in r.parameters)"envMap"===v||"map"===v||"lightMap"===v||"bumpMap"===v?r.parameters[v]=R.textures[r.parameters[v]]:"shading"===v?r.parameters[v]="flat"===r.parameters[v]?THREE.FlatShading:THREE.SmoothShading:"side"===v?r.parameters[v]="double"==r.parameters[v]?THREE.DoubleSide:"back"==
|
|
r.parameters[v]?THREE.BackSide:THREE.FrontSide:"blending"===v?r.parameters[v]=r.parameters[v]in THREE?THREE[r.parameters[v]]:THREE.NormalBlending:"combine"===v?r.parameters[v]="MixOperation"==r.parameters[v]?THREE.MixOperation:THREE.MultiplyOperation:"vertexColors"===v?"face"==r.parameters[v]?r.parameters[v]=THREE.FaceColors:r.parameters[v]&&(r.parameters[v]=THREE.VertexColors):"wrapRGB"===v&&(q=r.parameters[v],r.parameters[v]=new THREE.Vector3(q[0],q[1],q[2]));void 0!==r.parameters.opacity&&1>r.parameters.opacity&&
|
|
r.parameters[v]?THREE.BackSide:THREE.FrontSide:"blending"===v?r.parameters[v]=r.parameters[v]in THREE?THREE[r.parameters[v]]:THREE.NormalBlending:"combine"===v?r.parameters[v]="MixOperation"==r.parameters[v]?THREE.MixOperation:THREE.MultiplyOperation:"vertexColors"===v?"face"==r.parameters[v]?r.parameters[v]=THREE.FaceColors:r.parameters[v]&&(r.parameters[v]=THREE.VertexColors):"wrapRGB"===v&&(q=r.parameters[v],r.parameters[v]=new THREE.Vector3(q[0],q[1],q[2]));void 0!==r.parameters.opacity&&1>r.parameters.opacity&&
|
|
-(r.parameters.transparent=!0);r.parameters.normalMap?(q=THREE.ShaderUtils.lib.normal,$=THREE.UniformsUtils.clone(q.uniforms),l=r.parameters.color,B=r.parameters.specular,K=r.parameters.ambient,p=r.parameters.shininess,$.tNormal.value=R.textures[r.parameters.normalMap],r.parameters.normalScale&&$.uNormalScale.value.set(r.parameters.normalScale[0],r.parameters.normalScale[1]),r.parameters.map&&($.tDiffuse.value=r.parameters.map,$.enableDiffuse.value=!0),r.parameters.envMap&&($.tCube.value=r.parameters.envMap,
|
|
|
|
|
|
+(r.parameters.transparent=!0);r.parameters.normalMap?(q=THREE.ShaderUtils.lib.normal,$=THREE.UniformsUtils.clone(q.uniforms),m=r.parameters.color,B=r.parameters.specular,K=r.parameters.ambient,o=r.parameters.shininess,$.tNormal.value=R.textures[r.parameters.normalMap],r.parameters.normalScale&&$.uNormalScale.value.set(r.parameters.normalScale[0],r.parameters.normalScale[1]),r.parameters.map&&($.tDiffuse.value=r.parameters.map,$.enableDiffuse.value=!0),r.parameters.envMap&&($.tCube.value=r.parameters.envMap,
|
|
$.enableReflection.value=!0,$.uReflectivity.value=r.parameters.reflectivity),r.parameters.lightMap&&($.tAO.value=r.parameters.lightMap,$.enableAO.value=!0),r.parameters.specularMap&&($.tSpecular.value=R.textures[r.parameters.specularMap],$.enableSpecular.value=!0),r.parameters.displacementMap&&($.tDisplacement.value=R.textures[r.parameters.displacementMap],$.enableDisplacement.value=!0,$.uDisplacementBias.value=r.parameters.displacementBias,$.uDisplacementScale.value=r.parameters.displacementScale),
|
|
$.enableReflection.value=!0,$.uReflectivity.value=r.parameters.reflectivity),r.parameters.lightMap&&($.tAO.value=r.parameters.lightMap,$.enableAO.value=!0),r.parameters.specularMap&&($.tSpecular.value=R.textures[r.parameters.specularMap],$.enableSpecular.value=!0),r.parameters.displacementMap&&($.tDisplacement.value=R.textures[r.parameters.displacementMap],$.enableDisplacement.value=!0,$.uDisplacementBias.value=r.parameters.displacementBias,$.uDisplacementScale.value=r.parameters.displacementScale),
|
|
-$.uDiffuseColor.value.setHex(l),$.uSpecularColor.value.setHex(B),$.uAmbientColor.value.setHex(K),$.uShininess.value=p,r.parameters.opacity&&($.uOpacity.value=r.parameters.opacity),E=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:$,lights:!0,fog:!0})):E=new THREE[r.type](r.parameters);R.materials[o]=E}e();R.cameras&&S.defaults.camera&&(R.currentCamera=R.cameras[S.defaults.camera]);R.fogs&&S.defaults.fog&&(R.scene.fog=R.fogs[S.defaults.fog]);w=S.defaults.bgcolor;
|
|
|
|
-R.bgColor=new THREE.Color;R.bgColor.setRGB(w[0],w[1],w[2]);R.bgColorAlpha=S.defaults.bgalpha;m.callbackSync(R);j()};THREE.TextureLoader=function(){THREE.EventTarget.call(this);this.crossOrigin=null};
|
|
|
|
|
|
+$.uDiffuseColor.value.setHex(m),$.uSpecularColor.value.setHex(B),$.uAmbientColor.value.setHex(K),$.uShininess.value=o,r.parameters.opacity&&($.uOpacity.value=r.parameters.opacity),E=new THREE.ShaderMaterial({fragmentShader:q.fragmentShader,vertexShader:q.vertexShader,uniforms:$,lights:!0,fog:!0})):E=new THREE[r.type](r.parameters);R.materials[p]=E}e();R.cameras&&S.defaults.camera&&(R.currentCamera=R.cameras[S.defaults.camera]);R.fogs&&S.defaults.fog&&(R.scene.fog=R.fogs[S.defaults.fog]);w=S.defaults.bgcolor;
|
|
|
|
+R.bgColor=new THREE.Color;R.bgColor.setRGB(w[0],w[1],w[2]);R.bgColorAlpha=S.defaults.bgalpha;l.callbackSync(R);j()};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.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=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.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}}};
|
|
@@ -277,34 +277,34 @@ 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.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
THREE.Scene.prototype.__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.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};
|
|
THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};
|
|
-THREE.CanvasRenderer=function(a){function b(a){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){s!==a&&(s=q.strokeStyle=a)}function e(a){D!==a&&(D=q.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,m=void 0!==a.canvas?a.canvas:
|
|
|
|
-document.createElement("canvas"),n,l,o,p,q=m.getContext("2d"),t=new THREE.Color(0),r=0,A=1,u=0,s=null,D=null,z=null,w=null,v=null,C,E,G,L,B=new THREE.RenderableVertex,J=new THREE.RenderableVertex,H,I,O,N,M,T,R,P,S,$,K,ja,Q=new THREE.Color,ha=new THREE.Color,da=new THREE.Color,Y=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,ia=new THREE.Color,ya={},Na={},za,Oa,Aa,pa,xb,Va,fb,kb,Bb,Cb,eb=new THREE.Rectangle,Ra=new THREE.Rectangle,Ia=new THREE.Rectangle,lb=!1,La=new THREE.Color,$a=new THREE.Color,
|
|
|
|
-db=new THREE.Color,ka=new THREE.Vector3,ab,bb,mb,ua,gb,qb,a=16;ab=document.createElement("canvas");ab.width=ab.height=2;bb=ab.getContext("2d");bb.fillStyle="rgba(0,0,0,1)";bb.fillRect(0,0,2,2);mb=bb.getImageData(0,0,2,2);ua=mb.data;gb=document.createElement("canvas");gb.width=gb.height=a;qb=gb.getContext("2d");qb.translate(-a/2,-a/2);qb.scale(a,a);a--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a;l=b;o=
|
|
|
|
-Math.floor(n/2);p=Math.floor(l/2);m.width=n;m.height=l;eb.set(-o,-p,o,p);Ra.set(-o,-p,o,p);A=1;u=0;v=w=z=D=s=null};this.setClearColor=function(a,b){t.copy(a);r=void 0!==b?b:1;Ra.set(-o,-p,o,p)};this.setClearColorHex=function(a,b){t.setHex(a);r=void 0!==b?b:1;Ra.set(-o,-p,o,p)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){q.setTransform(1,0,0,-1,o,p);!1===Ra.isEmpty()&&(Ra.minSelf(eb),Ra.inflate(2),1>r&&q.clearRect(Math.floor(Ra.getX()),Math.floor(Ra.getY()),Math.floor(Ra.getWidth()),
|
|
|
|
-Math.floor(Ra.getHeight())),0<r&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*t.r)+","+Math.floor(255*t.g)+","+Math.floor(255*t.b)+","+r+")"),q.fillRect(Math.floor(Ra.getX()),Math.floor(Ra.getY()),Math.floor(Ra.getWidth()),Math.floor(Ra.getHeight()))),Ra.empty())};this.render=function(a,m){function l(a,b,c){for(var d=0,e=i.length;d<e;d++){var f=i[d],g=f.color;if(f instanceof THREE.DirectionalLight){var h=f.matrixWorld.getPosition().normalize(),k=b.dot(h);0>=k||(k*=f.intensity,c.r+=g.r*k,
|
|
|
|
|
|
+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){t!==a&&(t=q.strokeStyle=a)}function e(a){D!==a&&(D=q.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,j=new THREE.Projector,l=void 0!==a.canvas?a.canvas:
|
|
|
|
+document.createElement("canvas"),n,m,p,o,q=l.getContext("2d"),s=new THREE.Color(0),r=0,A=1,u=0,t=null,D=null,z=null,w=null,v=null,C,E,G,L,B=new THREE.RenderableVertex,J=new THREE.RenderableVertex,H,I,O,N,M,T,R,P,S,$,K,ja,Q=new THREE.Color,ha=new THREE.Color,da=new THREE.Color,Y=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,ia=new THREE.Color,ya={},Na={},za,Oa,Aa,pa,xb,Va,fb,kb,Bb,Cb,eb=new THREE.Rectangle,Ra=new THREE.Rectangle,Ia=new THREE.Rectangle,lb=!1,La=new THREE.Color,$a=new THREE.Color,
|
|
|
|
+db=new THREE.Color,ka=new THREE.Vector3,ab,bb,mb,ua,gb,qb,a=16;ab=document.createElement("canvas");ab.width=ab.height=2;bb=ab.getContext("2d");bb.fillStyle="rgba(0,0,0,1)";bb.fillRect(0,0,2,2);mb=bb.getImageData(0,0,2,2);ua=mb.data;gb=document.createElement("canvas");gb.width=gb.height=a;qb=gb.getContext("2d");qb.translate(-a/2,-a/2);qb.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;p=
|
|
|
|
+Math.floor(n/2);o=Math.floor(m/2);l.width=n;l.height=m;eb.set(-p,-o,p,o);Ra.set(-p,-o,p,o);A=1;u=0;v=w=z=D=t=null};this.setClearColor=function(a,b){s.copy(a);r=void 0!==b?b:1;Ra.set(-p,-o,p,o)};this.setClearColorHex=function(a,b){s.setHex(a);r=void 0!==b?b:1;Ra.set(-p,-o,p,o)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){q.setTransform(1,0,0,-1,p,o);!1===Ra.isEmpty()&&(Ra.minSelf(eb),Ra.inflate(2),1>r&&q.clearRect(Math.floor(Ra.getX()),Math.floor(Ra.getY()),Math.floor(Ra.getWidth()),
|
|
|
|
+Math.floor(Ra.getHeight())),0<r&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*s.r)+","+Math.floor(255*s.g)+","+Math.floor(255*s.b)+","+r+")"),q.fillRect(Math.floor(Ra.getX()),Math.floor(Ra.getY()),Math.floor(Ra.getWidth()),Math.floor(Ra.getHeight()))),Ra.empty())};this.render=function(a,l){function m(a,b,c){for(var d=0,e=i.length;d<e;d++){var f=i[d],g=f.color;if(f instanceof THREE.DirectionalLight){var h=f.matrixWorld.getPosition().normalize(),k=b.dot(h);0>=k||(k*=f.intensity,c.r+=g.r*k,
|
|
c.g+=g.g*k,c.b+=g.b*k)}else f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),k=b.dot(ka.sub(h,a).normalize()),0>=k||(k*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=k&&(k*=f.intensity,c.r+=g.r*k,c.g+=g.g*k,c.b+=g.b*k)))}}function n(a,d,e,g,h,k,i,j){f.info.render.vertices+=3;f.info.render.faces++;b(j.opacity);c(j.blending);H=a.positionScreen.x;I=a.positionScreen.y;O=d.positionScreen.x;N=d.positionScreen.y;M=e.positionScreen.x;T=e.positionScreen.y;r(H,I,O,N,M,T);(j instanceof
|
|
c.g+=g.g*k,c.b+=g.b*k)}else f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),k=b.dot(ka.sub(h,a).normalize()),0>=k||(k*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=k&&(k*=f.intensity,c.r+=g.r*k,c.g+=g.g*k,c.b+=g.b*k)))}}function n(a,d,e,g,h,k,i,j){f.info.render.vertices+=3;f.info.render.faces++;b(j.opacity);c(j.blending);H=a.positionScreen.x;I=a.positionScreen.y;O=d.positionScreen.x;N=d.positionScreen.y;M=e.positionScreen.x;T=e.positionScreen.y;r(H,I,O,N,M,T);(j instanceof
|
|
-THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)&&null===j.map&&null===j.map?(ba.copy(j.color),ia.copy(j.emissive),j.vertexColors===THREE.FaceColors&&(ba.r*=i.color.r,ba.g*=i.color.g,ba.b*=i.color.b),!0===lb)?!1===j.wireframe&&j.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(ha.r=da.r=Y.r=La.r,ha.g=da.g=Y.g=La.g,ha.b=da.b=Y.b=La.b,l(i.v1.positionWorld,i.vertexNormalsWorld[0],ha),l(i.v2.positionWorld,i.vertexNormalsWorld[1],da),l(i.v3.positionWorld,i.vertexNormalsWorld[2],
|
|
|
|
-Y),ha.r=ha.r*ba.r+ia.r,ha.g=ha.g*ba.g+ia.g,ha.b=ha.b*ba.b+ia.b,da.r=da.r*ba.r+ia.r,da.g=da.g*ba.g+ia.g,da.b=da.b*ba.b+ia.b,Y.r=Y.r*ba.r+ia.r,Y.g=Y.g*ba.g+ia.g,Y.b=Y.b*ba.b+ia.b,aa.r=0.5*(da.r+Y.r),aa.g=0.5*(da.g+Y.g),aa.b=0.5*(da.b+Y.b),Aa=wc(ha,da,Y,aa),ma(H,I,O,N,M,T,0,0,1,0,0,1,Aa)):(Q.r=La.r,Q.g=La.g,Q.b=La.b,l(i.centroidWorld,i.normalWorld,Q),Q.r=Q.r*ba.r+ia.r,Q.g=Q.g*ba.g+ia.g,Q.b=Q.b*ba.b+ia.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&&(pa=i.uvs[0],A(H,I,O,N,M,T,pa[g].u,pa[g].v,pa[h].u,pa[h].v,pa[k].u,pa[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=m.matrixWorldInverse,ka.copy(i.vertexNormalsWorld[g]),xb=0.5*(ka.x*a.elements[0]+ka.y*
|
|
|
|
|
|
+THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial)&&null===j.map&&null===j.map?(ba.copy(j.color),ia.copy(j.emissive),j.vertexColors===THREE.FaceColors&&(ba.r*=i.color.r,ba.g*=i.color.g,ba.b*=i.color.b),!0===lb)?!1===j.wireframe&&j.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(ha.r=da.r=Y.r=La.r,ha.g=da.g=Y.g=La.g,ha.b=da.b=Y.b=La.b,m(i.v1.positionWorld,i.vertexNormalsWorld[0],ha),m(i.v2.positionWorld,i.vertexNormalsWorld[1],da),m(i.v3.positionWorld,i.vertexNormalsWorld[2],
|
|
|
|
+Y),ha.r=ha.r*ba.r+ia.r,ha.g=ha.g*ba.g+ia.g,ha.b=ha.b*ba.b+ia.b,da.r=da.r*ba.r+ia.r,da.g=da.g*ba.g+ia.g,da.b=da.b*ba.b+ia.b,Y.r=Y.r*ba.r+ia.r,Y.g=Y.g*ba.g+ia.g,Y.b=Y.b*ba.b+ia.b,aa.r=0.5*(da.r+Y.r),aa.g=0.5*(da.g+Y.g),aa.b=0.5*(da.b+Y.b),Aa=wc(ha,da,Y,aa),ma(H,I,O,N,M,T,0,0,1,0,0,1,Aa)):(Q.r=La.r,Q.g=La.g,Q.b=La.b,m(i.centroidWorld,i.normalWorld,Q),Q.r=Q.r*ba.r+ia.r,Q.g=Q.g*ba.g+ia.g,Q.b=Q.b*ba.b+ia.b,!0===j.wireframe?t(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q)):!0===j.wireframe?
|
|
|
|
+t(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&&(pa=i.uvs[0],A(H,I,O,N,M,T,pa[g].u,pa[g].v,pa[h].u,pa[h].v,pa[k].u,pa[k].v,j.map)):null!==j.envMap?j.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(a=l.matrixWorldInverse,ka.copy(i.vertexNormalsWorld[g]),xb=0.5*(ka.x*a.elements[0]+ka.y*
|
|
a.elements[4]+ka.z*a.elements[8])+0.5,Va=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[h]),fb=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,kb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[k]),Bb=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,Cb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,A(H,I,O,N,M,T,xb,Va,fb,kb,Bb,Cb,j.envMap)):(Q.copy(j.color),
|
|
a.elements[4]+ka.z*a.elements[8])+0.5,Va=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[h]),fb=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,kb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,ka.copy(i.vertexNormalsWorld[k]),Bb=0.5*(ka.x*a.elements[0]+ka.y*a.elements[4]+ka.z*a.elements[8])+0.5,Cb=0.5*(ka.x*a.elements[1]+ka.y*a.elements[5]+ka.z*a.elements[9])+0.5,A(H,I,O,N,M,T,xb,Va,fb,kb,Bb,Cb,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?(za=m.near,Oa=m.far,ha.r=ha.g=ha.b=1-nb(a.positionScreen.z,za,Oa),da.r=da.g=da.b=1-nb(d.positionScreen.z,za,Oa),Y.r=Y.g=Y.b=1-nb(e.positionScreen.z,za,Oa),aa.r=0.5*(da.r+Y.r),aa.g=0.5*(da.g+Y.g),aa.b=0.5*(da.b+Y.b),Aa=wc(ha,da,Y,aa),ma(H,I,O,N,M,T,0,0,1,0,0,1,Aa)):j instanceof THREE.MeshNormalMaterial&&
|
|
|
|
-(Q.r=gc(i.normalWorld.x),Q.g=gc(i.normalWorld.y),Q.b=gc(i.normalWorld.z),!0===j.wireframe?s(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q))}function r(a,b,c,d,e,f){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.closePath()}function t(a,b,c,d,e,f,g,h){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.lineTo(g,h);q.closePath()}function s(a,b,c,e){z!==b&&(z=q.lineWidth=b);w!==c&&(w=q.lineCap=c);v!==e&&(v=q.lineJoin=e);d(a.getContextStyle());q.stroke();Ia.inflate(2*
|
|
|
|
|
|
+j.vertexColors===THREE.FaceColors&&(Q.r*=i.color.r,Q.g*=i.color.g,Q.b*=i.color.b),!0===j.wireframe?t(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q)):j instanceof THREE.MeshDepthMaterial?(za=l.near,Oa=l.far,ha.r=ha.g=ha.b=1-nb(a.positionScreen.z,za,Oa),da.r=da.g=da.b=1-nb(d.positionScreen.z,za,Oa),Y.r=Y.g=Y.b=1-nb(e.positionScreen.z,za,Oa),aa.r=0.5*(da.r+Y.r),aa.g=0.5*(da.g+Y.g),aa.b=0.5*(da.b+Y.b),Aa=wc(ha,da,Y,aa),ma(H,I,O,N,M,T,0,0,1,0,0,1,Aa)):j instanceof THREE.MeshNormalMaterial&&
|
|
|
|
+(Q.r=gc(i.normalWorld.x),Q.g=gc(i.normalWorld.y),Q.b=gc(i.normalWorld.z),!0===j.wireframe?t(Q,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):u(Q))}function r(a,b,c,d,e,f){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.closePath()}function s(a,b,c,d,e,f,g,h){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.lineTo(g,h);q.closePath()}function t(a,b,c,e){z!==b&&(z=q.lineWidth=b);w!==c&&(w=q.lineCap=c);v!==e&&(v=q.lineJoin=e);d(a.getContextStyle());q.stroke();Ia.inflate(2*
|
|
b)}function u(a){e(a.getContextStyle());q.fill()}function A(a,b,c,d,f,g,h,k,i,j,l,m,ma){if(!(ma instanceof THREE.DataTexture||void 0===ma.image||0==ma.image.width)){if(!0===ma.needsUpdate){var n=ma.wrapS==THREE.RepeatWrapping,nb=ma.wrapT==THREE.RepeatWrapping;ya[ma.id]=q.createPattern(ma.image,!0===n&&!0===nb?"repeat":!0===n&&!1===nb?"repeat-x":!1===n&&!0===nb?"repeat-y":"no-repeat");ma.needsUpdate=!1}void 0===ya[ma.id]?e("rgba(0,0,0,1)"):e(ya[ma.id]);var n=ma.offset.x/ma.repeat.x,nb=ma.offset.y/
|
|
b)}function u(a){e(a.getContextStyle());q.fill()}function A(a,b,c,d,f,g,h,k,i,j,l,m,ma){if(!(ma instanceof THREE.DataTexture||void 0===ma.image||0==ma.image.width)){if(!0===ma.needsUpdate){var n=ma.wrapS==THREE.RepeatWrapping,nb=ma.wrapT==THREE.RepeatWrapping;ya[ma.id]=q.createPattern(ma.image,!0===n&&!0===nb?"repeat":!0===n&&!1===nb?"repeat-x":!1===n&&!0===nb?"repeat-y":"no-repeat");ma.needsUpdate=!1}void 0===ya[ma.id]?e("rgba(0,0,0,1)"):e(ya[ma.id]);var n=ma.offset.x/ma.repeat.x,nb=ma.offset.y/
|
|
ma.repeat.y,o=ma.image.width*ma.repeat.x,p=ma.image.height*ma.repeat.y,h=(h+n)*o,k=(1-k+nb)*p,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+n)*o-h,j=(1-j+nb)*p-k,l=(l+n)*o-h,m=(1-m+nb)*p-k,n=i*m-l*j;0===n?(void 0===Na[ma.id]&&(b=document.createElement("canvas"),b.width=ma.image.width,b.height=ma.image.height,b=b.getContext("2d"),b.drawImage(ma.image,0,0),Na[ma.id]=b.getImageData(0,0,ma.image.width,ma.image.height).data),b=Na[ma.id],h=4*(Math.floor(h)+Math.floor(k)*ma.image.width),Q.setRGB(b[h]/255,b[h+1]/255,b[h+
|
|
ma.repeat.y,o=ma.image.width*ma.repeat.x,p=ma.image.height*ma.repeat.y,h=(h+n)*o,k=(1-k+nb)*p,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+n)*o-h,j=(1-j+nb)*p-k,l=(l+n)*o-h,m=(1-m+nb)*p-k,n=i*m-l*j;0===n?(void 0===Na[ma.id]&&(b=document.createElement("canvas"),b.width=ma.image.width,b.height=ma.image.height,b=b.getContext("2d"),b.drawImage(ma.image,0,0),Na[ma.id]=b.getImageData(0,0,ma.image.width,ma.image.height).data),b=Na[ma.id],h=4*(Math.floor(h)+Math.floor(k)*ma.image.width),Q.setRGB(b[h]/255,b[h+1]/255,b[h+
|
|
2]/255),u(Q)):(n=1/n,ma=(m*c-j*f)*n,j=(m*d-j*g)*n,c=(i*f-l*c)*n,d=(i*g-l*d)*n,a=a-ma*h-c*k,h=b-j*h-d*k,q.save(),q.transform(ma,j,c,d,a,h),q.fill(),q.restore())}}function ma(a,b,c,d,e,f,g,h,k,i,j,l,m){var ma,n;ma=m.width-1;n=m.height-1;g*=ma;h*=n;c-=a;d-=b;e-=a;f-=b;k=k*ma-g;i=i*n-h;j=j*ma-g;l=l*n-h;n=1/(k*l-j*i);ma=(l*c-i*e)*n;i=(l*d-i*f)*n;c=(k*e-j*c)*n;d=(k*f-j*d)*n;a=a-ma*g-c*h;b=b-i*g-d*h;q.save();q.transform(ma,i,c,d,a,b);q.clip();q.drawImage(m,0,0);q.restore()}function wc(a,b,c,d){ua[0]=255*
|
|
2]/255),u(Q)):(n=1/n,ma=(m*c-j*f)*n,j=(m*d-j*g)*n,c=(i*f-l*c)*n,d=(i*g-l*d)*n,a=a-ma*h-c*k,h=b-j*h-d*k,q.save(),q.transform(ma,j,c,d,a,h),q.fill(),q.restore())}}function ma(a,b,c,d,e,f,g,h,k,i,j,l,m){var ma,n;ma=m.width-1;n=m.height-1;g*=ma;h*=n;c-=a;d-=b;e-=a;f-=b;k=k*ma-g;i=i*n-h;j=j*ma-g;l=l*n-h;n=1/(k*l-j*i);ma=(l*c-i*e)*n;i=(l*d-i*f)*n;c=(k*e-j*c)*n;d=(k*f-j*d)*n;a=a-ma*g-c*h;b=b-i*g-d*h;q.save();q.transform(ma,i,c,d,a,b);q.clip();q.drawImage(m,0,0);q.restore()}function wc(a,b,c,d){ua[0]=255*
|
|
-a.r|0;ua[1]=255*a.g|0;ua[2]=255*a.b|0;ua[4]=255*b.r|0;ua[5]=255*b.g|0;ua[6]=255*b.b|0;ua[8]=255*c.r|0;ua[9]=255*c.g|0;ua[10]=255*c.b|0;ua[12]=255*d.r|0;ua[13]=255*d.g|0;ua[14]=255*d.b|0;bb.putImageData(mb,0,0);qb.drawImage(ab,0,0);return gb}function nb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function gc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Xb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
|
-else{var Yb,xc,na,ea;!0===this.autoClear?this.clear():q.setTransform(1,0,0,-1,o,p);f.info.render.vertices=0;f.info.render.faces=0;g=j.projectScene(a,m,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;lb=0<i.length;if(!0===lb){La.setRGB(0,0,0);$a.setRGB(0,0,0);db.setRGB(0,0,0);Yb=0;for(xc=i.length;Yb<xc;Yb++){ea=i[Yb];var oa=ea.color;ea instanceof THREE.AmbientLight?(La.r+=oa.r,La.g+=oa.g,La.b+=oa.b):ea instanceof THREE.DirectionalLight?($a.r+=oa.r,$a.g+=oa.g,$a.b+=oa.b):ea instanceof THREE.PointLight&&
|
|
|
|
-(db.r+=oa.r,db.g+=oa.g,db.b+=oa.b)}}Yb=0;for(xc=h.length;Yb<xc;Yb++)if(na=h[Yb],ea=na.material,!(void 0===ea||!1===ea.visible)){Ia.empty();if(na instanceof THREE.RenderableParticle){C=na;C.x*=o;C.y*=p;var oa=C,D=na;b(ea.opacity);c(ea.blending);var zb=void 0,Ab=void 0,rb=void 0,sb=void 0,hc=na=void 0,Pc=void 0;ea instanceof THREE.ParticleBasicMaterial?null===ea.map?(rb=D.object.scale.x,sb=D.object.scale.y,rb*=D.scale.x*o,sb*=D.scale.y*p,Ia.set(oa.x-rb,oa.y-sb,oa.x+rb,oa.y+sb),!1!==eb.intersects(Ia)&&
|
|
|
|
-(e(ea.color.getContextStyle()),q.save(),q.translate(oa.x,oa.y),q.rotate(-D.rotation),q.scale(rb,sb),q.fillRect(-1,-1,2,2),q.restore())):(na=ea.map.image,hc=na.width>>1,Pc=na.height>>1,rb=D.scale.x*o,sb=D.scale.y*p,zb=rb*hc,Ab=sb*Pc,Ia.set(oa.x-zb,oa.y-Ab,oa.x+zb,oa.y+Ab),!1!==eb.intersects(Ia)&&(q.save(),q.translate(oa.x,oa.y),q.rotate(-D.rotation),q.scale(rb,-sb),q.translate(-hc,-Pc),q.drawImage(na,0,0),q.restore())):ea instanceof THREE.ParticleCanvasMaterial&&(zb=D.scale.x*o,Ab=D.scale.y*p,Ia.set(oa.x-
|
|
|
|
-zb,oa.y-Ab,oa.x+zb,oa.y+Ab),!1!==eb.intersects(Ia)&&(d(ea.color.getContextStyle()),e(ea.color.getContextStyle()),q.save(),q.translate(oa.x,oa.y),q.rotate(-D.rotation),q.scale(zb,Ab),ea.program(q),q.restore()))}else if(na instanceof THREE.RenderableLine){if(C=na.v1,E=na.v2,C.positionScreen.x*=o,C.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=p,Ia.addPoint(C.positionScreen.x,C.positionScreen.y),Ia.addPoint(E.positionScreen.x,E.positionScreen.y),!0===eb.intersects(Ia)&&(oa=C,D=E,b(ea.opacity),
|
|
|
|
-c(ea.blending),q.beginPath(),q.moveTo(oa.positionScreen.x,oa.positionScreen.y),q.lineTo(D.positionScreen.x,D.positionScreen.y),ea instanceof THREE.LineBasicMaterial))oa=ea.linewidth,z!==oa&&(z=q.lineWidth=oa),oa=ea.linecap,w!==oa&&(w=q.lineCap=oa),oa=ea.linejoin,v!==oa&&(v=q.lineJoin=oa),d(ea.color.getContextStyle()),q.stroke(),Ia.inflate(2*ea.linewidth)}else if(na instanceof THREE.RenderableFace3)C=na.v1,E=na.v2,G=na.v3,C.positionScreen.x*=o,C.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=
|
|
|
|
-p,G.positionScreen.x*=o,G.positionScreen.y*=p,!0===ea.overdraw&&(Xb(C.positionScreen,E.positionScreen),Xb(E.positionScreen,G.positionScreen),Xb(G.positionScreen,C.positionScreen)),Ia.add3Points(C.positionScreen.x,C.positionScreen.y,E.positionScreen.x,E.positionScreen.y,G.positionScreen.x,G.positionScreen.y),!0===eb.intersects(Ia)&&n(C,E,G,0,1,2,na,ea,a);else if(na instanceof THREE.RenderableFace4&&(C=na.v1,E=na.v2,G=na.v3,L=na.v4,C.positionScreen.x*=o,C.positionScreen.y*=p,E.positionScreen.x*=o,E.positionScreen.y*=
|
|
|
|
-p,G.positionScreen.x*=o,G.positionScreen.y*=p,L.positionScreen.x*=o,L.positionScreen.y*=p,B.positionScreen.copy(E.positionScreen),J.positionScreen.copy(L.positionScreen),!0===ea.overdraw&&(Xb(C.positionScreen,E.positionScreen),Xb(E.positionScreen,L.positionScreen),Xb(L.positionScreen,C.positionScreen),Xb(G.positionScreen,B.positionScreen),Xb(G.positionScreen,J.positionScreen)),Ia.addPoint(C.positionScreen.x,C.positionScreen.y),Ia.addPoint(E.positionScreen.x,E.positionScreen.y),Ia.addPoint(G.positionScreen.x,
|
|
|
|
|
|
+a.r|0;ua[1]=255*a.g|0;ua[2]=255*a.b|0;ua[4]=255*b.r|0;ua[5]=255*b.g|0;ua[6]=255*b.b|0;ua[8]=255*c.r|0;ua[9]=255*c.g|0;ua[10]=255*c.b|0;ua[12]=255*d.r|0;ua[13]=255*d.g|0;ua[14]=255*d.b|0;bb.putImageData(mb,0,0);qb.drawImage(ab,0,0);return gb}function nb(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function gc(a){a=0.5*(a+1);return 0>a?0:1<a?1:a}function Xb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,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 Yb,xc,na,ea;!0===this.autoClear?this.clear():q.setTransform(1,0,0,-1,p,o);f.info.render.vertices=0;f.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){La.setRGB(0,0,0);$a.setRGB(0,0,0);db.setRGB(0,0,0);Yb=0;for(xc=i.length;Yb<xc;Yb++){ea=i[Yb];var oa=ea.color;ea instanceof THREE.AmbientLight?(La.r+=oa.r,La.g+=oa.g,La.b+=oa.b):ea instanceof THREE.DirectionalLight?($a.r+=oa.r,$a.g+=oa.g,$a.b+=oa.b):ea instanceof THREE.PointLight&&
|
|
|
|
+(db.r+=oa.r,db.g+=oa.g,db.b+=oa.b)}}Yb=0;for(xc=h.length;Yb<xc;Yb++)if(na=h[Yb],ea=na.material,!(void 0===ea||!1===ea.visible)){Ia.empty();if(na instanceof THREE.RenderableParticle){C=na;C.x*=p;C.y*=o;var oa=C,D=na;b(ea.opacity);c(ea.blending);var zb=void 0,Ab=void 0,rb=void 0,sb=void 0,hc=na=void 0,Pc=void 0;ea instanceof THREE.ParticleBasicMaterial?null===ea.map?(rb=D.object.scale.x,sb=D.object.scale.y,rb*=D.scale.x*p,sb*=D.scale.y*o,Ia.set(oa.x-rb,oa.y-sb,oa.x+rb,oa.y+sb),!1!==eb.intersects(Ia)&&
|
|
|
|
+(e(ea.color.getContextStyle()),q.save(),q.translate(oa.x,oa.y),q.rotate(-D.rotation),q.scale(rb,sb),q.fillRect(-1,-1,2,2),q.restore())):(na=ea.map.image,hc=na.width>>1,Pc=na.height>>1,rb=D.scale.x*p,sb=D.scale.y*o,zb=rb*hc,Ab=sb*Pc,Ia.set(oa.x-zb,oa.y-Ab,oa.x+zb,oa.y+Ab),!1!==eb.intersects(Ia)&&(q.save(),q.translate(oa.x,oa.y),q.rotate(-D.rotation),q.scale(rb,-sb),q.translate(-hc,-Pc),q.drawImage(na,0,0),q.restore())):ea instanceof THREE.ParticleCanvasMaterial&&(zb=D.scale.x*p,Ab=D.scale.y*o,Ia.set(oa.x-
|
|
|
|
+zb,oa.y-Ab,oa.x+zb,oa.y+Ab),!1!==eb.intersects(Ia)&&(d(ea.color.getContextStyle()),e(ea.color.getContextStyle()),q.save(),q.translate(oa.x,oa.y),q.rotate(-D.rotation),q.scale(zb,Ab),ea.program(q),q.restore()))}else if(na instanceof THREE.RenderableLine){if(C=na.v1,E=na.v2,C.positionScreen.x*=p,C.positionScreen.y*=o,E.positionScreen.x*=p,E.positionScreen.y*=o,Ia.addPoint(C.positionScreen.x,C.positionScreen.y),Ia.addPoint(E.positionScreen.x,E.positionScreen.y),!0===eb.intersects(Ia)&&(oa=C,D=E,b(ea.opacity),
|
|
|
|
+c(ea.blending),q.beginPath(),q.moveTo(oa.positionScreen.x,oa.positionScreen.y),q.lineTo(D.positionScreen.x,D.positionScreen.y),ea instanceof THREE.LineBasicMaterial))oa=ea.linewidth,z!==oa&&(z=q.lineWidth=oa),oa=ea.linecap,w!==oa&&(w=q.lineCap=oa),oa=ea.linejoin,v!==oa&&(v=q.lineJoin=oa),d(ea.color.getContextStyle()),q.stroke(),Ia.inflate(2*ea.linewidth)}else if(na instanceof THREE.RenderableFace3)C=na.v1,E=na.v2,G=na.v3,C.positionScreen.x*=p,C.positionScreen.y*=o,E.positionScreen.x*=p,E.positionScreen.y*=
|
|
|
|
+o,G.positionScreen.x*=p,G.positionScreen.y*=o,!0===ea.overdraw&&(Xb(C.positionScreen,E.positionScreen),Xb(E.positionScreen,G.positionScreen),Xb(G.positionScreen,C.positionScreen)),Ia.add3Points(C.positionScreen.x,C.positionScreen.y,E.positionScreen.x,E.positionScreen.y,G.positionScreen.x,G.positionScreen.y),!0===eb.intersects(Ia)&&n(C,E,G,0,1,2,na,ea,a);else if(na instanceof THREE.RenderableFace4&&(C=na.v1,E=na.v2,G=na.v3,L=na.v4,C.positionScreen.x*=p,C.positionScreen.y*=o,E.positionScreen.x*=p,E.positionScreen.y*=
|
|
|
|
+o,G.positionScreen.x*=p,G.positionScreen.y*=o,L.positionScreen.x*=p,L.positionScreen.y*=o,B.positionScreen.copy(E.positionScreen),J.positionScreen.copy(L.positionScreen),!0===ea.overdraw&&(Xb(C.positionScreen,E.positionScreen),Xb(E.positionScreen,L.positionScreen),Xb(L.positionScreen,C.positionScreen),Xb(G.positionScreen,B.positionScreen),Xb(G.positionScreen,J.positionScreen)),Ia.addPoint(C.positionScreen.x,C.positionScreen.y),Ia.addPoint(E.positionScreen.x,E.positionScreen.y),Ia.addPoint(G.positionScreen.x,
|
|
G.positionScreen.y),Ia.addPoint(L.positionScreen.x,L.positionScreen.y),!0===eb.intersects(Ia)))(oa=C,D=E,zb=G,Ab=L,rb=B,sb=J,hc=a,f.info.render.vertices+=4,f.info.render.faces++,b(ea.opacity),c(ea.blending),void 0!==ea.map&&null!==ea.map||void 0!==ea.envMap&&null!==ea.envMap)?(n(oa,D,Ab,0,1,3,na,ea,hc),n(rb,zb,sb,1,2,3,na,ea,hc)):(H=oa.positionScreen.x,I=oa.positionScreen.y,O=D.positionScreen.x,N=D.positionScreen.y,M=zb.positionScreen.x,T=zb.positionScreen.y,R=Ab.positionScreen.x,P=Ab.positionScreen.y,
|
|
G.positionScreen.y),Ia.addPoint(L.positionScreen.x,L.positionScreen.y),!0===eb.intersects(Ia)))(oa=C,D=E,zb=G,Ab=L,rb=B,sb=J,hc=a,f.info.render.vertices+=4,f.info.render.faces++,b(ea.opacity),c(ea.blending),void 0!==ea.map&&null!==ea.map||void 0!==ea.envMap&&null!==ea.envMap)?(n(oa,D,Ab,0,1,3,na,ea,hc),n(rb,zb,sb,1,2,3,na,ea,hc)):(H=oa.positionScreen.x,I=oa.positionScreen.y,O=D.positionScreen.x,N=D.positionScreen.y,M=zb.positionScreen.x,T=zb.positionScreen.y,R=Ab.positionScreen.x,P=Ab.positionScreen.y,
|
|
-S=rb.positionScreen.x,$=rb.positionScreen.y,K=sb.positionScreen.x,ja=sb.positionScreen.y,ea instanceof THREE.MeshLambertMaterial||ea instanceof THREE.MeshPhongMaterial)?(ba.copy(ea.color),ia.copy(ea.emissive),ea.vertexColors===THREE.FaceColors&&(ba.r*=na.color.r,ba.g*=na.color.g,ba.b*=na.color.b),!0===lb)?!1===ea.wireframe&&ea.shading==THREE.SmoothShading&&4==na.vertexNormalsLength?(ha.r=da.r=Y.r=aa.r=La.r,ha.g=da.g=Y.g=aa.g=La.g,ha.b=da.b=Y.b=aa.b=La.b,l(na.v1.positionWorld,na.vertexNormalsWorld[0],
|
|
|
|
-ha),l(na.v2.positionWorld,na.vertexNormalsWorld[1],da),l(na.v4.positionWorld,na.vertexNormalsWorld[3],Y),l(na.v3.positionWorld,na.vertexNormalsWorld[2],aa),ha.r=ha.r*ba.r+ia.r,ha.g=ha.g*ba.g+ia.g,ha.b=ha.b*ba.b+ia.b,da.r=da.r*ba.r+ia.r,da.g=da.g*ba.g+ia.g,da.b=da.b*ba.b+ia.b,Y.r=Y.r*ba.r+ia.r,Y.g=Y.g*ba.g+ia.g,Y.b=Y.b*ba.b+ia.b,aa.r=aa.r*ba.r+ia.r,aa.g=aa.g*ba.g+ia.g,aa.b=aa.b*ba.b+ia.b,Aa=wc(ha,da,Y,aa),r(H,I,O,N,R,P),ma(H,I,O,N,R,P,0,0,1,0,0,1,Aa),r(S,$,M,T,K,ja),ma(S,$,M,T,K,ja,1,0,1,1,0,1,Aa)):
|
|
|
|
-(Q.r=La.r,Q.g=La.g,Q.b=La.b,l(na.centroidWorld,na.normalWorld,Q),Q.r=Q.r*ba.r+ia.r,Q.g=Q.g*ba.g+ia.g,Q.b=Q.b*ba.b+ia.b,t(H,I,O,N,M,T,R,P),!0===ea.wireframe?s(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):(Q.r=ba.r+ia.r,Q.g=ba.g+ia.g,Q.b=ba.b+ia.b,t(H,I,O,N,M,T,R,P),!0===ea.wireframe?s(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):ea instanceof THREE.MeshBasicMaterial?(Q.copy(ea.color),ea.vertexColors===THREE.FaceColors&&(Q.r*=na.color.r,Q.g*=na.color.g,
|
|
|
|
-Q.b*=na.color.b),t(H,I,O,N,M,T,R,P),!0===ea.wireframe?s(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):ea instanceof THREE.MeshNormalMaterial?(Q.r=gc(na.normalWorld.x),Q.g=gc(na.normalWorld.y),Q.b=gc(na.normalWorld.z),t(H,I,O,N,M,T,R,P),!0===ea.wireframe?s(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):ea instanceof THREE.MeshDepthMaterial&&(za=m.near,Oa=m.far,ha.r=ha.g=ha.b=1-nb(oa.positionScreen.z,za,Oa),da.r=da.g=da.b=1-nb(D.positionScreen.z,za,
|
|
|
|
|
|
+S=rb.positionScreen.x,$=rb.positionScreen.y,K=sb.positionScreen.x,ja=sb.positionScreen.y,ea instanceof THREE.MeshLambertMaterial||ea instanceof THREE.MeshPhongMaterial)?(ba.copy(ea.color),ia.copy(ea.emissive),ea.vertexColors===THREE.FaceColors&&(ba.r*=na.color.r,ba.g*=na.color.g,ba.b*=na.color.b),!0===lb)?!1===ea.wireframe&&ea.shading==THREE.SmoothShading&&4==na.vertexNormalsLength?(ha.r=da.r=Y.r=aa.r=La.r,ha.g=da.g=Y.g=aa.g=La.g,ha.b=da.b=Y.b=aa.b=La.b,m(na.v1.positionWorld,na.vertexNormalsWorld[0],
|
|
|
|
+ha),m(na.v2.positionWorld,na.vertexNormalsWorld[1],da),m(na.v4.positionWorld,na.vertexNormalsWorld[3],Y),m(na.v3.positionWorld,na.vertexNormalsWorld[2],aa),ha.r=ha.r*ba.r+ia.r,ha.g=ha.g*ba.g+ia.g,ha.b=ha.b*ba.b+ia.b,da.r=da.r*ba.r+ia.r,da.g=da.g*ba.g+ia.g,da.b=da.b*ba.b+ia.b,Y.r=Y.r*ba.r+ia.r,Y.g=Y.g*ba.g+ia.g,Y.b=Y.b*ba.b+ia.b,aa.r=aa.r*ba.r+ia.r,aa.g=aa.g*ba.g+ia.g,aa.b=aa.b*ba.b+ia.b,Aa=wc(ha,da,Y,aa),r(H,I,O,N,R,P),ma(H,I,O,N,R,P,0,0,1,0,0,1,Aa),r(S,$,M,T,K,ja),ma(S,$,M,T,K,ja,1,0,1,1,0,1,Aa)):
|
|
|
|
+(Q.r=La.r,Q.g=La.g,Q.b=La.b,m(na.centroidWorld,na.normalWorld,Q),Q.r=Q.r*ba.r+ia.r,Q.g=Q.g*ba.g+ia.g,Q.b=Q.b*ba.b+ia.b,s(H,I,O,N,M,T,R,P),!0===ea.wireframe?t(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):(Q.r=ba.r+ia.r,Q.g=ba.g+ia.g,Q.b=ba.b+ia.b,s(H,I,O,N,M,T,R,P),!0===ea.wireframe?t(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):ea instanceof THREE.MeshBasicMaterial?(Q.copy(ea.color),ea.vertexColors===THREE.FaceColors&&(Q.r*=na.color.r,Q.g*=na.color.g,
|
|
|
|
+Q.b*=na.color.b),s(H,I,O,N,M,T,R,P),!0===ea.wireframe?t(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):ea instanceof THREE.MeshNormalMaterial?(Q.r=gc(na.normalWorld.x),Q.g=gc(na.normalWorld.y),Q.b=gc(na.normalWorld.z),s(H,I,O,N,M,T,R,P),!0===ea.wireframe?t(Q,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):u(Q)):ea instanceof THREE.MeshDepthMaterial&&(za=l.near,Oa=l.far,ha.r=ha.g=ha.b=1-nb(oa.positionScreen.z,za,Oa),da.r=da.g=da.b=1-nb(D.positionScreen.z,za,
|
|
Oa),Y.r=Y.g=Y.b=1-nb(Ab.positionScreen.z,za,Oa),aa.r=aa.g=aa.b=1-nb(zb.positionScreen.z,za,Oa),Aa=wc(ha,da,Y,aa),r(H,I,O,N,R,P),ma(H,I,O,N,R,P,0,0,1,0,0,1,Aa),r(S,$,M,T,K,ja),ma(S,$,M,T,K,ja,1,0,1,1,0,1,Aa));Ra.addRectangle(Ia)}q.setTransform(1,0,0,1,0,0)}}};
|
|
Oa),Y.r=Y.g=Y.b=1-nb(Ab.positionScreen.z,za,Oa),aa.r=aa.g=aa.b=1-nb(zb.positionScreen.z,za,Oa),Aa=wc(ha,da,Y,aa),r(H,I,O,N,R,P),ma(H,I,O,N,R,P,0,0,1,0,0,1,Aa),r(S,$,M,T,K,ja),ma(S,$,M,T,K,ja,1,0,1,1,0,1,Aa));Ra.addRectangle(Ia)}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",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
@@ -362,15 +362,15 @@ h.boundTo)if(f=0,e=h.value.length,1===h.size)for(d=0;d<e;d++)g=n[d][1],h.array[d
|
|
h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d],f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(p)for(d=0;d<j;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.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(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=
|
|
h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(o)for(d=0;d<g;d++)e=h[d],f=3*d,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(p)for(d=0;d<j;d++)e=i[d],f=3*d,m[f]=e.r,m[f+1]=e.g,m[f+2]=e.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(e=h.value.length,f=0,1===h.size)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(2===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(3===h.size)if("c"===h.type)for(d=0;d<e;d++)g=h.value[d],h.array[f]=
|
|
g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=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],
|
|
g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(4===h.size)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=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 j(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,
|
|
h.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.bufferData(k.ARRAY_BUFFER,h.array,b)}}function j(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 m(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function n(a,
|
|
|
|
-b){return b[1]-a[1]}function l(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ba=ha=null,Y=aa=za=Na=fb=Va=Oa=-1,gb=!0,a[d].render(b,c,$a,db),ba=ha=null,Y=aa=za=Na=fb=Va=Oa=-1,gb=!0}function o(a,b,c,d,e,f,g,h){var k,i,j,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(k=a[m],k.render){i=k.object;j=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&K.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);K.setDepthTest(k.depthTest);K.setDepthWrite(k.depthWrite);C(k.polygonOffset,
|
|
|
|
-k.polygonOffsetFactor,k.polygonOffsetUnits)}K.setMaterialFaces(k);j instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,k,j,i):K.renderBuffer(d,e,f,k,j,i)}}function p(a,b,c,d,e,f,g){for(var h,k,i=0,j=a.length;i<j;i++)if(h=a[i],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&K.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);K.setDepthTest(h.depthTest);K.setDepthWrite(h.depthWrite);C(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,
|
|
|
|
-d,e,h,k)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function t(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function r(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function s(a,b,c,d,e){ya=0;d.needsUpdate&&(d.program&&K.deallocateMaterial(d),K.initMaterial(d,b,c,e),d.needsUpdate=
|
|
|
|
|
|
+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 l(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function n(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++)ba=ha=null,Y=aa=za=Na=fb=Va=Oa=-1,gb=!0,a[d].render(b,c,$a,db),ba=ha=null,Y=aa=za=Na=fb=Va=Oa=-1,gb=!0}function p(a,b,c,d,e,f,g,h){var k,i,j,l;b?(i=a.length-1,l=b=-1):(i=0,b=a.length,l=1);for(var m=i;m!==b;m+=l)if(k=a[m],k.render){i=k.object;j=k.buffer;if(h)k=h;else{k=k[c];if(!k)continue;g&&K.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);K.setDepthTest(k.depthTest);K.setDepthWrite(k.depthWrite);C(k.polygonOffset,
|
|
|
|
+k.polygonOffsetFactor,k.polygonOffsetUnits)}K.setMaterialFaces(k);j instanceof THREE.BufferGeometry?K.renderBufferDirect(d,e,f,k,j,i):K.renderBuffer(d,e,f,k,j,i)}}function o(a,b,c,d,e,f,g){for(var h,k,i=0,j=a.length;i<j;i++)if(h=a[i],k=h.object,k.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&K.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);K.setDepthTest(h.depthTest);K.setDepthWrite(h.depthWrite);C(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}K.renderImmediateObject(c,
|
|
|
|
+d,e,h,k)}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function s(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function r(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function A(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function u(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function t(a,b,c,d,e){ya=0;d.needsUpdate&&(d.program&&K.deallocateMaterial(d),K.initMaterial(d,b,c,e),d.needsUpdate=
|
|
!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==ha&&(k.useProgram(g),ha=g,f=!0);d.id!==Y&&(Y=d.id,f=!0);if(f||a!==ba)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==ba&&(ba=a);if(d.skinning)if(fc&&e.useVertexTexture){if(null!==h.boneTexture){var j=D();k.uniform1i(h.boneTexture,j);K.setTexture(e.boneTexture,j)}}else null!==h.boneGlobalMatrices&&k.uniformMatrix4fv(h.boneGlobalMatrices,
|
|
!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(K.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==ha&&(k.useProgram(g),ha=g,f=!0);d.id!==Y&&(Y=d.id,f=!0);if(f||a!==ba)k.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray),a!==ba&&(ba=a);if(d.skinning)if(fc&&e.useVertexTexture){if(null!==h.boneTexture){var j=D();k.uniform1i(h.boneTexture,j);K.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(gb){for(var l=0,m=0,n=0,o,p,q,r=qb,t=r.directional.colors,s=r.directional.positions,u=r.point.colors,z=r.point.positions,A=r.point.distances,B=r.spot.colors,C=r.spot.positions,E=r.spot.distances,G=r.spot.directions,Q=
|
|
|
|
-r.spot.anglesCos,J=r.spot.exponents,P=r.hemi.skyColors,N=r.hemi.groundColors,S=r.hemi.positions,M=0,R=0,O=0,da=0,ia=0,$=0,aa=0,ca=0,T=p=0,c=T=T=0,f=b.length;c<f;c++)j=b[c],j.onlyShadow||(o=j.color,q=j.intensity,p=j.distance,j instanceof THREE.AmbientLight?j.visible&&(K.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?(ia+=1,j.visible&&(p=3*M,K.gammaInput?w(t,p,o,q*q):v(t,p,o,q),ua.copy(j.matrixWorld.getPosition()),ua.subSelf(j.target.matrixWorld.getPosition()),
|
|
|
|
-ua.normalize(),s[p]=ua.x,s[p+1]=ua.y,s[p+2]=ua.z,M+=1)):j instanceof THREE.PointLight?($+=1,j.visible&&(T=3*R,K.gammaInput?w(u,T,o,q*q):v(u,T,o,q),q=j.matrixWorld.getPosition(),z[T]=q.x,z[T+1]=q.y,z[T+2]=q.z,A[R]=p,R+=1)):j instanceof THREE.SpotLight?(aa+=1,j.visible&&(T=3*O,K.gammaInput?w(B,T,o,q*q):v(B,T,o,q),q=j.matrixWorld.getPosition(),C[T]=q.x,C[T+1]=q.y,C[T+2]=q.z,E[O]=p,ua.copy(q),ua.subSelf(j.target.matrixWorld.getPosition()),ua.normalize(),G[T]=ua.x,G[T+1]=ua.y,G[T+2]=ua.z,Q[O]=Math.cos(j.angle),
|
|
|
|
-J[O]=j.exponent,O+=1)):j instanceof THREE.HemisphereLight&&(ca+=1,j.visible&&(o=j.color,p=j.groundColor,T=3*da,K.gammaInput?(q*=q,w(P,T,o,q),w(N,T,p,q)):(v(P,T,o,q),v(N,T,p,q)),ua.copy(j.matrixWorld.getPosition()),ua.normalize(),S[T]=ua.x,S[T+1]=ua.y,S[T+2]=ua.z,da+=1)));c=3*M;for(f=Math.max(t.length,3*ia);c<f;c++)t[c]=0;c=3*M;for(f=Math.max(s.length,3*ia);c<f;c++)s[c]=0;c=3*R;for(f=Math.max(u.length,3*$);c<f;c++)u[c]=0;c=3*R;for(f=Math.max(z.length,3*$);c<f;c++)z[c]=0;c=R;for(f=Math.max(A.length,
|
|
|
|
|
|
+!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(gb){for(var l=0,m=0,n=0,o,p,q,r=qb,s=r.directional.colors,t=r.directional.positions,u=r.point.colors,z=r.point.positions,A=r.point.distances,B=r.spot.colors,C=r.spot.positions,E=r.spot.distances,G=r.spot.directions,Q=
|
|
|
|
+r.spot.anglesCos,J=r.spot.exponents,P=r.hemi.skyColors,N=r.hemi.groundColors,S=r.hemi.positions,M=0,R=0,O=0,da=0,ia=0,$=0,aa=0,ca=0,T=p=0,c=T=T=0,f=b.length;c<f;c++)j=b[c],j.onlyShadow||(o=j.color,q=j.intensity,p=j.distance,j instanceof THREE.AmbientLight?j.visible&&(K.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?(ia+=1,j.visible&&(p=3*M,K.gammaInput?w(s,p,o,q*q):v(s,p,o,q),ua.copy(j.matrixWorld.getPosition()),ua.subSelf(j.target.matrixWorld.getPosition()),
|
|
|
|
+ua.normalize(),t[p]=ua.x,t[p+1]=ua.y,t[p+2]=ua.z,M+=1)):j instanceof THREE.PointLight?($+=1,j.visible&&(T=3*R,K.gammaInput?w(u,T,o,q*q):v(u,T,o,q),q=j.matrixWorld.getPosition(),z[T]=q.x,z[T+1]=q.y,z[T+2]=q.z,A[R]=p,R+=1)):j instanceof THREE.SpotLight?(aa+=1,j.visible&&(T=3*O,K.gammaInput?w(B,T,o,q*q):v(B,T,o,q),q=j.matrixWorld.getPosition(),C[T]=q.x,C[T+1]=q.y,C[T+2]=q.z,E[O]=p,ua.copy(q),ua.subSelf(j.target.matrixWorld.getPosition()),ua.normalize(),G[T]=ua.x,G[T+1]=ua.y,G[T+2]=ua.z,Q[O]=Math.cos(j.angle),
|
|
|
|
+J[O]=j.exponent,O+=1)):j instanceof THREE.HemisphereLight&&(ca+=1,j.visible&&(o=j.color,p=j.groundColor,T=3*da,K.gammaInput?(q*=q,w(P,T,o,q),w(N,T,p,q)):(v(P,T,o,q),v(N,T,p,q)),ua.copy(j.matrixWorld.getPosition()),ua.normalize(),S[T]=ua.x,S[T+1]=ua.y,S[T+2]=ua.z,da+=1)));c=3*M;for(f=Math.max(s.length,3*ia);c<f;c++)s[c]=0;c=3*M;for(f=Math.max(t.length,3*ia);c<f;c++)t[c]=0;c=3*R;for(f=Math.max(u.length,3*$);c<f;c++)u[c]=0;c=3*R;for(f=Math.max(z.length,3*$);c<f;c++)z[c]=0;c=R;for(f=Math.max(A.length,
|
|
$);c<f;c++)A[c]=0;c=3*O;for(f=Math.max(B.length,3*aa);c<f;c++)B[c]=0;c=3*O;for(f=Math.max(C.length,3*aa);c<f;c++)C[c]=0;c=3*O;for(f=Math.max(G.length,3*aa);c<f;c++)G[c]=0;c=O;for(f=Math.max(Q.length,aa);c<f;c++)Q[c]=0;c=O;for(f=Math.max(J.length,aa);c<f;c++)J[c]=0;c=O;for(f=Math.max(E.length,aa);c<f;c++)E[c]=0;c=3*da;for(f=Math.max(P.length,3*ca);c<f;c++)P[c]=0;c=3*da;for(f=Math.max(N.length,3*ca);c<f;c++)N[c]=0;c=3*da;for(f=Math.max(S.length,3*ca);c<f;c++)S[c]=0;r.directional.length=M;r.point.length=
|
|
$);c<f;c++)A[c]=0;c=3*O;for(f=Math.max(B.length,3*aa);c<f;c++)B[c]=0;c=3*O;for(f=Math.max(C.length,3*aa);c<f;c++)C[c]=0;c=3*O;for(f=Math.max(G.length,3*aa);c<f;c++)G[c]=0;c=O;for(f=Math.max(Q.length,aa);c<f;c++)Q[c]=0;c=O;for(f=Math.max(J.length,aa);c<f;c++)J[c]=0;c=O;for(f=Math.max(E.length,aa);c<f;c++)E[c]=0;c=3*da;for(f=Math.max(P.length,3*ca);c<f;c++)P[c]=0;c=3*da;for(f=Math.max(N.length,3*ca);c<f;c++)N[c]=0;c=3*da;for(f=Math.max(S.length,3*ca);c<f;c++)S[c]=0;r.directional.length=M;r.point.length=
|
|
R;r.spot.length=O;r.hemi.length=da;r.ambient[0]=l;r.ambient[1]=m;r.ambient[2]=n;gb=!1}c=qb;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=
|
|
R;r.spot.length=O;r.hemi.length=da;r.ambient[0]=l;r.ambient[1]=m;r.ambient[2]=n;gb=!1}c=qb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=
|
|
c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;
|
|
c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;K.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;
|
|
@@ -382,8 +382,8 @@ j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[ja]=j.s
|
|
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<
|
|
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*
|
|
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=D(),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.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=D(),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++)K.autoScaleCubemaps&&!f?(m=j,n=l,r=c.image[l],s=Oc,r.width<=s&&r.height<=s||(u=Math.max(r.width,r.height),t=Math.floor(r.width*s/u),s=Math.floor(r.height*s/u),u=document.createElement("canvas"),u.width=t,u.height=s,u.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,t,s),r=u),m[n]=r):j[l]=c.image[l];l=j[0];m=0===(l.width&l.width-1)&&0===(l.height&l.height-1);n=H(c.format);r=H(c.type);L(k.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){s=j[l].mipmaps;u=0;for(z=s.length;u<z;u++)t=
|
|
|
|
-s[u],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,u,n,t.width,t.height,0,t.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,r,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)):K.setTexture(n,
|
|
|
|
|
|
+j=[];for(l=0;6>l;l++)K.autoScaleCubemaps&&!f?(m=j,n=l,r=c.image[l],t=Oc,r.width<=t&&r.height<=t||(u=Math.max(r.width,r.height),s=Math.floor(r.width*t/u),t=Math.floor(r.height*t/u),u=document.createElement("canvas"),u.width=s,u.height=t,u.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,s,t),r=u),m[n]=r):j[l]=c.image[l];l=j[0];m=0===(l.width&l.width-1)&&0===(l.height&l.height-1);n=H(c.format);r=H(c.type);L(k.TEXTURE_CUBE_MAP,c,m);for(l=0;6>l;l++)if(f){t=j[l].mipmaps;u=0;for(z=t.length;u<z;u++)s=
|
|
|
|
+t[u],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,u,n,s.width,s.height,0,s.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,n,n,r,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)):K.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]=D();k.uniform1iv(f,c._array);l=0;for(m=c.value.length;l<m;l++)n=c.value[l],j=c._array[l],n&&K.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||
|
|
j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(m=c.value.length;l<m;l++)c._array[l]=D();k.uniform1iv(f,c._array);l=0;for(m=c.value.length;l<m;l++)n=c.value[l],j=c._array[l],n&&K.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 D(){var a=ya;a>=vc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+vc);ya+=1;return a}function z(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,
|
|
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 D(){var a=ya;a>=vc&&console.warn("Trying to use "+a+" texture units while this GPU supports only "+vc);ya+=1;return a}function z(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,
|
|
a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function w(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 v(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function C(a,b,c){kb!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),kb=a);if(a&&(Bb!==b||Cb!==c))k.polygonOffset(b,c),Bb=b,Cb=c}function E(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 G(a,b){var c;"fragment"===
|
|
a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function w(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 v(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function C(a,b,c){kb!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),kb=a);if(a&&(Bb!==b||Cb!==c))k.polygonOffset(b,c),Bb=b,Cb=c}function E(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 G(a,b){var c;"fragment"===
|
|
@@ -410,11 +410,11 @@ a.__webglTexture)if(k.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRe
|
|
ja.length;a<c;a++)d=ja[a],d.program!==b&&e.push(d);ja=e;k.deleteProgram(b);K.info.memory.programs--}}};this.updateShadowMap=function(a,b){ha=null;Y=aa=fb=Va=Oa=-1;gb=!0;za=Na=-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&&
|
|
ja.length;a<c;a++)d=ja[a],d.program!==b&&e.push(d);ja=e;k.deleteProgram(b);K.info.memory.programs--}}};this.updateShadowMap=function(a,b){ha=null;Y=aa=fb=Va=Oa=-1;gb=!0;za=Na=-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,e,f,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],e=n[o+1],f=n[o+2],g=n[o+3],i=n[o+4],l=n[o+
|
|
(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,e,f,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],e=n[o+1],f=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,e=(e+i+j)/3,f=(f+l+m)/3,n[o]=d,n[o+1]=e,n[o+2]=f,n[o+3]=d,n[o+4]=e,n[o+5]=f,n[o+6]=d,n[o+7]=e,n[o+8]=f}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,
|
|
5],h=n[o+6],j=n[o+7],m=n[o+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+l+m)/3,n[o]=d,n[o+1]=e,n[o+2]=f,n[o+3]=d,n[o+4]=e,n[o+5]=f,n[o+6]=d,n[o+7]=e,n[o+8]=f}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,e,f){if(!1!==d.visible)if(c=s(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==aa&&(aa=d,b=!0),f instanceof
|
|
|
|
|
|
+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,e,f){if(!1!==d.visible)if(c=t(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==aa&&(aa=d,b=!0),f instanceof
|
|
THREE.Mesh){f=e.offsets;1<f.length&&(b=!0);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.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=e.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=e.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,
|
|
THREE.Mesh){f=e.offsets;1<f.length&&(b=!0);d=0;for(c=f.length;d<c;++d){var g=f[d].index;if(b){var h=e.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=e.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=e.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=e.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=e.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,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,2*f[d].start);
|
|
!1,0,4*g*i),k.enableVertexAttribArray(a.uv)):k.disableVertexAttribArray(a.uv));i=e.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=e.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,e.attributes.index.buffer)}k.drawElements(k.TRIANGLES,f[d].count,k.UNSIGNED_SHORT,2*f[d].start);
|
|
K.info.render.calls++;K.info.render.vertices+=f[d].count;K.info.render.faces+=f[d].count/3}}else f instanceof THREE.ParticleSystem&&b&&(h=e.attributes.position,i=h.itemSize,k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.vertexAttribPointer(a.position,i,k.FLOAT,!1,0,0),i=e.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),K.info.render.calls++,K.info.render.points+=h.numItems/3)};this.renderBuffer=
|
|
K.info.render.calls++;K.info.render.vertices+=f[d].count;K.info.render.faces+=f[d].count/3}}else f instanceof THREE.ParticleSystem&&b&&(h=e.attributes.position,i=h.itemSize,k.bindBuffer(k.ARRAY_BUFFER,h.buffer),k.vertexAttribPointer(a.position,i,k.FLOAT,!1,0,0),i=e.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),K.info.render.calls++,K.info.render.points+=h.numItems/3)};this.renderBuffer=
|
|
-function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=s(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==aa&&(aa=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&
|
|
|
|
|
|
+function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=t(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==aa&&(aa=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):0<=c.position&&
|
|
(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,
|
|
(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,
|
|
!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;var j,l=g.length;for(j=0;j<l;j++)i=g[j],0<i&&h.push([j,i]);h.length>d.numSupportedMorphTargets?(h.sort(n),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(n):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(j=h[i][0],k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]),k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;var j,l=g.length;for(j=0;j<l;j++)i=g[j],0<i&&h.push([j,i]);h.length>d.numSupportedMorphTargets?(h.sort(n),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(n):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(j=h[i][0],k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]),k.vertexAttribPointer(c["morphTarget"+i],3,k.FLOAT,!1,0,0),d.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
e.__webglMorphNormalsBuffers[j]),k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,!1,0,0)),f.__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),f.__webglMorphTargetInfluences[i]=0),i++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<
|
|
e.__webglMorphNormalsBuffers[j]),k.vertexAttribPointer(c["morphNormal"+i],3,k.FLOAT,!1,0,0)),f.__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),f.__webglMorphTargetInfluences[i]=0),i++}null!==d.program.uniforms.morphTargetInfluences&&k.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<
|
|
@@ -423,14 +423,14 @@ h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(k.b
|
|
k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));0<=b.lineDistance&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k.vertexAttribPointer(b.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==eb&&(k.lineWidth(d),eb=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,
|
|
k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));0<=b.lineDistance&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k.vertexAttribPointer(b.lineDistance,1,k.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==eb&&(k.lineWidth(d),eb=d),a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),k.drawElements(k.LINES,e.__webglLineCount,k.UNSIGNED_SHORT,
|
|
0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),K.info.render.calls++,K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==eb&&(k.lineWidth(d),eb=d),k.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),K.info.render.calls++,
|
|
0)):(a&&k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),k.drawElements(k.TRIANGLES,e.__webglFaceCount,k.UNSIGNED_SHORT,0)),K.info.render.calls++,K.info.render.vertices+=e.__webglFaceCount,K.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES,d=d.linewidth,d!==eb&&(k.lineWidth(d),eb=d),k.drawArrays(f,0,e.__webglLineCount),K.info.render.calls++):f instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,e.__webglParticleCount),K.info.render.calls++,
|
|
K.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),K.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,j=a.fog;Y=-1;gb=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b._viewMatrixArray||(b._viewMatrixArray=new Float32Array(16));
|
|
K.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,e.__webglVertexCount),K.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,j=a.fog;Y=-1;gb=!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);ab.multiply(b.projectionMatrix,b.matrixWorldInverse);ka.setFromMatrix(ab);this.autoUpdateObjects&&this.initWebGLObjects(a);l(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);
|
|
|
|
|
|
+b._projectionMatrixArray||(b._projectionMatrixArray=new Float32Array(16));b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);ab.multiply(b.projectionMatrix,b.matrixWorldInverse);ka.setFromMatrix(ab);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);K.info.render.calls=0;K.info.render.vertices=0;K.info.render.faces=0;K.info.render.points=0;this.setRenderTarget(c);
|
|
(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ka.contains(g))){z(g,b);var n=f,q=n.object,r=n.buffer,s=void 0,s=s=void 0,s=q.material;s instanceof THREE.MeshFaceMaterial?(s=r.materialIndex,0<=s&&(s=q.geometry.materials[s],s.transparent?(n.transparent=s,n.opaque=null):(n.opaque=s,n.transparent=
|
|
(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||ka.contains(g))){z(g,b);var n=f,q=n.object,r=n.buffer,s=void 0,s=s=void 0,s=q.material;s instanceof THREE.MeshFaceMaterial?(s=r.materialIndex,0<=s&&(s=q.geometry.materials[s],s.transparent?(n.transparent=s,n.opaque=null):(n.opaque=s,n.transparent=
|
|
-null))):s&&(s.transparent?(n.transparent=s,n.opaque=null):(n.opaque=s,n.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(mb.copy(g.matrixWorld.getPosition()),ab.multiplyVector3(mb),f.z=mb.z),f.id=g.id)}this.sortObjects&&h.sort(m);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(z(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,
|
|
|
|
-this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),C(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),o(a.__webglObjects,!1,"",b,i,j,!0,d),p(a.__webglObjectsImmediate,"",b,i,j,!1,d)):(this.setBlending(THREE.NormalBlending),o(a.__webglObjects,!0,"opaque",b,i,j,!1),p(a.__webglObjectsImmediate,"opaque",b,i,j,!1),o(a.__webglObjects,!1,"transparent",b,i,j,!0),p(a.__webglObjectsImmediate,"transparent",b,i,j,!0));
|
|
|
|
-l(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,e){var f=
|
|
|
|
-s(a,b,c,d,e);aa=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ka):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],l=a,m=void 0,n=void 0,o=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,b instanceof
|
|
|
|
-THREE.Mesh)if(n=b.geometry,n instanceof THREE.Geometry){if(void 0===n.geometryGroups){var p=n,s=void 0,v=void 0,w=void 0,z=void 0,B=void 0,D=void 0,C=void 0,E={},G=p.morphTargets.length,H=p.morphNormals.length;p.geometryGroups={};s=0;for(v=p.faces.length;s<v;s++)w=p.faces[s],z=w.materialIndex,D=void 0!==z?z:-1,void 0===E[D]&&(E[D]={hash:D,counter:0}),C=E[D].hash+"_"+E[D].counter,void 0===p.geometryGroups[C]&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H}),
|
|
|
|
-B=w instanceof THREE.Face3?3:4,65535<p.geometryGroups[C].vertices+B&&(E[D].counter+=1,C=E[D].hash+"_"+E[D].counter,void 0===p.geometryGroups[C]&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H})),w instanceof THREE.Face3?p.geometryGroups[C].faces3.push(s):p.geometryGroups[C].faces4.push(s),p.geometryGroups[C].vertices+=B;p.geometryGroupsList=[];var I=void 0;for(I in p.geometryGroups)p.geometryGroups[I].id=ia++,p.geometryGroupsList.push(p.geometryGroups[I])}for(m in n.geometryGroups)if(o=
|
|
|
|
|
|
+null))):s&&(s.transparent?(n.transparent=s,n.opaque=null):(n.opaque=s,n.transparent=null));f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(mb.copy(g.matrixWorld.getPosition()),ab.multiplyVector3(mb),f.z=mb.z),f.id=g.id)}this.sortObjects&&h.sort(l);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(z(g,b),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,
|
|
|
|
+this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),C(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),p(a.__webglObjects,!1,"",b,i,j,!0,d),o(a.__webglObjectsImmediate,"",b,i,j,!1,d)):(this.setBlending(THREE.NormalBlending),p(a.__webglObjects,!0,"opaque",b,i,j,!1),o(a.__webglObjectsImmediate,"opaque",b,i,j,!1),p(a.__webglObjects,!1,"transparent",b,i,j,!0),o(a.__webglObjectsImmediate,"transparent",b,i,j,!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,e){var f=
|
|
|
|
+t(a,b,c,d,e);aa=-1;K.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,ka):e.render(function(a){K.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],l=a,m=void 0,n=void 0,o=void 0;if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,b instanceof
|
|
|
|
+THREE.Mesh)if(n=b.geometry,n instanceof THREE.Geometry){if(void 0===n.geometryGroups){var p=n,t=void 0,v=void 0,w=void 0,z=void 0,B=void 0,D=void 0,C=void 0,E={},G=p.morphTargets.length,H=p.morphNormals.length;p.geometryGroups={};t=0;for(v=p.faces.length;t<v;t++)w=p.faces[t],z=w.materialIndex,D=void 0!==z?z:-1,void 0===E[D]&&(E[D]={hash:D,counter:0}),C=E[D].hash+"_"+E[D].counter,void 0===p.geometryGroups[C]&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H}),
|
|
|
|
+B=w instanceof THREE.Face3?3:4,65535<p.geometryGroups[C].vertices+B&&(E[D].counter+=1,C=E[D].hash+"_"+E[D].counter,void 0===p.geometryGroups[C]&&(p.geometryGroups[C]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:G,numMorphNormals:H})),w instanceof THREE.Face3?p.geometryGroups[C].faces3.push(t):p.geometryGroups[C].faces4.push(t),p.geometryGroups[C].vertices+=B;p.geometryGroupsList=[];var I=void 0;for(I in p.geometryGroups)p.geometryGroups[I].id=ia++,p.geometryGroupsList.push(p.geometryGroups[I])}for(m in n.geometryGroups)if(o=
|
|
n.geometryGroups[m],!o.__webglVertexBuffer){var Q=o;Q.__webglVertexBuffer=k.createBuffer();Q.__webglNormalBuffer=k.createBuffer();Q.__webglTangentBuffer=k.createBuffer();Q.__webglColorBuffer=k.createBuffer();Q.__webglUVBuffer=k.createBuffer();Q.__webglUV2Buffer=k.createBuffer();Q.__webglSkinIndicesBuffer=k.createBuffer();Q.__webglSkinWeightsBuffer=k.createBuffer();Q.__webglFaceBuffer=k.createBuffer();Q.__webglLineBuffer=k.createBuffer();var J=void 0,Y=void 0;if(Q.numMorphTargets){Q.__webglMorphTargetsBuffers=
|
|
n.geometryGroups[m],!o.__webglVertexBuffer){var Q=o;Q.__webglVertexBuffer=k.createBuffer();Q.__webglNormalBuffer=k.createBuffer();Q.__webglTangentBuffer=k.createBuffer();Q.__webglColorBuffer=k.createBuffer();Q.__webglUVBuffer=k.createBuffer();Q.__webglUV2Buffer=k.createBuffer();Q.__webglSkinIndicesBuffer=k.createBuffer();Q.__webglSkinWeightsBuffer=k.createBuffer();Q.__webglFaceBuffer=k.createBuffer();Q.__webglLineBuffer=k.createBuffer();var J=void 0,Y=void 0;if(Q.numMorphTargets){Q.__webglMorphTargetsBuffers=
|
|
[];J=0;for(Y=Q.numMorphTargets;J<Y;J++)Q.__webglMorphTargetsBuffers.push(k.createBuffer())}if(Q.numMorphNormals){Q.__webglMorphNormalsBuffers=[];J=0;for(Y=Q.numMorphNormals;J<Y;J++)Q.__webglMorphNormalsBuffers.push(k.createBuffer())}K.info.memory.geometries++;d(o,b);n.verticesNeedUpdate=!0;n.morphTargetsNeedUpdate=!0;n.elementsNeedUpdate=!0;n.uvsNeedUpdate=!0;n.normalsNeedUpdate=!0;n.tangentsNeedUpdate=!0;n.colorsNeedUpdate=!0}}else n instanceof THREE.BufferGeometry&&h(n);else if(b instanceof THREE.Ribbon){if(n=
|
|
[];J=0;for(Y=Q.numMorphTargets;J<Y;J++)Q.__webglMorphTargetsBuffers.push(k.createBuffer())}if(Q.numMorphNormals){Q.__webglMorphNormalsBuffers=[];J=0;for(Y=Q.numMorphNormals;J<Y;J++)Q.__webglMorphNormalsBuffers.push(k.createBuffer())}K.info.memory.geometries++;d(o,b);n.verticesNeedUpdate=!0;n.morphTargetsNeedUpdate=!0;n.elementsNeedUpdate=!0;n.uvsNeedUpdate=!0;n.normalsNeedUpdate=!0;n.tangentsNeedUpdate=!0;n.colorsNeedUpdate=!0}}else n instanceof THREE.BufferGeometry&&h(n);else if(b instanceof THREE.Ribbon){if(n=
|
|
b.geometry,!n.__webglVertexBuffer){var P=n;P.__webglVertexBuffer=k.createBuffer();P.__webglColorBuffer=k.createBuffer();P.__webglNormalBuffer=k.createBuffer();K.info.memory.geometries++;var L=n,O=b,S=L.vertices.length;L.__vertexArray=new Float32Array(3*S);L.__colorArray=new Float32Array(3*S);L.__normalArray=new Float32Array(3*S);L.__webglVertexCount=S;c(L,O);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(n=b.geometry,!n.__webglVertexBuffer){var N=
|
|
b.geometry,!n.__webglVertexBuffer){var P=n;P.__webglVertexBuffer=k.createBuffer();P.__webglColorBuffer=k.createBuffer();P.__webglNormalBuffer=k.createBuffer();K.info.memory.geometries++;var L=n,O=b,S=L.vertices.length;L.__vertexArray=new Float32Array(3*S);L.__colorArray=new Float32Array(3*S);L.__normalArray=new Float32Array(3*S);L.__webglVertexCount=S;c(L,O);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(n=b.geometry,!n.__webglVertexBuffer){var N=
|
|
@@ -439,7 +439,7 @@ THREE.Geometry){var ha=n;ha.__webglVertexBuffer=k.createBuffer();ha.__webglColor
|
|
b);else for(m in n.geometryGroups)o=n.geometryGroups[m],q(l.__webglObjects,o,b);else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(n=b.geometry,q(l.__webglObjects,n,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?l.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?l.__webglSprites.push(b):b instanceof THREE.LensFlare&&l.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var aa=
|
|
b);else for(m in n.geometryGroups)o=n.geometryGroups[m],q(l.__webglObjects,o,b);else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(n=b.geometry,q(l.__webglObjects,n,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?l.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?l.__webglSprites.push(b):b instanceof THREE.LensFlare&&l.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var aa=
|
|
a.__objectsRemoved[0],ja=a;aa instanceof THREE.Mesh||aa instanceof THREE.ParticleSystem||aa instanceof THREE.Ribbon||aa instanceof THREE.Line?A(ja.__webglObjects,aa):aa instanceof THREE.Sprite?u(ja.__webglSprites,aa):aa instanceof THREE.LensFlare?u(ja.__webglFlares,aa):(aa instanceof THREE.ImmediateRenderObject||aa.immediateRenderCallback)&&A(ja.__webglObjectsImmediate,aa);aa.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var ya=0,Na=a.__webglObjects.length;ya<Na;ya++){var pa=a.__webglObjects[ya].object,
|
|
a.__objectsRemoved[0],ja=a;aa instanceof THREE.Mesh||aa instanceof THREE.ParticleSystem||aa instanceof THREE.Ribbon||aa instanceof THREE.Line?A(ja.__webglObjects,aa):aa instanceof THREE.Sprite?u(ja.__webglSprites,aa):aa instanceof THREE.LensFlare?u(ja.__webglFlares,aa):(aa instanceof THREE.ImmediateRenderObject||aa.immediateRenderCallback)&&A(ja.__webglObjectsImmediate,aa);aa.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var ya=0,Na=a.__webglObjects.length;ya<Na;ya++){var pa=a.__webglObjects[ya].object,
|
|
ca=pa.geometry,ua=void 0,za=void 0,ka=void 0;if(pa instanceof THREE.Mesh)if(ca instanceof THREE.BufferGeometry)(ca.verticesNeedUpdate||ca.elementsNeedUpdate||ca.uvsNeedUpdate||ca.normalsNeedUpdate||ca.colorsNeedUpdate||ca.tangentsNeedUpdate)&&j(ca,k.DYNAMIC_DRAW,!ca.dynamic),ca.verticesNeedUpdate=!1,ca.elementsNeedUpdate=!1,ca.uvsNeedUpdate=!1,ca.normalsNeedUpdate=!1,ca.colorsNeedUpdate=!1,ca.tangentsNeedUpdate=!1;else{for(var Ia=0,Oa=ca.geometryGroupsList.length;Ia<Oa;Ia++)if(ua=ca.geometryGroupsList[Ia],
|
|
ca=pa.geometry,ua=void 0,za=void 0,ka=void 0;if(pa instanceof THREE.Mesh)if(ca instanceof THREE.BufferGeometry)(ca.verticesNeedUpdate||ca.elementsNeedUpdate||ca.uvsNeedUpdate||ca.normalsNeedUpdate||ca.colorsNeedUpdate||ca.tangentsNeedUpdate)&&j(ca,k.DYNAMIC_DRAW,!ca.dynamic),ca.verticesNeedUpdate=!1,ca.elementsNeedUpdate=!1,ca.uvsNeedUpdate=!1,ca.normalsNeedUpdate=!1,ca.colorsNeedUpdate=!1,ca.tangentsNeedUpdate=!1;else{for(var Ia=0,Oa=ca.geometryGroupsList.length;Ia<Oa;Ia++)if(ua=ca.geometryGroupsList[Ia],
|
|
-ka=e(pa,ua),ca.buffersNeedUpdate&&d(ua,pa),za=ka.attributes&&t(ka),ca.verticesNeedUpdate||ca.morphTargetsNeedUpdate||ca.elementsNeedUpdate||ca.uvsNeedUpdate||ca.normalsNeedUpdate||ca.colorsNeedUpdate||ca.tangentsNeedUpdate||za){var ra=ua,La=pa,Aa=k.DYNAMIC_DRAW,Ra=!ca.dynamic,Va=ka;if(ra.__inittedArrays){var eb=f(Va),gb=Va.vertexColors?Va.vertexColors:!1,xb=g(Va),fb=eb===THREE.SmoothShading,F=void 0,Z=void 0,$a=void 0,U=void 0,db=void 0,ab=void 0,Db=void 0,mb=void 0,bb=void 0,kb=void 0,lb=void 0,
|
|
|
|
|
|
+ka=e(pa,ua),ca.buffersNeedUpdate&&d(ua,pa),za=ka.attributes&&s(ka),ca.verticesNeedUpdate||ca.morphTargetsNeedUpdate||ca.elementsNeedUpdate||ca.uvsNeedUpdate||ca.normalsNeedUpdate||ca.colorsNeedUpdate||ca.tangentsNeedUpdate||za){var ra=ua,La=pa,Aa=k.DYNAMIC_DRAW,Ra=!ca.dynamic,Va=ka;if(ra.__inittedArrays){var eb=f(Va),gb=Va.vertexColors?Va.vertexColors:!1,xb=g(Va),fb=eb===THREE.SmoothShading,F=void 0,Z=void 0,$a=void 0,U=void 0,db=void 0,ab=void 0,Db=void 0,mb=void 0,bb=void 0,kb=void 0,lb=void 0,
|
|
V=void 0,W=void 0,X=void 0,qa=void 0,Eb=void 0,Fb=void 0,Gb=void 0,pb=void 0,Hb=void 0,Ib=void 0,Jb=void 0,qb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,yb=void 0,Nb=void 0,Ob=void 0,Pb=void 0,Bb=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Cb=void 0,va=void 0,ec=void 0,Zb=void 0,ic=void 0,jc=void 0,Sa=void 0,fc=void 0,Pa=void 0,Qa=void 0,$b=void 0,Ub=void 0,Ja=0,Ma=0,Vb=0,Wb=0,tb=0,Ya=0,Ba=0,cb=0,Ka=0,ga=0,la=0,y=0,wa=void 0,Ta=ra.__vertexArray,nc=ra.__uvArray,oc=ra.__uv2Array,ub=ra.__normalArray,Ea=ra.__tangentArray,
|
|
V=void 0,W=void 0,X=void 0,qa=void 0,Eb=void 0,Fb=void 0,Gb=void 0,pb=void 0,Hb=void 0,Ib=void 0,Jb=void 0,qb=void 0,Kb=void 0,Lb=void 0,Mb=void 0,yb=void 0,Nb=void 0,Ob=void 0,Pb=void 0,Bb=void 0,Qb=void 0,Rb=void 0,Sb=void 0,Cb=void 0,va=void 0,ec=void 0,Zb=void 0,ic=void 0,jc=void 0,Sa=void 0,fc=void 0,Pa=void 0,Qa=void 0,$b=void 0,Ub=void 0,Ja=0,Ma=0,Vb=0,Wb=0,tb=0,Ya=0,Ba=0,cb=0,Ka=0,ga=0,la=0,y=0,wa=void 0,Ta=ra.__vertexArray,nc=ra.__uvArray,oc=ra.__uv2Array,ub=ra.__normalArray,Ea=ra.__tangentArray,
|
|
Ua=ra.__colorArray,Fa=ra.__skinIndexArray,Ga=ra.__skinWeightArray,Qc=ra.__morphTargetsArrays,Rc=ra.__morphNormalsArrays,Sc=ra.__webglCustomAttributesList,x=void 0,Tb=ra.__faceArray,ob=ra.__lineArray,hb=La.geometry,vc=hb.elementsNeedUpdate,mc=hb.uvsNeedUpdate,Nc=hb.normalsNeedUpdate,Oc=hb.tangentsNeedUpdate,fd=hb.colorsNeedUpdate,gd=hb.morphTargetsNeedUpdate,cc=hb.vertices,sa=ra.faces3,ta=ra.faces4,Za=hb.faces,Tc=hb.faceVertexUvs[0],Uc=hb.faceVertexUvs[1],dc=hb.skinIndices,ac=hb.skinWeights,bc=hb.morphTargets,
|
|
Ua=ra.__colorArray,Fa=ra.__skinIndexArray,Ga=ra.__skinWeightArray,Qc=ra.__morphTargetsArrays,Rc=ra.__morphNormalsArrays,Sc=ra.__webglCustomAttributesList,x=void 0,Tb=ra.__faceArray,ob=ra.__lineArray,hb=La.geometry,vc=hb.elementsNeedUpdate,mc=hb.uvsNeedUpdate,Nc=hb.normalsNeedUpdate,Oc=hb.tangentsNeedUpdate,fd=hb.colorsNeedUpdate,gd=hb.morphTargetsNeedUpdate,cc=hb.vertices,sa=ra.faces3,ta=ra.faces4,Za=hb.faces,Tc=hb.faceVertexUvs[0],Uc=hb.faceVertexUvs[1],dc=hb.skinIndices,ac=hb.skinWeights,bc=hb.morphTargets,
|
|
yc=hb.morphNormals;if(hb.verticesNeedUpdate){F=0;for(Z=sa.length;F<Z;F++)U=Za[sa[F]],V=cc[U.a],W=cc[U.b],X=cc[U.c],Ta[Ma]=V.x,Ta[Ma+1]=V.y,Ta[Ma+2]=V.z,Ta[Ma+3]=W.x,Ta[Ma+4]=W.y,Ta[Ma+5]=W.z,Ta[Ma+6]=X.x,Ta[Ma+7]=X.y,Ta[Ma+8]=X.z,Ma+=9;F=0;for(Z=ta.length;F<Z;F++)U=Za[ta[F]],V=cc[U.a],W=cc[U.b],X=cc[U.c],qa=cc[U.d],Ta[Ma]=V.x,Ta[Ma+1]=V.y,Ta[Ma+2]=V.z,Ta[Ma+3]=W.x,Ta[Ma+4]=W.y,Ta[Ma+5]=W.z,Ta[Ma+6]=X.x,Ta[Ma+7]=X.y,Ta[Ma+8]=X.z,Ta[Ma+9]=qa.x,Ta[Ma+10]=qa.y,Ta[Ma+11]=qa.z,Ma+=12;k.bindBuffer(k.ARRAY_BUFFER,
|
|
yc=hb.morphNormals;if(hb.verticesNeedUpdate){F=0;for(Z=sa.length;F<Z;F++)U=Za[sa[F]],V=cc[U.a],W=cc[U.b],X=cc[U.c],Ta[Ma]=V.x,Ta[Ma+1]=V.y,Ta[Ma+2]=V.z,Ta[Ma+3]=W.x,Ta[Ma+4]=W.y,Ta[Ma+5]=W.z,Ta[Ma+6]=X.x,Ta[Ma+7]=X.y,Ta[Ma+8]=X.z,Ma+=9;F=0;for(Z=ta.length;F<Z;F++)U=Za[ta[F]],V=cc[U.a],W=cc[U.b],X=cc[U.c],qa=cc[U.d],Ta[Ma]=V.x,Ta[Ma+1]=V.y,Ta[Ma+2]=V.z,Ta[Ma+3]=W.x,Ta[Ma+4]=W.y,Ta[Ma+5]=W.z,Ta[Ma+6]=X.x,Ta[Ma+7]=X.y,Ta[Ma+8]=X.z,Ta[Ma+9]=qa.x,Ta[Ma+10]=qa.y,Ta[Ma+11]=qa.z,Ma+=12;k.bindBuffer(k.ARRAY_BUFFER,
|
|
@@ -467,15 +467,15 @@ Z;F++)U=Za[sa[F]],V=x.value[U.a],W=x.value[U.b],X=x.value[U.c],x.array[y]=V.x,x.
|
|
x.array[y]=V.x,x.array[y+1]=V.y,x.array[y+2]=V.z,x.array[y+3]=V.w,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=W.z,x.array[y+7]=W.w,x.array[y+8]=X.x,x.array[y+9]=X.y,x.array[y+10]=X.z,x.array[y+11]=X.w,x.array[y+12]=qa.x,x.array[y+13]=qa.y,x.array[y+14]=qa.z,x.array[y+15]=qa.w,y+=16}else if("faceVertices"===x.boundTo){F=0;for(Z=sa.length;F<Z;F++)wa=x.value[sa[F]],V=wa[0],W=wa[1],X=wa[2],x.array[y]=V.x,x.array[y+1]=V.y,x.array[y+2]=V.z,x.array[y+3]=V.w,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+
|
|
x.array[y]=V.x,x.array[y+1]=V.y,x.array[y+2]=V.z,x.array[y+3]=V.w,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=W.z,x.array[y+7]=W.w,x.array[y+8]=X.x,x.array[y+9]=X.y,x.array[y+10]=X.z,x.array[y+11]=X.w,x.array[y+12]=qa.x,x.array[y+13]=qa.y,x.array[y+14]=qa.z,x.array[y+15]=qa.w,y+=16}else if("faceVertices"===x.boundTo){F=0;for(Z=sa.length;F<Z;F++)wa=x.value[sa[F]],V=wa[0],W=wa[1],X=wa[2],x.array[y]=V.x,x.array[y+1]=V.y,x.array[y+2]=V.z,x.array[y+3]=V.w,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+
|
|
6]=W.z,x.array[y+7]=W.w,x.array[y+8]=X.x,x.array[y+9]=X.y,x.array[y+10]=X.z,x.array[y+11]=X.w,y+=12;F=0;for(Z=ta.length;F<Z;F++)wa=x.value[ta[F]],V=wa[0],W=wa[1],X=wa[2],qa=wa[3],x.array[y]=V.x,x.array[y+1]=V.y,x.array[y+2]=V.z,x.array[y+3]=V.w,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=W.z,x.array[y+7]=W.w,x.array[y+8]=X.x,x.array[y+9]=X.y,x.array[y+10]=X.z,x.array[y+11]=X.w,x.array[y+12]=qa.x,x.array[y+13]=qa.y,x.array[y+14]=qa.z,x.array[y+15]=qa.w,y+=16}k.bindBuffer(k.ARRAY_BUFFER,x.buffer);
|
|
6]=W.z,x.array[y+7]=W.w,x.array[y+8]=X.x,x.array[y+9]=X.y,x.array[y+10]=X.z,x.array[y+11]=X.w,y+=12;F=0;for(Z=ta.length;F<Z;F++)wa=x.value[ta[F]],V=wa[0],W=wa[1],X=wa[2],qa=wa[3],x.array[y]=V.x,x.array[y+1]=V.y,x.array[y+2]=V.z,x.array[y+3]=V.w,x.array[y+4]=W.x,x.array[y+5]=W.y,x.array[y+6]=W.z,x.array[y+7]=W.w,x.array[y+8]=X.x,x.array[y+9]=X.y,x.array[y+10]=X.z,x.array[y+11]=X.w,x.array[y+12]=qa.x,x.array[y+13]=qa.y,x.array[y+14]=qa.z,x.array[y+15]=qa.w,y+=16}k.bindBuffer(k.ARRAY_BUFFER,x.buffer);
|
|
k.bufferData(k.ARRAY_BUFFER,x.array,Aa)}}Ra&&(delete ra.__inittedArrays,delete ra.__colorArray,delete ra.__normalArray,delete ra.__tangentArray,delete ra.__uvArray,delete ra.__uv2Array,delete ra.__faceArray,delete ra.__vertexArray,delete ra.__lineArray,delete ra.__skinIndexArray,delete ra.__skinWeightArray)}}ca.verticesNeedUpdate=!1;ca.morphTargetsNeedUpdate=!1;ca.elementsNeedUpdate=!1;ca.uvsNeedUpdate=!1;ca.normalsNeedUpdate=!1;ca.colorsNeedUpdate=!1;ca.tangentsNeedUpdate=!1;ca.buffersNeedUpdate=
|
|
k.bufferData(k.ARRAY_BUFFER,x.array,Aa)}}Ra&&(delete ra.__inittedArrays,delete ra.__colorArray,delete ra.__normalArray,delete ra.__tangentArray,delete ra.__uvArray,delete ra.__uv2Array,delete ra.__faceArray,delete ra.__vertexArray,delete ra.__lineArray,delete ra.__skinIndexArray,delete ra.__skinWeightArray)}}ca.verticesNeedUpdate=!1;ca.morphTargetsNeedUpdate=!1;ca.elementsNeedUpdate=!1;ca.uvsNeedUpdate=!1;ca.normalsNeedUpdate=!1;ca.colorsNeedUpdate=!1;ca.tangentsNeedUpdate=!1;ca.buffersNeedUpdate=
|
|
-!1;ka.attributes&&r(ka)}else if(pa instanceof THREE.Ribbon){ka=e(pa,ca);za=ka.attributes&&t(ka);if(ca.verticesNeedUpdate||ca.colorsNeedUpdate||ca.normalsNeedUpdate||za){var vb=ca,zc=k.DYNAMIC_DRAW,pc=void 0,qc=void 0,rc=void 0,Ac=void 0,xa=void 0,Bc=void 0,Cc=void 0,Dc=void 0,Xc=void 0,Wa=void 0,kc=void 0,Ca=void 0,ib=void 0,Yc=vb.vertices,Zc=vb.colors,$c=vb.normals,hd=Yc.length,id=Zc.length,jd=$c.length,Ec=vb.__vertexArray,Fc=vb.__colorArray,Gc=vb.__normalArray,kd=vb.colorsNeedUpdate,ld=vb.normalsNeedUpdate,
|
|
|
|
|
|
+!1;ka.attributes&&r(ka)}else if(pa instanceof THREE.Ribbon){ka=e(pa,ca);za=ka.attributes&&s(ka);if(ca.verticesNeedUpdate||ca.colorsNeedUpdate||ca.normalsNeedUpdate||za){var vb=ca,zc=k.DYNAMIC_DRAW,pc=void 0,qc=void 0,rc=void 0,Ac=void 0,xa=void 0,Bc=void 0,Cc=void 0,Dc=void 0,Xc=void 0,Wa=void 0,kc=void 0,Ca=void 0,ib=void 0,Yc=vb.vertices,Zc=vb.colors,$c=vb.normals,hd=Yc.length,id=Zc.length,jd=$c.length,Ec=vb.__vertexArray,Fc=vb.__colorArray,Gc=vb.__normalArray,kd=vb.colorsNeedUpdate,ld=vb.normalsNeedUpdate,
|
|
Vc=vb.__webglCustomAttributesList;if(vb.verticesNeedUpdate){for(pc=0;pc<hd;pc++)Ac=Yc[pc],xa=3*pc,Ec[xa]=Ac.x,Ec[xa+1]=Ac.y,Ec[xa+2]=Ac.z;k.bindBuffer(k.ARRAY_BUFFER,vb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ec,zc)}if(kd){for(qc=0;qc<id;qc++)Bc=Zc[qc],xa=3*qc,Fc[xa]=Bc.r,Fc[xa+1]=Bc.g,Fc[xa+2]=Bc.b;k.bindBuffer(k.ARRAY_BUFFER,vb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Fc,zc)}if(ld){for(rc=0;rc<jd;rc++)Cc=$c[rc],xa=3*rc,Gc[xa]=Cc.x,Gc[xa+1]=Cc.y,Gc[xa+2]=Cc.z;k.bindBuffer(k.ARRAY_BUFFER,
|
|
Vc=vb.__webglCustomAttributesList;if(vb.verticesNeedUpdate){for(pc=0;pc<hd;pc++)Ac=Yc[pc],xa=3*pc,Ec[xa]=Ac.x,Ec[xa+1]=Ac.y,Ec[xa+2]=Ac.z;k.bindBuffer(k.ARRAY_BUFFER,vb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Ec,zc)}if(kd){for(qc=0;qc<id;qc++)Bc=Zc[qc],xa=3*qc,Fc[xa]=Bc.r,Fc[xa+1]=Bc.g,Fc[xa+2]=Bc.b;k.bindBuffer(k.ARRAY_BUFFER,vb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Fc,zc)}if(ld){for(rc=0;rc<jd;rc++)Cc=$c[rc],xa=3*rc,Gc[xa]=Cc.x,Gc[xa+1]=Cc.y,Gc[xa+2]=Cc.z;k.bindBuffer(k.ARRAY_BUFFER,
|
|
vb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Gc,zc)}if(Vc){Dc=0;for(Xc=Vc.length;Dc<Xc;Dc++)if(Ca=Vc[Dc],Ca.needsUpdate&&(void 0===Ca.boundTo||"vertices"===Ca.boundTo)){xa=0;kc=Ca.value.length;if(1===Ca.size)for(Wa=0;Wa<kc;Wa++)Ca.array[Wa]=Ca.value[Wa];else if(2===Ca.size)for(Wa=0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.x,Ca.array[xa+1]=ib.y,xa+=2;else if(3===Ca.size)if("c"===Ca.type)for(Wa=0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.r,Ca.array[xa+1]=ib.g,Ca.array[xa+2]=ib.b,xa+=3;else for(Wa=
|
|
vb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Gc,zc)}if(Vc){Dc=0;for(Xc=Vc.length;Dc<Xc;Dc++)if(Ca=Vc[Dc],Ca.needsUpdate&&(void 0===Ca.boundTo||"vertices"===Ca.boundTo)){xa=0;kc=Ca.value.length;if(1===Ca.size)for(Wa=0;Wa<kc;Wa++)Ca.array[Wa]=Ca.value[Wa];else if(2===Ca.size)for(Wa=0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.x,Ca.array[xa+1]=ib.y,xa+=2;else if(3===Ca.size)if("c"===Ca.type)for(Wa=0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.r,Ca.array[xa+1]=ib.g,Ca.array[xa+2]=ib.b,xa+=3;else for(Wa=
|
|
-0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.x,Ca.array[xa+1]=ib.y,Ca.array[xa+2]=ib.z,xa+=3;else if(4===Ca.size)for(Wa=0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.x,Ca.array[xa+1]=ib.y,Ca.array[xa+2]=ib.z,Ca.array[xa+3]=ib.w,xa+=4;k.bindBuffer(k.ARRAY_BUFFER,Ca.buffer);k.bufferData(k.ARRAY_BUFFER,Ca.array,zc)}}}ca.verticesNeedUpdate=!1;ca.colorsNeedUpdate=!1;ca.normalsNeedUpdate=!1;ka.attributes&&r(ka)}else if(pa instanceof THREE.Line){ka=e(pa,ca);za=ka.attributes&&t(ka);if(ca.verticesNeedUpdate||
|
|
|
|
|
|
+0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.x,Ca.array[xa+1]=ib.y,Ca.array[xa+2]=ib.z,xa+=3;else if(4===Ca.size)for(Wa=0;Wa<kc;Wa++)ib=Ca.value[Wa],Ca.array[xa]=ib.x,Ca.array[xa+1]=ib.y,Ca.array[xa+2]=ib.z,Ca.array[xa+3]=ib.w,xa+=4;k.bindBuffer(k.ARRAY_BUFFER,Ca.buffer);k.bufferData(k.ARRAY_BUFFER,Ca.array,zc)}}}ca.verticesNeedUpdate=!1;ca.colorsNeedUpdate=!1;ca.normalsNeedUpdate=!1;ka.attributes&&r(ka)}else if(pa instanceof THREE.Line){ka=e(pa,ca);za=ka.attributes&&s(ka);if(ca.verticesNeedUpdate||
|
|
ca.colorsNeedUpdate||ca.lineDistancesNeedUpdate||za){var wb=ca,Hc=k.DYNAMIC_DRAW,sc=void 0,tc=void 0,uc=void 0,Ic=void 0,Ha=void 0,Jc=void 0,ad=wb.vertices,bd=wb.colors,cd=wb.lineDistances,md=ad.length,nd=bd.length,od=cd.length,Kc=wb.__vertexArray,Lc=wb.__colorArray,dd=wb.__lineDistanceArray,pd=wb.colorsNeedUpdate,qd=wb.lineDistancesNeedUpdate,Wc=wb.__webglCustomAttributesList,Mc=void 0,ed=void 0,Xa=void 0,lc=void 0,jb=void 0,Da=void 0;if(wb.verticesNeedUpdate){for(sc=0;sc<md;sc++)Ic=ad[sc],Ha=3*
|
|
ca.colorsNeedUpdate||ca.lineDistancesNeedUpdate||za){var wb=ca,Hc=k.DYNAMIC_DRAW,sc=void 0,tc=void 0,uc=void 0,Ic=void 0,Ha=void 0,Jc=void 0,ad=wb.vertices,bd=wb.colors,cd=wb.lineDistances,md=ad.length,nd=bd.length,od=cd.length,Kc=wb.__vertexArray,Lc=wb.__colorArray,dd=wb.__lineDistanceArray,pd=wb.colorsNeedUpdate,qd=wb.lineDistancesNeedUpdate,Wc=wb.__webglCustomAttributesList,Mc=void 0,ed=void 0,Xa=void 0,lc=void 0,jb=void 0,Da=void 0;if(wb.verticesNeedUpdate){for(sc=0;sc<md;sc++)Ic=ad[sc],Ha=3*
|
|
sc,Kc[Ha]=Ic.x,Kc[Ha+1]=Ic.y,Kc[Ha+2]=Ic.z;k.bindBuffer(k.ARRAY_BUFFER,wb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Kc,Hc)}if(pd){for(tc=0;tc<nd;tc++)Jc=bd[tc],Ha=3*tc,Lc[Ha]=Jc.r,Lc[Ha+1]=Jc.g,Lc[Ha+2]=Jc.b;k.bindBuffer(k.ARRAY_BUFFER,wb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Lc,Hc)}if(qd){for(uc=0;uc<od;uc++)dd[uc]=cd[uc];k.bindBuffer(k.ARRAY_BUFFER,wb.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,dd,Hc)}if(Wc){Mc=0;for(ed=Wc.length;Mc<ed;Mc++)if(Da=Wc[Mc],Da.needsUpdate&&
|
|
sc,Kc[Ha]=Ic.x,Kc[Ha+1]=Ic.y,Kc[Ha+2]=Ic.z;k.bindBuffer(k.ARRAY_BUFFER,wb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,Kc,Hc)}if(pd){for(tc=0;tc<nd;tc++)Jc=bd[tc],Ha=3*tc,Lc[Ha]=Jc.r,Lc[Ha+1]=Jc.g,Lc[Ha+2]=Jc.b;k.bindBuffer(k.ARRAY_BUFFER,wb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Lc,Hc)}if(qd){for(uc=0;uc<od;uc++)dd[uc]=cd[uc];k.bindBuffer(k.ARRAY_BUFFER,wb.__webglLineDistanceBuffer);k.bufferData(k.ARRAY_BUFFER,dd,Hc)}if(Wc){Mc=0;for(ed=Wc.length;Mc<ed;Mc++)if(Da=Wc[Mc],Da.needsUpdate&&
|
|
(void 0===Da.boundTo||"vertices"===Da.boundTo)){Ha=0;lc=Da.value.length;if(1===Da.size)for(Xa=0;Xa<lc;Xa++)Da.array[Xa]=Da.value[Xa];else if(2===Da.size)for(Xa=0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.x,Da.array[Ha+1]=jb.y,Ha+=2;else if(3===Da.size)if("c"===Da.type)for(Xa=0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.r,Da.array[Ha+1]=jb.g,Da.array[Ha+2]=jb.b,Ha+=3;else for(Xa=0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.x,Da.array[Ha+1]=jb.y,Da.array[Ha+2]=jb.z,Ha+=3;else if(4===Da.size)for(Xa=
|
|
(void 0===Da.boundTo||"vertices"===Da.boundTo)){Ha=0;lc=Da.value.length;if(1===Da.size)for(Xa=0;Xa<lc;Xa++)Da.array[Xa]=Da.value[Xa];else if(2===Da.size)for(Xa=0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.x,Da.array[Ha+1]=jb.y,Ha+=2;else if(3===Da.size)if("c"===Da.type)for(Xa=0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.r,Da.array[Ha+1]=jb.g,Da.array[Ha+2]=jb.b,Ha+=3;else for(Xa=0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.x,Da.array[Ha+1]=jb.y,Da.array[Ha+2]=jb.z,Ha+=3;else if(4===Da.size)for(Xa=
|
|
0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.x,Da.array[Ha+1]=jb.y,Da.array[Ha+2]=jb.z,Da.array[Ha+3]=jb.w,Ha+=4;k.bindBuffer(k.ARRAY_BUFFER,Da.buffer);k.bufferData(k.ARRAY_BUFFER,Da.array,Hc)}}}ca.verticesNeedUpdate=!1;ca.colorsNeedUpdate=!1;ca.lineDistancesNeedUpdate=!1;ka.attributes&&r(ka)}else pa instanceof THREE.ParticleSystem&&(ca instanceof THREE.BufferGeometry?((ca.verticesNeedUpdate||ca.colorsNeedUpdate)&&j(ca,k.DYNAMIC_DRAW,!ca.dynamic),ca.verticesNeedUpdate=!1,ca.colorsNeedUpdate=!1):(ka=
|
|
0;Xa<lc;Xa++)jb=Da.value[Xa],Da.array[Ha]=jb.x,Da.array[Ha+1]=jb.y,Da.array[Ha+2]=jb.z,Da.array[Ha+3]=jb.w,Ha+=4;k.bindBuffer(k.ARRAY_BUFFER,Da.buffer);k.bufferData(k.ARRAY_BUFFER,Da.array,Hc)}}}ca.verticesNeedUpdate=!1;ca.colorsNeedUpdate=!1;ca.lineDistancesNeedUpdate=!1;ka.attributes&&r(ka)}else pa instanceof THREE.ParticleSystem&&(ca instanceof THREE.BufferGeometry?((ca.verticesNeedUpdate||ca.colorsNeedUpdate)&&j(ca,k.DYNAMIC_DRAW,!ca.dynamic),ca.verticesNeedUpdate=!1,ca.colorsNeedUpdate=!1):(ka=
|
|
-e(pa,ca),za=ka.attributes&&t(ka),(ca.verticesNeedUpdate||ca.colorsNeedUpdate||pa.sortParticles||za)&&i(ca,k.DYNAMIC_DRAW,pa),ca.verticesNeedUpdate=!1,ca.colorsNeedUpdate=!1,ka.attributes&&r(ka)))}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,l,n,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof
|
|
|
|
|
|
+e(pa,ca),za=ka.attributes&&s(ka),(ca.verticesNeedUpdate||ca.colorsNeedUpdate||pa.sortParticles||za)&&i(ca,k.DYNAMIC_DRAW,pa),ca.verticesNeedUpdate=!1,ca.colorsNeedUpdate=!1,ka.attributes&&r(ka)))}};this.initMaterial=function(a,b,c,d){var e,f,g,h,i,j,l,n,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof
|
|
THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var o=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var p,q,r;e=p=q=r=o=0;for(f=b.length;e<f;e++)g=b[e],g.onlyShadow||(g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&r++,g instanceof THREE.HemisphereLight&&
|
|
THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var o=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(o.uniforms);a.vertexShader=o.vertexShader;a.fragmentShader=o.fragmentShader}var p,q,r;e=p=q=r=o=0;for(f=b.length;e<f;e++)g=b[e],g.onlyShadow||(g instanceof THREE.DirectionalLight&&p++,g instanceof THREE.PointLight&&q++,g instanceof THREE.SpotLight&&r++,g instanceof THREE.HemisphereLight&&
|
|
o++);e=p;f=q;g=r;h=o;o=p=0;for(r=b.length;o<r;o++)q=b[o],q.castShadow&&(q instanceof THREE.SpotLight&&p++,q instanceof THREE.DirectionalLight&&!q.shadowCascade&&p++);n=p;fc&&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;
|
|
o++);e=p;f=q;g=r;h=o;o=p=0;for(r=b.length;o<r;o++)q=b[o],q.castShadow&&(q instanceof THREE.SpotLight&&p++,q instanceof THREE.DirectionalLight&&!q.shadowCascade&&p++);n=p;fc&&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;r=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,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:fc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,
|
|
a:{q=a.fragmentShader;r=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,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:fc&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,
|
|
@@ -507,35 +507,35 @@ THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=null};
|
|
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsLength=0;this.material=this.color=null;this.uvs=[[]];this.z=null};
|
|
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.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 e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
-THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,m=a.faceVertexUvs[0],n=f.faceVertexUvs[0],l={},o=0;o<a.materials.length;o++)l[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,p=h.length;o<p;o++){var q=h[o].clone();c&&c.multiplyVector3(q);g.push(q)}o=0;for(p=j.length;o<p;o++){var g=j[o],
|
|
|
|
-t,r,A=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?t=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(t=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));t.normal.copy(g.normal);d&&d.multiplyVector3(t.normal);h=0;for(q=A.length;h<q;h++)r=A[h].clone(),d&&d.multiplyVector3(r),t.vertexNormals.push(r);t.color.copy(g.color);h=0;for(q=u.length;h<q;h++)r=u[h],t.vertexColors.push(r.clone());void 0!==g.materialIndex&&(h=f.materials[g.materialIndex],q=h.id,u=l[q],void 0===u&&(u=a.materials.length,
|
|
|
|
-l[q]=u,a.materials.push(h)),t.materialIndex=u);t.centroid.copy(g.centroid);c&&c.multiplyVector3(t.centroid);i.push(t)}o=0;for(p=n.length;o<p;o++){c=n[o];d=[];h=0;for(q=c.length;h<q;h++)d.push(new THREE.UV(c[h].u,c[h].v));m.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,e=a.faces,f=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=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;for(c=f.length;a<
|
|
|
|
|
|
+THREE.GeometryUtils={merge:function(a,b){for(var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,j=f.faces,l=a.faceVertexUvs[0],n=f.faceVertexUvs[0],m={},p=0;p<a.materials.length;p++)m[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,r,A=g.vertexNormals,u=g.vertexColors;g instanceof THREE.Face3?s=new THREE.Face3(g.a+e,g.b+e,g.c+e):g instanceof THREE.Face4&&(s=new THREE.Face4(g.a+e,g.b+e,g.c+e,g.d+e));s.normal.copy(g.normal);d&&d.multiplyVector3(s.normal);h=0;for(q=A.length;h<q;h++)r=A[h].clone(),d&&d.multiplyVector3(r),s.vertexNormals.push(r);s.color.copy(g.color);h=0;for(q=u.length;h<q;h++)r=u[h],s.vertexColors.push(r.clone());void 0!==g.materialIndex&&(h=f.materials[g.materialIndex],q=h.id,u=m[q],void 0===u&&(u=a.materials.length,
|
|
|
|
+m[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=n.length;p<o;p++){c=n[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,e=a.faces,f=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=e.length;a<c;a++)b.faces.push(e[a].clone());a=0;for(c=f.length;a<
|
|
c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=
|
|
c;a++){for(var d=f[a],e=[],g=0,h=d.length;g<h;g++)e.push(new THREE.UV(d[g].u,d[g].v));b.faceVertexUvs[0].push(e)}return b},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=
|
|
b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=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,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,
|
|
b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=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,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,
|
|
-e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],m,n,l,o;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(m=g[d.a],n=g[d.b],l=g[d.c],d._area=THREE.GeometryUtils.triangleArea(m,n,l)):d instanceof THREE.Face4&&(m=g[d.a],n=g[d.b],l=g[d.c],o=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(m,
|
|
|
|
-n,o),d._area2=THREE.GeometryUtils.triangleArea(n,l,o),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.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,
|
|
|
|
|
|
+e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return j[e]>a?b(c,e-1):j[e]<a?b(e+1,d):e}return b(0,j.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,j=[],l,n,m,p;for(e=0;e<h;e++)d=f[e],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],p=g[d.d],d._area1=THREE.GeometryUtils.triangleArea(l,
|
|
|
|
+n,p),d._area2=THREE.GeometryUtils.triangleArea(n,m,p),d._area=d._area1+d._area2),i+=d._area,j[e]=i;d=[];for(e=0;e<b;e++)g=THREE.GeometryUtils.random()*i,g=c(g),d[e]=THREE.GeometryUtils.randomPointInFace(f[g],a,!0);return d},triangleArea:function(a,b,c){var d,e=THREE.GeometryUtils.__v1;e.sub(a,b);d=e.length();e.sub(a,c);a=e.length();e.sub(b,c);c=e.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],e=0,f=d.length;e<f;e++)if(1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v)d[e].v-=Math.floor(d[e].v)},triangulateQuads:function(a){var b,c,d,e,f=[],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=
|
|
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],e=0,f=d.length;e<f;e++)if(1!==d[e].u&&(d[e].u-=Math.floor(d[e].u)),1!==d[e].v)d[e].v-=Math.floor(d[e].v)},triangulateQuads:function(a){var b,c,d,e,f=[],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){e=d.a;var i=d.b,j=d.c,m=d.d,n=new THREE.Face3,l=new THREE.Face3;n.color.copy(d.color);l.color.copy(d.color);n.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=m;l.a=i;l.b=j;l.c=m;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(),l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=
|
|
|
|
-d.vertexColors[3].clone());f.push(n,l);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],j=n[2],m=n[3],n=[n[0].clone(),i.clone(),m.clone()],i=[i.clone(),j.clone(),m.clone()],h[d].push(n,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=
|
|
|
|
|
|
+a.faces[b],d instanceof THREE.Face4){e=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=e;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());f.push(n,m);d=0;for(e=a.faceVertexUvs.length;d<e;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(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;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 e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],
|
|
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 e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],j=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());f.a=e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.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()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,m,n,l,o,p,q,t,r,A,u,s,D=[],z=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],m=a.vertices[g],n=a.vertices[h],o=j.distanceTo(m),p=m.distanceTo(n),l=j.distanceTo(n),o>b||p>b||l>b){i=a.vertices.length;u=e.clone();s=e.clone();o>=p&&
|
|
|
|
-o>=l?(j=j.clone(),j.lerpSelf(m,0.5),u.a=f,u.b=i,u.c=h,s.a=i,s.b=g,s.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),u.vertexNormals[1].copy(f),s.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),u.vertexColors[1].copy(f),s.vertexColors[0].copy(f)),e=0):p>=o&&p>=l?(j=m.clone(),j.lerpSelf(n,0.5),u.a=f,u.b=g,u.c=i,s.a=i,s.b=h,s.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),
|
|
|
|
-f.lerpSelf(e.vertexNormals[2],0.5),u.vertexNormals[2].copy(f),s.vertexNormals[0].copy(f),s.vertexNormals[1].copy(e.vertexNormals[2]),s.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),u.vertexColors[2].copy(f),s.vertexColors[0].copy(f),s.vertexColors[1].copy(e.vertexColors[2]),s.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.lerpSelf(n,0.5),u.a=f,u.b=g,u.c=i,s.a=i,s.b=g,s.c=h,3===e.vertexNormals.length&&
|
|
|
|
-(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),u.vertexNormals[2].copy(f),s.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),u.vertexColors[2].copy(f),s.vertexColors[0].copy(f)),e=2);D.push(u,s);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],s=j[0],h=j[1],u=j[2],0===e?(m=s.clone(),m.lerpSelf(h,0.5),j=[s.clone(),m.clone(),u.clone()],h=[m.clone(),h.clone(),
|
|
|
|
-u.clone()]):1===e?(m=h.clone(),m.lerpSelf(u,0.5),j=[s.clone(),h.clone(),m.clone()],h=[m.clone(),u.clone(),s.clone()]):(m=s.clone(),m.lerpSelf(u,0.5),j=[s.clone(),h.clone(),m.clone()],h=[m.clone(),h.clone(),u.clone()]),z[f].push(j,h))}else{D.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],m=a.vertices[g],n=a.vertices[h],l=a.vertices[i],o=j.distanceTo(m),p=m.distanceTo(n),q=n.distanceTo(l),t=j.distanceTo(l),o>b||p>b||
|
|
|
|
-q>b||t>b){r=a.vertices.length;A=a.vertices.length+1;u=e.clone();s=e.clone();o>=p&&o>=q&&o>=t||q>=p&&q>=o&&q>=t?(o=j.clone(),o.lerpSelf(m,0.5),m=n.clone(),m.lerpSelf(l,0.5),u.a=f,u.b=r,u.c=A,u.d=i,s.a=r,s.b=g,s.c=h,s.d=A,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),u.vertexNormals[1].copy(f),u.vertexNormals[2].copy(g),s.vertexNormals[0].copy(f),s.vertexNormals[3].copy(g)),4===e.vertexColors.length&&
|
|
|
|
-(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),u.vertexColors[1].copy(f),u.vertexColors[2].copy(g),s.vertexColors[0].copy(f),s.vertexColors[3].copy(g)),e=0):(o=m.clone(),o.lerpSelf(n,0.5),m=l.clone(),m.lerpSelf(j,0.5),u.a=f,u.b=g,u.c=r,u.d=A,s.a=A,s.b=r,s.c=h,s.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),
|
|
|
|
-u.vertexNormals[2].copy(f),u.vertexNormals[3].copy(g),s.vertexNormals[0].copy(g),s.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),u.vertexColors[2].copy(f),u.vertexColors[3].copy(g),s.vertexColors[0].copy(g),s.vertexColors[1].copy(f)),e=1);D.push(u,s);a.vertices.push(o,m);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],s=j[0],
|
|
|
|
-h=j[1],u=j[2],j=j[3],0===e?(m=s.clone(),m.lerpSelf(h,0.5),n=u.clone(),n.lerpSelf(j,0.5),s=[s.clone(),m.clone(),n.clone(),j.clone()],h=[m.clone(),h.clone(),u.clone(),n.clone()]):(m=h.clone(),m.lerpSelf(u,0.5),n=j.clone(),n.lerpSelf(s,0.5),s=[s.clone(),h.clone(),m.clone(),n.clone()],h=[n.clone(),m.clone(),u.clone(),j.clone()]),z[f].push(s,h))}else{D.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}a.faces=D;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
|
|
|
|
+b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,j,l,n,m,p,o,q,s,r,A,u,t,D=[],z=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)z[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,j=a.vertices[f],l=a.vertices[g],n=a.vertices[h],p=j.distanceTo(l),o=l.distanceTo(n),m=j.distanceTo(n),p>b||o>b||m>b){i=a.vertices.length;u=e.clone();t=e.clone();p>=o&&
|
|
|
|
+p>=m?(j=j.clone(),j.lerpSelf(l,0.5),u.a=f,u.b=i,u.c=h,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),u.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),u.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):o>=p&&o>=m?(j=l.clone(),j.lerpSelf(n,0.5),u.a=f,u.b=g,u.c=i,t.a=i,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),
|
|
|
|
+f.lerpSelf(e.vertexNormals[2],0.5),u.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),u.vertexColors[2].copy(f),t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(j=j.clone(),j.lerpSelf(n,0.5),u.a=f,u.b=g,u.c=i,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&
|
|
|
|
+(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),u.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),u.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);D.push(u,t);a.vertices.push(j);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],t=j[0],h=j[1],u=j[2],0===e?(l=t.clone(),l.lerpSelf(h,0.5),j=[t.clone(),l.clone(),u.clone()],h=[l.clone(),h.clone(),
|
|
|
|
+u.clone()]):1===e?(l=h.clone(),l.lerpSelf(u,0.5),j=[t.clone(),h.clone(),l.clone()],h=[l.clone(),u.clone(),t.clone()]):(l=t.clone(),l.lerpSelf(u,0.5),j=[t.clone(),h.clone(),l.clone()],h=[l.clone(),h.clone(),u.clone()]),z[f].push(j,h))}else{D.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,j=a.vertices[f],l=a.vertices[g],n=a.vertices[h],m=a.vertices[i],p=j.distanceTo(l),o=l.distanceTo(n),q=n.distanceTo(m),s=j.distanceTo(m),p>b||o>b||
|
|
|
|
+q>b||s>b){r=a.vertices.length;A=a.vertices.length+1;u=e.clone();t=e.clone();p>=o&&p>=q&&p>=s||q>=o&&q>=p&&q>=s?(p=j.clone(),p.lerpSelf(l,0.5),l=n.clone(),l.lerpSelf(m,0.5),u.a=f,u.b=r,u.c=A,u.d=i,t.a=r,t.b=g,t.c=h,t.d=A,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),u.vertexNormals[1].copy(f),u.vertexNormals[2].copy(g),t.vertexNormals[0].copy(f),t.vertexNormals[3].copy(g)),4===e.vertexColors.length&&
|
|
|
|
+(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),u.vertexColors[1].copy(f),u.vertexColors[2].copy(g),t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(p=l.clone(),p.lerpSelf(n,0.5),l=m.clone(),l.lerpSelf(j,0.5),u.a=f,u.b=g,u.c=r,u.d=A,t.a=A,t.b=r,t.c=h,t.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),
|
|
|
|
+u.vertexNormals[2].copy(f),u.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),u.vertexColors[2].copy(f),u.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);D.push(u,t);a.vertices.push(p,l);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(j=a.faceVertexUvs[f][c],t=j[0],
|
|
|
|
+h=j[1],u=j[2],j=j[3],0===e?(l=t.clone(),l.lerpSelf(h,0.5),n=u.clone(),n.lerpSelf(j,0.5),t=[t.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(t,0.5),t=[t.clone(),h.clone(),l.clone(),n.clone()],h=[n.clone(),l.clone(),u.clone(),j.clone()]),z[f].push(t,h))}else{D.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)z[f].push(a.faceVertexUvs[f][c])}a.faces=D;a.faceVertexUvs=z}};THREE.GeometryUtils.random=THREE.Math.random16;
|
|
THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};h.onerror=
|
|
!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount=e.loadCount+1;if(e.loadCount===6){f.needsUpdate=true;c&&c()}};h.onerror=
|
|
d;h.crossOrigin=this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;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;e.loadCount=e.loadCount+1;if(e.loadCount===6){f.format=d.format;f.needsUpdate=true;c&&c()}}},g=0,h=a.length;g<h;++g){var i=
|
|
d;h.crossOrigin=this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;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;e.loadCount=e.loadCount+1;if(e.loadCount===6){f.format=d.format;f.needsUpdate=true;c&&c()}}},g=0,h=a.length;g<h;++g){var i=
|
|
{};e[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 f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=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"),
|
|
{};e[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 f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=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 e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.width=h[4];d.height=h[3];h=h[1]+4;f=d.width;g=d.height;for(i=0;i<d.mipmapCount;i++){var j=Math.max(4,f)/
|
|
d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.width=h[4];d.height=h[3];h=h[1]+4;f=d.width;g=d.height;for(i=0;i<d.mipmapCount;i++){var j=Math.max(4,f)/
|
|
-4*Math.max(4,g)/4*e,m={data:new Uint8Array(a,h,j),width:f,height:g};d.mipmaps.push(m);h+=j;f=Math.max(0.5*f,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,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,m=0;m<d;m++)for(var n=0;n<e;n++){var l=
|
|
|
|
-0>n-1?0:n-1,o=n+1>e-1?e-1:n+1,p=0>m-1?0:m-1,q=m+1>d-1?d-1:m+1,t=[],r=[0,0,h[4*(n*d+m)]/255*b];t.push([-1,0,h[4*(n*d+p)]/255*b]);t.push([-1,-1,h[4*(l*d+p)]/255*b]);t.push([0,-1,h[4*(l*d+m)]/255*b]);t.push([1,-1,h[4*(l*d+q)]/255*b]);t.push([1,0,h[4*(n*d+q)]/255*b]);t.push([1,1,h[4*(o*d+q)]/255*b]);t.push([0,1,h[4*(o*d+m)]/255*b]);t.push([-1,1,h[4*(o*d+p)]/255*b]);l=[];p=t.length;for(o=0;o<p;o++){var q=t[o],A=t[(o+1)%p],q=[q[0]-r[0],q[1]-r[1],q[2]-r[2]],A=[A[0]-r[0],A[1]-r[1],A[2]-r[2]];l.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]]))}t=[0,0,0];for(o=0;o<l.length;o++)t[0]+=l[o][0],t[1]+=l[o][1],t[2]+=l[o][2];t[0]/=l.length;t[1]/=l.length;t[2]/=l.length;r=4*(n*d+m);j[r]=255*((t[0]+1)/2)|0;j[r+1]=255*((t[1]+1)/2)|0;j[r+2]=255*t[2]|0;j[r+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,
|
|
|
|
|
|
+4*Math.max(4,g)/4*e,l={data:new Uint8Array(a,h,j),width:f,height:g};d.mipmaps.push(l);h+=j;f=Math.max(0.5*f,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,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,i=g.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var n=0;n<e;n++){var m=
|
|
|
|
+0>n-1?0:n-1,p=n+1>e-1?e-1:n+1,o=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,s=[],r=[0,0,h[4*(n*d+l)]/255*b];s.push([-1,0,h[4*(n*d+o)]/255*b]);s.push([-1,-1,h[4*(m*d+o)]/255*b]);s.push([0,-1,h[4*(m*d+l)]/255*b]);s.push([1,-1,h[4*(m*d+q)]/255*b]);s.push([1,0,h[4*(n*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]);m=[];o=s.length;for(p=0;p<o;p++){var q=s[p],A=s[(p+1)%o],q=[q[0]-r[0],q[1]-r[1],q[2]-r[2]],A=[A[0]-r[0],A[1]-r[1],A[2]-r[2]];m.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<m.length;p++)s[0]+=m[p][0],s[1]+=m[p][1],s[2]+=m[p][2];s[0]/=m.length;s[1]/=m.length;s[2]/=m.length;r=4*(n*d+l);j[r]=255*((s[0]+1)/2)|0;j[r+1]=255*((s[1]+1)/2)|0;j[r+2]=255*s[2]|0;j[r+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,
|
|
a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
|
|
a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
|
|
THREE.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}",
|
|
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 worldPosition = modelMatrix * vec4( position, 1.0 );\nvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = worldPosition.xyz - cameraPosition;\nvReflect = reflect( I, worldNormal );\nvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\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 worldPosition = modelMatrix * vec4( position, 1.0 );\nvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = worldPosition.xyz - cameraPosition;\nvReflect = reflect( I, worldNormal );\nvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
@@ -547,12 +547,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 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
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 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - worldPosition.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}"}}});
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - worldPosition.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=
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
-0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,m,n,l,o,p,q,t,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));j=b.length;for(a=0;a<j;){i=b[a++];switch(i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
|
-c+d;m=b[a++]*c;o=b[a++]*c+d;p=b[a++]*c;e.quadraticCurveTo(o,p,i,m);if(g=f[f.length-1]){n=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var A=g/h;THREE.Shape.Utils.b2(A,n,o,i);THREE.Shape.Utils.b2(A,l,p,m)}}break;case "b":i=b[a++]*c+d;m=b[a++]*c;o=b[a++]*c+d;p=b[a++]*-c;q=b[a++]*c+d;t=b[a++]*-c;e.bezierCurveTo(i,m,o,p,q,t);if(g=f[f.length-1]){n=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){A=g/h;THREE.Shape.Utils.b3(A,n,o,q,i);THREE.Shape.Utils.b3(A,l,p,t,m)}}}}}return{offset:r.ha*c,path:e}}}};
|
|
|
|
|
|
+0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,j,l,n,m,p,o,q,s,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.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;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
|
+c+d;l=b[a++]*c;p=b[a++]*c+d;o=b[a++]*c;e.quadraticCurveTo(p,o,i,l);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){var A=g/h;THREE.Shape.Utils.b2(A,n,p,i);THREE.Shape.Utils.b2(A,m,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;e.bezierCurveTo(i,l,p,o,q,s);if(g=f[f.length-1]){n=g.x;m=g.y;g=1;for(h=this.divisions;g<=h;g++){A=g/h;THREE.Shape.Utils.b3(A,n,p,q,i);THREE.Shape.Utils.b3(A,m,o,s,l)}}}}}return{offset:r.ha*c,path:e}}}};
|
|
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",e=b.weight!==void 0?b.weight:"normal",f=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=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
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",e=b.weight!==void 0?b.weight:"normal",f=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=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,j,m;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var n=2*e;for(j=e-1;e>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);m=j+1;e<=m&&(m=0);var l;a:{l=a;var o=i,p=j,q=m,t=e,r=g,A=void 0,u=void 0,s=void 0,D=void 0,z=void 0,
|
|
|
|
-w=void 0,v=void 0,C=void 0,E=void 0,u=l[r[o]].x,s=l[r[o]].y,D=l[r[p]].x,z=l[r[p]].y,w=l[r[q]].x,v=l[r[q]].y;if(1E-10>(D-u)*(v-s)-(z-s)*(w-u))l=false;else{for(A=0;A<t;A++)if(!(A==o||A==p||A==q)){var C=l[r[A]].x,E=l[r[A]].y,G=void 0,L=void 0,B=void 0,J=void 0,H=void 0,I=void 0,O=void 0,N=void 0,M=void 0,T=void 0,R=void 0,P=void 0,G=B=H=void 0,G=w-D,L=v-z,B=u-w,J=s-v,H=D-u,I=z-s,O=C-u,N=E-s,M=C-D,T=E-z,R=C-w,P=E-v,G=G*T-L*M,H=H*N-I*O,B=B*P-J*R;if(G>=0&&B>=0&&H>=0){l=false;break a}}l=true}}if(l){f.push([a[g[i]],
|
|
|
|
-a[g[j]],a[g[m]]]);h.push([g[i],g[j],g[m]]);i=j;for(m=j+1;m<e;i++,m++)g[i]=g[m];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.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,e=0,f=b-1,g=0;g<b;f=g++)e=e+(a[f].x*a[g].y-a[g].x*a[f].y);return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var f=[],g=[],h=[],i,j,l;if(b(a)>0)for(j=0;j<e;j++)g[j]=j;else for(j=0;j<e;j++)g[j]=e-1-j;var n=2*e;for(j=e-1;e>2;){if(n--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);l=j+1;e<=l&&(l=0);var m;a:{m=a;var p=i,o=j,q=l,s=e,r=g,A=void 0,u=void 0,t=void 0,D=void 0,z=void 0,
|
|
|
|
+w=void 0,v=void 0,C=void 0,E=void 0,u=m[r[p]].x,t=m[r[p]].y,D=m[r[o]].x,z=m[r[o]].y,w=m[r[q]].x,v=m[r[q]].y;if(1E-10>(D-u)*(v-t)-(z-t)*(w-u))m=false;else{for(A=0;A<s;A++)if(!(A==p||A==o||A==q)){var C=m[r[A]].x,E=m[r[A]].y,G=void 0,L=void 0,B=void 0,J=void 0,H=void 0,I=void 0,O=void 0,N=void 0,M=void 0,T=void 0,R=void 0,P=void 0,G=B=H=void 0,G=w-D,L=v-z,B=u-w,J=t-v,H=D-u,I=z-t,O=C-u,N=E-t,M=C-D,T=E-z,R=C-w,P=E-v,G=G*T-L*M,H=H*N-I*O,B=B*P-J*R;if(G>=0&&B>=0&&H>=0){m=false;break a}}m=true}}if(m){f.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<e;i++,l++)g[i]=g[l];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.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.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),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);d=c}return this.cacheArcLengths=b};THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};
|
|
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),e,f=0;b.push(0);for(e=1;e<=a;e++){c=this.getPoint(e/a);f=f+c.distanceTo(d);b.push(f);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,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-f;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;){d=Math.floor(g+(h-g)/2);i=c[d]-f;if(i<0)g=d+1;else if(i>0)h=d-1;else{h=d;break}}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
|
|
@@ -573,7 +573,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,e);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))};
|
|
d[c[1]].z,d[c[2]].z,d[c[3]].z,e);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.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.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,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,i,j,m,n=a[0]instanceof THREE.Vector3;m=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<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(n)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;m.addSelf(h)}a={minX:e,minY:f,maxX:b,maxY:c,centroid:m.divideScalar(j)};if(n){a.maxZ=d;a.minZ=g}return a};
|
|
|
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=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<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<f)f=h.y;if(n)if(h.z>d)d=h.z;else if(h.z<g)g=h.z;l.addSelf(h)}a={minX:e,minY:f,maxX:b,maxY:c,centroid:l.divideScalar(j)};if(n){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.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,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;if(!b)b=this.bends;d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};
|
|
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,e,f,g,h,i;d=0;for(e=a.length;d<e;d++){f=a[d];g=f.x;h=f.y;i=g/c.maxX;i=b.getUtoTmapping(i,g);g=b.getPoint(i);h=b.getNormalVector(i).multiplyScalar(h);f.x=g.x+h.x;f.y=g.y+h.y}return a};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);
|
|
@@ -586,28 +586,28 @@ THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.s
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
|
|
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)};
|
|
THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,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.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),i=new THREE.EllipseCurve(a,b,c,d,e,f,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.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,e,f,g,h,i,j,m,n,l,o,p,q;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];l=f[1];if(c.length>0){g=c[c.length-1];
|
|
|
|
-o=g.x;p=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];p=g[g.length-1]}for(f=1;f<=a;f++){q=f/a;g=THREE.Shape.Utils.b2(q,o,n,h);q=THREE.Shape.Utils.b2(q,p,l,i);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];l=f[1];j=f[2];m=f[3];if(c.length>0){g=c[c.length-1];o=g.x;p=g.y}else{g=this.actions[d-1].args;o=g[g.length-2];p=g[g.length-1]}for(f=1;f<=a;f++){q=f/a;g=THREE.Shape.Utils.b3(q,o,n,j,h);q=THREE.Shape.Utils.b3(q,p,l,m,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*f[0].length;q=q.concat(f[0]);q=new THREE.SplineCurve(q);for(f=1;f<=g;f++)c.push(q.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];l=f[2];j=f[3];g=f[4];n=!!f[5];o=g-j;p=a*2;for(f=1;f<=p;f++){q=f/p;n||(q=1-q);q=j+q*o;g=h+l*Math.cos(q);q=i+l*Math.sin(q);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];l=f[2];m=f[3];j=f[4];g=f[5];
|
|
|
|
-n=!!f[6];o=g-j;p=a*2;for(f=1;f<=p;f++){q=f/p;n||(q=1-q);q=j+q*o;g=h+l*Math.cos(q);q=i+m*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.getPoints=function(a,b){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(a,b)}var a=a||12,c=[],d,e,f,g,h,i,j,l,n,m,p,o,q;d=0;for(e=this.actions.length;d<e;d++){f=this.actions[d];g=f.action;f=f.args;switch(g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];i=f[3];n=f[0];m=f[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(f=1;f<=a;f++){q=f/a;g=THREE.Shape.Utils.b2(q,p,n,h);q=THREE.Shape.Utils.b2(q,o,m,i);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];i=f[5];n=f[0];m=f[1];j=f[2];l=f[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(f=1;f<=a;f++){q=f/a;g=THREE.Shape.Utils.b3(q,p,n,j,h);q=THREE.Shape.Utils.b3(q,o,m,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*f[0].length;q=q.concat(f[0]);q=new THREE.SplineCurve(q);for(f=1;f<=g;f++)c.push(q.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];i=f[1];m=f[2];j=f[3];g=f[4];n=!!f[5];p=g-j;o=a*2;for(f=1;f<=o;f++){q=f/o;n||(q=1-q);q=j+q*p;g=h+m*Math.cos(q);q=i+m*Math.sin(q);c.push(new THREE.Vector2(g,q))}break;case THREE.PathActions.ELLIPSE:h=f[0];i=f[1];m=f[2];l=f[3];j=f[4];g=f[5];
|
|
|
|
+n=!!f[6];p=g-j;o=a*2;for(f=1;f<=o;f++){q=f/o;n||(q=1-q);q=j+q*p;g=h+m*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,e=[],f=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&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
|
|
THREE.Path.prototype.toShapes=function(){var a,b,c,d,e=[],f=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&&f.actions.length!=0){e.push(f);f=new THREE.Path}f[c].apply(f,d)}f.actions.length!=0&&e.push(f);if(e.length==0)return[];var g;d=[];a=!THREE.Shape.Utils.isClockWise(e[0].getPoints());if(e.length==1){f=e[0];g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves;d.push(g);return d}if(a){g=new THREE.Shape;a=0;for(b=e.length;a<
|
|
b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}d.push(g)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);
|
|
b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g.actions=f.actions;g.curves=f.curves;d.push(g);g=new THREE.Shape}else g.holes.push(f)}}else{a=0;for(b=e.length;a<b;a++){f=e[a];if(THREE.Shape.Utils.isClockWise(f.getPoints())){g&&d.push(g);g=new THREE.Shape;g.actions=f.actions;g.curves=f.curves}else g.holes.push(f)}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.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.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
-THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,m,n,l,o,p=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){l=j[e];o=[];for(n=0;n<c.length;n++){m=c[n];m=l.distanceToSquared(m);o.push(m);if(m<f){f=m;g=e;h=n}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var q=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(q);var t=[j[g],j[f],c[h]];l=THREE.FontUtils.Triangulate.area(t);o=h;m=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;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;q=[j[g],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(q);t=[j[g],j[f],c[h]];t=THREE.FontUtils.Triangulate.area(t);if(n+l>q+t){h=o;g=m;h<0&&(h=h+c.length);h=h%c.length;g<0&&(g=g+j.length);g=g%j.length;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}n=c.slice(0,h);l=c.slice(h);o=j.slice(g);m=j.slice(0,g);f=[j[g],j[f],c[h]];p.push([j[g],c[h],c[e]]);p.push(f);c=n.concat(o).concat(m).concat(l)}return{shape:c,
|
|
|
|
-isolatedPts:p,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];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(e)},
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),e,f,g,h,i,j,l,n,m,p,o=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);f=Number.POSITIVE_INFINITY;for(e=0;e<j.length;e++){m=j[e];p=[];for(n=0;n<c.length;n++){l=c[n];l=m.distanceToSquared(l);p.push(l);if(l<f){f=l;g=e;h=n}}}e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;var q=[j[g],c[h],c[e]];n=THREE.FontUtils.Triangulate.area(q);var s=[j[g],j[f],c[h]];m=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;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1;q=[j[g],c[h],c[e]];q=THREE.FontUtils.Triangulate.area(q);s=[j[g],j[f],c[h]];s=THREE.FontUtils.Triangulate.area(s);if(n+m>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;e=h-1>=0?h-1:c.length-1;f=g-1>=0?g-1:j.length-1}n=c.slice(0,h);m=c.slice(h);p=j.slice(g);l=j.slice(0,g);f=[j[g],j[f],c[h]];o.push([j[g],c[h],c[e]]);o.push(f);c=n.concat(p).concat(l).concat(m)}return{shape:c,
|
|
|
|
+isolatedPts:o,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,e=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,false),f,g,h,i,j={};f=0;for(g=d.length;f<g;f++){i=d[f].x+":"+d[f].y;j[i]!==void 0&&console.log("Duplicate point",i);j[i]=f}f=0;for(g=c.length;f<g;f++){h=c[f];for(d=0;d<3;d++){i=h[d].x+":"+h[d].y;i=j[i];i!==void 0&&(h[d]=i)}}f=0;for(g=e.length;f<g;f++){h=e[f];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(e)},
|
|
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,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
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,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
|
|
this.b3p3(a,e)}};
|
|
this.b3p3(a,e)}};
|
|
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=
|
|
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=
|
|
-0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var m=
|
|
|
|
-{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){m[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(m[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=m}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
|
|
|
|
+0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=h;for(d=0;d<a.hierarchy[c].keys.length;d++){var l=
|
|
|
|
+{};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){l[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(l[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[c].keys.length;d++)if(a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time){a.hierarchy[c].keys.splice(d,1);d--}for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=d}d=parseInt(a.length*
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=true}},get:function(a){if(typeof a==="string"){if(b[a])return b[a];console.log("THREE.AnimationHandler.get: Couldn't find animation "+a);return null}},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=0;c.CATMULLROM=
|
|
1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
|
|
1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.points=[];this.target=new THREE.Vector3};
|
|
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,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
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,e;for(c=0;c<d;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=true;e.matrixAutoUpdate=true;if(e.animationCache===void 0){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
|
|
e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};
|
|
e instanceof THREE.Bone?e.skinMatrix:e.matrix}var f=e.animationCache.prevKey;e=e.animationCache.nextKey;f.pos=this.data.hierarchy[c].keys[0];f.rot=this.data.hierarchy[c].keys[0];f.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=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.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,e,f,g,h,i,j,m;m=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,l=this.hierarchy.length;n<l;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<=m){if(j<m)if(this.loop){g=this.data.hierarchy[n].keys[0];
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying!==false){var b=["pos","rot","scl"],c,d,e,f,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 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[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);e=g[c];f=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=e[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);e=g[c];f=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=e[0]+
|
|
(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=
|
|
(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=this.getPrevKeyWith("pos",n,g.index-1).pos;this.points[1]=e;this.points[2]=f;this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);c.x=e[0];c.y=e[1];c.z=e[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(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}};
|
|
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(e,f,a.quaternion,d);else if(c==="scl"){c=a.scale;c.x=e[0]+(f[0]-e[0])*d;c.y=e[1]+(f[1]-e[1])*d;c.z=e[2]+(f[2]-e[2])*d}}}}};
|
|
@@ -619,14 +619,14 @@ false;this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=true}}
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
|
|
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=true;this.loop=a!==void 0?a:true;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,e,f;for(c=0;c<d;c++){e=this.hierarchy[c];f=this.data.hierarchy[c];e.useQuaternion=true;if(f.animationCache===void 0){f.animationCache={};f.animationCache.prevKey=null;f.animationCache.nextKey=null;f.animationCache.originalMatrix=e instanceof THREE.Bone?
|
|
e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
e.skinMatrix:e.matrix}e=this.data.hierarchy[c].keys;if(e.length){f.animationCache.prevKey=e[0];f.animationCache.nextKey=e[1];this.startTime=Math.min(e[0].time,this.startTime);this.endTime=Math.max(e[e.length-1].time,this.endTime)}}this.update(0)}this.isPaused=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.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,e,f=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;e=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 m=this.data.hierarchy[a].keys,f=this.data.hierarchy[a].sids;d=m.length-1;e=
|
|
|
|
-this.hierarchy[a];if(m.length){for(m=0;m<f.length;m++){g=f[m];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.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 m=b.keys,n=b.animationCache;if(this.JITCompile&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];d.matrixWorldNeedsUpdate=
|
|
|
|
-true}else if(m.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=m[0];for(c=m[1];c.time<g;){b=c;c=m[b.index+1]}}else if(!i)for(var l=m.length-1;c.time<g&&c.index!==l;){b=c;c=m[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&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
|
|
|
|
+THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,e,f=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;e=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,f=this.data.hierarchy[a].sids;d=l.length-1;e=
|
|
|
|
+this.hierarchy[a];if(l.length){for(l=0;l<f.length;l++){g=f[l];(h=this.getPrevKeyWith(g,a,d))&&h.apply(g)}this.data.hierarchy[a].node.updateMatrix();e.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&&f[a][e]!==void 0)if(d instanceof THREE.Bone){d.skinMatrix=f[a][e];d.matrixWorldNeedsUpdate=false}else{d.matrix=f[a][e];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&&f[0][e]===void 0){this.hierarchy[0].updateMatrixWorld(true);
|
|
for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c%b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};
|
|
for(a=0;a<this.hierarchy.length;a++)f[a][e]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=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.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 e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0));this.add(g);var h=new THREE.PerspectiveCamera(90,
|
|
-1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var 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,l=c.generateMipmaps;c.generateMipmaps=false;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=
|
|
|
|
-2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=l;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};
|
|
|
|
|
|
+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,e,c);c.activeCubeFace=
|
|
|
|
+2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=m;c.activeCubeFace=5;a.render(b,i,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CombinedCamera=function(a,b,c,d,e,f,g){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,f,g);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,e);this.zoom=1;this.toPerspective()};
|
|
THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype);THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPerspectiveMode=true;this.inOrthographicMode=false};
|
|
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.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()}};
|
|
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()}};
|
|
@@ -637,57 +637,57 @@ THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
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,e,f=[];e=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++){this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c]));this.faceVertexUvs[0].push([f[e],
|
|
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,e,f=[];e=new THREE.Vector3;var g=new THREE.UV(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.UV((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++){this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c]));this.faceVertexUvs[0].push([f[e],
|
|
f[e+1],g])}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
f[e+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,e,f,g,h){function i(a,b,c,d,e,f,g,h){var i,l=j.widthSegments,m=j.heightSegments,n=e/2,o=f/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,t=m+1,O=e/l,N=f/m,M=new THREE.Vector3;M[i]=g>0?1:-1;for(e=0;e<t;e++)for(f=0;f<q;f++){var T=new THREE.Vector3;T[a]=(f*O-n)*c;T[b]=(e*N-o)*d;T[i]=g;j.vertices.push(T)}for(e=
|
|
|
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,f,g,h){function i(a,b,c,d,e,f,g,h){var i,l=j.widthSegments,m=j.heightSegments,n=e/2,o=f/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=e/l,N=f/m,M=new THREE.Vector3;M[i]=g>0?1:-1;for(e=0;e<s;e++)for(f=0;f<q;f++){var T=new THREE.Vector3;T[a]=(f*O-n)*c;T[b]=(e*N-o)*d;T[i]=g;j.vertices.push(T)}for(e=
|
|
0;e<m;e++)for(f=0;f<l;f++){a=new THREE.Face4(f+q*e+p,f+q*(e+1)+p,f+1+q*(e+1)+p,f+1+q*e+p);a.normal.copy(M);a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone());a.materialIndex=h;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(f/l,1-e/m),new THREE.UV(f/l,1-(e+1)/m),new THREE.UV((f+1)/l,1-(e+1)/m),new THREE.UV((f+1)/l,1-e/m)])}}THREE.Geometry.call(this);var j=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var a=this.width/
|
|
0;e<m;e++)for(f=0;f<l;f++){a=new THREE.Face4(f+q*e+p,f+q*(e+1)+p,f+1+q*(e+1)+p,f+1+q*e+p);a.normal.copy(M);a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone());a.materialIndex=h;j.faces.push(a);j.faceVertexUvs[0].push([new THREE.UV(f/l,1-e/m),new THREE.UV(f/l,1-(e+1)/m),new THREE.UV((f+1)/l,1-(e+1)/m),new THREE.UV((f+1)/l,1-e/m)])}}THREE.Geometry.call(this);var j=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var a=this.width/
|
|
-2,b=this.height/2,c=this.depth/2,m,n,l,o,p,q;if(g!==void 0){if(g instanceof Array)this.materials=g;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(g)}m=0;o=1;n=2;p=3;l=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 t in h)this.sides[t]!==void 0&&(this.sides[t]=h[t]);this.sides.px&&i("z","y",-1,-1,this.depth,this.height,a,m);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,p);this.sides.pz&&i("x","y",1,-1,this.width,this.height,c,l);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,e,f){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,e=e||1,h,i,j=[],m=[];for(i=0;i<=e;i++){var n=[],l=[],o=i/e,p=o*(b-a)+a;for(h=0;h<=d;h++){var q=h/d,t=new THREE.Vector3;t.x=p*Math.sin(q*Math.PI*2);t.y=-o*c+g;t.z=p*Math.cos(q*Math.PI*2);this.vertices.push(t);n.push(this.vertices.length-1);l.push(new THREE.UV(q,1-o))}j.push(n);m.push(l)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){n=this.vertices[j[0][h]].clone();l=
|
|
|
|
-this.vertices[j[0][h+1]].clone()}else{n=this.vertices[j[1][h]].clone();l=this.vertices[j[1][h+1]].clone()}n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var o=j[i][h],p=j[i+1][h],q=j[i+1][h+1],t=j[i][h+1],r=n.clone(),A=n.clone(),u=l.clone(),s=l.clone(),D=m[i][h].clone(),z=m[i+1][h].clone(),w=m[i+1][h+1].clone(),v=m[i][h+1].clone();this.faces.push(new THREE.Face4(o,p,q,t,[r,A,u,s]));this.faceVertexUvs[0].push([D,z,w,v])}}if(!f&&a>
|
|
|
|
-0){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++){o=j[0][h];p=j[0][h+1];q=this.vertices.length-1;r=new THREE.Vector3(0,1,0);A=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);D=m[0][h].clone();z=m[0][h+1].clone();w=new THREE.UV(z.u,0);this.faces.push(new THREE.Face3(o,p,q,[r,A,u]));this.faceVertexUvs[0].push([D,z,w])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){o=j[i][h+1];p=j[i][h];q=this.vertices.length-1;r=new THREE.Vector3(0,-1,0);A=new THREE.Vector3(0,
|
|
|
|
--1,0);u=new THREE.Vector3(0,-1,0);D=m[i][h+1].clone();z=m[i][h].clone();w=new THREE.UV(z.u,1);this.faces.push(new THREE.Face3(o,p,q,[r,A,u]));this.faceVertexUvs[0].push([D,z,w])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
|
|
|
+2,b=this.height/2,c=this.depth/2,l,n,m,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;n=2;o=3;m=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,n);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,m);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,e,f){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,e=e||1,h,i,j=[],l=[];for(i=0;i<=e;i++){var n=[],m=[],p=i/e,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);n.push(this.vertices.length-1);m.push(new THREE.UV(q,1-p))}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<e;i++){var p=j[i][h],o=j[i+1][h],q=j[i+1][h+1],s=j[i][h+1],r=n.clone(),A=n.clone(),u=m.clone(),t=m.clone(),D=l[i][h].clone(),z=l[i+1][h].clone(),w=l[i+1][h+1].clone(),v=l[i][h+1].clone();this.faces.push(new THREE.Face4(p,o,q,s,[r,A,u,t]));this.faceVertexUvs[0].push([D,z,w,v])}}if(!f&&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;r=new THREE.Vector3(0,1,0);A=new THREE.Vector3(0,1,0);u=new THREE.Vector3(0,1,0);D=l[0][h].clone();z=l[0][h+1].clone();w=new THREE.UV(z.u,0);this.faces.push(new THREE.Face3(p,o,q,[r,A,u]));this.faceVertexUvs[0].push([D,z,w])}}if(!f&&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;r=new THREE.Vector3(0,-1,0);A=new THREE.Vector3(0,
|
|
|
|
+-1,0);u=new THREE.Vector3(0,-1,0);D=l[i][h+1].clone();z=l[i][h].clone();w=new THREE.UV(z.u,1);this.faces.push(new THREE.Face3(p,o,q,[r,A,u]));this.faceVertexUvs[0].push([D,z,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=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(P=c.length;--P>=0;){e=P;f=P-1;f<0&&(f=
|
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(P=c.length;--P>=0;){e=P;f=P-1;f<0&&(f=
|
|
-c.length-1);for(var g=0,h=l+m*2,g=0;g<h;g++){var i=M*g,j=M*(g+1),n=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,q=g,s=h,t=e,u=f,n=n+G,i=i+G,o=o+G,j=j+G;E.faces.push(new THREE.Face4(n,i,o,j,null,null,r));n=A.generateSideWallUV(E,a,p,b,n,i,o,j,q,s,t,u);E.faceVertexUvs[0].push(n)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+G;d=d+G;e=e+G;E.faces.push(new THREE.Face3(c,d,e,null,null,t));c=f?A.generateBottomUV(E,a,b,c,d,e):A.generateTopUV(E,a,b,c,d,e);E.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,m=b.bevelSegments!==void 0?b.bevelSegments:3,n=b.bevelEnabled!==void 0?b.bevelEnabled:true,l=b.steps!==void 0?b.steps:1,o=b.extrudePath,p,q=false,t=b.material,r=b.extrudeMaterial,A=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,u,s,D,z;if(o){p=o.getSpacedPoints(l);q=true;n=false;u=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(o,l,
|
|
|
|
-false);s=new THREE.Vector3;D=new THREE.Vector3;z=new THREE.Vector3}if(!n)j=i=m=0;var w,v,C,E=this,G=this.vertices.length,o=a.extractPoints(),L=o.shape,o=o.holes,B=!THREE.Shape.Utils.isClockWise(L);if(B){L=L.reverse();v=0;for(C=o.length;v<C;v++){w=o[v];THREE.Shape.Utils.isClockWise(w)&&(o[v]=w.reverse())}B=false}var J=THREE.Shape.Utils.triangulateShape(L,o),B=L;v=0;for(C=o.length;v<C;v++){w=o[v];L=L.concat(w)}var H,I,O,N,M=L.length,T=J.length,R=[],P=0,S=B.length;H=S-1;for(I=P+1;P<S;P++,H++,I++){H===
|
|
|
|
-S&&(H=0);I===S&&(I=0);R[P]=d(B[P],B[H],B[I])}var $=[],K,ja=R.concat();v=0;for(C=o.length;v<C;v++){w=o[v];K=[];P=0;S=w.length;H=S-1;for(I=P+1;P<S;P++,H++,I++){H===S&&(H=0);I===S&&(I=0);K[P]=d(w[P],w[H],w[I])}$.push(K);ja=ja.concat(K)}for(H=0;H<m;H++){w=H/m;O=i*(1-w);I=j*Math.sin(w*Math.PI/2);P=0;for(S=B.length;P<S;P++){N=c(B[P],R[P],I);f(N.x,N.y,-O)}v=0;for(C=o.length;v<C;v++){w=o[v];K=$[v];P=0;for(S=w.length;P<S;P++){N=c(w[P],K[P],I);f(N.x,N.y,-O)}}}I=j;for(P=0;P<M;P++){N=n?c(L[P],ja[P],I):L[P];if(q){D.copy(u.normals[0]).multiplyScalar(N.x);
|
|
|
|
-s.copy(u.binormals[0]).multiplyScalar(N.y);z.copy(p[0]).addSelf(D).addSelf(s);f(z.x,z.y,z.z)}else f(N.x,N.y,0)}for(w=1;w<=l;w++)for(P=0;P<M;P++){N=n?c(L[P],ja[P],I):L[P];if(q){D.copy(u.normals[w]).multiplyScalar(N.x);s.copy(u.binormals[w]).multiplyScalar(N.y);z.copy(p[w]).addSelf(D).addSelf(s);f(z.x,z.y,z.z)}else f(N.x,N.y,h/l*w)}for(H=m-1;H>=0;H--){w=H/m;O=i*(1-w);I=j*Math.sin(w*Math.PI/2);P=0;for(S=B.length;P<S;P++){N=c(B[P],R[P],I);f(N.x,N.y,h+O)}v=0;for(C=o.length;v<C;v++){w=o[v];K=$[v];P=0;for(S=
|
|
|
|
-w.length;P<S;P++){N=c(w[P],K[P],I);q?f(N.x,N.y+p[l-1].y,p[l-1].x+O):f(N.x,N.y,h+O)}}}if(n){i=M*0;for(P=0;P<T;P++){h=J[P];g(h[2]+i,h[1]+i,h[0]+i,true)}i=M*(l+m*2);for(P=0;P<T;P++){h=J[P];g(h[0]+i,h[1]+i,h[2]+i,false)}}else{for(P=0;P<T;P++){h=J[P];g(h[2],h[1],h[0],true)}for(P=0;P<T;P++){h=J[P];g(h[0]+M*l,h[1]+M*l,h[2]+M*l,false)}}h=0;e(B,h);h=h+B.length;v=0;for(C=o.length;v<C;v++){w=o[v];e(w,h);h=h+w.length}};
|
|
|
|
-THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,a.vertices[d].y),new THREE.UV(b,e),new THREE.UV(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,j=a.vertices[g].x,m=a.vertices[g].y,
|
|
|
|
-g=a.vertices[g].z,n=a.vertices[h].x,l=a.vertices[h].y,a=a.vertices[h].z;return Math.abs(c-i)<0.01?[new THREE.UV(b,1-e),new THREE.UV(d,1-f),new THREE.UV(j,1-g),new THREE.UV(n,1-a)]:[new THREE.UV(c,1-e),new THREE.UV(i,1-f),new THREE.UV(m,1-g),new THREE.UV(l,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;
|
|
|
|
|
|
+c.length-1);for(var g=0,h=m+l*2,g=0;g<h;g++){var i=M*g,j=M*(g+1),n=d+e+i,i=d+f+i,o=d+f+j,j=d+e+j,p=c,q=g,s=h,t=e,u=f,n=n+G,i=i+G,o=o+G,j=j+G;E.faces.push(new THREE.Face4(n,i,o,j,null,null,r));n=A.generateSideWallUV(E,a,p,b,n,i,o,j,q,s,t,u);E.faceVertexUvs[0].push(n)}}}function f(a,b,c){E.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c=c+G;d=d+G;e=e+G;E.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?A.generateBottomUV(E,a,b,c,d,e):A.generateTopUV(E,a,b,c,d,e);E.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,p=b.extrudePath,o,q=false,s=b.material,r=b.extrudeMaterial,A=b.UVGenerator!==void 0?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,u,t,D,z;if(p){o=p.getSpacedPoints(m);q=true;n=false;u=b.frames!==void 0?b.frames:new THREE.TubeGeometry.FrenetFrames(p,m,
|
|
|
|
+false);t=new THREE.Vector3;D=new THREE.Vector3;z=new THREE.Vector3}if(!n)j=i=l=0;var w,v,C,E=this,G=this.vertices.length,p=a.extractPoints(),L=p.shape,p=p.holes,B=!THREE.Shape.Utils.isClockWise(L);if(B){L=L.reverse();v=0;for(C=p.length;v<C;v++){w=p[v];THREE.Shape.Utils.isClockWise(w)&&(p[v]=w.reverse())}B=false}var J=THREE.Shape.Utils.triangulateShape(L,p),B=L;v=0;for(C=p.length;v<C;v++){w=p[v];L=L.concat(w)}var H,I,O,N,M=L.length,T=J.length,R=[],P=0,S=B.length;H=S-1;for(I=P+1;P<S;P++,H++,I++){H===
|
|
|
|
+S&&(H=0);I===S&&(I=0);R[P]=d(B[P],B[H],B[I])}var $=[],K,ja=R.concat();v=0;for(C=p.length;v<C;v++){w=p[v];K=[];P=0;S=w.length;H=S-1;for(I=P+1;P<S;P++,H++,I++){H===S&&(H=0);I===S&&(I=0);K[P]=d(w[P],w[H],w[I])}$.push(K);ja=ja.concat(K)}for(H=0;H<l;H++){w=H/l;O=i*(1-w);I=j*Math.sin(w*Math.PI/2);P=0;for(S=B.length;P<S;P++){N=c(B[P],R[P],I);f(N.x,N.y,-O)}v=0;for(C=p.length;v<C;v++){w=p[v];K=$[v];P=0;for(S=w.length;P<S;P++){N=c(w[P],K[P],I);f(N.x,N.y,-O)}}}I=j;for(P=0;P<M;P++){N=n?c(L[P],ja[P],I):L[P];if(q){D.copy(u.normals[0]).multiplyScalar(N.x);
|
|
|
|
+t.copy(u.binormals[0]).multiplyScalar(N.y);z.copy(o[0]).addSelf(D).addSelf(t);f(z.x,z.y,z.z)}else f(N.x,N.y,0)}for(w=1;w<=m;w++)for(P=0;P<M;P++){N=n?c(L[P],ja[P],I):L[P];if(q){D.copy(u.normals[w]).multiplyScalar(N.x);t.copy(u.binormals[w]).multiplyScalar(N.y);z.copy(o[w]).addSelf(D).addSelf(t);f(z.x,z.y,z.z)}else f(N.x,N.y,h/m*w)}for(H=l-1;H>=0;H--){w=H/l;O=i*(1-w);I=j*Math.sin(w*Math.PI/2);P=0;for(S=B.length;P<S;P++){N=c(B[P],R[P],I);f(N.x,N.y,h+O)}v=0;for(C=p.length;v<C;v++){w=p[v];K=$[v];P=0;for(S=
|
|
|
|
+w.length;P<S;P++){N=c(w[P],K[P],I);q?f(N.x,N.y+o[m-1].y,o[m-1].x+O):f(N.x,N.y,h+O)}}}if(n){i=M*0;for(P=0;P<T;P++){h=J[P];g(h[2]+i,h[1]+i,h[0]+i,true)}i=M*(m+l*2);for(P=0;P<T;P++){h=J[P];g(h[0]+i,h[1]+i,h[2]+i,false)}}else{for(P=0;P<T;P++){h=J[P];g(h[2],h[1],h[0],true)}for(P=0;P<T;P++){h=J[P];g(h[0]+M*m,h[1]+M*m,h[2]+M*m,false)}}h=0;e(B,h);h=h+B.length;v=0;for(C=p.length;v<C;v++){w=p[v];e(w,h);h=h+w.length}};
|
|
|
|
+THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.UV(a.vertices[d].x,a.vertices[d].y),new THREE.UV(b,e),new THREE.UV(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,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-e),new THREE.UV(d,1-f),new THREE.UV(j,1-g),new THREE.UV(n,1-a)]:[new THREE.UV(c,1-e),new THREE.UV(i,1-f),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;
|
|
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.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,e,f,g,h=this.vertices.length;e=a.extractPoints();var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;e<f;e++){g=j[e];THREE.Shape.Utils.isClockWise(g)&&(j[e]=g.reverse())}}var m=THREE.Shape.Utils.triangulateShape(i,j);e=0;for(f=j.length;e<f;e++){g=j[e];i=i.concat(g)}j=i.length;f=m.length;for(e=
|
|
|
|
-0;e<j;e++){g=i[e];this.vertices.push(new THREE.Vector3(g.x,g.y,0))}for(e=0;e<f;e++){j=m[e];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))}};
|
|
|
|
|
|
+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,e,f,g,h=this.vertices.length;e=a.extractPoints();var i=e.shape,j=e.holes;if(!THREE.Shape.Utils.isClockWise(i)){i=i.reverse();e=0;for(f=j.length;e<f;e++){g=j[e];THREE.Shape.Utils.isClockWise(g)&&(j[e]=g.reverse())}}var l=THREE.Shape.Utils.triangulateShape(i,j);e=0;for(f=j.length;e<f;e++){g=j[e];i=i.concat(g)}j=i.length;f=l.length;for(e=
|
|
|
|
+0;e<j;e++){g=i[e];this.vertices.push(new THREE.Vector3(g.x,g.y,0))}for(e=0;e<f;e++){j=l[e];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))}};
|
|
THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
|
|
THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);for(var b=b||12,c=c||2*Math.PI,d=[],e=(new THREE.Matrix4).makeRotationZ(c/b),f=0;f<a.length;f++){d[f]=a[f].clone();this.vertices.push(d[f])}for(var g=b+1,c=0;c<g;c++)for(f=0;f<d.length;f++){d[f]=e.multiplyVector3(d[f].clone());this.vertices.push(d[f])}for(c=0;c<b;c++){d=0;for(e=a.length;d<e-1;d++){this.faces.push(new THREE.Face4(c*e+d,(c+1)%g*e+d,(c+1)%g*e+(d+1)%e,c*e+(d+1)%e));this.faceVertexUvs[0].push([new THREE.UV(1-c/b,d/e),new THREE.UV(1-
|
|
(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
(c+1)/b,d/e),new THREE.UV(1-(c+1)/b,(d+1)/e),new THREE.UV(1-c/b,(d+1)/e)])}}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,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,h=f+1,i=this.width/d,j=this.height/f,m=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-e),0));for(a=0;a<f;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(m);c.vertexNormals.push(m.clone(),m.clone(),
|
|
|
|
-m.clone(),m.clone());this.faces.push(c);this.faceVertexUvs[0].push([new THREE.UV(b/d,1-a/f),new THREE.UV(b/d,1-(a+1)/f),new THREE.UV((b+1)/d,1-(a+1)/f),new THREE.UV((b+1)/d,1-a/f)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
|
-THREE.SphereGeometry=function(a,b,c,d,e,f,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,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f: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 m=a/this.widthSegments,n=b/this.heightSegments,l=new THREE.Vector3;l.x=-this.radius*Math.cos(d+m*e)*Math.sin(f+n*g);l.y=this.radius*
|
|
|
|
-Math.cos(f+n*g);l.z=this.radius*Math.sin(d+m*e)*Math.sin(f+n*g);this.vertices.push(l);i.push(this.vertices.length-1);j.push(new THREE.UV(m,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],e=c[b][a],f=c[b+1][a],g=c[b+1][a+1],i=this.vertices[d].clone().normalize(),j=this.vertices[e].clone().normalize(),m=this.vertices[f].clone().normalize(),n=this.vertices[g].clone().normalize(),l=h[b][a+1].clone(),o=h[b][a].clone(),p=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,f,g,[i,m,n]));this.faceVertexUvs[0].push([l,p,q])}else if(Math.abs(this.vertices[f].y)===this.radius){this.faces.push(new THREE.Face3(d,e,f,[i,j,m]));this.faceVertexUvs[0].push([l,o,p])}else{this.faces.push(new THREE.Face4(d,e,f,g,[i,j,m,n]));this.faceVertexUvs[0].push([l,o,p,q])}}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:this.radius}};
|
|
|
|
|
|
+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,e=b/2,d=this.widthSegments,f=this.heightSegments,g=d+1,h=f+1,i=this.width/d,j=this.height/f,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-e),0));for(a=0;a<f;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/f),new THREE.UV(b/d,1-(a+1)/f),new THREE.UV((b+1)/d,1-(a+1)/f),new THREE.UV((b+1)/d,1-a/f)])}this.computeCentroids()};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
|
+THREE.SphereGeometry=function(a,b,c,d,e,f,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,e=e!==void 0?e:Math.PI*2,f=f!==void 0?f: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*e)*Math.sin(f+n*g);m.y=this.radius*
|
|
|
|
+Math.cos(f+n*g);m.z=this.radius*Math.sin(d+l*e)*Math.sin(f+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],e=c[b][a],f=c[b+1][a],g=c[b+1][a+1],i=this.vertices[d].clone().normalize(),j=this.vertices[e].clone().normalize(),l=this.vertices[f].clone().normalize(),n=this.vertices[g].clone().normalize(),m=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,f,g,[i,l,n]));this.faceVertexUvs[0].push([m,o,q])}else if(Math.abs(this.vertices[f].y)===this.radius){this.faces.push(new THREE.Face3(d,e,f,[i,j,l]));this.faceVertexUvs[0].push([m,p,o])}else{this.faces.push(new THREE.Face4(d,e,f,g,[i,j,l,n]));this.faceVertexUvs[0].push([m,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.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,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=c/this.radialSegments*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.radialSegments=c||8;this.tubularSegments=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.radialSegments;c++)for(d=0;d<=this.tubularSegments;d++){var f=d/this.tubularSegments*this.arc,g=c/this.radialSegments*Math.PI*2;e.x=this.radius*Math.cos(f);e.y=this.radius*Math.sin(f);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(g))*Math.cos(f);h.y=(this.radius+this.tube*
|
|
Math.cos(g))*Math.sin(f);h.z=this.tube*Math.sin(g);this.vertices.push(h);a.push(new THREE.UV(d/this.tubularSegments,c/this.radialSegments));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);
|
|
Math.cos(g))*Math.sin(f);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(e).normalize())}for(c=1;c<=this.radialSegments;c++)for(d=1;d<=this.tubularSegments;d++){var e=(this.tubularSegments+1)*c+d-1,f=(this.tubularSegments+1)*(c-1)+d-1,g=(this.tubularSegments+1)*(c-1)+d,h=(this.tubularSegments+1)*c+d,i=new THREE.Face4(e,f,g,h,[b[e],b[f],b[g],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);
|
|
i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);this.faceVertexUvs[0].push([a[e].clone(),a[f].clone(),a[g].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a=c/d*a;c=Math.cos(a);g=e*(2+c)*0.5*g;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.radialSegments=c||64;this.tubularSegments=d||8;this.p=e||2;this.q=f||3;this.heightScale=g||1;this.grid=Array(this.radialSegments);c=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.radialSegments;++a){this.grid[a]=
|
|
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,f=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,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(i*d.x+g*e.x);f.y=f.y+(i*d.y+g*e.y);f.z=f.z+(i*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
|
|
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,f=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,f);d.add(i,f);e.cross(c,d);d.cross(e,c);e.normalize();d.normalize();i=-this.tube*Math.cos(g);g=this.tube*Math.sin(g);f.x=f.x+(i*d.x+g*e.x);f.y=f.y+(i*d.y+g*e.y);f.z=f.z+(i*d.z+g*e.z);this.grid[a][b]=this.vertices.push(new THREE.Vector3(f.x,
|
|
-f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],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),m=new THREE.UV(a/this.radialSegments,(b+1)/this.tubularSegments);this.faces.push(new THREE.Face4(c,
|
|
|
|
-d,e,f));this.faceVertexUvs[0].push([g,i,j,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,j,m,n=new THREE.Vector3,l,o,p,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);l=b.tangents;o=b.normals;p=b.binormals;this.tangents=l;this.normals=o;this.binormals=p;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);m=a.getPointAt(d);d=l[b];g=o[b];h=p[b];if(this.debug){this.debug.add(new THREE.ArrowHelper(d,
|
|
|
|
-m,c,255));this.debug.add(new THREE.ArrowHelper(g,m,c,16711680));this.debug.add(new THREE.ArrowHelper(h,m,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(m);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++){f=e?(b+1)%this.segments:b+1;n=(d+1)%this.radiusSegments;
|
|
|
|
-a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][n];n=this.grid[b][n];l=new THREE.UV(b/this.segments,d/this.radiusSegments);o=new THREE.UV((b+1)/this.segments,d/this.radiusSegments);p=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,f,n));this.faceVertexUvs[0].push([l,o,p,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 e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,m,n;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){m=j/(b-1);e[j]=a.getTangentAt(m);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);m=Math.abs(e[0].y);n=Math.abs(e[0].z);if(j<=a){a=j;d.set(1,0,0)}if(m<=a){a=m;d.set(0,1,0)}n<=a&&d.set(0,0,1);h.cross(e[0],d).normalize();
|
|
|
|
|
|
+f.y,f.z))-1}}for(a=0;a<this.radialSegments;++a)for(b=0;b<this.tubularSegments;++b){var e=(a+1)%this.radialSegments,f=(b+1)%this.tubularSegments,c=this.grid[a][b],d=this.grid[e][b],e=this.grid[e][f],f=this.grid[a][f],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,e,f));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,e,f){THREE.Geometry.call(this);this.path=a;this.segments=b||64;this.radius=c||1;this.radiusSegments=d||8;this.closed=e||false;if(f)this.debug=new THREE.Object3D;this.grid=[];var g,h,f=this.segments+1,i,j,l,n=new THREE.Vector3,m,p,o,b=new THREE.TubeGeometry.FrenetFrames(a,b,e);m=b.tangents;p=b.normals;o=b.binormals;this.tangents=m;this.normals=p;this.binormals=o;for(b=0;b<f;b++){this.grid[b]=[];d=b/(f-1);l=a.getPointAt(d);d=m[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);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++){f=e?(b+1)%this.segments:b+1;n=(d+1)%this.radiusSegments;
|
|
|
|
+a=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][n];n=this.grid[b][n];m=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,f,n));this.faceVertexUvs[0].push([m,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 e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4,b=b+1,j,l,n;this.tangents=e;this.normals=f;this.binormals=g;for(j=0;j<b;j++){l=j/(b-1);e[j]=a.getTangentAt(l);e[j].normalize()}f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;j=Math.abs(e[0].x);l=Math.abs(e[0].y);n=Math.abs(e[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(e[0],d).normalize();
|
|
f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));i.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
|
|
f[0].cross(e[0],h);g[0].cross(e[0],f[0]);for(j=1;j<b;j++){f[j]=f[j-1].clone();g[j]=g[j-1].clone();h.cross(e[j-1],e[j]);if(h.length()>1E-4){h.normalize();d=Math.acos(e[j-1].dot(e[j]));i.makeRotationAxis(h,d).multiplyVector3(f[j])}g[j].cross(e[j],f[j])}if(c){d=Math.acos(f[0].dot(f[b-1]));d=d/(b-1);e[0].dot(h.cross(f[0],f[b-1]))>0&&(d=-d);for(j=1;j<b;j++){i.makeRotationAxis(e[j],d*j).multiplyVector3(f[j]);g[j].cross(e[j],f[j])}}};
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(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 f(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);
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(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 f(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;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(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=e((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);
|
|
i.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}else{d=d-1;f(a,g(a,b),g(a,c),d);f(g(a,b),b,g(b,c),d);f(g(a,c),g(b,c),c,d);f(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=e((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,m=a.length;j<m;j++)e(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var n=[],a=this.vertices,j=0,m=b.length;j<m;j++)f(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(m=this.vertices.length;j<m;j++)this.vertices[j].multiplyScalar(c);this.computeCentroids();this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
|
|
|
+for(var c=c||1,d=d||0,i=this,j=0,l=a.length;j<l;j++)e(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++)f(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.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.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
-THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,g=this.faceVertexUvs[0],d=d===void 0?false:d,h,i,j,m,n=b+1;for(h=0;h<=c;h++){m=h/c;for(i=0;i<=b;i++){j=i/b;j=a(j,m);e.push(j)}}var l,o,p,q;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*n+i;e=h*n+i+1;m=(h+1)*n+i;j=(h+1)*n+i+1;l=new THREE.UV(i/b,h/c);o=new THREE.UV((i+1)/b,h/c);p=new THREE.UV(i/b,(h+1)/c);q=new THREE.UV((i+1)/b,(h+1)/c);if(d){f.push(new THREE.Face3(a,e,m));f.push(new THREE.Face3(e,j,m));g.push([l,
|
|
|
|
-o,p]);g.push([o,q,p])}else{f.push(new THREE.Face4(a,e,j,m));g.push([l,o,q,p])}}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 e=d,f=a[e].clone(),g=f.length();f.x=f.x+g*(Math.random()-0.5)*2E-6;f.y=f.y+g*(Math.random()-0.5)*2E-6;f.z=f.z+g*(Math.random()-0.5)*2E-6;for(var g=[],h=0;h<c.length;){var i=c[h],j=f,m=a[i[0]],n;n=m;var l=a[i[1]],o=a[i[2]],p=new THREE.Vector3,q=new THREE.Vector3;p.sub(o,l);q.sub(n,l);p.crossSelf(q);p.isZero()||p.normalize();n=
|
|
|
|
-p;m=n.dot(m);if(n.dot(j)>=m){for(j=0;j<3;j++){m=[i[j],i[(j+1)%3]];n=true;for(l=0;l<g.length;l++)if(g[l][0]===m[1]&&g[l][1]===m[0]){g[l]=g[g.length-1];g.pop();n=false;break}n&&g.push(m)}c[h]=c[c.length-1];c.pop()}else h++}for(l=0;l<g.length;l++)c.push([g[l][0],g[l][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;h<3;h++){if(f[g[h]]===void 0){f[g[h]]=e++;this.vertices.push(a[g[h]])}g[h]=f[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 e=this.vertices,f=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);e.push(j)}}var m,p,o,q;for(h=0;h<c;h++)for(i=0;i<b;i++){a=h*n+i;e=h*n+i+1;l=(h+1)*n+i;j=(h+1)*n+i+1;m=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){f.push(new THREE.Face3(a,e,l));f.push(new THREE.Face3(e,j,l));g.push([m,
|
|
|
|
+p,o]);g.push([p,q,o])}else{f.push(new THREE.Face4(a,e,j,l));g.push([m,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 e=d,f=a[e].clone(),g=f.length();f.x=f.x+g*(Math.random()-0.5)*2E-6;f.y=f.y+g*(Math.random()-0.5)*2E-6;f.z=f.z+g*(Math.random()-0.5)*2E-6;for(var g=[],h=0;h<c.length;){var i=c[h],j=f,l=a[i[0]],n;n=l;var m=a[i[1]],p=a[i[2]],o=new THREE.Vector3,q=new THREE.Vector3;o.sub(p,m);q.sub(n,m);o.crossSelf(q);o.isZero()||o.normalize();n=
|
|
|
|
+o;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],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;h<3;h++){if(f[g[h]]===void 0){f[g[h]]=e++;this.vertices.push(a[g[h]])}g[h]=f[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);
|
|
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=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);
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);
|
|
@@ -724,15 +724,15 @@ THREE.SpotLightHelper.prototype.update=function(){this.direction.sub(this.light.
|
|
this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightCone.material.color.copy(this.color);this.targetSphere.material.color.copy(this.color);this.targetLine.material.color.copy(this.color);this.targetLine.geometry.vertices[0].copy(this.light.position);this.targetLine.geometry.vertices[1].copy(this.light.target.position);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=true};
|
|
this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightCone.material.color.copy(this.color);this.targetSphere.material.color.copy(this.color);this.targetLine.material.color.copy(this.color);this.targetLine.geometry.vertices[0].copy(this.light.position);this.targetLine.geometry.vertices[1].copy(this.light.target.position);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=true};
|
|
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.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,e,f,g={},h=THREE.GeometryUtils.orderedKey;c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=h(e.a,e.b);b(f,c);f=h(e.b,e.c);b(f,c);f=h(e.c,e.a);b(f,c)}else if(e instanceof THREE.Face4){f=h(e.a,e.b);b(f,c);f=h(e.b,e.c);b(f,c);f=h(e.c,e.d);b(f,c);f=h(e.d,e.a);b(f,c)}}return g};
|
|
THREE.GeometryUtils.computeEdgeFaces=function(a){function b(a,b){g[a]===void 0&&(g[a]=[]);g[a].push(b)}var c,d,e,f,g={},h=THREE.GeometryUtils.orderedKey;c=0;for(d=a.faces.length;c<d;c++){e=a.faces[c];if(e instanceof THREE.Face3){f=h(e.a,e.b);b(f,c);f=h(e.b,e.c);b(f,c);f=h(e.c,e.a);b(f,c)}else if(e instanceof THREE.Face4){f=h(e.a,e.b);b(f,c);f=h(e.b,e.c);b(f,c);f=h(e.c,e.d);b(f,c);f=h(e.d,e.a);b(f,c)}}return g};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function b(){m.debug&&(console&&console.assert)&&console.assert.apply(console,arguments)}function c(){m.debug&&console.log.apply(console,arguments)}function d(){console&&console.log.apply(console,arguments)}function e(a,b,d,e,g,h,l){var n=new THREE.Face4(a,b,d,e,null,g.color,g.materialIndex);if(m.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(m.supportUVs){g=[f(a,""),f(b,l),f(d,l),f(e,l)];g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",e+":"+l):c("c :( ",d+":"+l):c("b :( ",b+":"+l):c("a :( ",a+":"+l)}}function f(a,b){var e=a+":"+b,f=u[e];if(!f){a>=q&&a<q+p.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=[],m=this,n=THREE.GeometryUtils.orderedKey,l=THREE.GeometryUtils.computeEdgeFaces,o=a.vertices,p=a.faces,q=o.length,h=o.concat(),t=[],r={},A={},u={},s,D,z,w,v,C=a.faceVertexUvs[0],E;c("originalFaces, uvs, originalVerticesLength",p.length,C.length,q);if(m.supportUVs){s=0;for(D=C.length;s<D;s++){z=0;for(w=C[s].length;z<w;z++){E=p[s]["abcd".charAt(z)];g(E,s,C[s][z])}}}if(C.length==0)m.supportUVs=false;s=0;for(var G in u)s++;if(!s){m.supportUVs=false;c("no uvs")}s=
|
|
|
|
-0;for(D=p.length;s<D;s++){v=p[s];t.push(v.centroid);h.push(v.centroid);if(m.supportUVs){w=new THREE.UV;if(v instanceof THREE.Face3){w.u=f(v.a,s).u+f(v.b,s).u+f(v.c,s).u;w.v=f(v.a,s).v+f(v.b,s).v+f(v.c,s).v;w.u=w.u/3;w.v=w.v/3}else if(v instanceof THREE.Face4){w.u=f(v.a,s).u+f(v.b,s).u+f(v.c,s).u+f(v.d,s).u;w.v=f(v.a,s).v+f(v.b,s).v+f(v.c,s).v+f(v.d,s).v;w.u=w.u/4;w.v=w.v/4}g(q+s,"",w)}}var l=l(a),L;D=0;var B,J;G={};C={};for(s in l){E=l[s];B=s.split("_");J=B[0];B=B[1];z=J;v=[J,B];G[z]===void 0&&(G[z]=
|
|
|
|
-[]);G[z].push(v);z=B;v=[J,B];G[z]===void 0&&(G[z]=[]);G[z].push(v);z=0;for(w=E.length;z<w;z++){v=E[z];L=J;var H=v,I=s;C[L]===void 0&&(C[L]={});C[L][H]=I;L=B;H=s;C[L]===void 0&&(C[L]={});C[L][v]=H}E.length<2&&(A[s]=true)}for(s in l){E=l[s];v=E[0];L=E[1];B=s.split("_");J=B[0];B=B[1];w=new THREE.Vector3;b(E.length>0,"an edge without faces?!");if(E.length==1){w.addSelf(o[J]);w.addSelf(o[B]);w.multiplyScalar(0.5)}else{w.addSelf(t[v]);w.addSelf(t[L]);w.addSelf(o[J]);w.addSelf(o[B]);w.multiplyScalar(0.25)}r[s]=
|
|
|
|
-q+p.length+D;h.push(w);D++;if(m.supportUVs){w=new THREE.UV;w.u=f(J,v).u+f(B,v).u;w.v=f(J,v).v+f(B,v).v;w.u=w.u/2;w.v=w.v/2;g(r[s],v,w);if(E.length>=2){b(E.length==2,"did we plan for more than 2 edges?");w=new THREE.UV;w.u=f(J,L).u+f(B,L).u;w.v=f(J,L).v+f(B,L).v;w.u=w.u/2;w.v=w.v/2;g(r[s],L,w)}}}c("-- Step 2 done");var O,N;w=["123","12","2","23"];L=["123","23","3","31"];var H=["123","31","1","12"],I=["1234","12","2","23"],M=["1234","23","3","34"],T=["1234","34","4","41"],R=["1234","41","1","12"];s=
|
|
|
|
-0;for(D=t.length;s<D;s++){v=p[s];E=q+s;if(v instanceof THREE.Face3){J=n(v.a,v.b);B=n(v.b,v.c);O=n(v.c,v.a);e(E,r[J],v.b,r[B],v,w,s);e(E,r[B],v.c,r[O],v,L,s);e(E,r[O],v.a,r[J],v,H,s)}else if(v instanceof THREE.Face4){J=n(v.a,v.b);B=n(v.b,v.c);O=n(v.c,v.d);N=n(v.d,v.a);e(E,r[J],v.b,r[B],v,I,s);e(E,r[B],v.c,r[O],v,M,s);e(E,r[O],v.d,r[N],v,T,s);e(E,r[N],v.a,r[J],v,R,s)}else c("face should be a face!",v)}r=new THREE.Vector3;v=new THREE.Vector3;s=0;for(D=o.length;s<D;s++)if(G[s]!==void 0){r.set(0,0,0);
|
|
|
|
-v.set(0,0,0);B=new THREE.Vector3(0,0,0);E=0;for(z in C[s]){r.addSelf(t[z]);E++}L=0;J=G[s].length;w=E!=J;for(z=0;z<J;z++)A[n(G[s][z][0],G[s][z][1])]&&L++;r.divideScalar(E);L=0;if(w){for(z=0;z<J;z++){E=G[s][z];if(H=l[n(E[0],E[1])].length==1){E=o[E[0]].clone().addSelf(o[E[1]]).divideScalar(2);v.addSelf(E);L++}}v.divideScalar(4);b(L==2,"should have only 2 boundary edges")}else{for(z=0;z<J;z++){E=G[s][z];E=o[E[0]].clone().addSelf(o[E[1]]).divideScalar(2);v.addSelf(E)}v.divideScalar(J)}B.addSelf(o[s]);
|
|
|
|
-if(w){B.divideScalar(2);B.addSelf(v)}else{B.multiplyScalar(J-3);B.addSelf(r);B.addSelf(v.multiplyScalar(2));B.divideScalar(J)}h[s]=B}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 e(a,b,d,e,g,h,n){var m=new THREE.Face4(a,b,d,e,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=[f(a,""),f(b,n),f(d,n),f(e,n)];g[0]?g[1]?g[2]?g[3]?j.push(g):c("d :( ",e+":"+n):c("c :( ",d+":"+n):c("b :( ",b+":"+n):c("a :( ",a+":"+n)}}function f(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,n=THREE.GeometryUtils.orderedKey,m=THREE.GeometryUtils.computeEdgeFaces,p=a.vertices,o=a.faces,q=p.length,h=p.concat(),s=[],r={},A={},u={},t,D,z,w,v,C=a.faceVertexUvs[0],E;c("originalFaces, uvs, originalVerticesLength",o.length,C.length,q);if(l.supportUVs){t=0;for(D=C.length;t<D;t++){z=0;for(w=C[t].length;z<w;z++){E=o[t]["abcd".charAt(z)];g(E,t,C[t][z])}}}if(C.length==0)l.supportUVs=false;t=0;for(var G in u)t++;if(!t){l.supportUVs=false;c("no uvs")}t=
|
|
|
|
+0;for(D=o.length;t<D;t++){v=o[t];s.push(v.centroid);h.push(v.centroid);if(l.supportUVs){w=new THREE.UV;if(v instanceof THREE.Face3){w.u=f(v.a,t).u+f(v.b,t).u+f(v.c,t).u;w.v=f(v.a,t).v+f(v.b,t).v+f(v.c,t).v;w.u=w.u/3;w.v=w.v/3}else if(v instanceof THREE.Face4){w.u=f(v.a,t).u+f(v.b,t).u+f(v.c,t).u+f(v.d,t).u;w.v=f(v.a,t).v+f(v.b,t).v+f(v.c,t).v+f(v.d,t).v;w.u=w.u/4;w.v=w.v/4}g(q+t,"",w)}}var m=m(a),L;D=0;var B,J;G={};C={};for(t in m){E=m[t];B=t.split("_");J=B[0];B=B[1];z=J;v=[J,B];G[z]===void 0&&(G[z]=
|
|
|
|
+[]);G[z].push(v);z=B;v=[J,B];G[z]===void 0&&(G[z]=[]);G[z].push(v);z=0;for(w=E.length;z<w;z++){v=E[z];L=J;var H=v,I=t;C[L]===void 0&&(C[L]={});C[L][H]=I;L=B;H=t;C[L]===void 0&&(C[L]={});C[L][v]=H}E.length<2&&(A[t]=true)}for(t in m){E=m[t];v=E[0];L=E[1];B=t.split("_");J=B[0];B=B[1];w=new THREE.Vector3;b(E.length>0,"an edge without faces?!");if(E.length==1){w.addSelf(p[J]);w.addSelf(p[B]);w.multiplyScalar(0.5)}else{w.addSelf(s[v]);w.addSelf(s[L]);w.addSelf(p[J]);w.addSelf(p[B]);w.multiplyScalar(0.25)}r[t]=
|
|
|
|
+q+o.length+D;h.push(w);D++;if(l.supportUVs){w=new THREE.UV;w.u=f(J,v).u+f(B,v).u;w.v=f(J,v).v+f(B,v).v;w.u=w.u/2;w.v=w.v/2;g(r[t],v,w);if(E.length>=2){b(E.length==2,"did we plan for more than 2 edges?");w=new THREE.UV;w.u=f(J,L).u+f(B,L).u;w.v=f(J,L).v+f(B,L).v;w.u=w.u/2;w.v=w.v/2;g(r[t],L,w)}}}c("-- Step 2 done");var O,N;w=["123","12","2","23"];L=["123","23","3","31"];var H=["123","31","1","12"],I=["1234","12","2","23"],M=["1234","23","3","34"],T=["1234","34","4","41"],R=["1234","41","1","12"];t=
|
|
|
|
+0;for(D=s.length;t<D;t++){v=o[t];E=q+t;if(v instanceof THREE.Face3){J=n(v.a,v.b);B=n(v.b,v.c);O=n(v.c,v.a);e(E,r[J],v.b,r[B],v,w,t);e(E,r[B],v.c,r[O],v,L,t);e(E,r[O],v.a,r[J],v,H,t)}else if(v instanceof THREE.Face4){J=n(v.a,v.b);B=n(v.b,v.c);O=n(v.c,v.d);N=n(v.d,v.a);e(E,r[J],v.b,r[B],v,I,t);e(E,r[B],v.c,r[O],v,M,t);e(E,r[O],v.d,r[N],v,T,t);e(E,r[N],v.a,r[J],v,R,t)}else c("face should be a face!",v)}r=new THREE.Vector3;v=new THREE.Vector3;t=0;for(D=p.length;t<D;t++)if(G[t]!==void 0){r.set(0,0,0);
|
|
|
|
+v.set(0,0,0);B=new THREE.Vector3(0,0,0);E=0;for(z in C[t]){r.addSelf(s[z]);E++}L=0;J=G[t].length;w=E!=J;for(z=0;z<J;z++)A[n(G[t][z][0],G[t][z][1])]&&L++;r.divideScalar(E);L=0;if(w){for(z=0;z<J;z++){E=G[t][z];if(H=m[n(E[0],E[1])].length==1){E=p[E[0]].clone().addSelf(p[E[1]]).divideScalar(2);v.addSelf(E);L++}}v.divideScalar(4);b(L==2,"should have only 2 boundary edges")}else{for(z=0;z<J;z++){E=G[t][z];E=p[E[0]].clone().addSelf(p[E[1]]).divideScalar(2);v.addSelf(E)}v.divideScalar(J)}B.addSelf(p[t]);
|
|
|
|
+if(w){B.divideScalar(2);B.addSelf(v)}else{B.multiplyScalar(J-3);B.addSelf(r);B.addSelf(v.multiplyScalar(2));B.divideScalar(J)}h[t]=B}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,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=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:f,color:e,blending:d})};
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){b===void 0&&(b=-1);c===void 0&&(c=0);f===void 0&&(f=1);e===void 0&&(e=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:f,color:e,blending:d})};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-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+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,e=-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+e*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation=c.rotation+(c.wantedRotation-c.rotation)*0.25}};
|
|
@@ -744,40 +744,41 @@ 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.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 e=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 f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
|
|
THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time=d.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 f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/
|
|
e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
|
|
e),0,d.length-1),g=d.weight;if(f!==d.currentFrame){this.morphTargetInfluences[d.lastFrame]=0;this.morphTargetInfluences[d.currentFrame]=1*g;this.morphTargetInfluences[f]=0;d.lastFrame=d.currentFrame;d.currentFrame=f}e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};
|
|
-THREE.LensFlarePlugin=function(){function a(a){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,e,f,g,h,i,j,m,n,l,o;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);e=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
|
|
|
|
-0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;e[p++]=0;e[p++]=1;e[p++]=2;e[p++]=0;e[p++]=2;e[p++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,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,e,f,g,h,i,j,l,n,m,p;this.init=function(o){b=o.context;c=o;d=new Float32Array(16);e=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;e[o++]=0;e[o++]=1;e[o++]=2;e[o++]=0;e[o++]=2;e[o++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,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.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;m=a(THREE.ShaderFlares.lensFlare)}else{j=true;m=a(THREE.ShaderFlares.lensFlareVertexTexture)}n={};l={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");l.renderType=b.getUniformLocation(m,"renderType");l.map=b.getUniformLocation(m,"map");l.occlusionMap=b.getUniformLocation(m,"occlusionMap");l.opacity=b.getUniformLocation(m,"opacity");l.color=b.getUniformLocation(m,
|
|
|
|
-"color");l.scale=b.getUniformLocation(m,"scale");l.rotation=b.getUniformLocation(m,"rotation");l.screenPosition=b.getUniformLocation(m,"screenPosition");o=false};this.render=function(a,d,e,r){var a=a.__webglFlares,A=a.length;if(A){var u=new THREE.Vector3,s=r/e,D=e*0.5,z=r*0.5,w=16/r,v=new THREE.Vector2(w*s,w),C=new THREE.Vector3(1,1,0),E=new THREE.Vector2(1,1),G=l,w=n;b.useProgram(m);if(!o){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);o=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
|
|
|
|
-1);b.bindBuffer(b.ARRAY_BUFFER,f);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 L,B,J,H,I;for(L=0;L<A;L++){w=16/r;v.set(w*s,w);H=a[L];u.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(u);d.projectionMatrix.multiplyVector3(u);C.copy(u);E.x=C.x*D+D;E.y=C.y*z+z;if(j||E.x>0&&E.x<e&&E.y>0&&
|
|
|
|
|
|
+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");p=false};this.render=function(a,d,e,r){var a=a.__webglFlares,A=a.length;if(A){var u=new THREE.Vector3,t=r/e,D=e*0.5,z=r*0.5,w=16/r,v=new THREE.Vector2(w*t,w),C=new THREE.Vector3(1,1,0),E=new THREE.Vector2(1,1),G=m,w=n;b.useProgram(l);if(!p){b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);p=true}b.uniform1i(G.occlusionMap,0);b.uniform1i(G.map,
|
|
|
|
+1);b.bindBuffer(b.ARRAY_BUFFER,f);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 L,B,J,H,I;for(L=0;L<A;L++){w=16/r;v.set(w*t,w);H=a[L];u.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]);d.matrixWorldInverse.multiplyVector3(u);d.projectionMatrix.multiplyVector3(u);C.copy(u);E.x=C.x*D+D;E.y=C.y*z+z;if(j||E.x>0&&E.x<e&&E.y>0&&
|
|
E.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,v.x,v.y);b.uniform3f(G.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,E.x-8,E.y-8,16,16,0);b.uniform1i(G.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);
|
|
E.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,E.x-8,E.y-8,16,16,0);b.uniform1i(G.renderType,0);b.uniform2f(G.scale,v.x,v.y);b.uniform3f(G.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,E.x-8,E.y-8,16,16,0);b.uniform1i(G.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(C);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);B=0;for(J=H.lensFlares.length;B<J;B++){I=H.lensFlares[B];if(I.opacity>0.001&&I.scale>0.001){C.x=I.x;C.y=I.y;C.z=I.z;w=I.size*I.scale/r;v.x=w*s;v.y=w;b.uniform3f(G.screenPosition,C.x,C.y,C.z);b.uniform2f(G.scale,v.x,v.y);b.uniform1f(G.rotation,I.rotation);b.uniform1f(G.opacity,I.opacity);
|
|
|
|
|
|
+b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);H.positionScreen.copy(C);H.customUpdateCallback?H.customUpdateCallback(H):H.updateLensFlares();b.uniform1i(G.renderType,2);b.enable(b.BLEND);B=0;for(J=H.lensFlares.length;B<J;B++){I=H.lensFlares[B];if(I.opacity>0.001&&I.scale>0.001){C.x=I.x;C.y=I.y;C.z=I.z;w=I.size*I.scale/r;v.x=w*t;v.y=w;b.uniform3f(G.screenPosition,C.x,C.y,C.z);b.uniform2f(G.scale,v.x,v.y);b.uniform1f(G.rotation,I.rotation);b.uniform1f(G.opacity,I.opacity);
|
|
b.uniform3f(G.color,I.color.r,I.color.g,I.color.b);c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst);c.setTexture(I.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
b.uniform3f(G.color,I.color.r,I.color.g,I.color.b);c.setBlending(I.blending,I.blendEquation,I.blendSrc,I.blendDst);c.setTexture(I.texture,1);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,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});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,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});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true;f._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var l,o,p,q,t,r,A,u,s,D=[];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);l=0;for(o=m.__lights.length;l<o;l++){p=m.__lights[l];if(p.castShadow)if(p instanceof THREE.DirectionalLight&&p.shadowCascade)for(t=0;t<p.shadowCascadeCount;t++){var z;if(p.shadowCascadeArray[t])z=p.shadowCascadeArray[t];else{s=p;A=t;z=new THREE.DirectionalLight;z.isVirtual=true;z.onlyShadow=true;z.castShadow=true;z.shadowCameraNear=s.shadowCameraNear;z.shadowCameraFar=s.shadowCameraFar;z.shadowCameraLeft=s.shadowCameraLeft;z.shadowCameraRight=
|
|
|
|
-s.shadowCameraRight;z.shadowCameraBottom=s.shadowCameraBottom;z.shadowCameraTop=s.shadowCameraTop;z.shadowCameraVisible=s.shadowCameraVisible;z.shadowDarkness=s.shadowDarkness;z.shadowBias=s.shadowCascadeBias[A];z.shadowMapWidth=s.shadowCascadeWidth[A];z.shadowMapHeight=s.shadowCascadeHeight[A];z.pointsWorld=[];z.pointsFrustum=[];u=z.pointsWorld;r=z.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;r[w]=new THREE.Vector3}u=s.shadowCascadeNearZ[A];s=s.shadowCascadeFarZ[A];r[0].set(-1,-1,u);
|
|
|
|
-r[1].set(1,-1,u);r[2].set(-1,1,u);r[3].set(1,1,u);r[4].set(-1,-1,s);r[5].set(1,-1,s);r[6].set(-1,1,s);r[7].set(1,1,s);z.originalCamera=n;r=new THREE.Gyroscope;r.position=p.shadowCascadeOffset;r.add(z);r.add(z.target);n.add(r);p.shadowCascadeArray[t]=z;console.log("Created virtualLight",z)}A=p;u=t;s=A.shadowCascadeArray[u];s.position.copy(A.position);s.target.position.copy(A.target.position);s.lookAt(s.target);s.shadowCameraVisible=A.shadowCameraVisible;s.shadowDarkness=A.shadowDarkness;s.shadowBias=
|
|
|
|
-A.shadowCascadeBias[u];r=A.shadowCascadeNearZ[u];A=A.shadowCascadeFarZ[u];s=s.pointsFrustum;s[0].z=r;s[1].z=r;s[2].z=r;s[3].z=r;s[4].z=A;s[5].z=A;s[6].z=A;s[7].z=A;D[q]=z;q++}else{D[q]=p;q++}}l=0;for(o=D.length;l<o;l++){p=D[l];if(!p.shadowMap){p.shadowMap=new THREE.WebGLRenderTarget(p.shadowMapWidth,p.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat});p.shadowMapSize=new THREE.Vector2(p.shadowMapWidth,p.shadowMapHeight);p.shadowMatrix=new THREE.Matrix4}if(!p.shadowCamera){if(p instanceof
|
|
|
|
-THREE.SpotLight)p.shadowCamera=new THREE.PerspectiveCamera(p.shadowCameraFov,p.shadowMapWidth/p.shadowMapHeight,p.shadowCameraNear,p.shadowCameraFar);else if(p instanceof THREE.DirectionalLight)p.shadowCamera=new THREE.OrthographicCamera(p.shadowCameraLeft,p.shadowCameraRight,p.shadowCameraTop,p.shadowCameraBottom,p.shadowCameraNear,p.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(p.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}if(p.shadowCameraVisible&&
|
|
|
|
-!p.cameraHelper){p.cameraHelper=new THREE.CameraHelper(p.shadowCamera);p.shadowCamera.add(p.cameraHelper)}if(p.isVirtual&&z.originalCamera==n){t=n;q=p.shadowCamera;r=p.pointsFrustum;s=p.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(A=0;A<8;A++){u=s[A];u.copy(r[A]);THREE.ShadowMapPlugin.__projector.unprojectVector(u,t);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=p.shadowMap;r=p.shadowMatrix;t=p.shadowCamera;t.position.copy(p.matrixWorld.getPosition());t.lookAt(p.target.matrixWorld.getPosition());t.updateMatrixWorld();t.matrixWorldInverse.getInverse(t.matrixWorld);if(p.cameraHelper)p.cameraHelper.visible=p.shadowCameraVisible;p.shadowCameraVisible&&p.cameraHelper.update();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(t.projectionMatrix);r.multiplySelf(t.matrixWorldInverse);
|
|
|
|
-if(!t._viewMatrixArray)t._viewMatrixArray=new Float32Array(16);if(!t._projectionMatrixArray)t._projectionMatrixArray=new Float32Array(16);t.matrixWorldInverse.flattenToArray(t._viewMatrixArray);t.projectionMatrix.flattenToArray(t._projectionMatrixArray);h.multiply(t.projectionMatrix,t.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(q);b.clear();s=m.__webglObjects;p=0;for(q=s.length;p<q;p++){A=s[p];r=A.object;A.render=false;if(r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh)||!r.frustumCulled||
|
|
|
|
-g.contains(r))){r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld);A.render=true}}p=0;for(q=s.length;p<q;p++){A=s[p];if(A.render){r=A.object;A=A.buffer;w=r.material instanceof THREE.MeshFaceMaterial?r.geometry.materials[0]:r.material;u=r.geometry.morphTargets.length>0&&w.morphTargets;w=r instanceof THREE.SkinnedMesh&&w.skinning;u=r.customDepthMaterial?r.customDepthMaterial:w?u?f:e:u?d:c;A instanceof THREE.BufferGeometry?b.renderBufferDirect(t,m.__lights,null,u,A,r):b.renderBuffer(t,m.__lights,
|
|
|
|
-null,u,A,r)}}s=m.__webglObjectsImmediate;p=0;for(q=s.length;p<q;p++){A=s[p];r=A.object;if(r.visible&&r.castShadow){r._modelViewMatrix.multiply(t.matrixWorldInverse,r.matrixWorld);b.renderImmediateObject(t,m.__lights,null,c,r)}}}l=b.getClearColor();o=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,o);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
|
-THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,j,m;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=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;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);
|
|
|
|
-b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),p=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(p,a.vertexShader);b.compileShader(o);b.compileShader(p);b.attachShader(l,o);b.attachShader(l,p);b.linkProgram(l);h=l;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,
|
|
|
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true;f._shadowPass=true};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(l,n){var m,p,o,q,s,r,A,u,t,D=[];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);m=0;for(p=l.__lights.length;m<p;m++){o=l.__lights[m];if(o.castShadow)if(o instanceof THREE.DirectionalLight&&o.shadowCascade)for(s=0;s<o.shadowCascadeCount;s++){var z;if(o.shadowCascadeArray[s])z=o.shadowCascadeArray[s];else{t=o;A=s;z=new THREE.DirectionalLight;z.isVirtual=true;z.onlyShadow=true;z.castShadow=true;z.shadowCameraNear=t.shadowCameraNear;z.shadowCameraFar=t.shadowCameraFar;z.shadowCameraLeft=t.shadowCameraLeft;z.shadowCameraRight=
|
|
|
|
+t.shadowCameraRight;z.shadowCameraBottom=t.shadowCameraBottom;z.shadowCameraTop=t.shadowCameraTop;z.shadowCameraVisible=t.shadowCameraVisible;z.shadowDarkness=t.shadowDarkness;z.shadowBias=t.shadowCascadeBias[A];z.shadowMapWidth=t.shadowCascadeWidth[A];z.shadowMapHeight=t.shadowCascadeHeight[A];z.pointsWorld=[];z.pointsFrustum=[];u=z.pointsWorld;r=z.pointsFrustum;for(var w=0;w<8;w++){u[w]=new THREE.Vector3;r[w]=new THREE.Vector3}u=t.shadowCascadeNearZ[A];t=t.shadowCascadeFarZ[A];r[0].set(-1,-1,u);
|
|
|
|
+r[1].set(1,-1,u);r[2].set(-1,1,u);r[3].set(1,1,u);r[4].set(-1,-1,t);r[5].set(1,-1,t);r[6].set(-1,1,t);r[7].set(1,1,t);z.originalCamera=n;r=new THREE.Gyroscope;r.position=o.shadowCascadeOffset;r.add(z);r.add(z.target);n.add(r);o.shadowCascadeArray[s]=z;console.log("Created virtualLight",z)}A=o;u=s;t=A.shadowCascadeArray[u];t.position.copy(A.position);t.target.position.copy(A.target.position);t.lookAt(t.target);t.shadowCameraVisible=A.shadowCameraVisible;t.shadowDarkness=A.shadowDarkness;t.shadowBias=
|
|
|
|
+A.shadowCascadeBias[u];r=A.shadowCascadeNearZ[u];A=A.shadowCascadeFarZ[u];t=t.pointsFrustum;t[0].z=r;t[1].z=r;t[2].z=r;t[3].z=r;t[4].z=A;t[5].z=A;t[6].z=A;t[7].z=A;D[q]=z;q++}else{D[q]=o;q++}}m=0;for(p=D.length;m<p;m++){o=D[m];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&&z.originalCamera==n){s=n;q=o.shadowCamera;r=o.pointsFrustum;t=o.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(A=0;A<8;A++){u=t[A];u.copy(r[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;r=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();r.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);r.multiplySelf(s.projectionMatrix);r.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();t=l.__webglObjects;o=0;for(q=t.length;o<q;o++){A=t[o];r=A.object;A.render=false;if(r.visible&&r.castShadow&&(!(r instanceof THREE.Mesh||r instanceof
|
|
|
|
+THREE.ParticleSystem)||!r.frustumCulled||g.contains(r))){r._modelViewMatrix.multiply(s.matrixWorldInverse,r.matrixWorld);A.render=true}}o=0;for(q=t.length;o<q;o++){A=t[o];if(A.render){r=A.object;A=A.buffer;w=r.material instanceof THREE.MeshFaceMaterial?r.geometry.materials[0]:r.material;u=r.geometry.morphTargets.length>0&&w.morphTargets;w=r instanceof THREE.SkinnedMesh&&w.skinning;u=r.customDepthMaterial?r.customDepthMaterial:w?u?f:e:u?d:c;A instanceof THREE.BufferGeometry?b.renderBufferDirect(s,
|
|
|
|
+l.__lights,null,u,A,r):b.renderBuffer(s,l.__lights,null,u,A,r)}}t=l.__webglObjectsImmediate;o=0;for(q=t.length;o<q;o++){A=t[o];r=A.object;if(r.visible&&r.castShadow){r._modelViewMatrix.multiply(s.matrixWorldInverse,r.matrixWorld);b.renderImmediateObject(s,l.__lights,null,c,r)}}}m=b.getClearColor();p=b.getClearAlpha();a.clearColor(m.r,m.g,m.b,p);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
|
|
|
|
+THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,j,l;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);e=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;e[a++]=0;e[a++]=1;e[a++]=2;e[a++]=0;e[a++]=2;e[a++]=3;f=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);
|
|
|
|
+b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,e,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=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(m,p);b.attachShader(m,o);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,"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");
|
|
"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");j.fogType=b.getUniformLocation(h,"fogType");j.fogDensity=b.getUniformLocation(h,"fogDensity");j.fogNear=b.getUniformLocation(h,"fogNear");j.fogFar=b.getUniformLocation(h,"fogFar");j.fogColor=b.getUniformLocation(h,"fogColor");m=false};this.render=function(d,e,o,p){var q=d.__webglSprites,t=q.length;if(t){var r=i,A=j,u=p/o,o=o*0.5,s=p*0.5,D=true;b.useProgram(h);if(!m){b.enableVertexAttribArray(r.position);
|
|
|
|
-b.enableVertexAttribArray(r.uv);m=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(A.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(A.map,0);var z=r=0,w=d.fog;if(w){b.uniform3f(A.fogColor,w.color.r,w.color.g,w.color.b);if(w instanceof THREE.Fog){b.uniform1f(A.fogNear,
|
|
|
|
-w.near);b.uniform1f(A.fogFar,w.far);b.uniform1i(A.fogType,1);z=r=1}else if(w instanceof THREE.FogExp2){b.uniform1f(A.fogDensity,w.density);b.uniform1i(A.fogType,2);z=r=2}}else{b.uniform1i(A.fogType,0);z=r=0}for(var v,C=[],w=0;w<t;w++){v=q[w];if(v.visible&&v.opacity!==0)if(v.useScreenCoordinates)v.z=-v.position.z;else{v._modelViewMatrix.multiply(e.matrixWorldInverse,v.matrixWorld);v.z=-v._modelViewMatrix.elements[14]}}q.sort(a);for(w=0;w<t;w++){v=q[w];if(v.visible&&v.opacity!==0&&v.map&&v.map.image&&
|
|
|
|
-v.map.image.width){if(v.useScreenCoordinates){b.uniform1i(A.useScreenCoordinates,1);b.uniform3f(A.screenPosition,(v.position.x-o)/o,(s-v.position.y)/s,Math.max(0,Math.min(1,v.position.z)))}else{b.uniform1i(A.useScreenCoordinates,0);b.uniform1i(A.affectedByDistance,v.affectedByDistance?1:0);b.uniformMatrix4fv(A.modelViewMatrix,false,v._modelViewMatrix.elements)}e=d.fog&&v.fog?z:0;if(r!==e){b.uniform1i(A.fogType,e);r=e}e=1/(v.scaleByViewport?p:1);C[0]=e*u*v.scale.x;C[1]=e*v.scale.y;b.uniform2f(A.uvScale,
|
|
|
|
|
|
+j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");j.fogType=b.getUniformLocation(h,"fogType");j.fogDensity=b.getUniformLocation(h,"fogDensity");j.fogNear=b.getUniformLocation(h,"fogNear");j.fogFar=b.getUniformLocation(h,"fogFar");j.fogColor=b.getUniformLocation(h,"fogColor");l=false};this.render=function(d,e,p,o){var q=d.__webglSprites,s=q.length;if(s){var r=i,A=j,u=o/p,p=p*0.5,t=o*0.5,D=true;b.useProgram(h);if(!l){b.enableVertexAttribArray(r.position);
|
|
|
|
+b.enableVertexAttribArray(r.uv);l=true}b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(true);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(r.position,2,b.FLOAT,false,16,0);b.vertexAttribPointer(r.uv,2,b.FLOAT,false,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(A.projectionMatrix,false,e._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(A.map,0);var z=r=0,w=d.fog;if(w){b.uniform3f(A.fogColor,w.color.r,w.color.g,w.color.b);if(w instanceof THREE.Fog){b.uniform1f(A.fogNear,
|
|
|
|
+w.near);b.uniform1f(A.fogFar,w.far);b.uniform1i(A.fogType,1);z=r=1}else if(w instanceof THREE.FogExp2){b.uniform1f(A.fogDensity,w.density);b.uniform1i(A.fogType,2);z=r=2}}else{b.uniform1i(A.fogType,0);z=r=0}for(var v,C=[],w=0;w<s;w++){v=q[w];if(v.visible&&v.opacity!==0)if(v.useScreenCoordinates)v.z=-v.position.z;else{v._modelViewMatrix.multiply(e.matrixWorldInverse,v.matrixWorld);v.z=-v._modelViewMatrix.elements[14]}}q.sort(a);for(w=0;w<s;w++){v=q[w];if(v.visible&&v.opacity!==0&&v.map&&v.map.image&&
|
|
|
|
+v.map.image.width){if(v.useScreenCoordinates){b.uniform1i(A.useScreenCoordinates,1);b.uniform3f(A.screenPosition,(v.position.x-p)/p,(t-v.position.y)/t,Math.max(0,Math.min(1,v.position.z)))}else{b.uniform1i(A.useScreenCoordinates,0);b.uniform1i(A.affectedByDistance,v.affectedByDistance?1:0);b.uniformMatrix4fv(A.modelViewMatrix,false,v._modelViewMatrix.elements)}e=d.fog&&v.fog?z:0;if(r!==e){b.uniform1i(A.fogType,e);r=e}e=1/(v.scaleByViewport?o:1);C[0]=e*u*v.scale.x;C[1]=e*v.scale.y;b.uniform2f(A.uvScale,
|
|
v.uvScale.x,v.uvScale.y);b.uniform2f(A.uvOffset,v.uvOffset.x,v.uvOffset.y);b.uniform2f(A.alignment,v.alignment.x,v.alignment.y);b.uniform1f(A.opacity,v.opacity);b.uniform3f(A.color,v.color.r,v.color.g,v.color.b);b.uniform1f(A.rotation,v.rotation);b.uniform2fv(A.scale,C);if(v.mergeWith3D&&!D){b.enable(b.DEPTH_TEST);D=true}else if(!v.mergeWith3D&&D){b.disable(b.DEPTH_TEST);D=false}c.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst);c.setTexture(v.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,
|
|
v.uvScale.x,v.uvScale.y);b.uniform2f(A.uvOffset,v.uvOffset.x,v.uvOffset.y);b.uniform2f(A.alignment,v.alignment.x,v.alignment.y);b.uniform1f(A.opacity,v.opacity);b.uniform3f(A.color,v.color.r,v.color.g,v.color.b);b.uniform1f(A.rotation,v.rotation);b.uniform2fv(A.scale,C);if(v.mergeWith3D&&!D){b.enable(b.DEPTH_TEST);D=true}else if(!v.mergeWith3D&&D){b.disable(b.DEPTH_TEST);D=false}c.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst);c.setTexture(v.map,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,
|
|
0)}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(true)}}};
|
|
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,e=new THREE.Frustum,f=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,m,n,l,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);f.multiply(h.projectionMatrix,
|
|
|
|
-h.matrixWorldInverse);e.setFromMatrix(f);b.setRenderTarget(this.renderTarget);b.clear();o=g.__webglObjects;i=0;for(j=o.length;i<j;i++){m=o[i];l=m.object;m.render=false;if(l.visible&&(!(l instanceof THREE.Mesh)||!l.frustumCulled||e.contains(l))){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);m.render=true}}i=0;for(j=o.length;i<j;i++){m=o[i];if(m.render){l=m.object;m=m.buffer;l.material&&b.setMaterialFaces(l.material);n=l.customDepthMaterial?l.customDepthMaterial:l.geometry.morphTargets.length?
|
|
|
|
-d:c;m instanceof THREE.BufferGeometry?b.renderBufferDirect(h,g.__lights,null,n,m,l):b.renderBuffer(h,g.__lights,null,n,m,l)}}o=g.__webglObjectsImmediate;i=0;for(j=o.length;i<j;i++){m=o[i];l=m.object;if(l.visible&&l.castShadow){l._modelViewMatrix.multiply(h.matrixWorldInverse,l.matrixWorld);b.renderImmediateObject(h,g.__lights,null,c,l)}}i=b.getClearColor();j=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,j);a.enable(a.BLEND)}};
|
|
|
|
|
|
+THREE.DepthPassPlugin=function(){this.enabled=false;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;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});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:true});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:true,skinning:true});c._shadowPass=true;d._shadowPass=true;e._shadowPass=true;f._shadowPass=true};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,j){var l,n,m,p,o,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(true);b.autoUpdateScene&&i.updateMatrixWorld();if(!j._viewMatrixArray)j._viewMatrixArray=
|
|
|
|
+new Float32Array(16);if(!j._projectionMatrixArray)j._projectionMatrixArray=new Float32Array(16);j.matrixWorldInverse.getInverse(j.matrixWorld);j.matrixWorldInverse.flattenToArray(j._viewMatrixArray);j.projectionMatrix.flattenToArray(j._projectionMatrixArray);h.multiply(j.projectionMatrix,j.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();q=i.__webglObjects;l=0;for(n=q.length;l<n;l++){m=q[l];o=m.object;m.render=false;if(o.visible&&(!(o instanceof THREE.Mesh||o instanceof
|
|
|
|
+THREE.ParticleSystem)||!o.frustumCulled||g.contains(o))){o._modelViewMatrix.multiply(j.matrixWorldInverse,o.matrixWorld);m.render=true}}var s;l=0;for(n=q.length;l<n;l++){m=q[l];if(m.render){o=m.object;m=m.buffer;if(!(o instanceof THREE.ParticleSystem)||o.customDepthMaterial){(s=o.material instanceof THREE.MeshFaceMaterial?o.geometry.materials[0]:o.material)&&b.setMaterialFaces(o.material);p=o.geometry.morphTargets.length>0&&s.morphTargets;s=o instanceof THREE.SkinnedMesh&&s.skinning;p=o.customDepthMaterial?
|
|
|
|
+o.customDepthMaterial:s?p?f:e:p?d:c;m instanceof THREE.BufferGeometry?b.renderBufferDirect(j,i.__lights,null,p,m,o):b.renderBuffer(j,i.__lights,null,p,m,o)}}}q=i.__webglObjectsImmediate;l=0;for(n=q.length;l<n;l++){m=q[l];o=m.object;if(o.visible){o._modelViewMatrix.multiply(j.matrixWorldInverse,o.matrixWorld);b.renderImmediateObject(j,i.__lights,null,c,o)}}l=b.getClearColor();n=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,n);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}"},
|
|
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}"}};
|
|
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}",
|
|
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}",
|