|
@@ -89,15 +89,15 @@ typeof a.order&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expe
|
|
|
j*c-i,b[8]=f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-j,b[6]=l+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,j=d*g,l=d*e,b[0]=a-l*c,b[4]=-f*e,b[8]=j+i*c,b[1]=i+j*c,b[5]=f*g,b[9]=l-a*c,b[2]=-f*d,b[6]=c,b[10]=f*h):"ZYX"===a.order?(a=f*g,i=f*e,j=c*g,l=c*e,b[0]=h*g,b[4]=j*d-i,b[8]=a*d+l,b[1]=h*e,b[5]=l*d+a,b[9]=i*d-j,b[2]=-d,b[6]=c*h,b[10]=f*h):"YZX"===a.order?(a=f*h,i=f*d,j=c*h,l=c*d,b[0]=h*g,b[4]=l-a*e,b[8]=j*e+i,b[1]=e,b[5]=f*g,b[9]=-c*g,b[2]=-d*g,b[6]=i*e+j,b[10]=a-l*e):"XZY"===a.order&&(a=f*h,i=f*d,j=
|
|
|
c*h,l=c*d,b[0]=h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+l,b[5]=f*g,b[9]=i*e-j,b[2]=j*e-i,b[6]=c*g,b[10]=l*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,
|
|
|
a=c*h,j=c*g,c=c*i,l=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(l+e);b[4]=j-f;b[8]=c+g;b[1]=j+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+l);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,
|
|
|
-a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],p=c[2],t=c[6],q=c[10],r=c[14],s=c[3],v=c[7],
|
|
|
-z=c[11],c=c[15],C=d[0],F=d[4],H=d[8],I=d[12],G=d[1],A=d[5],K=d[9],B=d[13],J=d[2],N=d[6],y=d[10],M=d[14],w=d[3],Z=d[7],L=d[11],d=d[15];e[0]=f*C+h*G+g*J+i*w;e[4]=f*F+h*A+g*N+i*Z;e[8]=f*H+h*K+g*y+i*L;e[12]=f*I+h*B+g*M+i*d;e[1]=j*C+l*G+m*J+n*w;e[5]=j*F+l*A+m*N+n*Z;e[9]=j*H+l*K+m*y+n*L;e[13]=j*I+l*B+m*M+n*d;e[2]=p*C+t*G+q*J+r*w;e[6]=p*F+t*A+q*N+r*Z;e[10]=p*H+t*K+q*y+r*L;e[14]=p*I+t*B+q*M+r*d;e[3]=s*C+v*G+z*J+c*w;e[7]=s*F+v*A+z*N+c*Z;e[11]=s*H+v*K+z*y+c*L;e[15]=s*I+v*B+z*M+c*d;return this},multiplyToArray:function(a,
|
|
|
+a);h[0]=a.x;h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],j=c[1],l=c[5],m=c[9],n=c[13],p=c[2],t=c[6],q=c[10],r=c[14],s=c[3],u=c[7],
|
|
|
+z=c[11],c=c[15],C=d[0],F=d[4],H=d[8],I=d[12],G=d[1],A=d[5],K=d[9],B=d[13],J=d[2],N=d[6],y=d[10],M=d[14],w=d[3],Z=d[7],L=d[11],d=d[15];e[0]=f*C+h*G+g*J+i*w;e[4]=f*F+h*A+g*N+i*Z;e[8]=f*H+h*K+g*y+i*L;e[12]=f*I+h*B+g*M+i*d;e[1]=j*C+l*G+m*J+n*w;e[5]=j*F+l*A+m*N+n*Z;e[9]=j*H+l*K+m*y+n*L;e[13]=j*I+l*B+m*M+n*d;e[2]=p*C+t*G+q*J+r*w;e[6]=p*F+t*A+q*N+r*Z;e[10]=p*H+t*K+q*y+r*L;e[14]=p*I+t*B+q*M+r*d;e[3]=s*C+u*G+z*J+c*w;e[7]=s*F+u*A+z*N+c*Z;e[11]=s*H+u*K+z*y+c*L;e[15]=s*I+u*B+z*M+c*d;return this},multiplyToArray:function(a,
|
|
|
b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
|
|
|
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
|
|
|
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],j=a[2],l=a[6],m=a[10],n=a[14];return a[3]*(+e*g*l-d*i*l-e*h*m+c*i*m+d*h*n-c*g*n)+a[7]*(+b*g*n-b*i*m+e*f*m-d*f*n+d*i*j-e*g*j)+a[11]*(+b*i*l-b*h*n-e*f*l+c*f*n+e*h*j-c*i*j)+a[15]*(-d*h*j-b*g*l+b*h*m+d*f*l-c*f*
|
|
|
m+c*g*j)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
|
|
|
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
|
|
|
-b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],j=d[5],l=d[9],m=d[13],n=d[2],p=d[6],t=d[10],q=d[14],r=d[3],s=d[7],v=d[11],d=d[15];c[0]=l*q*s-m*t*s+m*p*v-j*q*v-l*p*d+j*t*d;c[4]=g*t*s-h*q*s-g*p*v+f*q*v+h*p*d-f*t*d;c[8]=h*m*s-g*l*s+g*j*v-f*m*v-h*j*d+f*l*d;c[12]=g*l*p-h*m*p-g*j*t+f*m*t+h*j*q-f*l*q;c[1]=m*t*r-l*q*r-m*n*v+i*q*v+l*n*d-i*t*d;c[5]=h*q*r-g*t*r+g*n*v-e*q*v-h*n*d+e*t*d;c[9]=g*l*r-h*m*r-g*i*v+e*m*v+h*i*d-
|
|
|
-e*l*d;c[13]=h*m*n-g*l*n+g*i*t-e*m*t-h*i*q+e*l*q;c[2]=j*q*r-m*p*r+m*n*s-i*q*s-j*n*d+i*p*d;c[6]=g*p*r-f*q*r-g*n*s+e*q*s+f*n*d-e*p*d;c[10]=f*m*r-g*j*r+g*i*s-e*m*s-f*i*d+e*j*d;c[14]=g*j*n-f*m*n-g*i*p+e*m*p+f*i*q-e*j*q;c[3]=l*p*r-j*t*r-l*n*s+i*t*s+j*n*v-i*p*v;c[7]=f*t*r-h*p*r+h*n*s-e*t*s-f*n*v+e*p*v;c[11]=h*j*r-f*l*r-h*i*s+e*l*s+f*i*v-e*j*v;c[15]=f*l*n-h*j*n+h*i*p-e*l*p-f*i*t+e*j*t;c=e*c[0]+i*c[4]+n*c[8]+r*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
+b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],j=d[5],l=d[9],m=d[13],n=d[2],p=d[6],t=d[10],q=d[14],r=d[3],s=d[7],u=d[11],d=d[15];c[0]=l*q*s-m*t*s+m*p*u-j*q*u-l*p*d+j*t*d;c[4]=g*t*s-h*q*s-g*p*u+f*q*u+h*p*d-f*t*d;c[8]=h*m*s-g*l*s+g*j*u-f*m*u-h*j*d+f*l*d;c[12]=g*l*p-h*m*p-g*j*t+f*m*t+h*j*q-f*l*q;c[1]=m*t*r-l*q*r-m*n*u+i*q*u+l*n*d-i*t*d;c[5]=h*q*r-g*t*r+g*n*u-e*q*u-h*n*d+e*t*d;c[9]=g*l*r-h*m*r-g*i*u+e*m*u+h*i*d-
|
|
|
+e*l*d;c[13]=h*m*n-g*l*n+g*i*t-e*m*t-h*i*q+e*l*q;c[2]=j*q*r-m*p*r+m*n*s-i*q*s-j*n*d+i*p*d;c[6]=g*p*r-f*q*r-g*n*s+e*q*s+f*n*d-e*p*d;c[10]=f*m*r-g*j*r+g*i*s-e*m*s-f*i*d+e*j*d;c[14]=g*j*n-f*m*n-g*i*p+e*m*p+f*i*q-e*j*q;c[3]=l*p*r-j*t*r-l*n*s+i*t*s+j*n*u-i*p*u;c[7]=f*t*r-h*p*r+h*n*s-e*t*s-f*n*u+e*p*u;c[11]=h*j*r-f*l*r-h*i*s+e*l*s+f*i*u-e*j*u;c[15]=f*l*n-h*j*n+h*i*p-e*l*p-f*i*t+e*j*t;c=e*c[0]+i*c[4]+n*c[8]+r*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
|
|
|
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
|
|
|
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,g=a.z,i=e*f,j=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,j*h+c,j*g-d*f,0,i*g-d*h,j*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
|
|
@@ -106,10 +106,10 @@ g;b.elements[6]/=g;b.elements[8]/=i;b.elements[9]/=i;b.elements[10]/=i;d.setFrom
|
|
|
makeOrthographic:function(a,b,c,d,e,f){var h=this.elements,g=b-a,i=c-d,j=f-e;h[0]=2/g;h[4]=0;h[8]=0;h[12]=-((b+a)/g);h[1]=0;h[5]=2/i;h[9]=0;h[13]=-((c+d)/i);h[2]=0;h[6]=0;h[10]=-2/j;h[14]=-((f+e)/j);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},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.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);
|
|
|
-var d=c.dot(this.direction);return c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqAndPointToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(0.5),f=b.clone().sub(a).normalize(),h=0.5*a.distanceTo(b),g=this.origin.clone().sub(e),a=-this.direction.dot(f),b=
|
|
|
-g.dot(this.direction),i=g.lengthSq(),j=Math.abs(1-a*a),l,m;0<=j?(l=-g.dot(f),g=a*b-l,m=h*j,g>=-m?g<=m?(j=1/j,h=(a*l-b)*j,g*=j,a=h*(h+a*g+2*b)+g*(a*h+g+2*l)+i):(g=h,h=-(a*g+b),a=-h*h+g*(g+2*l)+i):(g=-h,h=-(a*g+b),a=-h*h+g*(g+2*l)+i)):(g=0,h=-b,a=b*h+i);c&&c.copy(this.direction.clone().multiplyScalar(h).add(this.origin));d&&d.copy(f.clone().multiplyScalar(g).add(e));return a},isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){return 0!=
|
|
|
-a.normal.dot(this.direction)||0==a.distanceToPoint(this.origin)?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b){if(0==a.distanceToPoint(this.origin))return 0}else return-(this.origin.dot(a.normal)+a.constant)/b},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return void 0===c?void 0:this.at(c,b)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&
|
|
|
-a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
|
|
|
+var d=c.dot(this.direction);return 0>d?this.origin.clone():c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(0.5),f=b.clone().sub(a).normalize(),h=0.5*a.distanceTo(b),g=
|
|
|
+this.origin.clone().sub(e),a=-this.direction.dot(f),b=g.dot(this.direction),i=-g.dot(f),j=g.lengthSq(),l=Math.abs(1-a*a),m,n;0<=l?(g=a*i-b,m=a*b-i,n=h*l,0<=g?m>=-n?m<=n?(h=1/l,g*=h,m*=h,a=g*(g+a*m+2*b)+m*(a*g+m+2*i)+j):(m=h,g=Math.max(0,-(a*m+b)),a=-g*g+m*(m+2*i)+j):(m=-h,g=Math.max(0,-(a*m+b)),a=-g*g+m*(m+2*i)+j):m<=-n?(g=Math.max(0,-(-a*h+b)),m=0<g?-h:Math.min(Math.max(-h,-i),h),a=-g*g+m*(m+2*i)+j):m<=n?(g=0,m=Math.min(Math.max(-h,-i),h),a=m*(m+2*i)+j):(g=Math.max(0,-(a*h+b)),m=0<g?h:Math.min(Math.max(-h,
|
|
|
+-i),h),a=-g*g+m*(m+2*i)+j)):(m=0<a?-h:h,g=Math.max(0,-(a*m+b)),a=-g*g+m*(m+2*i)+j);c&&c.copy(this.direction.clone().multiplyScalar(g).add(this.origin));d&&d.copy(f.clone().multiplyScalar(m).add(e));return a},isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?
|
|
|
+0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
|
|
|
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(a){for(var b,c=0,d=0,e=a.length;d<e;d++)b=a[d].lengthSq(),c=Math.max(c,b);this.center.set(0,0,0);this.radius=Math.sqrt(c);return this},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-
|
|
|
this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);
|
|
|
this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
|
|
@@ -137,13 +137,13 @@ a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.Eve
|
|
|
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(a){if(void 0!==
|
|
|
this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.lengthSq()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Vector3,h=new a.Matrix4,g=function(a,b){return a.distance-b.distance},i=function(g,j,n){if(g instanceof a.Particle){f.getPositionFromMatrix(g.matrixWorld);var p=j.ray.distanceToPoint(f);if(p>g.scale.x)return n;n.push({distance:p,point:g.position,face:null,object:g})}else if(g instanceof
|
|
|
a.LOD)f.getPositionFromMatrix(g.matrixWorld),p=j.ray.origin.distanceTo(f),i(g.getObjectForDistance(p),j,n);else if(g instanceof a.Mesh){p=g.geometry;f.getPositionFromMatrix(g.matrixWorld);null===p.boundingSphere&&p.computeBoundingSphere();b.set(f,p.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!1===j.ray.isIntersectionSphere(b))return n;var t=p.vertices;if(p instanceof a.BufferGeometry){var q=g.material;if(void 0===q||!1===p.dynamic)return n;var r=g.material instanceof a.MeshFaceMaterial,
|
|
|
-s=!0===r?g.material.materials:null,v=g.material.side,z,C,F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);var H,t=!1;p.attributes.index&&(t=!0);s=new a.Vector3;H=new a.Vector3;var I=new a.Vector3;new a.Vector3;new a.Vector3;for(var G=0;G<p.offsets.length;++G)for(var A=p.offsets[G].start,K=p.offsets[G].index,r=A,B=A+p.offsets[G].count;r<B;r+=3)if(t?(v=K+p.attributes.index.array[r],z=K+p.attributes.index.array[r+1],C=K+p.attributes.index.array[r+2]):(v=K,z=K+1,C=K+2),s.set(p.attributes.position.array[3*
|
|
|
-v],p.attributes.position.array[3*v+1],p.attributes.position.array[3*v+2]),H.set(p.attributes.position.array[3*z],p.attributes.position.array[3*z+1],p.attributes.position.array[3*z+2]),I.set(p.attributes.position.array[3*C],p.attributes.position.array[3*C+1],p.attributes.position.array[3*C+2]),d.setFromCoplanarPoints(s,H,I),A=c.distanceToPlane(d),!(Math.abs(A)<F)&&!(0>A)){v=q.side;if(v!==a.DoubleSide&&(z=c.direction.dot(d.normal),!(v===a.FrontSide?0>z:0<z)))continue;A<j.near||A>j.far||(e=c.at(A,e),
|
|
|
-!1!==a.Triangle.containsPoint(e,s,H,I)&&n.push({distance:A,point:j.ray.at(A),face:null,faceIndex:null,object:g}))}}else if(p instanceof a.Geometry){r=g.material instanceof a.MeshFaceMaterial;s=!0===r?g.material.materials:null;F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);I=0;for(H=p.faces.length;I<H;I++)if(G=p.faces[I],q=!0===r?s[G.materialIndex]:g.material,void 0!==q&&(d.setFromNormalAndCoplanarPoint(G.normal,t[G.a]),A=c.distanceToPlane(d),!(Math.abs(A)<F)&&!(0>A))){v=q.side;
|
|
|
-if(v!==a.DoubleSide&&(z=c.direction.dot(d.normal),!(v===a.FrontSide?0>z:0<z)))continue;if(!(A<j.near||A>j.far)){e=c.at(A,e);if(G instanceof a.Face3){if(v=t[G.a],z=t[G.b],C=t[G.c],!1===a.Triangle.containsPoint(e,v,z,C))continue}else if(G instanceof a.Face4){if(v=t[G.a],z=t[G.b],C=t[G.c],q=t[G.d],!1===a.Triangle.containsPoint(e,v,z,q)&&!1===a.Triangle.containsPoint(e,z,C,q))continue}else throw Error("face type not supported");n.push({distance:A,point:j.ray.at(A),face:G,faceIndex:I,object:g})}}}}else if(g instanceof
|
|
|
-a.Line){F=j.linePrecision;F*=F;p=g.geometry;null===p.boundingSphere&&p.computeBoundingSphere();f.getPositionFromMatrix(g.matrixWorld);b.set(f,p.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!1===j.ray.isIntersectionSphere(b))return n;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);c.direction.normalize();t=p.vertices;q=t.length;A=new a.Vector3;v=new a.Vector3;z=g.type===a.LineStrip?1:2;for(r=0;r<q-1;r+=z)c.distanceSqAndPointToSegment(t[r],t[r+1],v,A),A.applyMatrix4(g.matrixWorld),
|
|
|
-v.applyMatrix4(g.matrixWorld),v.distanceToSquared(A)<=F&&(p=j.ray.origin.distanceTo(v),j.near<=p&&p<=j.far&&n.push({distance:p,point:A.clone(),face:null,faceIndex:null,object:g}))}},j=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,
|
|
|
-b){var c=[];!0===b&&j(a,this,c);i(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)i(a[d],this,c),!0===b&&j(a[d],this,c);c.sort(g);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Euler;this.quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this.rotation._quaternion=this.quaternion;this.quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
|
+s=!0===r?g.material.materials:null,u=g.material.side,z,C,F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);var H,t=!1;p.attributes.index&&(t=!0);s=new a.Vector3;H=new a.Vector3;var I=new a.Vector3;new a.Vector3;new a.Vector3;for(var G=0;G<p.offsets.length;++G)for(var A=p.offsets[G].start,K=p.offsets[G].index,r=A,B=A+p.offsets[G].count;r<B;r+=3)if(t?(u=K+p.attributes.index.array[r],z=K+p.attributes.index.array[r+1],C=K+p.attributes.index.array[r+2]):(u=K,z=K+1,C=K+2),s.set(p.attributes.position.array[3*
|
|
|
+u],p.attributes.position.array[3*u+1],p.attributes.position.array[3*u+2]),H.set(p.attributes.position.array[3*z],p.attributes.position.array[3*z+1],p.attributes.position.array[3*z+2]),I.set(p.attributes.position.array[3*C],p.attributes.position.array[3*C+1],p.attributes.position.array[3*C+2]),d.setFromCoplanarPoints(s,H,I),A=c.distanceToPlane(d),!(A<F)&&null!==A){u=q.side;if(u!==a.DoubleSide&&(z=c.direction.dot(d.normal),!(u===a.FrontSide?0>z:0<z)))continue;A<j.near||A>j.far||(e=c.at(A,e),!1!==a.Triangle.containsPoint(e,
|
|
|
+s,H,I)&&n.push({distance:A,point:j.ray.at(A),face:null,faceIndex:null,object:g}))}}else if(p instanceof a.Geometry){r=g.material instanceof a.MeshFaceMaterial;s=!0===r?g.material.materials:null;F=j.precision;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);I=0;for(H=p.faces.length;I<H;I++)if(G=p.faces[I],q=!0===r?s[G.materialIndex]:g.material,void 0!==q&&(d.setFromNormalAndCoplanarPoint(G.normal,t[G.a]),A=c.distanceToPlane(d),!(A<F)&&null!==A)){u=q.side;if(u!==a.DoubleSide&&(z=c.direction.dot(d.normal),
|
|
|
+!(u===a.FrontSide?0>z:0<z)))continue;if(!(A<j.near||A>j.far)){e=c.at(A,e);if(G instanceof a.Face3){if(u=t[G.a],z=t[G.b],C=t[G.c],!1===a.Triangle.containsPoint(e,u,z,C))continue}else if(G instanceof a.Face4){if(u=t[G.a],z=t[G.b],C=t[G.c],q=t[G.d],!1===a.Triangle.containsPoint(e,u,z,q)&&!1===a.Triangle.containsPoint(e,z,C,q))continue}else throw Error("face type not supported");n.push({distance:A,point:j.ray.at(A),face:G,faceIndex:I,object:g})}}}}else if(g instanceof a.Line){F=j.linePrecision;F*=F;p=
|
|
|
+g.geometry;null===p.boundingSphere&&p.computeBoundingSphere();f.getPositionFromMatrix(g.matrixWorld);b.set(f,p.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!1===j.ray.isIntersectionSphere(b))return n;h.getInverse(g.matrixWorld);c.copy(j.ray).applyMatrix4(h);c.direction.normalize();t=p.vertices;q=t.length;A=new a.Vector3;u=new a.Vector3;z=g.type===a.LineStrip?1:2;for(r=0;r<q-1;r+=z)c.distanceToSegment(t[r],t[r+1],u,A),A.applyMatrix4(g.matrixWorld),u.applyMatrix4(g.matrixWorld),u.distanceToSquared(A)<=
|
|
|
+F&&(p=j.ray.origin.distanceTo(u),j.near<=p&&p<=j.far&&n.push({distance:p,point:A.clone(),face:null,faceIndex:null,object:g}))}},j=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)i(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&j(a,this,c);i(a,this,c);c.sort(g);
|
|
|
+return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)i(a[d],this,c),!0===b&&j(a[d],this,c);c.sort(g);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Euler;this.quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this.rotation._quaternion=this.quaternion;this.quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
|
|
|
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");return this.rotation.order},set eulerOrder(a){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");
|
|
|
this.rotation.order=a},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);
|
|
@@ -155,20 +155,20 @@ a.parent.remove(a);a.parent=this;a.dispatchEvent({type:"added"});this.children.p
|
|
|
getObjectById:function(a,b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.id===a||!0===b&&(e=e.getObjectById(a,b),void 0!==e))return e}},getObjectByName:function(a,b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getObjectByName(a,b),void 0!==e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(a,b)},getDescendants:function(a){void 0===
|
|
|
a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),
|
|
|
this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=
|
|
|
-this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===l){var a=new THREE.RenderableVertex;j.push(a);l++;i++;return a}return j[i++]}function b(a,b){return b.z-a.z}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=0,g,i,j=[],l=0,m,n,p=[],t=0,q,r=[],
|
|
|
-s=0,v,z,C=[],F=0,H,I,G=[],A=0,K={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,J=new THREE.Vector4,N=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),y=new THREE.Box3,M=Array(3),w=Array(4),Z=new THREE.Matrix4,L=new THREE.Matrix4,oa,Pa=new THREE.Matrix4,Va=new THREE.Matrix3,O=new THREE.Matrix3,qa=new THREE.Vector3,Fa=new THREE.Frustum,wa=new THREE.Vector4,D=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);L.multiplyMatrices(b.projectionMatrix,
|
|
|
-b.matrixWorldInverse);return a.applyProjection(L)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);L.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(L)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var V=function(a){if(e===h){var b=new THREE.RenderableObject;f.push(b);h++;e++;d=b}else d=f[e++];
|
|
|
-d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(B.getPositionFromMatrix(a.matrixWorld),B.applyProjection(L),d.z=B.z);return d},ea=function(a){if(!1!==a.visible){a instanceof THREE.Light?K.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===Fa.intersectsObject(a))&&K.objects.push(V(a)):(a instanceof THREE.Sprite||a instanceof THREE.Particle)&&K.sprites.push(V(a));for(var b=0,c=a.children.length;b<c;b++)ea(a.children[b])}};this.projectScene=function(d,f,h,
|
|
|
-l){var V=!1,B,fa,da,T,aa,la,Y,ma,xa,bb,ia,ha,ra;I=z=q=n=0;K.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();Z.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));L.multiplyMatrices(f.projectionMatrix,Z);O.getNormalMatrix(Z);Fa.setFromMatrix(L);e=0;K.objects.length=0;K.sprites.length=0;K.lights.length=0;ea(d);!0===h&&K.objects.sort(b);d=0;for(h=K.objects.length;d<h;d++)if(ma=K.objects[d].object,oa=ma.matrixWorld,i=0,ma instanceof THREE.Mesh){xa=
|
|
|
-ma.geometry;da=xa.vertices;bb=xa.faces;xa=xa.faceVertexUvs;Va.getNormalMatrix(oa);ha=ma.material instanceof THREE.MeshFaceMaterial;ra=!0===ha?ma.material:null;B=0;for(fa=da.length;B<fa;B++)g=a(),g.positionWorld.copy(da[B]).applyMatrix4(oa),g.positionScreen.copy(g.positionWorld).applyMatrix4(L),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.positionScreen.z/=g.positionScreen.w,g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||
|
|
|
--1>g.positionScreen.z||1<g.positionScreen.z);da=0;for(B=bb.length;da<B;da++){fa=bb[da];var ka=!0===ha?ra.materials[fa.materialIndex]:ma.material;if(void 0!==ka){la=ka.side;if(fa instanceof THREE.Face3)if(T=j[fa.a],aa=j[fa.b],Y=j[fa.c],M[0]=T.positionScreen,M[1]=aa.positionScreen,M[2]=Y.positionScreen,!0===T.visible||!0===aa.visible||!0===Y.visible||N.isIntersectionBox(y.setFromPoints(M)))if(V=0>(Y.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(Y.positionScreen.y-T.positionScreen.y)*
|
|
|
-(aa.positionScreen.x-T.positionScreen.x),la===THREE.DoubleSide||V===(la===THREE.FrontSide))n===t?(ia=new THREE.RenderableFace3,p.push(ia),t++,n++,m=ia):m=p[n++],m.v1.copy(T),m.v2.copy(aa),m.v3.copy(Y);else continue;else continue;else if(fa instanceof THREE.Face4)if(T=j[fa.a],aa=j[fa.b],Y=j[fa.c],ia=j[fa.d],w[0]=T.positionScreen,w[1]=aa.positionScreen,w[2]=Y.positionScreen,w[3]=ia.positionScreen,!0===T.visible||!0===aa.visible||!0===Y.visible||!0===ia.visible||N.isIntersectionBox(y.setFromPoints(w)))if(V=
|
|
|
-0>(ia.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(ia.positionScreen.y-T.positionScreen.y)*(aa.positionScreen.x-T.positionScreen.x)||0>(aa.positionScreen.x-Y.positionScreen.x)*(ia.positionScreen.y-Y.positionScreen.y)-(aa.positionScreen.y-Y.positionScreen.y)*(ia.positionScreen.x-Y.positionScreen.x),la===THREE.DoubleSide||V===(la===THREE.FrontSide)){if(q===s){var ua=new THREE.RenderableFace4;r.push(ua);s++;q++;m=ua}else m=r[q++];m.v1.copy(T);m.v2.copy(aa);m.v3.copy(Y);
|
|
|
-m.v4.copy(ia)}else continue;else continue;m.normalModel.copy(fa.normal);!1===V&&(la===THREE.BackSide||la===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(Va).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(O);m.centroidModel.copy(fa.centroid).applyMatrix4(oa);Y=fa.vertexNormals;T=0;for(aa=Y.length;T<aa;T++)ia=m.vertexNormalsModel[T],ia.copy(Y[T]),!1===V&&(la===THREE.BackSide||la===THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(Va).normalize(),m.vertexNormalsModelView[T].copy(ia).applyMatrix3(O);
|
|
|
-m.vertexNormalsLength=Y.length;T=0;for(aa=xa.length;T<aa;T++)if(ia=xa[T][da],void 0!==ia){la=0;for(Y=ia.length;la<Y;la++)m.uvs[T][la]=ia[la]}m.color=fa.color;m.material=ka;qa.copy(m.centroidModel).applyProjection(L);m.z=qa.z;K.elements.push(m)}}}else if(ma instanceof THREE.Line){Pa.multiplyMatrices(L,oa);da=ma.geometry.vertices;T=a();T.positionScreen.copy(da[0]).applyMatrix4(Pa);bb=ma.type===THREE.LinePieces?2:1;B=1;for(fa=da.length;B<fa;B++)T=a(),T.positionScreen.copy(da[B]).applyMatrix4(Pa),0<(B+
|
|
|
-1)%bb||(aa=j[i-2],wa.copy(T.positionScreen),D.copy(aa.positionScreen),!0===c(wa,D)&&(wa.multiplyScalar(1/wa.w),D.multiplyScalar(1/D.w),z===F?(xa=new THREE.RenderableLine,C.push(xa),F++,z++,v=xa):v=C[z++],v.v1.positionScreen.copy(wa),v.v2.positionScreen.copy(D),v.z=Math.max(wa.z,D.z),v.material=ma.material,ma.material.vertexColors===THREE.VertexColors&&(v.vertexColors[0].copy(ma.geometry.colors[B]),v.vertexColors[1].copy(ma.geometry.colors[B-1])),K.elements.push(v)))}d=0;for(h=K.sprites.length;d<h;d++)ma=
|
|
|
-K.sprites[d].object,oa=ma.matrixWorld,ma instanceof THREE.Particle&&(J.set(oa.elements[12],oa.elements[13],oa.elements[14],1),J.applyMatrix4(L),J.z/=J.w,0<J.z&&1>J.z&&(I===A?(V=new THREE.RenderableParticle,G.push(V),A++,I++,H=V):H=G[I++],H.object=ma,H.x=J.x/J.w,H.y=J.y/J.w,H.z=J.z,H.rotation=ma.rotation.z,H.scale.x=ma.scale.x*Math.abs(H.x-(J.x+f.projectionMatrix.elements[0])/(J.w+f.projectionMatrix.elements[12])),H.scale.y=ma.scale.y*Math.abs(H.y-(J.y+f.projectionMatrix.elements[5])/(J.w+f.projectionMatrix.elements[13])),
|
|
|
-H.material=ma.material,K.elements.push(H)));!0===l&&K.elements.sort(b);return K}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
+this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===l){var a=new THREE.RenderableVertex;j.push(a);l++;i++;return a}return j[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
|
|
|
+0,g,i,j=[],l=0,m,n,p=[],t=0,q,r=[],s=0,u,z,C=[],F=0,H,I,G=[],A=0,K={objects:[],sprites:[],lights:[],elements:[]},B=new THREE.Vector3,J=new THREE.Vector4,N=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),y=new THREE.Box3,M=Array(3),w=Array(4),Z=new THREE.Matrix4,L=new THREE.Matrix4,oa,Pa=new THREE.Matrix4,Va=new THREE.Matrix3,O=new THREE.Matrix3,qa=new THREE.Vector3,Fa=new THREE.Frustum,wa=new THREE.Vector4,D=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
|
|
|
+L.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(L)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);L.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(L)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var V=function(a){if(e===h){var b=new THREE.RenderableObject;
|
|
|
+f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(B.getPositionFromMatrix(a.matrixWorld),B.applyProjection(L),d.z=B.z);return d},ea=function(a){if(!1!==a.visible){a instanceof THREE.Light?K.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===Fa.intersectsObject(a))&&K.objects.push(V(a)):(a instanceof THREE.Sprite||a instanceof THREE.Particle)&&K.sprites.push(V(a));for(var b=0,c=a.children.length;b<c;b++)ea(a.children[b])}};
|
|
|
+this.projectScene=function(d,f,h,l){var V=!1,B,fa,da,T,aa,ma,ka,X,xa,bb,ia,ha,ra;I=z=q=n=0;K.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();Z.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));L.multiplyMatrices(f.projectionMatrix,Z);O.getNormalMatrix(Z);Fa.setFromMatrix(L);e=0;K.objects.length=0;K.sprites.length=0;K.lights.length=0;ea(d);!0===h&&K.objects.sort(b);d=0;for(h=K.objects.length;d<h;d++)if(X=K.objects[d].object,oa=X.matrixWorld,i=
|
|
|
+0,X instanceof THREE.Mesh){xa=X.geometry;da=xa.vertices;bb=xa.faces;xa=xa.faceVertexUvs;Va.getNormalMatrix(oa);ha=X.material instanceof THREE.MeshFaceMaterial;ra=!0===ha?X.material:null;B=0;for(fa=da.length;B<fa;B++)g=a(),g.positionWorld.copy(da[B]).applyMatrix4(oa),g.positionScreen.copy(g.positionWorld).applyMatrix4(L),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.positionScreen.z/=g.positionScreen.w,g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||
|
|
|
+1<g.positionScreen.y||-1>g.positionScreen.z||1<g.positionScreen.z);da=0;for(B=bb.length;da<B;da++){fa=bb[da];var la=!0===ha?ra.materials[fa.materialIndex]:X.material;if(void 0!==la){ma=la.side;if(fa instanceof THREE.Face3)if(T=j[fa.a],aa=j[fa.b],ka=j[fa.c],M[0]=T.positionScreen,M[1]=aa.positionScreen,M[2]=ka.positionScreen,!0===T.visible||!0===aa.visible||!0===ka.visible||N.isIntersectionBox(y.setFromPoints(M)))if(V=0>(ka.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-
|
|
|
+(ka.positionScreen.y-T.positionScreen.y)*(aa.positionScreen.x-T.positionScreen.x),ma===THREE.DoubleSide||V===(ma===THREE.FrontSide))n===t?(ia=new THREE.RenderableFace3,p.push(ia),t++,n++,m=ia):m=p[n++],m.id=X.id,m.v1.copy(T),m.v2.copy(aa),m.v3.copy(ka);else continue;else continue;else if(fa instanceof THREE.Face4)if(T=j[fa.a],aa=j[fa.b],ka=j[fa.c],ia=j[fa.d],w[0]=T.positionScreen,w[1]=aa.positionScreen,w[2]=ka.positionScreen,w[3]=ia.positionScreen,!0===T.visible||!0===aa.visible||!0===ka.visible||
|
|
|
+!0===ia.visible||N.isIntersectionBox(y.setFromPoints(w)))if(V=0>(ia.positionScreen.x-T.positionScreen.x)*(aa.positionScreen.y-T.positionScreen.y)-(ia.positionScreen.y-T.positionScreen.y)*(aa.positionScreen.x-T.positionScreen.x)||0>(aa.positionScreen.x-ka.positionScreen.x)*(ia.positionScreen.y-ka.positionScreen.y)-(aa.positionScreen.y-ka.positionScreen.y)*(ia.positionScreen.x-ka.positionScreen.x),ma===THREE.DoubleSide||V===(ma===THREE.FrontSide)){if(q===s){var ua=new THREE.RenderableFace4;r.push(ua);
|
|
|
+s++;q++;m=ua}else m=r[q++];m.id=X.id;m.v1.copy(T);m.v2.copy(aa);m.v3.copy(ka);m.v4.copy(ia)}else continue;else continue;m.normalModel.copy(fa.normal);!1===V&&(ma===THREE.BackSide||ma===THREE.DoubleSide)&&m.normalModel.negate();m.normalModel.applyMatrix3(Va).normalize();m.normalModelView.copy(m.normalModel).applyMatrix3(O);m.centroidModel.copy(fa.centroid).applyMatrix4(oa);ka=fa.vertexNormals;T=0;for(aa=ka.length;T<aa;T++)ia=m.vertexNormalsModel[T],ia.copy(ka[T]),!1===V&&(ma===THREE.BackSide||ma===
|
|
|
+THREE.DoubleSide)&&ia.negate(),ia.applyMatrix3(Va).normalize(),m.vertexNormalsModelView[T].copy(ia).applyMatrix3(O);m.vertexNormalsLength=ka.length;T=0;for(aa=xa.length;T<aa;T++)if(ia=xa[T][da],void 0!==ia){ma=0;for(ka=ia.length;ma<ka;ma++)m.uvs[T][ma]=ia[ma]}m.color=fa.color;m.material=la;qa.copy(m.centroidModel).applyProjection(L);m.z=qa.z;K.elements.push(m)}}}else if(X instanceof THREE.Line){Pa.multiplyMatrices(L,oa);da=X.geometry.vertices;T=a();T.positionScreen.copy(da[0]).applyMatrix4(Pa);bb=
|
|
|
+X.type===THREE.LinePieces?2:1;B=1;for(fa=da.length;B<fa;B++)T=a(),T.positionScreen.copy(da[B]).applyMatrix4(Pa),0<(B+1)%bb||(aa=j[i-2],wa.copy(T.positionScreen),D.copy(aa.positionScreen),!0===c(wa,D)&&(wa.multiplyScalar(1/wa.w),D.multiplyScalar(1/D.w),z===F?(xa=new THREE.RenderableLine,C.push(xa),F++,z++,u=xa):u=C[z++],u.id=X.id,u.v1.positionScreen.copy(wa),u.v2.positionScreen.copy(D),u.z=Math.max(wa.z,D.z),u.material=X.material,X.material.vertexColors===THREE.VertexColors&&(u.vertexColors[0].copy(X.geometry.colors[B]),
|
|
|
+u.vertexColors[1].copy(X.geometry.colors[B-1])),K.elements.push(u)))}d=0;for(h=K.sprites.length;d<h;d++)X=K.sprites[d].object,oa=X.matrixWorld,X instanceof THREE.Particle&&(J.set(oa.elements[12],oa.elements[13],oa.elements[14],1),J.applyMatrix4(L),J.z/=J.w,0<J.z&&1>J.z&&(I===A?(V=new THREE.RenderableParticle,G.push(V),A++,I++,H=V):H=G[I++],H.id=X.id,H.x=J.x/J.w,H.y=J.y/J.w,H.z=J.z,H.object=X,H.rotation=X.rotation.z,H.scale.x=X.scale.x*Math.abs(H.x-(J.x+f.projectionMatrix.elements[0])/(J.w+f.projectionMatrix.elements[12])),
|
|
|
+H.scale.y=X.scale.y*Math.abs(H.y-(J.y+f.projectionMatrix.elements[5])/(J.w+f.projectionMatrix.elements[13])),H.material=X.material,K.elements.push(H)));!0===l&&K.elements.sort(b);return K}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,h){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==h?h:0;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -184,7 +184,7 @@ this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNorm
|
|
|
e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var h=this.morphNormals[a].faceNormals,
|
|
|
g=this.morphNormals[a].vertexNormals,i,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},h.push(i),g.push(j)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=h.faceNormals[c],j=h.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,y){g=a.vertices[b];i=a.vertices[c];j=a.vertices[d];l=h[e];m=h[f];n=h[y];p=i.x-
|
|
|
-g.x;t=j.x-g.x;q=i.y-g.y;r=j.y-g.y;s=i.z-g.z;v=j.z-g.z;z=m.x-l.x;C=n.x-l.x;F=m.y-l.y;H=n.y-l.y;I=1/(z*H-C*F);B.set((H*p-F*t)*I,(H*q-F*r)*I,(H*s-F*v)*I);J.set((z*t-C*p)*I,(z*r-C*q)*I,(z*v-C*s)*I);A[b].add(B);A[c].add(B);A[d].add(B);K[b].add(J);K[c].add(J);K[d].add(J)}var b,c,d,e,f,h,g,i,j,l,m,n,p,t,q,r,s,v,z,C,F,H,I,G,A=[],K=[],B=new THREE.Vector3,J=new THREE.Vector3,N=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,K[b]=new THREE.Vector3;
|
|
|
+g.x;t=j.x-g.x;q=i.y-g.y;r=j.y-g.y;s=i.z-g.z;u=j.z-g.z;z=m.x-l.x;C=n.x-l.x;F=m.y-l.y;H=n.y-l.y;I=1/(z*H-C*F);B.set((H*p-F*t)*I,(H*q-F*r)*I,(H*s-F*u)*I);J.set((z*t-C*p)*I,(z*r-C*q)*I,(z*u-C*s)*I);A[b].add(B);A[c].add(B);A[d].add(B);K[b].add(J);K[c].add(J);K[d].add(J)}var b,c,d,e,f,h,g,i,j,l,m,n,p,t,q,r,s,u,z,C,F,H,I,G,A=[],K=[],B=new THREE.Vector3,J=new THREE.Vector3,N=new THREE.Vector3,y=new THREE.Vector3,M=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)A[b]=new THREE.Vector3,K[b]=new THREE.Vector3;
|
|
|
b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],h=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 w=["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++)M.copy(f.vertexNormals[d]),e=f[w[d]],G=A[e],N.copy(G),N.sub(M.multiplyScalar(M.dot(G))).normalize(),y.crossVectors(f.vertexNormals[d],G),e=y.dot(K[e]),e=0>e?-1:1,f.vertexTangents[d]=
|
|
|
new THREE.Vector4(N.x,N.y,N.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(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a=
|
|
|
{},b=[],c=[],d,e=Math.pow(10,4),f,h,g,i,j;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(h=this.faces.length;f<h;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];g=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(g[i]==g[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];
|
|
@@ -194,12 +194,12 @@ e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEv
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),
|
|
|
this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?
|
|
|
b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,h=a.length;f<h;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,
|
|
|
-b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,j,l,m,n=new THREE.Vector3,p=new THREE.Vector3,t=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3;if(this.attributes.index){var s=this.attributes.index.array,v=this.offsets;c=0;for(d=
|
|
|
-v.length;c<d;++c){b=v[c].start;h=v[c].count;var z=v[c].index;a=b;for(b+=h;a<b;a+=3)h=z+s[a],g=z+s[a+1],i=z+s[a+2],j=e[3*h],l=e[3*h+1],m=e[3*h+2],n.set(j,l,m),j=e[3*g],l=e[3*g+1],m=e[3*g+2],p.set(j,l,m),j=e[3*i],l=e[3*i+1],m=e[3*i+2],t.set(j,l,m),q.subVectors(t,p),r.subVectors(n,p),q.cross(r),f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*i]+=q.x,f[3*i+1]+=q.y,f[3*i+2]+=q.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],l=e[a+1],m=e[a+2],n.set(j,l,m),j=e[a+3],l=e[a+4],
|
|
|
+b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,j,l,m,n=new THREE.Vector3,p=new THREE.Vector3,t=new THREE.Vector3,q=new THREE.Vector3,r=new THREE.Vector3;if(this.attributes.index){var s=this.attributes.index.array,u=this.offsets;c=0;for(d=
|
|
|
+u.length;c<d;++c){b=u[c].start;h=u[c].count;var z=u[c].index;a=b;for(b+=h;a<b;a+=3)h=z+s[a],g=z+s[a+1],i=z+s[a+2],j=e[3*h],l=e[3*h+1],m=e[3*h+2],n.set(j,l,m),j=e[3*g],l=e[3*g+1],m=e[3*g+2],p.set(j,l,m),j=e[3*i],l=e[3*i+1],m=e[3*i+2],t.set(j,l,m),q.subVectors(t,p),r.subVectors(n,p),q.cross(r),f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*i]+=q.x,f[3*i+1]+=q.y,f[3*i+2]+=q.z}}else{a=0;for(b=e.length;a<b;a+=9)j=e[a],l=e[a+1],m=e[a+2],n.set(j,l,m),j=e[a+3],l=e[a+4],
|
|
|
m=e[a+5],p.set(j,l,m),j=e[a+6],l=e[a+7],m=e[a+8],t.set(j,l,m),q.subVectors(t,p),r.subVectors(n,p),q.cross(r),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.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){Pa.x=d[3*a];Pa.y=d[3*a+1];
|
|
|
Pa.z=d[3*a+2];Va.copy(Pa);qa=g[a];L.copy(qa);L.sub(Pa.multiplyScalar(Pa.dot(qa))).normalize();oa.crossVectors(Va,qa);Fa=oa.dot(i[a]);O=0>Fa?-1:1;h[4*a]=L.x;h[4*a+1]=L.y;h[4*a+2]=L.z;h[4*a+3]=O}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,
|
|
|
-d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],j=0;j<f;j++)g[j]=new THREE.Vector3,i[j]=new THREE.Vector3;var l,m,n,p,t,q,r,s,v,z,C,F,H,I,G,f=new THREE.Vector3,j=new THREE.Vector3,A,K,B,J,N,y,M,w=this.offsets;B=0;for(J=w.length;B<J;++B){K=w[B].start;N=w[B].count;var Z=w[B].index;A=K;for(K+=N;A<K;A+=3)N=Z+b[A],y=Z+b[A+1],M=Z+b[A+
|
|
|
-2],l=c[3*N],m=c[3*N+1],n=c[3*N+2],p=c[3*y],t=c[3*y+1],q=c[3*y+2],r=c[3*M],s=c[3*M+1],v=c[3*M+2],z=e[2*N],C=e[2*N+1],F=e[2*y],H=e[2*y+1],I=e[2*M],G=e[2*M+1],p-=l,l=r-l,t-=m,m=s-m,q-=n,n=v-n,F-=z,z=I-z,H-=C,C=G-C,G=1/(F*C-z*H),f.set((C*p-H*l)*G,(C*t-H*m)*G,(C*q-H*n)*G),j.set((F*l-z*p)*G,(F*m-z*t)*G,(F*n-z*q)*G),g[N].add(f),g[y].add(f),g[M].add(f),i[N].add(j),i[y].add(j),i[M].add(j)}var L=new THREE.Vector3,oa=new THREE.Vector3,Pa=new THREE.Vector3,Va=new THREE.Vector3,O,qa,Fa;B=0;for(J=w.length;B<J;++B){K=
|
|
|
+d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],j=0;j<f;j++)g[j]=new THREE.Vector3,i[j]=new THREE.Vector3;var l,m,n,p,t,q,r,s,u,z,C,F,H,I,G,f=new THREE.Vector3,j=new THREE.Vector3,A,K,B,J,N,y,M,w=this.offsets;B=0;for(J=w.length;B<J;++B){K=w[B].start;N=w[B].count;var Z=w[B].index;A=K;for(K+=N;A<K;A+=3)N=Z+b[A],y=Z+b[A+1],M=Z+b[A+
|
|
|
+2],l=c[3*N],m=c[3*N+1],n=c[3*N+2],p=c[3*y],t=c[3*y+1],q=c[3*y+2],r=c[3*M],s=c[3*M+1],u=c[3*M+2],z=e[2*N],C=e[2*N+1],F=e[2*y],H=e[2*y+1],I=e[2*M],G=e[2*M+1],p-=l,l=r-l,t-=m,m=s-m,q-=n,n=u-n,F-=z,z=I-z,H-=C,C=G-C,G=1/(F*C-z*H),f.set((C*p-H*l)*G,(C*t-H*m)*G,(C*q-H*n)*G),j.set((F*l-z*p)*G,(F*m-z*t)*G,(F*n-z*q)*G),g[N].add(f),g[y].add(f),g[M].add(f),i[N].add(j),i[y].add(j),i[M].add(j)}var L=new THREE.Vector3,oa=new THREE.Vector3,Pa=new THREE.Vector3,Va=new THREE.Vector3,O,qa,Fa;B=0;for(J=w.length;B<J;++B){K=
|
|
|
w[B].start;N=w[B].count;Z=w[B].index;A=K;for(K+=N;A<K;A+=3)N=Z+b[A],y=Z+b[A+1],M=Z+b[A+2],a(N),a(y),a(M)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=new THREE.Vector3(0,
|
|
@@ -208,8 +208,8 @@ THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLig
|
|
|
this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
|
|
|
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
|
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,j,r){var s=/\.dds$/i.test(f),v=b+"/"+f;if(s){var z=THREE.ImageUtils.loadCompressedTexture(v);a[e]=z}else z=document.createElement("canvas"),a[e]=new THREE.Texture(z);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);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]]));r&&(a[e].anisotropy=r);if(!s){var C=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);C.image.width=a;C.image.height=b;C.image.getContext("2d").drawImage(this,0,0,a,b)}else C.image=this;C.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,j,r){var s=/\.dds$/i.test(f),u=b+"/"+f;if(s){var z=THREE.ImageUtils.loadCompressedTexture(u);a[e]=z}else z=document.createElement("canvas"),a[e]=new THREE.Texture(z);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);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]]));r&&(a[e].anisotropy=r);if(!s){var C=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);C.image.width=a;C.image.height=b;C.image.getContext("2d").drawImage(this,0,0,a,b)}else C.image=this;C.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=u}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
|
|
|
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?g="MeshPhongMaterial":"basic"===j&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
|
|
|
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
|
|
|
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
|
|
@@ -219,8 +219,8 @@ THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){va
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a)},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
|
|
|
(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
|
|
|
-THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,j,l,m,n,p,t,q,r,s,v,z=a.faces;p=a.vertices;var C=a.normals,F=a.colors,H=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&H++;for(e=0;e<H;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[]}g=0;for(i=p.length;g<i;)j=new THREE.Vector3,j.x=p[g++]*d,j.y=p[g++]*d,j.z=p[g++]*d,c.vertices.push(j);g=0;for(i=z.length;g<i;){p=z[g++];j=p&1;h=p&2;e=p&4;f=p&8;m=p&16;l=p&32;t=p&64;p&=128;j?(q=
|
|
|
-new THREE.Face4,q.a=z[g++],q.b=z[g++],q.c=z[g++],q.d=z[g++],j=4):(q=new THREE.Face3,q.a=z[g++],q.b=z[g++],q.c=z[g++],j=3);h&&(h=z[g++],q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<H;e++)r=a.uvs[e],n=z[g++],v=r[2*n],n=r[2*n+1],c.faceUvs[e][h]=new THREE.Vector2(v,n);if(f)for(e=0;e<H;e++){r=a.uvs[e];s=[];for(f=0;f<j;f++)n=z[g++],v=r[2*n],n=r[2*n+1],s[f]=new THREE.Vector2(v,n);c.faceVertexUvs[e][h]=s}m&&(m=3*z[g++],f=new THREE.Vector3,f.x=C[m++],f.y=C[m++],f.z=C[m],q.normal=f);if(l)for(e=0;e<j;e++)m=
|
|
|
+THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,j,l,m,n,p,t,q,r,s,u,z=a.faces;p=a.vertices;var C=a.normals,F=a.colors,H=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&H++;for(e=0;e<H;e++)c.faceUvs[e]=[],c.faceVertexUvs[e]=[]}g=0;for(i=p.length;g<i;)j=new THREE.Vector3,j.x=p[g++]*d,j.y=p[g++]*d,j.z=p[g++]*d,c.vertices.push(j);g=0;for(i=z.length;g<i;){p=z[g++];j=p&1;h=p&2;e=p&4;f=p&8;m=p&16;l=p&32;t=p&64;p&=128;j?(q=
|
|
|
+new THREE.Face4,q.a=z[g++],q.b=z[g++],q.c=z[g++],q.d=z[g++],j=4):(q=new THREE.Face3,q.a=z[g++],q.b=z[g++],q.c=z[g++],j=3);h&&(h=z[g++],q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<H;e++)r=a.uvs[e],n=z[g++],u=r[2*n],n=r[2*n+1],c.faceUvs[e][h]=new THREE.Vector2(u,n);if(f)for(e=0;e<H;e++){r=a.uvs[e];s=[];for(f=0;f<j;f++)n=z[g++],u=r[2*n],n=r[2*n+1],s[f]=new THREE.Vector2(u,n);c.faceVertexUvs[e][h]=s}m&&(m=3*z[g++],f=new THREE.Vector3,f.x=C[m++],f.y=C[m++],f.z=C[m],q.normal=f);if(l)for(e=0;e<j;e++)m=
|
|
|
3*z[g++],f=new THREE.Vector3,f.x=C[m++],f.y=C[m++],f.z=C[m],q.vertexNormals.push(f);t&&(l=z[g++],l=new THREE.Color(F[l]),q.color=l);if(p)for(e=0;e<j;e++)l=z[g++],l=new THREE.Color(F[l]),q.vertexColors.push(l);c.faces.push(q)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)z=a.skinWeights[g],C=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(z,C,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<i;g+=2)z=a.skinIndices[g],C=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(z,
|
|
|
C,0,0))}c.bones=a.bones;c.animation=a.animation;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];F=c.morphTargets[g].vertices;H=a.morphTargets[g].vertices;z=0;for(C=H.length;z<C;z+=3)p=new THREE.Vector3,p.x=H[z]*d,p.y=H[z+1]*d,p.z=H[z+2]*d,F.push(p)}}if(void 0!==a.morphColors){g=0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=
|
|
|
[];C=c.morphColors[g].colors;F=a.morphColors[g].colors;d=0;for(z=F.length;d<z;d+=3)H=new THREE.Color(16755200),H.setRGB(F[d],F[d+1],F[d+2]),C.push(H)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
|
|
@@ -238,12 +238,12 @@ THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){va
|
|
|
B.objects)}function f(a,b){var c,e,h,i,j,l,n;for(n in b){var r=A.objects[n],s=b[n];if(void 0===r){if(s.type&&s.type in m.hierarchyHandlers){if(void 0===s.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};h={};for(var y in s)y in e||(h[y]=s[y]);t=A.materials[s.material];s.loading=!0;e=m.hierarchyHandlers[s.type].loaderObject;e.options?e.load(d(s.url,B.urlBaseType),g(n,a,t,s)):e.load(d(s.url,B.urlBaseType),g(n,
|
|
|
a,t,s),h)}}else if(void 0!==s.geometry){if(p=A.geometries[s.geometry]){r=!1;t=A.materials[s.material];r=t instanceof THREE.ShaderMaterial;h=s.position;i=s.rotation;j=s.scale;c=s.matrix;l=s.quaternion;s.material||(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)r=r||t.materials[e]instanceof THREE.ShaderMaterial;
|
|
|
r&&p.computeTangents();s.skin?r=new THREE.SkinnedMesh(p,t):s.morph?(r=new THREE.MorphAnimMesh(p,t),void 0!==s.duration&&(r.duration=s.duration),void 0!==s.time&&(r.time=s.time),void 0!==s.mirroredLoop&&(r.mirroredLoop=s.mirroredLoop),t.morphNormals&&p.computeMorphNormals()):r=new THREE.Mesh(p,t);r.name=n;c?(r.matrixAutoUpdate=!1,r.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(r.position.fromArray(h),l?r.quaternion.fromArray(l):r.rotation.fromArray(i),
|
|
|
-r.scale.fromArray(j));r.visible=s.visible;r.castShadow=s.castShadow;r.receiveShadow=s.receiveShadow;a.add(r);A.objects[n]=r}}else"DirectionalLight"===s.type||"PointLight"===s.type||"AmbientLight"===s.type?(z=void 0!==s.color?s.color:16777215,C=void 0!==s.intensity?s.intensity:1,"DirectionalLight"===s.type?(h=s.direction,v=new THREE.DirectionalLight(z,C),v.position.fromArray(h),s.target&&(K.push({object:v,targetName:s.target}),v.target=null)):"PointLight"===s.type?(h=s.position,e=s.distance,v=new THREE.PointLight(z,
|
|
|
-C,e),v.position.fromArray(h)):"AmbientLight"===s.type&&(v=new THREE.AmbientLight(z)),a.add(v),v.name=n,A.lights[n]=v,A.objects[n]=v):"PerspectiveCamera"===s.type||"OrthographicCamera"===s.type?(h=s.position,i=s.rotation,l=s.quaternion,"PerspectiveCamera"===s.type?q=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):"OrthographicCamera"===s.type&&(q=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),q.name=n,q.position.fromArray(h),void 0!==l?q.quaternion.fromArray(l):
|
|
|
+r.scale.fromArray(j));r.visible=s.visible;r.castShadow=s.castShadow;r.receiveShadow=s.receiveShadow;a.add(r);A.objects[n]=r}}else"DirectionalLight"===s.type||"PointLight"===s.type||"AmbientLight"===s.type?(z=void 0!==s.color?s.color:16777215,C=void 0!==s.intensity?s.intensity:1,"DirectionalLight"===s.type?(h=s.direction,u=new THREE.DirectionalLight(z,C),u.position.fromArray(h),s.target&&(K.push({object:u,targetName:s.target}),u.target=null)):"PointLight"===s.type?(h=s.position,e=s.distance,u=new THREE.PointLight(z,
|
|
|
+C,e),u.position.fromArray(h)):"AmbientLight"===s.type&&(u=new THREE.AmbientLight(z)),a.add(u),u.name=n,A.lights[n]=u,A.objects[n]=u):"PerspectiveCamera"===s.type||"OrthographicCamera"===s.type?(h=s.position,i=s.rotation,l=s.quaternion,"PerspectiveCamera"===s.type?q=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):"OrthographicCamera"===s.type&&(q=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),q.name=n,q.position.fromArray(h),void 0!==l?q.quaternion.fromArray(l):
|
|
|
void 0!==i&&q.rotation.fromArray(i),a.add(q),A.cameras[n]=q,A.objects[n]=q):(h=s.position,i=s.rotation,j=s.scale,l=s.quaternion,r=new THREE.Object3D,r.name=n,r.position.fromArray(h),l?r.quaternion.fromArray(l):r.rotation.fromArray(i),r.scale.fromArray(j),r.visible=void 0!==s.visible?s.visible:!1,a.add(r),A.objects[n]=r,A.empties[n]=r);if(r){if(void 0!==s.userData)for(var F in s.userData)r.userData[F]=s.userData[F];if(void 0!==s.groups)for(e=0;e<s.groups.length;e++)h=s.groups[e],void 0===A.groups[h]&&
|
|
|
(A.groups[h]=[]),A.groups[h].push(n)}}void 0!==r&&void 0!==s.children&&f(r,s.children)}}function h(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c;e();F-=1;m.onLoadComplete();j()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:
|
|
|
!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;A.objects[a]=f;e();F-=1;m.onLoadComplete();j()}}function i(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c}}function j(){m.callbackProgress({totalModels:I,totalTextures:G,loadedModels:I-F,loadedTextures:G-H},A);m.onLoadProgress();if(0===F&&0===H){for(var a=0;a<K.length;a++){var c=K[a],d=A.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,A.scene.add(c.object.target));c.object.target.userData.targetInverse=
|
|
|
-c.object}b(A)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),p,t,q,r,s,v,z,C,F,H,I,G,A,K=[],B=a,J;for(J in this.geometryHandlers)a=this.geometryHandlers[J].loaderClass,this.geometryHandlers[J].loaderObject=new a;for(J in this.hierarchyHandlers)a=this.hierarchyHandlers[J].loaderClass,this.hierarchyHandlers[J].loaderObject=new a;H=F=0;A={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
+c.object}b(A)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),p,t,q,r,s,u,z,C,F,H,I,G,A,K=[],B=a,J;for(J in this.geometryHandlers)a=this.geometryHandlers[J].loaderClass,this.geometryHandlers[J].loaderObject=new a;for(J in this.hierarchyHandlers)a=this.hierarchyHandlers[J].loaderClass,this.hierarchyHandlers[J].loaderObject=new a;H=F=0;A={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(B.transform&&(J=B.transform.position,a=B.transform.rotation,c=B.transform.scale,J&&A.scene.position.fromArray(J),a&&A.scene.rotation.fromArray(a),c&&A.scene.scale.fromArray(c),J||a||c))A.scene.updateMatrix(),A.scene.updateMatrixWorld();J=function(a){return function(){H-=a;j();m.onLoadComplete()}};for(var N in B.fogs)a=B.fogs[N],"linear"===a.type?r=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(r=new THREE.FogExp2(0,a.density)),a=a.color,
|
|
|
r.color.setRGB(a[0],a[1],a[2]),A.fogs[N]=r;for(var y in B.geometries)r=B.geometries[y],r.type in this.geometryHandlers&&(F+=1,m.onLoadStart());for(var M in B.objects)l(B.objects[M],function(a){a.type&&a.type in m.hierarchyHandlers&&(F+=1,m.onLoadStart())});I=F;for(y in B.geometries)if(r=B.geometries[y],"cube"===r.type)p=new THREE.CubeGeometry(r.width,r.height,r.depth,r.widthSegments,r.heightSegments,r.depthSegments),p.name=y,A.geometries[y]=p;else if("plane"===r.type)p=new THREE.PlaneGeometry(r.width,
|
|
|
r.height,r.widthSegments,r.heightSegments),p.name=y,A.geometries[y]=p;else if("sphere"===r.type)p=new THREE.SphereGeometry(r.radius,r.widthSegments,r.heightSegments),p.name=y,A.geometries[y]=p;else if("cylinder"===r.type)p=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),p.name=y,A.geometries[y]=p;else if("torus"===r.type)p=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),p.name=y,A.geometries[y]=p;else if("icosahedron"===r.type)p=new THREE.IcosahedronGeometry(r.radius,
|
|
@@ -299,17 +299,17 @@ THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===t
|
|
|
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
|
|
|
THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=I.length;d<e;d++){var f=I[d];Xb.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=Xa.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Xb.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=Xa.getPositionFromMatrix(f.matrixWorld),g=b.dot(Xa.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Xb.multiplyScalar(g)))))}}
|
|
|
function c(a,c,e,l,p,r,U,q){C.info.render.vertices+=3;C.info.render.faces++;m(q.opacity);n(q.blending);ya=a.positionScreen.x;Ha=a.positionScreen.y;fa=c.positionScreen.x;da=c.positionScreen.y;T=e.positionScreen.x;aa=e.positionScreen.y;d(ya,Ha,fa,da,T,aa);(q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial)&&null===q.map?(Qa.copy(q.color),Ya.copy(q.emissive),q.vertexColors===THREE.FaceColors&&Qa.multiply(U.color),!1===q.wireframe&&q.shading==THREE.SmoothShading&&3==U.vertexNormalsLength?
|
|
|
-(ra.copy(ib),ka.copy(ib),ua.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),b(U.v2.positionWorld,U.vertexNormalsModel[1],ka),b(U.v3.positionWorld,U.vertexNormalsModel[2],ua),ra.multiply(Qa).add(Ya),ka.multiply(Qa).add(Ya),ua.multiply(Qa).add(Ya),Ra.addColors(ka,ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):(ha.copy(ib),b(U.centroidModel,U.normalModel,ha),ha.multiply(Qa).add(Ya),!0===q.wireframe?f(ha,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):
|
|
|
+(ra.copy(ib),la.copy(ib),ua.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),b(U.v2.positionWorld,U.vertexNormalsModel[1],la),b(U.v3.positionWorld,U.vertexNormalsModel[2],ua),ra.multiply(Qa).add(Ya),la.multiply(Qa).add(Ya),ua.multiply(Qa).add(Ya),Ra.addColors(la,ua).multiplyScalar(0.5),lb=j(ra,la,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):(ha.copy(ib),b(U.centroidModel,U.normalModel,ha),ha.multiply(Qa).add(Ya),!0===q.wireframe?f(ha,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):
|
|
|
h(ha))):q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial?null!==q.map?q.map.mapping instanceof THREE.UVMapping&&(Ga=U.uvs[0],g(ya,Ha,fa,da,T,aa,Ga[l].x,Ga[l].y,Ga[p].x,Ga[p].y,Ga[r].x,Ga[r].y,q.map)):null!==q.envMap?q.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(Xa.copy(U.vertexNormalsModelView[l]),Ca=0.5*Xa.x+0.5,yb=0.5*Xa.y+0.5,Xa.copy(U.vertexNormalsModelView[p]),Ib=0.5*Xa.x+0.5,k=0.5*Xa.y+0.5,Xa.copy(U.vertexNormalsModelView[r]),
|
|
|
-Rb=0.5*Xa.x+0.5,Yb=0.5*Xa.y+0.5,g(ya,Ha,fa,da,T,aa,Ca,yb,Ib,k,Rb,Yb,q.envMap)):(ha.copy(q.color),q.vertexColors===THREE.FaceColors&&ha.multiply(U.color),!0===q.wireframe?f(ha,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):h(ha)):q instanceof THREE.MeshDepthMaterial?(Sa=D.near,xb=D.far,ra.r=ra.g=ra.b=1-z(a.positionScreen.z*a.positionScreen.w,Sa,xb),ka.r=ka.g=ka.b=1-z(c.positionScreen.z*c.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-z(e.positionScreen.z*e.positionScreen.w,Sa,xb),Ra.addColors(ka,
|
|
|
-ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):q instanceof THREE.MeshNormalMaterial&&(q.shading==THREE.FlatShading?(a=U.normalModelView,ha.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===q.wireframe?f(ha,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):h(ha)):q.shading==THREE.SmoothShading&&(a=U.vertexNormalsModelView[l],ra.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=U.vertexNormalsModelView[p],ka.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
-a=U.vertexNormalsModelView[r],ua.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),Ra.addColors(ka,ua).multiplyScalar(0.5),lb=j(ra,ka,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)))}function d(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function e(a,b,c,d,e,f,h,g){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(h,g);y.closePath()}function f(a,b,c,d){p(b);t(c);q(d);r(a.getStyle());y.stroke();va.expandByScalar(2*b)}function h(a){s(a.getStyle());
|
|
|
-y.fill()}function g(a,b,c,d,e,f,g,k,i,j,l,m,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Jb[n.id]=y.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Jb[n.id]?s("rgba(0,0,0,1)"):s(Jb[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y,
|
|
|
-g=(g+p)*r,k=(1-k+q)*t,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+p)*r-g,j=(1-j+q)*t-k,l=(l+p)*r-g,m=(1-m+q)*t-k,p=i*m-l*j;0===p?(void 0===Ab[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),Ab[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=Ab[n.id],g=4*(Math.floor(g)+Math.floor(k)*n.image.width),ha.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),h(ha)):(p=1/p,n=(m*c-j*e)*p,j=(m*d-j*f)*p,c=(i*e-l*c)*p,d=(i*f-l*d)*p,a=a-
|
|
|
-n*g-c*k,g=b-j*g-d*k,y.save(),y.transform(n,j,c,d,a,g),y.fill(),y.restore())}}function i(a,b,c,d,e,f,h,g,k,i,j,l,m){var n,p;n=m.width-1;p=m.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;k=k*n-h;i=i*p-g;j=j*n-h;l=l*p-g;p=1/(k*l-j*i);n=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(k*e-j*c)*p;d=(k*f-j*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;y.save();y.transform(n,i,c,d,a,b);y.clip();y.drawImage(m,0,0);y.restore()}function j(a,b,c,d){Ka[0]=255*a.r|0;Ka[1]=255*a.g|0;Ka[2]=255*a.b|0;Ka[4]=255*b.r|0;Ka[5]=255*b.g|0;Ka[6]=255*b.b|0;Ka[8]=255*
|
|
|
+Rb=0.5*Xa.x+0.5,Yb=0.5*Xa.y+0.5,g(ya,Ha,fa,da,T,aa,Ca,yb,Ib,k,Rb,Yb,q.envMap)):(ha.copy(q.color),q.vertexColors===THREE.FaceColors&&ha.multiply(U.color),!0===q.wireframe?f(ha,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):h(ha)):q instanceof THREE.MeshDepthMaterial?(Sa=D.near,xb=D.far,ra.r=ra.g=ra.b=1-z(a.positionScreen.z*a.positionScreen.w,Sa,xb),la.r=la.g=la.b=1-z(c.positionScreen.z*c.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-z(e.positionScreen.z*e.positionScreen.w,Sa,xb),Ra.addColors(la,
|
|
|
+ua).multiplyScalar(0.5),lb=j(ra,la,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)):q instanceof THREE.MeshNormalMaterial&&(q.shading==THREE.FlatShading?(a=U.normalModelView,ha.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),!0===q.wireframe?f(ha,q.wireframeLinewidth,q.wireframeLinecap,q.wireframeLinejoin):h(ha)):q.shading==THREE.SmoothShading&&(a=U.vertexNormalsModelView[l],ra.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),a=U.vertexNormalsModelView[p],la.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),
|
|
|
+a=U.vertexNormalsModelView[r],ua.setRGB(a.x,a.y,a.z).multiplyScalar(0.5).addScalar(0.5),Ra.addColors(la,ua).multiplyScalar(0.5),lb=j(ra,la,ua,Ra),i(ya,Ha,fa,da,T,aa,0,0,1,0,0,1,lb)))}function d(a,b,c,d,e,f){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.closePath()}function e(a,b,c,d,e,f,h,g){y.beginPath();y.moveTo(a,b);y.lineTo(c,d);y.lineTo(e,f);y.lineTo(h,g);y.closePath()}function f(a,b,c,d){p(b);t(c);q(d);r(a.getStyle());y.stroke();va.expandByScalar(2*b)}function h(a){s(a.getStyle());
|
|
|
+y.fill()}function g(a,b,c,d,e,f,g,k,i,j,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0==n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS==THREE.RepeatWrapping,q=n.wrapT==THREE.RepeatWrapping;Jb[n.id]=y.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Jb[n.id]?s("rgba(0,0,0,1)"):s(Jb[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,r=n.image.width*n.repeat.x,t=n.image.height*n.repeat.y,
|
|
|
+g=(g+p)*r,k=(1-k+q)*t,c=c-a,d=d-b,e=e-a,f=f-b,i=(i+p)*r-g,j=(1-j+q)*t-k,m=(m+p)*r-g,l=(1-l+q)*t-k,p=i*l-m*j;0===p?(void 0===Ab[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),Ab[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=Ab[n.id],g=4*(Math.floor(g)+Math.floor(k)*n.image.width),ha.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),h(ha)):(p=1/p,n=(l*c-j*e)*p,j=(l*d-j*f)*p,c=(i*e-m*c)*p,d=(i*f-m*d)*p,a=a-
|
|
|
+n*g-c*k,g=b-j*g-d*k,y.save(),y.transform(n,j,c,d,a,g),y.fill(),y.restore())}}function i(a,b,c,d,e,f,h,g,k,i,j,m,l){var n,p;n=l.width-1;p=l.height-1;h*=n;g*=p;c-=a;d-=b;e-=a;f-=b;k=k*n-h;i=i*p-g;j=j*n-h;m=m*p-g;p=1/(k*m-j*i);n=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(k*e-j*c)*p;d=(k*f-j*d)*p;a=a-n*h-c*g;b=b-i*h-d*g;y.save();y.transform(n,i,c,d,a,b);y.clip();y.drawImage(l,0,0);y.restore()}function j(a,b,c,d){Ka[0]=255*a.r|0;Ka[1]=255*a.g|0;Ka[2]=255*a.b|0;Ka[4]=255*b.r|0;Ka[5]=255*b.g|0;Ka[6]=255*b.b|0;Ka[8]=255*
|
|
|
c.r|0;Ka[9]=255*c.g|0;Ka[10]=255*c.b|0;Ka[12]=255*d.r|0;Ka[13]=255*d.g|0;Ka[14]=255*d.b|0;Bb.putImageData(Kb,0,0);Lb.drawImage(Gb,0,0);return Sb}function l(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function m(a){Z!==a&&(Z=y.globalAlpha=a)}function n(a){L!==a&&(a===THREE.NormalBlending?y.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?y.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(y.globalCompositeOperation=
|
|
|
-"darker"),L=a)}function p(a){Va!==a&&(Va=y.lineWidth=a)}function t(a){O!==a&&(O=y.lineCap=a)}function q(a){qa!==a&&(qa=y.lineJoin=a)}function r(a){oa!==a&&(oa=y.strokeStyle=a)}function s(a){Pa!==a&&(Pa=y.fillStyle=a)}function v(a,b){if(Fa!==a||wa!==b)y.setLineDash([a,b]),Fa=a,wa=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var z=THREE.Math.smoothstep,a=a||{},C=this,F,H,I,G=new THREE.Projector,A=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K,B,J,N,y=A.getContext("2d"),M=new THREE.Color(0),
|
|
|
-w=0,Z=1,L=0,oa=null,Pa=null,Va=null,O=null,qa=null,Fa=null,wa=0,D,V,ea,pa,Ua,pb=new THREE.RenderableVertex,ub=new THREE.RenderableVertex,ya,Ha,fa,da,T,aa,la,Y,ma,xa,bb,ia,ha=new THREE.Color,ra=new THREE.Color,ka=new THREE.Color,ua=new THREE.Color,Ra=new THREE.Color,Qa=new THREE.Color,Ya=new THREE.Color,Xb=new THREE.Color,Jb={},Ab={},Sa,xb,lb,Ga,Ca,yb,Ib,k,Rb,Yb,fb=new THREE.Box2,na=new THREE.Box2,va=new THREE.Box2,ib=new THREE.Color,Tb=new THREE.Color,Ub=new THREE.Color,Xa=new THREE.Vector3,Gb,Bb,
|
|
|
+"darker"),L=a)}function p(a){Va!==a&&(Va=y.lineWidth=a)}function t(a){O!==a&&(O=y.lineCap=a)}function q(a){qa!==a&&(qa=y.lineJoin=a)}function r(a){oa!==a&&(oa=y.strokeStyle=a)}function s(a){Pa!==a&&(Pa=y.fillStyle=a)}function u(a,b){if(Fa!==a||wa!==b)y.setLineDash([a,b]),Fa=a,wa=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var z=THREE.Math.smoothstep,a=a||{},C=this,F,H,I,G=new THREE.Projector,A=void 0!==a.canvas?a.canvas:document.createElement("canvas"),K,B,J,N,y=A.getContext("2d"),M=new THREE.Color(0),
|
|
|
+w=0,Z=1,L=0,oa=null,Pa=null,Va=null,O=null,qa=null,Fa=null,wa=0,D,V,ea,pa,Ua,pb=new THREE.RenderableVertex,ub=new THREE.RenderableVertex,ya,Ha,fa,da,T,aa,ma,ka,X,xa,bb,ia,ha=new THREE.Color,ra=new THREE.Color,la=new THREE.Color,ua=new THREE.Color,Ra=new THREE.Color,Qa=new THREE.Color,Ya=new THREE.Color,Xb=new THREE.Color,Jb={},Ab={},Sa,xb,lb,Ga,Ca,yb,Ib,k,Rb,Yb,fb=new THREE.Box2,na=new THREE.Box2,va=new THREE.Box2,ib=new THREE.Color,Tb=new THREE.Color,Ub=new THREE.Color,Xa=new THREE.Vector3,Gb,Bb,
|
|
|
Kb,Ka,Sb,Lb,Hb=16;Gb=document.createElement("canvas");Gb.width=Gb.height=2;Bb=Gb.getContext("2d");Bb.fillStyle="rgba(0,0,0,1)";Bb.fillRect(0,0,2,2);Kb=Bb.getImageData(0,0,2,2);Ka=Kb.data;Sb=document.createElement("canvas");Sb.width=Sb.height=Hb;Lb=Sb.getContext("2d");Lb.translate(-Hb/2,-Hb/2);Lb.scale(Hb,Hb);Hb--;void 0===y.setLineDash&&(y.setLineDash=void 0!==y.mozDash?function(a){y.mozDash=null!==a[0]?a:null}:function(){});this.domElement=A;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:
|
|
|
void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){K=a*this.devicePixelRatio;B=b*this.devicePixelRatio;J=Math.floor(K/2);N=Math.floor(B/2);A.width=K;A.height=B;1!==this.devicePixelRatio&&!1!==c&&(A.style.width=a+"px",A.style.height=b+"px");fb.set(new THREE.Vector2(-J,-N),new THREE.Vector2(J,N));na.set(new THREE.Vector2(-J,
|
|
|
-N),new THREE.Vector2(J,N));Z=1;L=0;qa=O=Va=Pa=oa=null};this.setClearColor=function(a,b){M.set(a);w=void 0!==b?b:1;na.set(new THREE.Vector2(-J,-N),new THREE.Vector2(J,N))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){y.setTransform(1,0,0,-1,J,N);!1===na.empty()&&(na.intersect(fb),na.expandByScalar(2),1>w&&y.clearRect(na.min.x|
|
|
@@ -319,15 +319,15 @@ N;B=V;m(w.opacity);n(w.blending);var mb=void 0,nb=void 0,vb=void 0,zb=void 0,Zb=
|
|
|
1,vb=U.scale.x*J,zb=U.scale.y*N,mb=vb*Jc,nb=zb*Kc,va.min.set(B.x-mb,B.y-nb),va.max.set(B.x+mb,B.y+nb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(y.save(),y.translate(B.x,B.y),y.rotate(-U.rotation),y.scale(vb,-zb),y.translate(-Jc,-Kc),y.drawImage(Zb,0,0),y.restore())):w instanceof THREE.ParticleCanvasMaterial&&(mb=U.scale.x*J,nb=U.scale.y*N,va.min.set(B.x-mb,B.y-nb),va.max.set(B.x+mb,B.y+nb),!1===fb.isIntersectionBox(va)?va.makeEmpty():(r(w.color.getStyle()),s(w.color.getStyle()),y.save(),y.translate(B.x,
|
|
|
B.y),y.rotate(-U.rotation),y.scale(mb,nb),w.program(y),y.restore()))}else if(U instanceof THREE.RenderableLine){if(V=U.v1,ea=U.v2,V.positionScreen.x*=J,V.positionScreen.y*=N,ea.positionScreen.x*=J,ea.positionScreen.y*=N,va.setFromPoints([V.positionScreen,ea.positionScreen]),!0===fb.isIntersectionBox(va))if(B=V,mb=ea,m(w.opacity),n(w.blending),y.beginPath(),y.moveTo(B.positionScreen.x,B.positionScreen.y),y.lineTo(mb.positionScreen.x,mb.positionScreen.y),w instanceof THREE.LineBasicMaterial){p(w.linewidth);
|
|
|
t(w.linecap);q(w.linejoin);if(w.vertexColors!==THREE.VertexColors)r(w.color.getStyle());else if(nb=U.vertexColors[0].getStyle(),U=U.vertexColors[1].getStyle(),nb===U)r(nb);else{try{var wc=y.createLinearGradient(B.positionScreen.x,B.positionScreen.y,mb.positionScreen.x,mb.positionScreen.y);wc.addColorStop(0,nb);wc.addColorStop(1,U)}catch(fd){wc=nb}r(wc)}y.stroke();va.expandByScalar(2*w.linewidth)}else w instanceof THREE.LineDashedMaterial&&(p(w.linewidth),t(w.linecap),q(w.linejoin),r(w.color.getStyle()),
|
|
|
-v(w.dashSize,w.gapSize),y.stroke(),va.expandByScalar(2*w.linewidth),v(null,null))}else if(U instanceof THREE.RenderableFace3){V=U.v1;ea=U.v2;pa=U.v3;if(-1>V.positionScreen.z||1<V.positionScreen.z)continue;if(-1>ea.positionScreen.z||1<ea.positionScreen.z)continue;if(-1>pa.positionScreen.z||1<pa.positionScreen.z)continue;V.positionScreen.x*=J;V.positionScreen.y*=N;ea.positionScreen.x*=J;ea.positionScreen.y*=N;pa.positionScreen.x*=J;pa.positionScreen.y*=N;0<w.overdraw&&(l(V.positionScreen,ea.positionScreen,
|
|
|
+u(w.dashSize,w.gapSize),y.stroke(),va.expandByScalar(2*w.linewidth),u(null,null))}else if(U instanceof THREE.RenderableFace3){V=U.v1;ea=U.v2;pa=U.v3;if(-1>V.positionScreen.z||1<V.positionScreen.z)continue;if(-1>ea.positionScreen.z||1<ea.positionScreen.z)continue;if(-1>pa.positionScreen.z||1<pa.positionScreen.z)continue;V.positionScreen.x*=J;V.positionScreen.y*=N;ea.positionScreen.x*=J;ea.positionScreen.y*=N;pa.positionScreen.x*=J;pa.positionScreen.y*=N;0<w.overdraw&&(l(V.positionScreen,ea.positionScreen,
|
|
|
w.overdraw),l(ea.positionScreen,pa.positionScreen,w.overdraw),l(pa.positionScreen,V.positionScreen,w.overdraw));va.setFromPoints([V.positionScreen,ea.positionScreen,pa.positionScreen]);!0===fb.isIntersectionBox(va)&&c(V,ea,pa,0,1,2,U,w)}else if(U instanceof THREE.RenderableFace4){V=U.v1;ea=U.v2;pa=U.v3;Ua=U.v4;if(-1>V.positionScreen.z||1<V.positionScreen.z)continue;if(-1>ea.positionScreen.z||1<ea.positionScreen.z)continue;if(-1>pa.positionScreen.z||1<pa.positionScreen.z)continue;if(-1>Ua.positionScreen.z||
|
|
|
1<Ua.positionScreen.z)continue;V.positionScreen.x*=J;V.positionScreen.y*=N;ea.positionScreen.x*=J;ea.positionScreen.y*=N;pa.positionScreen.x*=J;pa.positionScreen.y*=N;Ua.positionScreen.x*=J;Ua.positionScreen.y*=N;pb.positionScreen.copy(ea.positionScreen);ub.positionScreen.copy(Ua.positionScreen);0<w.overdraw&&(l(V.positionScreen,ea.positionScreen,w.overdraw),l(ea.positionScreen,Ua.positionScreen,w.overdraw),l(Ua.positionScreen,V.positionScreen,w.overdraw),l(pa.positionScreen,pb.positionScreen,w.overdraw),
|
|
|
l(pa.positionScreen,ub.positionScreen,w.overdraw));va.setFromPoints([V.positionScreen,ea.positionScreen,pa.positionScreen,Ua.positionScreen]);!0===fb.isIntersectionBox(va)&&(B=V,mb=ea,nb=pa,vb=Ua,zb=pb,Zb=ub,C.info.render.vertices+=4,C.info.render.faces++,m(w.opacity),n(w.blending),void 0!==w.map&&null!==w.map||void 0!==w.envMap&&null!==w.envMap?(c(B,mb,vb,0,1,3,U,w),c(zb,nb,Zb,1,2,3,U,w)):(ya=B.positionScreen.x,Ha=B.positionScreen.y,fa=mb.positionScreen.x,da=mb.positionScreen.y,T=nb.positionScreen.x,
|
|
|
-aa=nb.positionScreen.y,la=vb.positionScreen.x,Y=vb.positionScreen.y,ma=zb.positionScreen.x,xa=zb.positionScreen.y,bb=Zb.positionScreen.x,ia=Zb.positionScreen.y,w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial?(Qa.copy(w.color),Ya.copy(w.emissive),w.vertexColors===THREE.FaceColors&&Qa.multiply(U.color),!1===w.wireframe&&w.shading==THREE.SmoothShading&&4==U.vertexNormalsLength?(ra.copy(ib),ka.copy(ib),ua.copy(ib),Ra.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),
|
|
|
-b(U.v2.positionWorld,U.vertexNormalsModel[1],ka),b(U.v4.positionWorld,U.vertexNormalsModel[3],ua),b(U.v3.positionWorld,U.vertexNormalsModel[2],Ra),ra.multiply(Qa).add(Ya),ka.multiply(Qa).add(Ya),ua.multiply(Qa).add(Ya),Ra.multiply(Qa).add(Ya),lb=j(ra,ka,ua,Ra),d(ya,Ha,fa,da,la,Y),i(ya,Ha,fa,da,la,Y,0,0,1,0,0,1,lb),d(ma,xa,T,aa,bb,ia),i(ma,xa,T,aa,bb,ia,1,0,1,1,0,1,lb)):(ha.copy(ib),b(U.centroidModel,U.normalModel,ha),ha.multiply(Qa).add(Ya),e(ya,Ha,fa,da,T,aa,la,Y),!0===w.wireframe?f(ha,w.wireframeLinewidth,
|
|
|
-w.wireframeLinecap,w.wireframeLinejoin):h(ha))):w instanceof THREE.MeshBasicMaterial?(ha.copy(w.color),w.vertexColors===THREE.FaceColors&&ha.multiply(U.color),e(ya,Ha,fa,da,T,aa,la,Y),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):h(ha)):w instanceof THREE.MeshNormalMaterial?(B=void 0,w.shading==THREE.FlatShading?(B=U.normalModelView,ha.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),e(ya,Ha,fa,da,T,aa,la,Y),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,
|
|
|
-w.wireframeLinejoin):h(ha)):w.shading==THREE.SmoothShading&&(B=U.vertexNormalsModelView[0],ra.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=U.vertexNormalsModelView[1],ka.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=U.vertexNormalsModelView[3],ua.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=U.vertexNormalsModelView[2],Ra.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),lb=j(ra,ka,ua,Ra),d(ya,Ha,fa,da,la,Y),i(ya,Ha,fa,da,la,Y,0,0,1,0,0,1,lb),d(ma,xa,T,aa,bb,
|
|
|
-ia),i(ma,xa,T,aa,bb,ia,1,0,1,1,0,1,lb))):w instanceof THREE.MeshDepthMaterial&&(Sa=D.near,xb=D.far,ra.r=ra.g=ra.b=1-z(B.positionScreen.z*B.positionScreen.w,Sa,xb),ka.r=ka.g=ka.b=1-z(mb.positionScreen.z*mb.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-z(vb.positionScreen.z*vb.positionScreen.w,Sa,xb),Ra.r=Ra.g=Ra.b=1-z(nb.positionScreen.z*nb.positionScreen.w,Sa,xb),lb=j(ra,ka,ua,Ra),d(ya,Ha,fa,da,la,Y),i(ya,Ha,fa,da,la,Y,0,0,1,0,0,1,lb),d(ma,xa,T,aa,bb,ia),i(ma,xa,T,aa,bb,ia,1,0,1,1,0,1,lb))))}na.union(va)}}y.setTransform(1,
|
|
|
+aa=nb.positionScreen.y,ma=vb.positionScreen.x,ka=vb.positionScreen.y,X=zb.positionScreen.x,xa=zb.positionScreen.y,bb=Zb.positionScreen.x,ia=Zb.positionScreen.y,w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial?(Qa.copy(w.color),Ya.copy(w.emissive),w.vertexColors===THREE.FaceColors&&Qa.multiply(U.color),!1===w.wireframe&&w.shading==THREE.SmoothShading&&4==U.vertexNormalsLength?(ra.copy(ib),la.copy(ib),ua.copy(ib),Ra.copy(ib),b(U.v1.positionWorld,U.vertexNormalsModel[0],ra),
|
|
|
+b(U.v2.positionWorld,U.vertexNormalsModel[1],la),b(U.v4.positionWorld,U.vertexNormalsModel[3],ua),b(U.v3.positionWorld,U.vertexNormalsModel[2],Ra),ra.multiply(Qa).add(Ya),la.multiply(Qa).add(Ya),ua.multiply(Qa).add(Ya),Ra.multiply(Qa).add(Ya),lb=j(ra,la,ua,Ra),d(ya,Ha,fa,da,ma,ka),i(ya,Ha,fa,da,ma,ka,0,0,1,0,0,1,lb),d(X,xa,T,aa,bb,ia),i(X,xa,T,aa,bb,ia,1,0,1,1,0,1,lb)):(ha.copy(ib),b(U.centroidModel,U.normalModel,ha),ha.multiply(Qa).add(Ya),e(ya,Ha,fa,da,T,aa,ma,ka),!0===w.wireframe?f(ha,w.wireframeLinewidth,
|
|
|
+w.wireframeLinecap,w.wireframeLinejoin):h(ha))):w instanceof THREE.MeshBasicMaterial?(ha.copy(w.color),w.vertexColors===THREE.FaceColors&&ha.multiply(U.color),e(ya,Ha,fa,da,T,aa,ma,ka),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):h(ha)):w instanceof THREE.MeshNormalMaterial?(B=void 0,w.shading==THREE.FlatShading?(B=U.normalModelView,ha.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),e(ya,Ha,fa,da,T,aa,ma,ka),!0===w.wireframe?f(ha,w.wireframeLinewidth,w.wireframeLinecap,
|
|
|
+w.wireframeLinejoin):h(ha)):w.shading==THREE.SmoothShading&&(B=U.vertexNormalsModelView[0],ra.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=U.vertexNormalsModelView[1],la.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=U.vertexNormalsModelView[3],ua.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=U.vertexNormalsModelView[2],Ra.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),lb=j(ra,la,ua,Ra),d(ya,Ha,fa,da,ma,ka),i(ya,Ha,fa,da,ma,ka,0,0,1,0,0,1,lb),d(X,xa,T,aa,bb,
|
|
|
+ia),i(X,xa,T,aa,bb,ia,1,0,1,1,0,1,lb))):w instanceof THREE.MeshDepthMaterial&&(Sa=D.near,xb=D.far,ra.r=ra.g=ra.b=1-z(B.positionScreen.z*B.positionScreen.w,Sa,xb),la.r=la.g=la.b=1-z(mb.positionScreen.z*mb.positionScreen.w,Sa,xb),ua.r=ua.g=ua.b=1-z(vb.positionScreen.z*vb.positionScreen.w,Sa,xb),Ra.r=Ra.g=Ra.b=1-z(nb.positionScreen.z*nb.positionScreen.w,Sa,xb),lb=j(ra,la,ua,Ra),d(ya,Ha,fa,da,ma,ka),i(ya,Ha,fa,da,ma,ka,0,0,1,0,0,1,lb),d(X,xa,T,aa,bb,ia),i(X,xa,T,aa,bb,ia,1,0,1,1,0,1,lb))))}na.union(va)}}y.setTransform(1,
|
|
|
0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
@@ -379,43 +379,43 @@ THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
|
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
|
|
|
depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a){if(a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)k.deleteBuffer(a.__webglCustomAttributesList[b].buffer)}function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?
|
|
|
-h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,g=a.faces4,i=3*d.length+4*g.length,j=1*d.length+2*g.length,g=3*d.length+4*g.length,d=e(b,a),l=h(d),m=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);m&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&
|
|
|
-(a.__colorArray=new Float32Array(3*i));if(l){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*j);a.__lineArray=new Uint16Array(2*g);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(l=a.numMorphTargets;c<
|
|
|
-l;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(l=a.numMorphNormals;c<l;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*j;a.__webglLineCount=2*g;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var j=d.attributes[p],c={},q;for(q in j)c[q]=j[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,g=1,"v2"===c.type?g=2:
|
|
|
+h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=k.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}function d(a,b){var c=b.geometry,d=a.faces3,g=a.faces4,i=3*d.length+4*g.length,j=1*d.length+2*g.length,g=3*d.length+4*g.length,d=e(b,a),m=h(d),l=f(d),n=d.vertexColors?d.vertexColors:!1;a.__vertexArray=new Float32Array(3*i);l&&(a.__normalArray=new Float32Array(3*i));c.hasTangents&&(a.__tangentArray=new Float32Array(4*i));n&&
|
|
|
+(a.__colorArray=new Float32Array(3*i));if(m){if(0<c.faceUvs.length||0<c.faceVertexUvs.length)a.__uvArray=new Float32Array(2*i);if(1<c.faceUvs.length||1<c.faceVertexUvs.length)a.__uv2Array=new Float32Array(2*i)}b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&(a.__skinIndexArray=new Float32Array(4*i),a.__skinWeightArray=new Float32Array(4*i));a.__faceArray=new Uint16Array(3*j);a.__lineArray=new Uint16Array(2*g);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<
|
|
|
+m;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*i))}a.__webglFaceCount=3*j;a.__webglLineCount=2*g;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var p in d.attributes){var j=d.attributes[p],c={},q;for(q in j)c[q]=j[q];if(!c.__webglInitialized||c.createUniqueBuffers)c.__webglInitialized=!0,g=1,"v2"===c.type?g=2:
|
|
|
"v3"===c.type?g=3:"v4"===c.type?g=4:"c"===c.type&&(g=3),c.size=g,c.array=new Float32Array(i*g),c.buffer=k.createBuffer(),c.buffer.belongsToAttribute=p,j.needsUpdate=!0,c.__original=j;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
|
|
|
THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function h(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a){Ab[a]||(k.enableVertexAttribArray(a),Ab[a]=!0)}function i(){for(var a in Ab)Ab[a]&&(k.disableVertexAttribArray(a),Ab[a]=!1)}function j(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function l(a,b){return b[0]-a[0]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ya=pa=null,pb=ub=T=da=bb=xa=aa=-1,yb=!0,a[d].render(b,
|
|
|
-c,Xb,Jb),ya=pa=null,pb=ub=T=da=bb=xa=aa=-1,yb=!0}function n(a,b,c,d,e,f,h,g){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(g)k=g;else{k=k[c];if(!k)continue;h&&D.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);D.setDepthTest(k.depthTest);D.setDepthWrite(k.depthWrite);K(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}D.setMaterialFaces(k);j instanceof THREE.BufferGeometry?D.renderBufferDirect(d,
|
|
|
+c,Xb,Jb),ya=pa=null,pb=ub=T=da=bb=xa=aa=-1,yb=!0}function n(a,b,c,d,e,f,h,g){var k,i,j,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(k=a[l],k.render){i=k.object;j=k.buffer;if(g)k=g;else{k=k[c];if(!k)continue;h&&D.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst);D.setDepthTest(k.depthTest);D.setDepthWrite(k.depthWrite);K(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}D.setMaterialFaces(k);j instanceof THREE.BufferGeometry?D.renderBufferDirect(d,
|
|
|
e,f,k,j,i):D.renderBuffer(d,e,f,k,j,i)}}function p(a,b,c,d,e,f,h){for(var g,k,i=0,j=a.length;i<j;i++)if(g=a[i],k=g.object,k.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&D.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);D.setDepthTest(g.depthTest);D.setDepthWrite(g.depthWrite);K(g.polygonOffset,g.polygonOffsetFactor,g.polygonOffsetUnits)}D.renderImmediateObject(c,d,e,g,k)}}function t(a,b){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,
|
|
|
a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",lc)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,j;for(i in f.attributes)j="index"===i?k.ELEMENT_ARRAY_BUFFER:k.ARRAY_BUFFER,g=f.attributes[i],void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=k.createBuffer(),k.bindBuffer(j,g.buffer),k.bufferData(j,g.array,k.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;
|
|
|
-if(void 0===f.geometryGroups){i=f;var l,m,n,p,r;j={};var s=i.morphTargets.length,t=i.morphNormals.length,v=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(l=i.faces.length;h<l;h++)m=i.faces[h],n=v?m.materialIndex:0,void 0===j[n]&&(j[n]={hash:n,counter:0}),r=j[n].hash+"_"+j[n].counter,void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:n,vertices:0,numMorphTargets:s,numMorphNormals:t}),p=m instanceof THREE.Face3?3:4,65535<i.geometryGroups[r].vertices+
|
|
|
-p&&(j[n].counter+=1,r=j[n].hash+"_"+j[n].counter,void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:n,vertices:0,numMorphTargets:s,numMorphNormals:t})),m instanceof THREE.Face3?i.geometryGroups[r].faces3.push(h):i.geometryGroups[r].faces4.push(h),i.geometryGroups[r].vertices+=p;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=Ha++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=
|
|
|
+if(void 0===f.geometryGroups){i=f;var m,l,n,p,r;j={};var s=i.morphTargets.length,t=i.morphNormals.length,u=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],n=u?l.materialIndex:0,void 0===j[n]&&(j[n]={hash:n,counter:0}),r=j[n].hash+"_"+j[n].counter,void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:n,vertices:0,numMorphTargets:s,numMorphNormals:t}),p=l instanceof THREE.Face3?3:4,65535<i.geometryGroups[r].vertices+
|
|
|
+p&&(j[n].counter+=1,r=j[n].hash+"_"+j[n].counter,void 0===i.geometryGroups[r]&&(i.geometryGroups[r]={faces3:[],faces4:[],materialIndex:n,vertices:0,numMorphTargets:s,numMorphNormals:t})),l instanceof THREE.Face3?i.geometryGroups[r].faces3.push(h):i.geometryGroups[r].faces4.push(h),i.geometryGroups[r].vertices+=p;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=Ha++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=f.geometryGroups[e],!g.__webglVertexBuffer){i=
|
|
|
g;i.__webglVertexBuffer=k.createBuffer();i.__webglNormalBuffer=k.createBuffer();i.__webglTangentBuffer=k.createBuffer();i.__webglColorBuffer=k.createBuffer();i.__webglUVBuffer=k.createBuffer();i.__webglUV2Buffer=k.createBuffer();i.__webglSkinIndicesBuffer=k.createBuffer();i.__webglSkinWeightsBuffer=k.createBuffer();i.__webglFaceBuffer=k.createBuffer();i.__webglLineBuffer=k.createBuffer();s=j=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];j=0;for(s=i.numMorphTargets;j<s;j++)i.__webglMorphTargetsBuffers.push(k.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=
|
|
|
[];j=0;for(s=i.numMorphNormals;j<s;j++)i.__webglMorphNormalsBuffers.push(k.createBuffer())}D.info.memory.geometries++;d(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Ribbon?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=k.createBuffer(),g.__webglColorBuffer=k.createBuffer(),g.__webglNormalBuffer=k.createBuffer(),D.info.memory.geometries++,g=f,i=g.vertices.length,
|
|
|
g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__normalArray=new Float32Array(3*i),g.__webglVertexCount=i,c(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.normalsNeedUpdate=!0):a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=k.createBuffer(),g.__webglColorBuffer=k.createBuffer(),g.__webglLineDistanceBuffer=k.createBuffer(),D.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*
|
|
|
i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,c(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=k.createBuffer(),g.__webglColorBuffer=k.createBuffer(),D.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,c(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=
|
|
|
!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)q(b.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],q(b.__webglObjects,g,a)}else a instanceof THREE.Ribbon||a instanceof THREE.Line||a instanceof THREE.ParticleSystem?(f=a.geometry,q(b.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?b.__webglObjectsImmediate.push({id:null,object:a,opaque:null,
|
|
|
-transparent:null,z:0}):a instanceof THREE.Sprite?b.__webglSprites.push(a):a instanceof THREE.LensFlare&&b.__webglFlares.push(a);a.__webglActive=!0}}function q(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof
|
|
|
+transparent:null,z:0}):a instanceof THREE.Sprite?b.__webglSprites.push(a):a instanceof THREE.LensFlare&&b.__webglFlares.push(a);a.__webglActive=!0}}function q(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Ribbon||a instanceof
|
|
|
THREE.Line?z(b.__webglObjects,a):a instanceof THREE.Sprite?C(b.__webglSprites,a):a instanceof THREE.LensFlare?C(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&z(b.__webglObjectsImmediate,a);delete a.__webglActive}function z(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function C(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function F(a,b,c,d,e){fa=0;d.needsUpdate&&(d.program&&vc(d),D.initMaterial(d,b,c,e),d.needsUpdate=
|
|
|
!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(D.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==pa&&(k.useProgram(g),pa=g,f=!0);d.id!==pb&&(pb=d.id,f=!0);if(f||a!==ya)k.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ya&&(ya=a);if(d.skinning)if(Bb&&e.useVertexTexture){if(null!==h.boneTexture){var j=H();k.uniform1i(h.boneTexture,j);D.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(yb){for(var l,m=j=0,n=0,p,q,r,s=Ib,t=s.directional.colors,v=s.directional.positions,z=s.point.colors,y=s.point.positions,A=s.point.distances,B=s.spot.colors,F=s.spot.positions,C=s.spot.distances,E=s.spot.directions,J=
|
|
|
-s.spot.anglesCos,L=s.spot.exponents,V=s.hemi.skyColors,K=s.hemi.groundColors,M=s.hemi.positions,O=0,ea=0,T=0,aa=0,da=0,R=0,S=0,P=0,ba=l=0,c=r=ba=0,f=b.length;c<f;c++)l=b[c],l.onlyShadow||(p=l.color,q=l.intensity,r=l.distance,l instanceof THREE.AmbientLight?l.visible&&(D.gammaInput?(j+=p.r*p.r,m+=p.g*p.g,n+=p.b*p.b):(j+=p.r,m+=p.g,n+=p.b)):l instanceof THREE.DirectionalLight?(da+=1,l.visible&&(Ca.getPositionFromMatrix(l.matrixWorld),Ga.getPositionFromMatrix(l.target.matrixWorld),Ca.sub(Ga),Ca.normalize(),
|
|
|
-0===Ca.x&&0===Ca.y&&0===Ca.z||(l=3*O,v[l]=Ca.x,v[l+1]=Ca.y,v[l+2]=Ca.z,D.gammaInput?I(t,l,p,q*q):G(t,l,p,q),O+=1))):l instanceof THREE.PointLight?(R+=1,l.visible&&(ba=3*ea,D.gammaInput?I(z,ba,p,q*q):G(z,ba,p,q),Ga.getPositionFromMatrix(l.matrixWorld),y[ba]=Ga.x,y[ba+1]=Ga.y,y[ba+2]=Ga.z,A[ea]=r,ea+=1)):l instanceof THREE.SpotLight?(S+=1,l.visible&&(ba=3*T,D.gammaInput?I(B,ba,p,q*q):G(B,ba,p,q),Ga.getPositionFromMatrix(l.matrixWorld),F[ba]=Ga.x,F[ba+1]=Ga.y,F[ba+2]=Ga.z,C[T]=r,Ca.copy(Ga),Ga.getPositionFromMatrix(l.target.matrixWorld),
|
|
|
-Ca.sub(Ga),Ca.normalize(),E[ba]=Ca.x,E[ba+1]=Ca.y,E[ba+2]=Ca.z,J[T]=Math.cos(l.angle),L[T]=l.exponent,T+=1)):l instanceof THREE.HemisphereLight&&(P+=1,l.visible&&(Ca.getPositionFromMatrix(l.matrixWorld),Ca.normalize(),0===Ca.x&&0===Ca.y&&0===Ca.z||(r=3*aa,M[r]=Ca.x,M[r+1]=Ca.y,M[r+2]=Ca.z,p=l.color,l=l.groundColor,D.gammaInput?(q*=q,I(V,r,p,q),I(K,r,l,q)):(G(V,r,p,q),G(K,r,l,q)),aa+=1))));c=3*O;for(f=Math.max(t.length,3*da);c<f;c++)t[c]=0;c=3*ea;for(f=Math.max(z.length,3*R);c<f;c++)z[c]=0;c=3*T;for(f=
|
|
|
-Math.max(B.length,3*S);c<f;c++)B[c]=0;c=3*aa;for(f=Math.max(V.length,3*P);c<f;c++)V[c]=0;c=3*aa;for(f=Math.max(K.length,3*P);c<f;c++)K[c]=0;s.directional.length=O;s.point.length=ea;s.spot.length=T;s.hemi.length=aa;s.ambient[0]=j;s.ambient[1]=m;s.ambient[2]=n;yb=!1}c=Ib;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=
|
|
|
+!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(yb){for(var m,l=j=0,n=0,p,q,r,s=Ib,t=s.directional.colors,u=s.directional.positions,z=s.point.colors,y=s.point.positions,A=s.point.distances,B=s.spot.colors,F=s.spot.positions,C=s.spot.distances,E=s.spot.directions,J=
|
|
|
+s.spot.anglesCos,L=s.spot.exponents,V=s.hemi.skyColors,K=s.hemi.groundColors,M=s.hemi.positions,O=0,ea=0,T=0,aa=0,da=0,R=0,S=0,P=0,ba=m=0,c=r=ba=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,r=m.distance,m instanceof THREE.AmbientLight?m.visible&&(D.gammaInput?(j+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(j+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(da+=1,m.visible&&(Ca.getPositionFromMatrix(m.matrixWorld),Ga.getPositionFromMatrix(m.target.matrixWorld),Ca.sub(Ga),Ca.normalize(),
|
|
|
+0===Ca.x&&0===Ca.y&&0===Ca.z||(m=3*O,u[m]=Ca.x,u[m+1]=Ca.y,u[m+2]=Ca.z,D.gammaInput?I(t,m,p,q*q):G(t,m,p,q),O+=1))):m instanceof THREE.PointLight?(R+=1,m.visible&&(ba=3*ea,D.gammaInput?I(z,ba,p,q*q):G(z,ba,p,q),Ga.getPositionFromMatrix(m.matrixWorld),y[ba]=Ga.x,y[ba+1]=Ga.y,y[ba+2]=Ga.z,A[ea]=r,ea+=1)):m instanceof THREE.SpotLight?(S+=1,m.visible&&(ba=3*T,D.gammaInput?I(B,ba,p,q*q):G(B,ba,p,q),Ga.getPositionFromMatrix(m.matrixWorld),F[ba]=Ga.x,F[ba+1]=Ga.y,F[ba+2]=Ga.z,C[T]=r,Ca.copy(Ga),Ga.getPositionFromMatrix(m.target.matrixWorld),
|
|
|
+Ca.sub(Ga),Ca.normalize(),E[ba]=Ca.x,E[ba+1]=Ca.y,E[ba+2]=Ca.z,J[T]=Math.cos(m.angle),L[T]=m.exponent,T+=1)):m instanceof THREE.HemisphereLight&&(P+=1,m.visible&&(Ca.getPositionFromMatrix(m.matrixWorld),Ca.normalize(),0===Ca.x&&0===Ca.y&&0===Ca.z||(r=3*aa,M[r]=Ca.x,M[r+1]=Ca.y,M[r+2]=Ca.z,p=m.color,m=m.groundColor,D.gammaInput?(q*=q,I(V,r,p,q),I(K,r,m,q)):(G(V,r,p,q),G(K,r,m,q)),aa+=1))));c=3*O;for(f=Math.max(t.length,3*da);c<f;c++)t[c]=0;c=3*ea;for(f=Math.max(z.length,3*R);c<f;c++)z[c]=0;c=3*T;for(f=
|
|
|
+Math.max(B.length,3*S);c<f;c++)B[c]=0;c=3*aa;for(f=Math.max(V.length,3*P);c<f;c++)V[c]=0;c=3*aa;for(f=Math.max(K.length,3*P);c<f;c++)K[c]=0;s.directional.length=O;s.point.length=ea;s.spot.length=T;s.hemi.length=aa;s.ambient[0]=j;s.ambient[1]=l;s.ambient[2]=n;yb=!1}c=Ib;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;D.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Y;d.map?Y=d.map:d.specularMap?Y=d.specularMap:d.normalMap?Y=d.normalMap:d.bumpMap&&(Y=d.bumpMap);void 0!==Y&&(c=Y.offset,
|
|
|
-Y=Y.repeat,i.offsetRepeat.value.set(c.x,c.y,Y.x,Y.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=
|
|
|
+d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;D.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var X;d.map?X=d.map:d.specularMap?X=d.specularMap:d.normalMap?X=d.normalMap:d.bumpMap&&(X=d.bumpMap);void 0!==X&&(c=X.offset,
|
|
|
+X=X.repeat,i.offsetRepeat.value.set(c.x,c.y,X.x,X.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=
|
|
|
d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=Z.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,D.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,
|
|
|
i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(D.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=
|
|
|
-d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Y=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[Y]=j.shadowMap,i.shadowMapSize.value[Y]=j.shadowMapSize,i.shadowMatrix.value[Y]=j.shadowMatrix,i.shadowDarkness.value[Y]=j.shadowDarkness,i.shadowBias.value[Y]=j.shadowBias,Y++}b=d.uniformsList;i=0;for(Y=b.length;i<Y;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],m=c.type,j=c.value,"i"===
|
|
|
-m)k.uniform1i(f,j);else if("f"===m)k.uniform1f(f,j);else if("v2"===m)k.uniform2f(f,j.x,j.y);else if("v3"===m)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===m)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===m)k.uniform3f(f,j.r,j.g,j.b);else if("iv1"===m)k.uniform1iv(f,j);else if("iv"===m)k.uniform3iv(f,j);else if("fv1"===m)k.uniform1fv(f,j);else if("fv"===m)k.uniform3fv(f,j);else if("v2v"===m){void 0===c._array&&(c._array=new Float32Array(2*j.length));m=0;for(n=j.length;m<n;m++)s=2*m,c._array[s]=j[m].x,c._array[s+
|
|
|
-1]=j[m].y;k.uniform2fv(f,c._array)}else if("v3v"===m){void 0===c._array&&(c._array=new Float32Array(3*j.length));m=0;for(n=j.length;m<n;m++)s=3*m,c._array[s]=j[m].x,c._array[s+1]=j[m].y,c._array[s+2]=j[m].z;k.uniform3fv(f,c._array)}else if("v4v"===m){void 0===c._array&&(c._array=new Float32Array(4*j.length));m=0;for(n=j.length;m<n;m++)s=4*m,c._array[s]=j[m].x,c._array[s+1]=j[m].y,c._array[s+2]=j[m].z,c._array[s+3]=j[m].w;k.uniform4fv(f,c._array)}else if("m4"===m)void 0===c._array&&(c._array=new Float32Array(16)),
|
|
|
-j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===m){void 0===c._array&&(c._array=new Float32Array(16*j.length));m=0;for(n=j.length;m<n;m++)j[m].flattenToArrayOffset(c._array,16*m);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===m){if(s=j,j=H(),k.uniform1i(f,j),s)if(s.image instanceof Array&&6===s.image.length){if(c=s,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",gc),c.image.__webglTextureCube=k.createTexture(),D.info.memory.textures++);
|
|
|
-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(m=0;6>m;m++)D.autoScaleCubemaps&&!f?(n=j,s=m,t=c.image[m],z=Ub,t.width<=z&&t.height<=z||(y=Math.max(t.width,t.height),v=Math.floor(t.width*z/y),z=Math.floor(t.height*z/y),y=document.createElement("canvas"),y.width=v,y.height=z,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,z),t=y),n[s]=t):j[m]=c.image[m];
|
|
|
-m=j[0];n=0===(m.width&m.width-1)&&0===(m.height&m.height-1);s=w(c.format);t=w(c.type);N(k.TEXTURE_CUBE_MAP,c,n);for(m=0;6>m;m++)if(f){z=j[m].mipmaps;y=0;for(A=z.length;y<A;y++)v=z[y],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+m,y,s,v.width,v.height,0,v.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,s,s,t,j[m]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,
|
|
|
-c.image.__webglTextureCube)}else s instanceof THREE.WebGLRenderTargetCube?(c=s,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):D.setTexture(s,j)}else if("tv"===m){void 0===c._array&&(c._array=[]);m=0;for(n=c.value.length;m<n;m++)c._array[m]=H();k.uniform1iv(f,c._array);m=0;for(n=c.value.length;m<n;m++)s=c.value[m],j=c._array[m],s&&D.setTexture(s,j)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+m);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
+d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=X=0;for(f=b.length;c<f;c++)if(j=b[c],j.castShadow&&(j instanceof THREE.SpotLight||j instanceof THREE.DirectionalLight&&!j.shadowCascade))i.shadowMap.value[X]=j.shadowMap,i.shadowMapSize.value[X]=j.shadowMapSize,i.shadowMatrix.value[X]=j.shadowMatrix,i.shadowDarkness.value[X]=j.shadowDarkness,i.shadowBias.value[X]=j.shadowBias,X++}b=d.uniformsList;i=0;for(X=b.length;i<X;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,j=c.value,"i"===
|
|
|
+l)k.uniform1i(f,j);else if("f"===l)k.uniform1f(f,j);else if("v2"===l)k.uniform2f(f,j.x,j.y);else if("v3"===l)k.uniform3f(f,j.x,j.y,j.z);else if("v4"===l)k.uniform4f(f,j.x,j.y,j.z,j.w);else if("c"===l)k.uniform3f(f,j.r,j.g,j.b);else if("iv1"===l)k.uniform1iv(f,j);else if("iv"===l)k.uniform3iv(f,j);else if("fv1"===l)k.uniform1fv(f,j);else if("fv"===l)k.uniform3fv(f,j);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*j.length));l=0;for(n=j.length;l<n;l++)s=2*l,c._array[s]=j[l].x,c._array[s+
|
|
|
+1]=j[l].y;k.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*j.length));l=0;for(n=j.length;l<n;l++)s=3*l,c._array[s]=j[l].x,c._array[s+1]=j[l].y,c._array[s+2]=j[l].z;k.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*j.length));l=0;for(n=j.length;l<n;l++)s=4*l,c._array[s]=j[l].x,c._array[s+1]=j[l].y,c._array[s+2]=j[l].z,c._array[s+3]=j[l].w;k.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),
|
|
|
+j.flattenToArray(c._array),k.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=new Float32Array(16*j.length));l=0;for(n=j.length;l<n;l++)j[l].flattenToArrayOffset(c._array,16*l);k.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(s=j,j=H(),k.uniform1i(f,j),s)if(s.image instanceof Array&&6===s.image.length){if(c=s,f=j,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",gc),c.image.__webglTextureCube=k.createTexture(),D.info.memory.textures++);
|
|
|
+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++)D.autoScaleCubemaps&&!f?(n=j,s=l,t=c.image[l],z=Ub,t.width<=z&&t.height<=z||(y=Math.max(t.width,t.height),u=Math.floor(t.width*z/y),z=Math.floor(t.height*z/y),y=document.createElement("canvas"),y.width=u,y.height=z,y.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,u,z),t=y),n[s]=t):j[l]=c.image[l];
|
|
|
+l=j[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);s=w(c.format);t=w(c.type);N(k.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){z=j[l].mipmaps;y=0;for(A=z.length;y<A;y++)u=z[y],k.compressedTexImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,y,s,u.width,u.height,0,u.data)}else k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,s,s,t,j[l]);c.generateMipmaps&&n&&k.generateMipmap(k.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else k.activeTexture(k.TEXTURE0+f),k.bindTexture(k.TEXTURE_CUBE_MAP,
|
|
|
+c.image.__webglTextureCube)}else s instanceof THREE.WebGLRenderTargetCube?(c=s,k.activeTexture(k.TEXTURE0+j),k.bindTexture(k.TEXTURE_CUBE_MAP,c.__webglTexture)):D.setTexture(s,j)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=H();k.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)s=c.value[l],j=c._array[l],s&&D.setTexture(s,j)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof
|
|
|
THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)Ga.getPositionFromMatrix(a.matrixWorld),k.uniform3f(h.cameraPosition,Ga.x,Ga.y,Ga.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&k.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}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 H(){var a=fa;a>=ib&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ib);fa+=1;return a}function I(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 G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==ka&&(k.lineWidth(a),ka=a)}function K(a,b,c){ia!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),ia=a);
|
|
|
+null!==h.modelMatrix&&k.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function H(){var a=fa;a>=ib&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+ib);fa+=1;return a}function I(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 G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a){a!==la&&(k.lineWidth(a),la=a)}function K(a,b,c){ia!==a&&(a?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),ia=a);
|
|
|
if(a&&(ha!==b||ra!==c))k.polygonOffset(b,c),ha=b,ra=c}function B(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 J(a,b){var c;"fragment"===a?c=k.createShader(k.FRAGMENT_SHADER):"vertex"===a&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,b);k.compileShader(c);return!k.getShaderParameter(c,k.COMPILE_STATUS)?(console.error(k.getShaderInfoLog(c)),console.error(B(b)),null):c}function N(a,b,c){c?(k.texParameteri(a,k.TEXTURE_WRAP_S,w(b.wrapS)),k.texParameteri(a,
|
|
|
k.TEXTURE_WRAP_T,w(b.wrapT)),k.texParameteri(a,k.TEXTURE_MAG_FILTER,w(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,w(b.minFilter))):(k.texParameteri(a,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(a,k.TEXTURE_MAG_FILTER,M(b.magFilter)),k.texParameteri(a,k.TEXTURE_MIN_FILTER,M(b.minFilter)));if(fb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))k.texParameterf(a,fb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Xa)),b.__oldAnisotropy=
|
|
|
b.anisotropy}function y(a,b){k.bindRenderbuffer(k.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,a)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height)}
|
|
@@ -426,7 +426,7 @@ if(a===THREE.ZeroFactor)return k.ZERO;if(a===THREE.OneFactor)return k.ONE;if(a==
|
|
|
if(a===THREE.SrcAlphaSaturateFactor)return k.SRC_ALPHA_SATURATE;if(void 0!==na){if(a===THREE.RGB_S3TC_DXT1_Format)return na.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return na.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return na.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return na.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},Z=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
|
|
|
L=void 0!==a.precision?a.precision:"highp",oa=void 0!==a.alpha?a.alpha:!0,Pa=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,Va=void 0!==a.antialias?a.antialias:!1,O=void 0!==a.stencil?a.stencil:!0,qa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Fa=new THREE.Color(0),wa=0;void 0!==a.clearColor&&(console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),Fa.setHex(a.clearColor));void 0!==a.clearAlpha&&(console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."),
|
|
|
wa=a.clearAlpha);this.domElement=Z;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=
|
|
|
-this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,V=[],ea=0,pa=null,Ua=null,pb=-1,ub=null,ya=null,Ha=0,fa=0,da=-1,T=-1,aa=-1,la=-1,Y=-1,ma=-1,xa=-1,bb=-1,ia=null,ha=null,ra=null,ka=null,ua=0,Ra=0,Qa=0,Ya=0,Xb=0,Jb=0,Ab={},Sa=new THREE.Frustum,xb=new THREE.Matrix4,lb=new THREE.Matrix4,Ga=new THREE.Vector3,
|
|
|
+this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var D=this,V=[],ea=0,pa=null,Ua=null,pb=-1,ub=null,ya=null,Ha=0,fa=0,da=-1,T=-1,aa=-1,ma=-1,ka=-1,X=-1,xa=-1,bb=-1,ia=null,ha=null,ra=null,la=null,ua=0,Ra=0,Qa=0,Ya=0,Xb=0,Jb=0,Ab={},Sa=new THREE.Frustum,xb=new THREE.Matrix4,lb=new THREE.Matrix4,Ga=new THREE.Vector3,
|
|
|
Ca=new THREE.Vector3,yb=!0,Ib={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},k,Rb,Yb,fb,na;try{if(!(k=Z.getContext("experimental-webgl",{alpha:oa,premultipliedAlpha:Pa,antialias:Va,stencil:O,preserveDrawingBuffer:qa})))throw"Error creating WebGL context.";}catch(va){console.error(va)}Rb=
|
|
|
k.getExtension("OES_texture_float");k.getExtension("OES_texture_float_linear");Yb=k.getExtension("OES_standard_derivatives");fb=k.getExtension("EXT_texture_filter_anisotropic")||k.getExtension("MOZ_EXT_texture_filter_anisotropic")||k.getExtension("WEBKIT_EXT_texture_filter_anisotropic");na=k.getExtension("WEBGL_compressed_texture_s3tc")||k.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||k.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Rb||console.log("THREE.WebGLRenderer: Float textures not supported.");
|
|
|
Yb||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");fb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");na||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===k.getShaderPrecisionFormat&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});k.clearColor(0,0,0,1);k.clearDepth(1);k.clearStencil(0);k.enable(k.DEPTH_TEST);k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);
|
|
@@ -441,12 +441,12 @@ k.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&k.deleteBuffer(a.
|
|
|
a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)k.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)k.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);D.info.memory.geometries--},gc=function(a){a=a.target;a.removeEventListener("dispose",gc);a.image&&a.image.__webglTextureCube?k.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,k.deleteTexture(a.__webglTexture));
|
|
|
D.info.memory.textures--},mc=function(a){a=a.target;a.removeEventListener("dispose",mc);if(a&&a.__webglTexture)if(k.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)k.deleteFramebuffer(a.__webglFramebuffer[b]),k.deleteRenderbuffer(a.__webglRenderbuffer[b]);else k.deleteFramebuffer(a.__webglFramebuffer),k.deleteRenderbuffer(a.__webglRenderbuffer);D.info.memory.textures--},uc=function(a){a=a.target;a.removeEventListener("dispose",uc);vc(a)},vc=function(a){var b=
|
|
|
a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=V.length;a<c;a++)if(d=V[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=V.length;a<c;a++)d=V[a],d.program!==b&&e.push(d);V=e;k.deleteProgram(b);D.info.memory.programs--}}};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,m,l,n,p,q=3*a.count;for(p=0;p<
|
|
|
-q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],m=n[p+5],h=n[p+6],j=n[p+7],l=n[p+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+m+l)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}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){var h,j,m,l;h=F(a,b,c,d,f);b=
|
|
|
-h.attributes;a=e.attributes;c=!1;h=16777215*e.id+2*h.id+(d.wireframe?1:0);h!==ub&&(ub=h,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=a.index){e=e.offsets;1<e.length&&(c=!0);for(var f=0,n=e.length;f<n;f++){var p=e[f].index;if(c){for(j in a)"index"!==j&&(m=b[j],h=a[j],l=h.itemSize,0<=m&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),g(m),k.vertexAttribPointer(m,l,k.FLOAT,!1,0,4*p*l)));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,d.buffer)}k.drawElements(k.TRIANGLES,e[f].count,k.UNSIGNED_SHORT,2*e[f].start);D.info.render.calls++;
|
|
|
-D.info.render.vertices+=e[f].count;D.info.render.faces+=e[f].count/3}}else{if(c)for(j in a)"index"!==j&&(m=b[j],h=a[j],l=h.itemSize,0<=m&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),g(m),k.vertexAttribPointer(m,l,k.FLOAT,!1,0,0)));a=e.attributes.position;k.drawArrays(k.TRIANGLES,0,a.numItems/3);D.info.render.calls++;D.info.render.vertices+=a.numItems/3;D.info.render.faces+=a.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(j in a)m=b[j],h=a[j],l=h.itemSize,0<=m&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
-h.buffer),g(m),k.vertexAttribPointer(m,l,k.FLOAT,!1,0,0));a=a.position;k.drawArrays(k.POINTS,0,a.numItems/3);D.info.render.calls++;D.info.render.points+=a.numItems/3}}else if(f instanceof THREE.Line&&c){for(j in a)m=b[j],h=a[j],l=h.itemSize,0<=m&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),g(m),k.vertexAttribPointer(m,l,k.FLOAT,!1,0,0));j=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;A(d.linewidth);a=a.position;k.drawArrays(j,0,a.numItems/3);D.info.render.calls++;D.info.render.points+=a.numItems}}};this.renderBuffer=
|
|
|
+(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,p,q=3*a.count;for(p=0;p<
|
|
|
+q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],l=n[p+5],h=n[p+6],j=n[p+7],m=n[p+8],d=(d+g+h)/3,e=(e+i+j)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}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){var h,j,l,m;h=F(a,b,c,d,f);b=
|
|
|
+h.attributes;a=e.attributes;c=!1;h=16777215*e.id+2*h.id+(d.wireframe?1:0);h!==ub&&(ub=h,c=!0);c&&i();if(f instanceof THREE.Mesh)if(d=a.index){e=e.offsets;1<e.length&&(c=!0);for(var f=0,n=e.length;f<n;f++){var p=e[f].index;if(c){for(j in a)"index"!==j&&(l=b[j],h=a[j],m=h.itemSize,0<=l&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),g(l),k.vertexAttribPointer(l,m,k.FLOAT,!1,0,4*p*m)));k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,d.buffer)}k.drawElements(k.TRIANGLES,e[f].count,k.UNSIGNED_SHORT,2*e[f].start);D.info.render.calls++;
|
|
|
+D.info.render.vertices+=e[f].count;D.info.render.faces+=e[f].count/3}}else{if(c)for(j in a)"index"!==j&&(l=b[j],h=a[j],m=h.itemSize,0<=l&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),g(l),k.vertexAttribPointer(l,m,k.FLOAT,!1,0,0)));a=e.attributes.position;k.drawArrays(k.TRIANGLES,0,a.numItems/3);D.info.render.calls++;D.info.render.vertices+=a.numItems/3;D.info.render.faces+=a.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(j in a)l=b[j],h=a[j],m=h.itemSize,0<=l&&(k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+h.buffer),g(l),k.vertexAttribPointer(l,m,k.FLOAT,!1,0,0));a=a.position;k.drawArrays(k.POINTS,0,a.numItems/3);D.info.render.calls++;D.info.render.points+=a.numItems/3}}else if(f instanceof THREE.Line&&c){for(j in a)l=b[j],h=a[j],m=h.itemSize,0<=l&&(k.bindBuffer(k.ARRAY_BUFFER,h.buffer),g(l),k.vertexAttribPointer(l,m,k.FLOAT,!1,0,0));j=f.type===THREE.LineStrip?k.LINE_STRIP:k.LINES;A(d.linewidth);a=a.position;k.drawArrays(j,0,a.numItems/3);D.info.render.calls++;D.info.render.points+=a.numItems}}};this.renderBuffer=
|
|
|
function(a,b,c,d,e,f){if(!1!==d.visible){var h,j,c=F(a,b,c,d,f),a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==ub&&(ub=c,b=!0);b&&i();if(!d.morphTargets&&0<=a.position)b&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),g(a.position),k.vertexAttribPointer(a.position,3,k.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),g(c.position),k.vertexAttribPointer(c.position,
|
|
|
3,k.FLOAT,!1,0,0)):0<=c.position&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglVertexBuffer),g(c.position),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;j=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<j.length;)0<=c["morphTarget"+m]&&(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j[m]]),g(c["morphTarget"+m]),k.vertexAttribPointer(c["morphTarget"+m],3,k.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&
|
|
|
(k.bindBuffer(k.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[j[m]]),g(c["morphNormal"+m]),k.vertexAttribPointer(c["morphNormal"+m],3,k.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=h[j[m]],m++}else{j=[];h=f.morphTargetInfluences;var n,p=h.length;for(n=0;n<p;n++)m=h[n],0<m&&j.push([m,n]);j.length>d.numSupportedMorphTargets?(j.sort(l),j.length=d.numSupportedMorphTargets):j.length>d.numSupportedMorphNormals?j.sort(l):0===j.length&&j.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)j[m]?(n=j[m][1],0<=
|
|
@@ -461,35 +461,35 @@ THREE.ParticleSystem)||!h.frustumCulled||Sa.intersectsObject(h))){var q=h;q._mod
|
|
|
!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(Ga.getPositionFromMatrix(h.matrixWorld),Ga.applyProjection(xb),f.z=Ga.z))}this.sortObjects&&g.sort(j);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,
|
|
|
this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),K(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),n(a.__webglObjects,!1,"",b,i,l,!0,d),p(a.__webglObjectsImmediate,"",b,i,l,!1,d)):(d=null,this.setBlending(THREE.NoBlending),n(a.__webglObjects,!0,"opaque",b,i,l,!1,d),p(a.__webglObjectsImmediate,"opaque",b,i,l,!1,d),n(a.__webglObjects,!1,"transparent",b,i,l,!0,d),p(a.__webglObjectsImmediate,"transparent",b,
|
|
|
i,l,!0,d));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=F(a,b,c,d,e);ub=-1;D.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,Sa):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)v(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=
|
|
|
-a.__webglObjects.length;b<c;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&v(g,a),t(g,a));var i=g,j=i.geometry,m=void 0,n=void 0,p=void 0;if(j instanceof THREE.BufferGeometry){var q=k.DYNAMIC_DRAW,z=!j.dynamic,w=j.attributes,y=void 0,A=void 0;for(y in w)A=w[y],A.needsUpdate&&("index"===y?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,A.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,A.array,q)):(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,
|
|
|
+b,c,d,e){var f=F(a,b,c,d,e);ub=-1;D.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,k,Sa):e.render(function(a){D.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,c=
|
|
|
+a.__webglObjects.length;b<c;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&u(g,a),t(g,a));var i=g,j=i.geometry,m=void 0,n=void 0,p=void 0;if(j instanceof THREE.BufferGeometry){var q=k.DYNAMIC_DRAW,z=!j.dynamic,w=j.attributes,y=void 0,A=void 0;for(y in w)A=w[y],A.needsUpdate&&("index"===y?(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,A.buffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,A.array,q)):(k.bindBuffer(k.ARRAY_BUFFER,A.buffer),k.bufferData(k.ARRAY_BUFFER,A.array,
|
|
|
q)),A.needsUpdate=!1),z&&!A.dynamic&&(A.array=null)}else if(i instanceof THREE.Mesh){for(var B=0,F=j.geometryGroupsList.length;B<F;B++)if(m=j.geometryGroupsList[B],p=e(i,m),j.buffersNeedUpdate&&d(m,i),n=p.attributes&&r(p),j.verticesNeedUpdate||j.morphTargetsNeedUpdate||j.elementsNeedUpdate||j.uvsNeedUpdate||j.normalsNeedUpdate||j.colorsNeedUpdate||j.tangentsNeedUpdate||n){var C=m,G=i,H=k.DYNAMIC_DRAW,I=!j.dynamic,J=p;if(C.__inittedArrays){var V=f(J),K=J.vertexColors?J.vertexColors:!1,L=h(J),M=V===
|
|
|
-THREE.SmoothShading,E=void 0,D=void 0,N=void 0,Q=void 0,O=void 0,ea=void 0,T=void 0,Y=void 0,pa=void 0,fa=void 0,aa=void 0,R=void 0,S=void 0,P=void 0,ba=void 0,Z=void 0,da=void 0,ya=void 0,ma=void 0,Ha=void 0,ha=void 0,Ua=void 0,qa=void 0,la=void 0,ia=void 0,ka=void 0,ua=void 0,na=void 0,oa=void 0,ra=void 0,Ca=void 0,va=void 0,wa=void 0,xa=void 0,pb=void 0,za=void 0,ub=void 0,Fa=void 0,Pa=void 0,Ra=void 0,cb=void 0,bb=void 0,$a=void 0,ab=void 0,Va=void 0,Qa=void 0,Ta=0,Za=0,Xa=0,Ya=0,Ka=0,jb=0,Da=
|
|
|
-0,ob=0,Wa=0,X=0,ga=0,x=0,Aa=void 0,db=C.__vertexArray,fb=C.__uvArray,ib=C.__uv2Array,Sa=C.__normalArray,La=C.__tangentArray,eb=C.__colorArray,Ma=C.__skinIndexArray,Na=C.__skinWeightArray,yb=C.__morphTargetsArrays,Ab=C.__morphNormalsArrays,Bb=C.__webglCustomAttributesList,u=void 0,Mb=C.__faceArray,wb=C.__lineArray,qb=G.geometry,Gb=qb.elementsNeedUpdate,Hb=qb.uvsNeedUpdate,Rb=qb.normalsNeedUpdate,Sb=qb.tangentsNeedUpdate,Xb=qb.colorsNeedUpdate,Yb=qb.morphTargetsNeedUpdate,cc=qb.vertices,sa=C.faces3,
|
|
|
+THREE.SmoothShading,E=void 0,D=void 0,N=void 0,Q=void 0,O=void 0,ea=void 0,T=void 0,X=void 0,pa=void 0,fa=void 0,aa=void 0,R=void 0,S=void 0,P=void 0,ba=void 0,Z=void 0,da=void 0,ya=void 0,ka=void 0,Ha=void 0,ha=void 0,Ua=void 0,qa=void 0,ma=void 0,ia=void 0,la=void 0,ua=void 0,na=void 0,oa=void 0,ra=void 0,Ca=void 0,va=void 0,wa=void 0,xa=void 0,pb=void 0,za=void 0,ub=void 0,Fa=void 0,Pa=void 0,Ra=void 0,cb=void 0,bb=void 0,$a=void 0,ab=void 0,Va=void 0,Qa=void 0,Ta=0,Za=0,Xa=0,Ya=0,Ka=0,jb=0,Da=
|
|
|
+0,ob=0,Wa=0,Y=0,ga=0,x=0,Aa=void 0,db=C.__vertexArray,fb=C.__uvArray,ib=C.__uv2Array,Sa=C.__normalArray,La=C.__tangentArray,eb=C.__colorArray,Ma=C.__skinIndexArray,Na=C.__skinWeightArray,yb=C.__morphTargetsArrays,Ab=C.__morphNormalsArrays,Bb=C.__webglCustomAttributesList,v=void 0,Mb=C.__faceArray,wb=C.__lineArray,qb=G.geometry,Gb=qb.elementsNeedUpdate,Hb=qb.uvsNeedUpdate,Rb=qb.normalsNeedUpdate,Sb=qb.tangentsNeedUpdate,Xb=qb.colorsNeedUpdate,Yb=qb.morphTargetsNeedUpdate,cc=qb.vertices,sa=C.faces3,
|
|
|
ta=C.faces4,kb=qb.faces,Jb=qb.faceVertexUvs[0],Lb=qb.faceVertexUvs[1],dc=qb.skinIndices,$b=qb.skinWeights,ac=qb.morphTargets,Ib=qb.morphNormals;if(qb.verticesNeedUpdate){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=cc[Q.a],S=cc[Q.b],P=cc[Q.c],db[Za]=R.x,db[Za+1]=R.y,db[Za+2]=R.z,db[Za+3]=S.x,db[Za+4]=S.y,db[Za+5]=S.z,db[Za+6]=P.x,db[Za+7]=P.y,db[Za+8]=P.z,Za+=9;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=cc[Q.a],S=cc[Q.b],P=cc[Q.c],ba=cc[Q.d],db[Za]=R.x,db[Za+1]=R.y,db[Za+2]=R.z,db[Za+3]=S.x,db[Za+4]=
|
|
|
S.y,db[Za+5]=S.z,db[Za+6]=P.x,db[Za+7]=P.y,db[Za+8]=P.z,db[Za+9]=ba.x,db[Za+10]=ba.y,db[Za+11]=ba.z,Za+=12;k.bindBuffer(k.ARRAY_BUFFER,C.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,db,H)}if(Yb){cb=0;for(bb=ac.length;cb<bb;cb++){E=ga=0;for(D=sa.length;E<D;E++)Va=sa[E],Q=kb[Va],R=ac[cb].vertices[Q.a],S=ac[cb].vertices[Q.b],P=ac[cb].vertices[Q.c],$a=yb[cb],$a[ga]=R.x,$a[ga+1]=R.y,$a[ga+2]=R.z,$a[ga+3]=S.x,$a[ga+4]=S.y,$a[ga+5]=S.z,$a[ga+6]=P.x,$a[ga+7]=P.y,$a[ga+8]=P.z,J.morphNormals&&(M?(Qa=Ib[cb].vertexNormals[Va],
|
|
|
Ha=Qa.a,ha=Qa.b,Ua=Qa.c):Ua=ha=Ha=Ib[cb].faceNormals[Va],ab=Ab[cb],ab[ga]=Ha.x,ab[ga+1]=Ha.y,ab[ga+2]=Ha.z,ab[ga+3]=ha.x,ab[ga+4]=ha.y,ab[ga+5]=ha.z,ab[ga+6]=Ua.x,ab[ga+7]=Ua.y,ab[ga+8]=Ua.z),ga+=9;E=0;for(D=ta.length;E<D;E++)Va=ta[E],Q=kb[Va],R=ac[cb].vertices[Q.a],S=ac[cb].vertices[Q.b],P=ac[cb].vertices[Q.c],ba=ac[cb].vertices[Q.d],$a=yb[cb],$a[ga]=R.x,$a[ga+1]=R.y,$a[ga+2]=R.z,$a[ga+3]=S.x,$a[ga+4]=S.y,$a[ga+5]=S.z,$a[ga+6]=P.x,$a[ga+7]=P.y,$a[ga+8]=P.z,$a[ga+9]=ba.x,$a[ga+10]=ba.y,$a[ga+11]=
|
|
|
ba.z,J.morphNormals&&(M?(Qa=Ib[cb].vertexNormals[Va],Ha=Qa.a,ha=Qa.b,Ua=Qa.c,qa=Qa.d):qa=Ua=ha=Ha=Ib[cb].faceNormals[Va],ab=Ab[cb],ab[ga]=Ha.x,ab[ga+1]=Ha.y,ab[ga+2]=Ha.z,ab[ga+3]=ha.x,ab[ga+4]=ha.y,ab[ga+5]=ha.z,ab[ga+6]=Ua.x,ab[ga+7]=Ua.y,ab[ga+8]=Ua.z,ab[ga+9]=qa.x,ab[ga+10]=qa.y,ab[ga+11]=qa.z),ga+=12;k.bindBuffer(k.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[cb]);k.bufferData(k.ARRAY_BUFFER,yb[cb],H);J.morphNormals&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglMorphNormalsBuffers[cb]),k.bufferData(k.ARRAY_BUFFER,
|
|
|
-Ab[cb],H))}}if($b.length){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],na=$b[Q.a],oa=$b[Q.b],ra=$b[Q.c],Na[X]=na.x,Na[X+1]=na.y,Na[X+2]=na.z,Na[X+3]=na.w,Na[X+4]=oa.x,Na[X+5]=oa.y,Na[X+6]=oa.z,Na[X+7]=oa.w,Na[X+8]=ra.x,Na[X+9]=ra.y,Na[X+10]=ra.z,Na[X+11]=ra.w,va=dc[Q.a],wa=dc[Q.b],xa=dc[Q.c],Ma[X]=va.x,Ma[X+1]=va.y,Ma[X+2]=va.z,Ma[X+3]=va.w,Ma[X+4]=wa.x,Ma[X+5]=wa.y,Ma[X+6]=wa.z,Ma[X+7]=wa.w,Ma[X+8]=xa.x,Ma[X+9]=xa.y,Ma[X+10]=xa.z,Ma[X+11]=xa.w,X+=12;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],na=$b[Q.a],
|
|
|
-oa=$b[Q.b],ra=$b[Q.c],Ca=$b[Q.d],Na[X]=na.x,Na[X+1]=na.y,Na[X+2]=na.z,Na[X+3]=na.w,Na[X+4]=oa.x,Na[X+5]=oa.y,Na[X+6]=oa.z,Na[X+7]=oa.w,Na[X+8]=ra.x,Na[X+9]=ra.y,Na[X+10]=ra.z,Na[X+11]=ra.w,Na[X+12]=Ca.x,Na[X+13]=Ca.y,Na[X+14]=Ca.z,Na[X+15]=Ca.w,va=dc[Q.a],wa=dc[Q.b],xa=dc[Q.c],pb=dc[Q.d],Ma[X]=va.x,Ma[X+1]=va.y,Ma[X+2]=va.z,Ma[X+3]=va.w,Ma[X+4]=wa.x,Ma[X+5]=wa.y,Ma[X+6]=wa.z,Ma[X+7]=wa.w,Ma[X+8]=xa.x,Ma[X+9]=xa.y,Ma[X+10]=xa.z,Ma[X+11]=xa.w,Ma[X+12]=pb.x,Ma[X+13]=pb.y,Ma[X+14]=pb.z,Ma[X+15]=pb.w,
|
|
|
-X+=16;0<X&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,Ma,H),k.bindBuffer(k.ARRAY_BUFFER,C.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Na,H))}if(Xb&&K){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],T=Q.vertexColors,Y=Q.color,3===T.length&&K===THREE.VertexColors?(la=T[0],ia=T[1],ka=T[2]):ka=ia=la=Y,eb[Wa]=la.r,eb[Wa+1]=la.g,eb[Wa+2]=la.b,eb[Wa+3]=ia.r,eb[Wa+4]=ia.g,eb[Wa+5]=ia.b,eb[Wa+6]=ka.r,eb[Wa+7]=ka.g,eb[Wa+8]=ka.b,Wa+=9;E=0;for(D=ta.length;E<D;E++)Q=
|
|
|
-kb[ta[E]],T=Q.vertexColors,Y=Q.color,4===T.length&&K===THREE.VertexColors?(la=T[0],ia=T[1],ka=T[2],ua=T[3]):ua=ka=ia=la=Y,eb[Wa]=la.r,eb[Wa+1]=la.g,eb[Wa+2]=la.b,eb[Wa+3]=ia.r,eb[Wa+4]=ia.g,eb[Wa+5]=ia.b,eb[Wa+6]=ka.r,eb[Wa+7]=ka.g,eb[Wa+8]=ka.b,eb[Wa+9]=ua.r,eb[Wa+10]=ua.g,eb[Wa+11]=ua.b,Wa+=12;0<Wa&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,eb,H))}if(Sb&&qb.hasTangents){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],pa=Q.vertexTangents,Z=pa[0],da=pa[1],ya=pa[2],La[Da]=
|
|
|
-Z.x,La[Da+1]=Z.y,La[Da+2]=Z.z,La[Da+3]=Z.w,La[Da+4]=da.x,La[Da+5]=da.y,La[Da+6]=da.z,La[Da+7]=da.w,La[Da+8]=ya.x,La[Da+9]=ya.y,La[Da+10]=ya.z,La[Da+11]=ya.w,Da+=12;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],pa=Q.vertexTangents,Z=pa[0],da=pa[1],ya=pa[2],ma=pa[3],La[Da]=Z.x,La[Da+1]=Z.y,La[Da+2]=Z.z,La[Da+3]=Z.w,La[Da+4]=da.x,La[Da+5]=da.y,La[Da+6]=da.z,La[Da+7]=da.w,La[Da+8]=ya.x,La[Da+9]=ya.y,La[Da+10]=ya.z,La[Da+11]=ya.w,La[Da+12]=ma.x,La[Da+13]=ma.y,La[Da+14]=ma.z,La[Da+15]=ma.w,Da+=16;k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
+Ab[cb],H))}}if($b.length){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],na=$b[Q.a],oa=$b[Q.b],ra=$b[Q.c],Na[Y]=na.x,Na[Y+1]=na.y,Na[Y+2]=na.z,Na[Y+3]=na.w,Na[Y+4]=oa.x,Na[Y+5]=oa.y,Na[Y+6]=oa.z,Na[Y+7]=oa.w,Na[Y+8]=ra.x,Na[Y+9]=ra.y,Na[Y+10]=ra.z,Na[Y+11]=ra.w,va=dc[Q.a],wa=dc[Q.b],xa=dc[Q.c],Ma[Y]=va.x,Ma[Y+1]=va.y,Ma[Y+2]=va.z,Ma[Y+3]=va.w,Ma[Y+4]=wa.x,Ma[Y+5]=wa.y,Ma[Y+6]=wa.z,Ma[Y+7]=wa.w,Ma[Y+8]=xa.x,Ma[Y+9]=xa.y,Ma[Y+10]=xa.z,Ma[Y+11]=xa.w,Y+=12;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],na=$b[Q.a],
|
|
|
+oa=$b[Q.b],ra=$b[Q.c],Ca=$b[Q.d],Na[Y]=na.x,Na[Y+1]=na.y,Na[Y+2]=na.z,Na[Y+3]=na.w,Na[Y+4]=oa.x,Na[Y+5]=oa.y,Na[Y+6]=oa.z,Na[Y+7]=oa.w,Na[Y+8]=ra.x,Na[Y+9]=ra.y,Na[Y+10]=ra.z,Na[Y+11]=ra.w,Na[Y+12]=Ca.x,Na[Y+13]=Ca.y,Na[Y+14]=Ca.z,Na[Y+15]=Ca.w,va=dc[Q.a],wa=dc[Q.b],xa=dc[Q.c],pb=dc[Q.d],Ma[Y]=va.x,Ma[Y+1]=va.y,Ma[Y+2]=va.z,Ma[Y+3]=va.w,Ma[Y+4]=wa.x,Ma[Y+5]=wa.y,Ma[Y+6]=wa.z,Ma[Y+7]=wa.w,Ma[Y+8]=xa.x,Ma[Y+9]=xa.y,Ma[Y+10]=xa.z,Ma[Y+11]=xa.w,Ma[Y+12]=pb.x,Ma[Y+13]=pb.y,Ma[Y+14]=pb.z,Ma[Y+15]=pb.w,
|
|
|
+Y+=16;0<Y&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,Ma,H),k.bindBuffer(k.ARRAY_BUFFER,C.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,Na,H))}if(Xb&&K){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],T=Q.vertexColors,X=Q.color,3===T.length&&K===THREE.VertexColors?(ma=T[0],ia=T[1],la=T[2]):la=ia=ma=X,eb[Wa]=ma.r,eb[Wa+1]=ma.g,eb[Wa+2]=ma.b,eb[Wa+3]=ia.r,eb[Wa+4]=ia.g,eb[Wa+5]=ia.b,eb[Wa+6]=la.r,eb[Wa+7]=la.g,eb[Wa+8]=la.b,Wa+=9;E=0;for(D=ta.length;E<D;E++)Q=
|
|
|
+kb[ta[E]],T=Q.vertexColors,X=Q.color,4===T.length&&K===THREE.VertexColors?(ma=T[0],ia=T[1],la=T[2],ua=T[3]):ua=la=ia=ma=X,eb[Wa]=ma.r,eb[Wa+1]=ma.g,eb[Wa+2]=ma.b,eb[Wa+3]=ia.r,eb[Wa+4]=ia.g,eb[Wa+5]=ia.b,eb[Wa+6]=la.r,eb[Wa+7]=la.g,eb[Wa+8]=la.b,eb[Wa+9]=ua.r,eb[Wa+10]=ua.g,eb[Wa+11]=ua.b,Wa+=12;0<Wa&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,eb,H))}if(Sb&&qb.hasTangents){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],pa=Q.vertexTangents,Z=pa[0],da=pa[1],ya=pa[2],La[Da]=
|
|
|
+Z.x,La[Da+1]=Z.y,La[Da+2]=Z.z,La[Da+3]=Z.w,La[Da+4]=da.x,La[Da+5]=da.y,La[Da+6]=da.z,La[Da+7]=da.w,La[Da+8]=ya.x,La[Da+9]=ya.y,La[Da+10]=ya.z,La[Da+11]=ya.w,Da+=12;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],pa=Q.vertexTangents,Z=pa[0],da=pa[1],ya=pa[2],ka=pa[3],La[Da]=Z.x,La[Da+1]=Z.y,La[Da+2]=Z.z,La[Da+3]=Z.w,La[Da+4]=da.x,La[Da+5]=da.y,La[Da+6]=da.z,La[Da+7]=da.w,La[Da+8]=ya.x,La[Da+9]=ya.y,La[Da+10]=ya.z,La[Da+11]=ya.w,La[Da+12]=ka.x,La[Da+13]=ka.y,La[Da+14]=ka.z,La[Da+15]=ka.w,Da+=16;k.bindBuffer(k.ARRAY_BUFFER,
|
|
|
C.__webglTangentBuffer);k.bufferData(k.ARRAY_BUFFER,La,H)}if(Rb&&V){E=0;for(D=sa.length;E<D;E++)if(Q=kb[sa[E]],O=Q.vertexNormals,ea=Q.normal,3===O.length&&M)for(za=0;3>za;za++)Fa=O[za],Sa[jb]=Fa.x,Sa[jb+1]=Fa.y,Sa[jb+2]=Fa.z,jb+=3;else for(za=0;3>za;za++)Sa[jb]=ea.x,Sa[jb+1]=ea.y,Sa[jb+2]=ea.z,jb+=3;E=0;for(D=ta.length;E<D;E++)if(Q=kb[ta[E]],O=Q.vertexNormals,ea=Q.normal,4===O.length&&M)for(za=0;4>za;za++)Fa=O[za],Sa[jb]=Fa.x,Sa[jb+1]=Fa.y,Sa[jb+2]=Fa.z,jb+=3;else for(za=0;4>za;za++)Sa[jb]=ea.x,Sa[jb+
|
|
|
1]=ea.y,Sa[jb+2]=ea.z,jb+=3;k.bindBuffer(k.ARRAY_BUFFER,C.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Sa,H)}if(Hb&&Jb&&L){E=0;for(D=sa.length;E<D;E++)if(N=sa[E],fa=Jb[N],void 0!==fa)for(za=0;3>za;za++)Pa=fa[za],fb[Xa]=Pa.x,fb[Xa+1]=Pa.y,Xa+=2;E=0;for(D=ta.length;E<D;E++)if(N=ta[E],fa=Jb[N],void 0!==fa)for(za=0;4>za;za++)Pa=fa[za],fb[Xa]=Pa.x,fb[Xa+1]=Pa.y,Xa+=2;0<Xa&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,fb,H))}if(Hb&&Lb&&L){E=0;for(D=sa.length;E<D;E++)if(N=
|
|
|
sa[E],aa=Lb[N],void 0!==aa)for(za=0;3>za;za++)Ra=aa[za],ib[Ya]=Ra.x,ib[Ya+1]=Ra.y,Ya+=2;E=0;for(D=ta.length;E<D;E++)if(N=ta[E],aa=Lb[N],void 0!==aa)for(za=0;4>za;za++)Ra=aa[za],ib[Ya]=Ra.x,ib[Ya+1]=Ra.y,Ya+=2;0<Ya&&(k.bindBuffer(k.ARRAY_BUFFER,C.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ib,H))}if(Gb){E=0;for(D=sa.length;E<D;E++)Mb[Ka]=Ta,Mb[Ka+1]=Ta+1,Mb[Ka+2]=Ta+2,Ka+=3,wb[ob]=Ta,wb[ob+1]=Ta+1,wb[ob+2]=Ta,wb[ob+3]=Ta+2,wb[ob+4]=Ta+1,wb[ob+5]=Ta+2,ob+=6,Ta+=3;E=0;for(D=ta.length;E<D;E++)Mb[Ka]=
|
|
|
-Ta,Mb[Ka+1]=Ta+1,Mb[Ka+2]=Ta+3,Mb[Ka+3]=Ta+1,Mb[Ka+4]=Ta+2,Mb[Ka+5]=Ta+3,Ka+=6,wb[ob]=Ta,wb[ob+1]=Ta+1,wb[ob+2]=Ta,wb[ob+3]=Ta+3,wb[ob+4]=Ta+1,wb[ob+5]=Ta+2,wb[ob+6]=Ta+2,wb[ob+7]=Ta+3,ob+=8,Ta+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,C.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Mb,H);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,C.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,wb,H)}if(Bb){za=0;for(ub=Bb.length;za<ub;za++)if(u=Bb[za],u.__original.needsUpdate){x=0;if(1===u.size)if(void 0===
|
|
|
-u.boundTo||"vertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],u.array[x]=u.value[Q.a],u.array[x+1]=u.value[Q.b],u.array[x+2]=u.value[Q.c],x+=3;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],u.array[x]=u.value[Q.a],u.array[x+1]=u.value[Q.b],u.array[x+2]=u.value[Q.c],u.array[x+3]=u.value[Q.d],x+=4}else{if("faces"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=u.value[sa[E]],u.array[x]=Aa,u.array[x+1]=Aa,u.array[x+2]=Aa,x+=3;E=0;for(D=ta.length;E<D;E++)Aa=u.value[ta[E]],u.array[x]=Aa,u.array[x+1]=
|
|
|
-Aa,u.array[x+2]=Aa,u.array[x+3]=Aa,x+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,x+=6;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],ba=u.value[Q.d],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,u.array[x+
|
|
|
-6]=ba.x,u.array[x+7]=ba.y,x+=8}else{if("faces"===u.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=u.value[sa[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,x+=6;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=S.x,u.array[x+3]=S.y,u.array[x+4]=P.x,u.array[x+5]=P.y,u.array[x+6]=ba.x,u.array[x+7]=ba.y,x+=8}}else if(3===u.size){var W;W="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||
|
|
|
-"vertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],x+=9;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],ba=u.value[Q.d],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],
|
|
|
-u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],u.array[x+9]=ba[W[0]],u.array[x+10]=ba[W[1]],u.array[x+11]=ba[W[2]],x+=12}else if("faces"===u.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=u.value[sa[E]],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],x+=9;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R[W[0]],
|
|
|
-u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],u.array[x+9]=ba[W[0]],u.array[x+10]=ba[W[1]],u.array[x+11]=ba[W[2]],x+=12}else if("faceVertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=u.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+
|
|
|
-7]=P[W[1]],u.array[x+8]=P[W[2]],x+=9;E=0;for(D=ta.length;E<D;E++)Aa=u.value[ta[E]],R=Aa[0],S=Aa[1],P=Aa[2],ba=Aa[3],u.array[x]=R[W[0]],u.array[x+1]=R[W[1]],u.array[x+2]=R[W[2]],u.array[x+3]=S[W[0]],u.array[x+4]=S[W[1]],u.array[x+5]=S[W[2]],u.array[x+6]=P[W[0]],u.array[x+7]=P[W[1]],u.array[x+8]=P[W[2]],u.array[x+9]=ba[W[0]],u.array[x+10]=ba[W[1]],u.array[x+11]=ba[W[2]],x+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=u.value[Q.a],S=
|
|
|
-u.value[Q.b],P=u.value[Q.c],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=u.value[Q.a],S=u.value[Q.b],P=u.value[Q.c],ba=u.value[Q.d],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=
|
|
|
-P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}else if("faces"===u.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=u.value[sa[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=u.value[ta[E]],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+
|
|
|
-2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}else if("faceVertices"===u.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=u.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,
|
|
|
-u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)Aa=u.value[ta[E]],R=Aa[0],S=Aa[1],P=Aa[2],ba=Aa[3],u.array[x]=R.x,u.array[x+1]=R.y,u.array[x+2]=R.z,u.array[x+3]=R.w,u.array[x+4]=S.x,u.array[x+5]=S.y,u.array[x+6]=S.z,u.array[x+7]=S.w,u.array[x+8]=P.x,u.array[x+9]=P.y,u.array[x+10]=P.z,u.array[x+11]=P.w,u.array[x+12]=ba.x,u.array[x+13]=ba.y,u.array[x+14]=ba.z,u.array[x+15]=ba.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,u.buffer);k.bufferData(k.ARRAY_BUFFER,u.array,H)}}I&&
|
|
|
+Ta,Mb[Ka+1]=Ta+1,Mb[Ka+2]=Ta+3,Mb[Ka+3]=Ta+1,Mb[Ka+4]=Ta+2,Mb[Ka+5]=Ta+3,Ka+=6,wb[ob]=Ta,wb[ob+1]=Ta+1,wb[ob+2]=Ta,wb[ob+3]=Ta+3,wb[ob+4]=Ta+1,wb[ob+5]=Ta+2,wb[ob+6]=Ta+2,wb[ob+7]=Ta+3,ob+=8,Ta+=4;k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,C.__webglFaceBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,Mb,H);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,C.__webglLineBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,wb,H)}if(Bb){za=0;for(ub=Bb.length;za<ub;za++)if(v=Bb[za],v.__original.needsUpdate){x=0;if(1===v.size)if(void 0===
|
|
|
+v.boundTo||"vertices"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],v.array[x]=v.value[Q.a],v.array[x+1]=v.value[Q.b],v.array[x+2]=v.value[Q.c],x+=3;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],v.array[x]=v.value[Q.a],v.array[x+1]=v.value[Q.b],v.array[x+2]=v.value[Q.c],v.array[x+3]=v.value[Q.d],x+=4}else{if("faces"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=v.value[sa[E]],v.array[x]=Aa,v.array[x+1]=Aa,v.array[x+2]=Aa,x+=3;E=0;for(D=ta.length;E<D;E++)Aa=v.value[ta[E]],v.array[x]=Aa,v.array[x+1]=
|
|
|
+Aa,v.array[x+2]=Aa,v.array[x+3]=Aa,x+=4}}else if(2===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=S.x,v.array[x+3]=S.y,v.array[x+4]=P.x,v.array[x+5]=P.y,x+=6;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],ba=v.value[Q.d],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=S.x,v.array[x+3]=S.y,v.array[x+4]=P.x,v.array[x+5]=P.y,v.array[x+
|
|
|
+6]=ba.x,v.array[x+7]=ba.y,x+=8}else{if("faces"===v.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=v.value[sa[E]],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=S.x,v.array[x+3]=S.y,v.array[x+4]=P.x,v.array[x+5]=P.y,x+=6;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=v.value[ta[E]],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=S.x,v.array[x+3]=S.y,v.array[x+4]=P.x,v.array[x+5]=P.y,v.array[x+6]=ba.x,v.array[x+7]=ba.y,x+=8}}else if(3===v.size){var W;W="c"===v.type?["r","g","b"]:["x","y","z"];if(void 0===v.boundTo||
|
|
|
+"vertices"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],v.array[x]=R[W[0]],v.array[x+1]=R[W[1]],v.array[x+2]=R[W[2]],v.array[x+3]=S[W[0]],v.array[x+4]=S[W[1]],v.array[x+5]=S[W[2]],v.array[x+6]=P[W[0]],v.array[x+7]=P[W[1]],v.array[x+8]=P[W[2]],x+=9;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],ba=v.value[Q.d],v.array[x]=R[W[0]],v.array[x+1]=R[W[1]],v.array[x+2]=R[W[2]],v.array[x+3]=S[W[0]],v.array[x+4]=S[W[1]],
|
|
|
+v.array[x+5]=S[W[2]],v.array[x+6]=P[W[0]],v.array[x+7]=P[W[1]],v.array[x+8]=P[W[2]],v.array[x+9]=ba[W[0]],v.array[x+10]=ba[W[1]],v.array[x+11]=ba[W[2]],x+=12}else if("faces"===v.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=v.value[sa[E]],v.array[x]=R[W[0]],v.array[x+1]=R[W[1]],v.array[x+2]=R[W[2]],v.array[x+3]=S[W[0]],v.array[x+4]=S[W[1]],v.array[x+5]=S[W[2]],v.array[x+6]=P[W[0]],v.array[x+7]=P[W[1]],v.array[x+8]=P[W[2]],x+=9;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=v.value[ta[E]],v.array[x]=R[W[0]],
|
|
|
+v.array[x+1]=R[W[1]],v.array[x+2]=R[W[2]],v.array[x+3]=S[W[0]],v.array[x+4]=S[W[1]],v.array[x+5]=S[W[2]],v.array[x+6]=P[W[0]],v.array[x+7]=P[W[1]],v.array[x+8]=P[W[2]],v.array[x+9]=ba[W[0]],v.array[x+10]=ba[W[1]],v.array[x+11]=ba[W[2]],x+=12}else if("faceVertices"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=v.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],v.array[x]=R[W[0]],v.array[x+1]=R[W[1]],v.array[x+2]=R[W[2]],v.array[x+3]=S[W[0]],v.array[x+4]=S[W[1]],v.array[x+5]=S[W[2]],v.array[x+6]=P[W[0]],v.array[x+
|
|
|
+7]=P[W[1]],v.array[x+8]=P[W[2]],x+=9;E=0;for(D=ta.length;E<D;E++)Aa=v.value[ta[E]],R=Aa[0],S=Aa[1],P=Aa[2],ba=Aa[3],v.array[x]=R[W[0]],v.array[x+1]=R[W[1]],v.array[x+2]=R[W[2]],v.array[x+3]=S[W[0]],v.array[x+4]=S[W[1]],v.array[x+5]=S[W[2]],v.array[x+6]=P[W[0]],v.array[x+7]=P[W[1]],v.array[x+8]=P[W[2]],v.array[x+9]=ba[W[0]],v.array[x+10]=ba[W[1]],v.array[x+11]=ba[W[2]],x+=12}}else if(4===v.size)if(void 0===v.boundTo||"vertices"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Q=kb[sa[E]],R=v.value[Q.a],S=
|
|
|
+v.value[Q.b],P=v.value[Q.c],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=R.z,v.array[x+3]=R.w,v.array[x+4]=S.x,v.array[x+5]=S.y,v.array[x+6]=S.z,v.array[x+7]=S.w,v.array[x+8]=P.x,v.array[x+9]=P.y,v.array[x+10]=P.z,v.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)Q=kb[ta[E]],R=v.value[Q.a],S=v.value[Q.b],P=v.value[Q.c],ba=v.value[Q.d],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=R.z,v.array[x+3]=R.w,v.array[x+4]=S.x,v.array[x+5]=S.y,v.array[x+6]=S.z,v.array[x+7]=S.w,v.array[x+8]=P.x,v.array[x+9]=
|
|
|
+P.y,v.array[x+10]=P.z,v.array[x+11]=P.w,v.array[x+12]=ba.x,v.array[x+13]=ba.y,v.array[x+14]=ba.z,v.array[x+15]=ba.w,x+=16}else if("faces"===v.boundTo){E=0;for(D=sa.length;E<D;E++)P=S=R=Aa=v.value[sa[E]],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=R.z,v.array[x+3]=R.w,v.array[x+4]=S.x,v.array[x+5]=S.y,v.array[x+6]=S.z,v.array[x+7]=S.w,v.array[x+8]=P.x,v.array[x+9]=P.y,v.array[x+10]=P.z,v.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)ba=P=S=R=Aa=v.value[ta[E]],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+
|
|
|
+2]=R.z,v.array[x+3]=R.w,v.array[x+4]=S.x,v.array[x+5]=S.y,v.array[x+6]=S.z,v.array[x+7]=S.w,v.array[x+8]=P.x,v.array[x+9]=P.y,v.array[x+10]=P.z,v.array[x+11]=P.w,v.array[x+12]=ba.x,v.array[x+13]=ba.y,v.array[x+14]=ba.z,v.array[x+15]=ba.w,x+=16}else if("faceVertices"===v.boundTo){E=0;for(D=sa.length;E<D;E++)Aa=v.value[sa[E]],R=Aa[0],S=Aa[1],P=Aa[2],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=R.z,v.array[x+3]=R.w,v.array[x+4]=S.x,v.array[x+5]=S.y,v.array[x+6]=S.z,v.array[x+7]=S.w,v.array[x+8]=P.x,
|
|
|
+v.array[x+9]=P.y,v.array[x+10]=P.z,v.array[x+11]=P.w,x+=12;E=0;for(D=ta.length;E<D;E++)Aa=v.value[ta[E]],R=Aa[0],S=Aa[1],P=Aa[2],ba=Aa[3],v.array[x]=R.x,v.array[x+1]=R.y,v.array[x+2]=R.z,v.array[x+3]=R.w,v.array[x+4]=S.x,v.array[x+5]=S.y,v.array[x+6]=S.z,v.array[x+7]=S.w,v.array[x+8]=P.x,v.array[x+9]=P.y,v.array[x+10]=P.z,v.array[x+11]=P.w,v.array[x+12]=ba.x,v.array[x+13]=ba.y,v.array[x+14]=ba.z,v.array[x+15]=ba.w,x+=16}k.bindBuffer(k.ARRAY_BUFFER,v.buffer);k.bufferData(k.ARRAY_BUFFER,v.array,H)}}I&&
|
|
|
(delete C.__inittedArrays,delete C.__colorArray,delete C.__normalArray,delete C.__tangentArray,delete C.__uvArray,delete C.__uv2Array,delete C.__faceArray,delete C.__vertexArray,delete C.__lineArray,delete C.__skinIndexArray,delete C.__skinWeightArray)}}j.verticesNeedUpdate=!1;j.morphTargetsNeedUpdate=!1;j.elementsNeedUpdate=!1;j.uvsNeedUpdate=!1;j.normalsNeedUpdate=!1;j.colorsNeedUpdate=!1;j.tangentsNeedUpdate=!1;j.buffersNeedUpdate=!1;p.attributes&&s(p)}else if(i instanceof THREE.Ribbon){p=e(i,
|
|
|
j);n=p.attributes&&r(p);if(j.verticesNeedUpdate||j.colorsNeedUpdate||j.normalsNeedUpdate||n){var Cb=j,Kb=k.DYNAMIC_DRAW,nc=void 0,oc=void 0,pc=void 0,Tb=void 0,Ba=void 0,Ub=void 0,xc=void 0,yc=void 0,gc=void 0,gb=void 0,hc=void 0,Ia=void 0,rb=void 0,kc=Cb.vertices,lc=Cb.colors,mc=Cb.normals,uc=kc.length,vc=lc.length,Yc=mc.length,zc=Cb.__vertexArray,Ac=Cb.__colorArray,Bc=Cb.__normalArray,Zc=Cb.colorsNeedUpdate,$c=Cb.normalsNeedUpdate,Lc=Cb.__webglCustomAttributesList;if(Cb.verticesNeedUpdate){for(nc=
|
|
|
0;nc<uc;nc++)Tb=kc[nc],Ba=3*nc,zc[Ba]=Tb.x,zc[Ba+1]=Tb.y,zc[Ba+2]=Tb.z;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,zc,Kb)}if(Zc){for(oc=0;oc<vc;oc++)Ub=lc[oc],Ba=3*oc,Ac[Ba]=Ub.r,Ac[Ba+1]=Ub.g,Ac[Ba+2]=Ub.b;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,Ac,Kb)}if($c){for(pc=0;pc<Yc;pc++)xc=mc[pc],Ba=3*pc,Bc[Ba]=xc.x,Bc[Ba+1]=xc.y,Bc[Ba+2]=xc.z;k.bindBuffer(k.ARRAY_BUFFER,Cb.__webglNormalBuffer);k.bufferData(k.ARRAY_BUFFER,Bc,Kb)}if(Lc){yc=
|
|
@@ -504,24 +504,24 @@ Wb.length;Eb<jc;Eb++)if($=Wb[Eb],void 0===$.boundTo||"vertices"===$.boundTo)if(c
|
|
|
1]=Ea.y,$.array[ca+2]=Ea.z,ca+=3;else if(4===$.size)for(ja=0;ja<Fb;ja++)Qb=Vb[ja][1],Ea=$.value[Qb],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,$.array[ca+3]=Ea.w,ca+=4}}else{if(Wc)for(tb=0;tb<Oc;tb++)Pb=Ic[tb],ca=3*tb,ec[ca]=Pb.x,ec[ca+1]=Pb.y,ec[ca+2]=Pb.z;if(Xc)for(Ob=0;Ob<Vc;Ob++)bc=Pc[Ob],ca=3*Ob,fc[ca]=bc.r,fc[ca+1]=bc.g,fc[ca+2]=bc.b;if(Wb){Eb=0;for(jc=Wb.length;Eb<jc;Eb++)if($=Wb[Eb],$.needsUpdate&&(void 0===$.boundTo||"vertices"===$.boundTo))if(Fb=$.value.length,ca=0,1===$.size)for(ja=
|
|
|
0;ja<Fb;ja++)$.array[ja]=$.value[ja];else if(2===$.size)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,ca+=2;else if(3===$.size)if("c"===$.type)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.r,$.array[ca+1]=Ea.g,$.array[ca+2]=Ea.b,ca+=3;else for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,ca+=3;else if(4===$.size)for(ja=0;ja<Fb;ja++)Ea=$.value[ja],$.array[ca]=Ea.x,$.array[ca+1]=Ea.y,$.array[ca+2]=Ea.z,$.array[ca+3]=Ea.w,ca+=4}}if(Wc||
|
|
|
tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,ec,Nc);if(Xc||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,Nb.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fc,Nc);if(Wb){Eb=0;for(jc=Wb.length;Eb<jc;Eb++)if($=Wb[Eb],$.needsUpdate||tc.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,$.buffer),k.bufferData(k.ARRAY_BUFFER,$.array,Nc)}}j.verticesNeedUpdate=!1;j.colorsNeedUpdate=!1;p.attributes&&s(p)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",
|
|
|
-uc);var i,j,m,l,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=
|
|
|
-p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0;f=p=0;for(var s=b.length;f<s;f++)h=b[f],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&p++);f=q;h=r;g=p;r=p=0;for(q=b.length;r<q;r++)s=b[r],s.castShadow&&(s instanceof THREE.SpotLight&&p++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&p++);l=p;Bb&&d&&d.useVertexTexture?m=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)")),m=b);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
-fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:m,useVertexTexture:Bb&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:l,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
-shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,w,d=[];n?d.push(n):(d.push(r),d.push(q));for(v in s)d.push(v),d.push(s[v]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(v=V.length;t<v;t++)if(d=V[t],d.code===n){d.usedTimes++;j=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":
|
|
|
-c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");v=[];for(w in s)d=s[w],!1!==d&&(d="#define "+w+" "+d,v.push(d));d=v.join("\n");w=k.createProgram();v=["precision "+L+" float;",d,Gb?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,
|
|
|
+uc);var i,j,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=
|
|
|
+p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0;f=p=0;for(var s=b.length;f<s;f++)h=b[f],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h instanceof THREE.PointLight&&q++,h instanceof THREE.SpotLight&&r++,h instanceof THREE.HemisphereLight&&p++);f=q;h=r;g=p;r=p=0;for(q=b.length;r<q;r++)s=b[r],s.castShadow&&(s instanceof THREE.SpotLight&&p++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&p++);m=p;Bb&&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);a:{var r=a.fragmentShader,q=a.vertexShader,p=a.uniforms,b=a.attributes,s=a.defines,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
|
|
|
+fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:Bb&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:e,maxPointLights:f,maxSpotLights:h,maxHemiLights:g,maxShadows:m,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,
|
|
|
+shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,u,w,d=[];n?d.push(n):(d.push(r),d.push(q));for(u in s)d.push(u),d.push(s[u]);for(t in c)d.push(t),d.push(c[t]);n=d.join();t=0;for(u=V.length;t<u;t++)if(d=V[t],d.code===n){d.usedTimes++;j=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":
|
|
|
+c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");u=[];for(w in s)d=s[w],!1!==d&&(d="#define "+w+" "+d,u.push(d));d=u.join("\n");w=k.createProgram();u=["precision "+L+" float;",d,Gb?"#define VERTEX_TEXTURES":"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,
|
|
|
"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):
|
|
|
"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":
|
|
|
"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
t=["precision "+L+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",D.gammaInput?"#define GAMMA_INPUT":"",D.gammaOutput?"#define GAMMA_OUTPUT":"",D.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=J("vertex",v+q);t=J("fragment",t+r);k.attachShader(w,v);k.attachShader(w,t);k.linkProgram(w);k.getProgramParameter(w,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(w,k.VALIDATE_STATUS)+", gl error ["+
|
|
|
-k.getError()+"]");k.deleteShader(t);k.deleteShader(v);w.uniforms={};w.attributes={};var z;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(z in p)t.push(z);z=t;t=0;for(v=z.length;t<v;t++)p=z[t],w.uniforms[p]=k.getUniformLocation(w,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(z=0;z<c.maxMorphTargets;z++)t.push("morphTarget"+
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=J("vertex",u+q);t=J("fragment",t+r);k.attachShader(w,u);k.attachShader(w,t);k.linkProgram(w);k.getProgramParameter(w,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(w,k.VALIDATE_STATUS)+", gl error ["+
|
|
|
+k.getError()+"]");k.deleteShader(t);k.deleteShader(u);w.uniforms={};w.attributes={};var z;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(z in p)t.push(z);z=t;t=0;for(u=z.length;t<u;t++)p=z[t],w.uniforms[p]=k.getUniformLocation(w,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(z=0;z<c.maxMorphTargets;z++)t.push("morphTarget"+
|
|
|
z);for(z=0;z<c.maxMorphNormals;z++)t.push("morphNormal"+z);for(j in b)t.push(j);j=t;z=0;for(b=j.length;z<b;z++)t=j[z],w.attributes[t]=k.getAttribLocation(w,t);w.id=ea++;V.push({program:w,code:n,usedTimes:1});D.info.memory.programs=V.length;j=w}a.program=j;z=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(j=0;j<this.maxMorphTargets;j++)w=b+j,0<=z[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(j=0;j<this.maxMorphNormals;j++)w=
|
|
|
b+j,0<=z[w]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?k.disable(k.CULL_FACE):(b===THREE.FrontFaceDirectionCW?k.frontFace(k.CW):k.frontFace(k.CCW),a===THREE.CullFaceBack?k.cullFace(k.BACK):a===THREE.CullFaceFront?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;da!==
|
|
|
b&&(b?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),da=b);T!==a&&(a?k.frontFace(k.CW):k.frontFace(k.CCW),T=a)};this.setDepthTest=function(a){xa!==a&&(a?k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),xa=a)};this.setDepthWrite=function(a){bb!==a&&(k.depthMask(a),bb=a)};this.setBlending=function(a,b,c,d){a!==aa&&(a===THREE.NoBlending?k.disable(k.BLEND):a===THREE.AdditiveBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.SRC_ALPHA,k.ONE)):a===THREE.SubtractiveBlending?(k.enable(k.BLEND),
|
|
|
-k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(k.enable(k.BLEND),k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)),aa=a);if(a===THREE.CustomBlending){if(b!==la&&(k.blendEquation(w(b)),la=b),c!==Y||d!==ma)k.blendFunc(w(c),w(d)),Y=c,ma=d}else ma=Y=
|
|
|
-la=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",gc),a.__webglTexture=k.createTexture(),D.info.memory.textures++);k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);k.pixelStorei(k.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=w(a.format),
|
|
|
+k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(k.enable(k.BLEND),k.blendEquation(k.FUNC_ADD),k.blendFunc(k.ZERO,k.SRC_COLOR)):a===THREE.CustomBlending?k.enable(k.BLEND):(k.enable(k.BLEND),k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)),aa=a);if(a===THREE.CustomBlending){if(b!==ma&&(k.blendEquation(w(b)),ma=b),c!==ka||d!==X)k.blendFunc(w(c),w(d)),ka=c,X=d}else X=ka=
|
|
|
+ma=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",gc),a.__webglTexture=k.createTexture(),D.info.memory.textures++);k.activeTexture(k.TEXTURE0+b);k.bindTexture(k.TEXTURE_2D,a.__webglTexture);k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,a.flipY);k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);k.pixelStorei(k.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=w(a.format),
|
|
|
f=w(a.type);N(k.TEXTURE_2D,a,d);var h=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<h.length&&d){for(var g=0,i=h.length;g<i;g++)c=h[g],k.texImage2D(k.TEXTURE_2D,g,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){g=0;for(i=h.length;g<i;g++)c=h[g],k.compressedTexImage2D(k.TEXTURE_2D,g,e,c.width,c.height,0,c.data)}else if(0<h.length&&d){g=0;for(i=h.length;g<i;g++)c=h[g],k.texImage2D(k.TEXTURE_2D,
|
|
|
g,e,e,f,c);a.generateMipmaps=!1}else k.texImage2D(k.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&k.generateMipmap(k.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else k.activeTexture(k.TEXTURE0+b),k.bindTexture(k.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",mc);a.__webglTexture=
|
|
|
k.createTexture();D.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=w(a.format),e=w(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];k.bindTexture(k.TEXTURE_CUBE_MAP,a.__webglTexture);N(k.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=k.createFramebuffer();a.__webglRenderbuffer[f]=k.createRenderbuffer();k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var h=a,g=k.TEXTURE_CUBE_MAP_POSITIVE_X+f;k.bindFramebuffer(k.FRAMEBUFFER,
|
|
@@ -530,8 +530,9 @@ k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a
|
|
|
null);k.bindFramebuffer(k.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Qa,a=Ya,d=ua,e=Ra);b!==Ua&&(k.bindFramebuffer(k.FRAMEBUFFER,b),k.viewport(d,e,c,a),Ua=b);Xb=c;Jb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:
|
|
|
THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
|
THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,clone:function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;
|
|
|
-a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=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.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
|
|
|
-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.vertexColors=[new THREE.Color,new THREE.Color];this.material=null};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,j=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,m=i.length;b<m;b++){var n=i[b].clone();d&&n.applyMatrix4(d);g.push(n)}b=0;for(m=l.length;b<m;b++){var n=l[b],p,t,q=n.vertexNormals,r=n.vertexColors;n instanceof
|
|
|
+a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=
|
|
|
+0};THREE.RenderableFace4=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,
|
|
|
+new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=0};THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0};THREE.RenderableParticle=function(){this.id=0;this.object=null;this.z=this.y=this.x=0;this.rotation=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.vertexColors=[new THREE.Color,new THREE.Color];this.material=null;this.z=0};THREE.GeometryUtils={merge:function(a,b,c){var d,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,i=h.vertices,j=a.faces,l=h.faces,a=a.faceVertexUvs[0],h=h.faceVertexUvs[0];void 0===c&&(c=0);b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,e=(new THREE.Matrix3).getNormalMatrix(d));for(var b=0,m=i.length;b<m;b++){var n=i[b].clone();d&&n.applyMatrix4(d);g.push(n)}b=0;for(m=l.length;b<m;b++){var n=l[b],p,t,q=n.vertexNormals,r=n.vertexColors;n instanceof
|
|
|
THREE.Face3?p=new THREE.Face3(n.a+f,n.b+f,n.c+f):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a+f,n.b+f,n.c+f,n.d+f));p.normal.copy(n.normal);e&&p.normal.applyMatrix3(e).normalize();g=0;for(i=q.length;g<i;g++)t=q[g].clone(),e&&t.applyMatrix3(e).normalize(),p.vertexNormals.push(t);p.color.copy(n.color);g=0;for(i=r.length;g<i;g++)t=r[g],p.vertexColors.push(t.clone());p.materialIndex=n.materialIndex+c;p.centroid.copy(n.centroid);d&&p.centroid.applyMatrix4(d);j.push(p)}b=0;for(m=h.length;b<m;b++){c=
|
|
|
h[b];d=[];g=0;for(i=c.length;g<i;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));a.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,h=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||h.push(f);a.faces=h},randomPointInTriangle:function(a,b,c){var d,e,f,h=new THREE.Vector3,g=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;h.copy(a);h.multiplyScalar(d);g.copy(b);g.multiplyScalar(e);
|
|
|
h.add(g);g.copy(c);g.multiplyScalar(f);h.add(g);return h},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],h;c?a._area1&&a._area2?(c=a._area1,h=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),h=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=h):(c=
|
|
@@ -547,14 +548,14 @@ i,!0);j.responseType="arraybuffer";j.send(null)}else j=new XMLHttpRequest,j.onlo
|
|
|
b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),h=c("DXT5"),g=new Int32Array(a,0,31);if(542327876!==g[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!g[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),d;var i=g[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;
|
|
|
break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case h:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;g[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,g[7]));d.isCubemap=g[28]&512?!0:!1;d.width=g[4];d.height=g[3];for(var g=g[1]+4,f=d.width,h=d.height,i=d.isCubemap?6:1,j=0;j<i;j++){for(var l=0;l<d.mipmapCount;l++){var m=Math.max(4,f)/
|
|
|
4*Math.max(4,h)/4*e,n={data:new Uint8Array(a,g,m),width:f,height:h};d.mipmaps.push(n);g+=m;f=Math.max(0.5*f,1);h=Math.max(0.5*h,1)}f=d.width;h=d.height}return d},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var h=f.getContext("2d");h.drawImage(a,0,0);for(var g=h.getImageData(0,0,d,e).data,i=h.createImageData(d,e),j=i.data,l=0;l<d;l++)for(var m=
|
|
|
-0;m<e;m++){var n=0>m-1?0:m-1,p=m+1>e-1?e-1:m+1,t=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,r=[],s=[0,0,g[4*(m*d+l)]/255*b];r.push([-1,0,g[4*(m*d+t)]/255*b]);r.push([-1,-1,g[4*(n*d+t)]/255*b]);r.push([0,-1,g[4*(n*d+l)]/255*b]);r.push([1,-1,g[4*(n*d+q)]/255*b]);r.push([1,0,g[4*(m*d+q)]/255*b]);r.push([1,1,g[4*(p*d+q)]/255*b]);r.push([0,1,g[4*(p*d+l)]/255*b]);r.push([-1,1,g[4*(p*d+t)]/255*b]);n=[];t=r.length;for(p=0;p<t;p++){var q=r[p],v=r[(p+1)%t],q=[q[0]-s[0],q[1]-s[1],q[2]-s[2]],v=[v[0]-s[0],v[1]-s[1],v[2]-s[2]];
|
|
|
-n.push(c([q[1]*v[2]-q[2]*v[1],q[2]*v[0]-q[0]*v[2],q[0]*v[1]-q[1]*v[0]]))}r=[0,0,0];for(p=0;p<n.length;p++)r[0]+=n[p][0],r[1]+=n[p][1],r[2]+=n[p][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;s=4*(m*d+l);j[s]=255*((r[0]+1)/2)|0;j[s+1]=255*((r[1]+1)/2)|0;j[s+2]=255*r[2]|0;j[s+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,
|
|
|
+0;m<e;m++){var n=0>m-1?0:m-1,p=m+1>e-1?e-1:m+1,t=0>l-1?0:l-1,q=l+1>d-1?d-1:l+1,r=[],s=[0,0,g[4*(m*d+l)]/255*b];r.push([-1,0,g[4*(m*d+t)]/255*b]);r.push([-1,-1,g[4*(n*d+t)]/255*b]);r.push([0,-1,g[4*(n*d+l)]/255*b]);r.push([1,-1,g[4*(n*d+q)]/255*b]);r.push([1,0,g[4*(m*d+q)]/255*b]);r.push([1,1,g[4*(p*d+q)]/255*b]);r.push([0,1,g[4*(p*d+l)]/255*b]);r.push([-1,1,g[4*(p*d+t)]/255*b]);n=[];t=r.length;for(p=0;p<t;p++){var q=r[p],u=r[(p+1)%t],q=[q[0]-s[0],q[1]-s[1],q[2]-s[2]],u=[u[0]-s[0],u[1]-s[1],u[2]-s[2]];
|
|
|
+n.push(c([q[1]*u[2]-q[2]*u[1],q[2]*u[0]-q[0]*u[2],q[0]*u[1]-q[1]*u[0]]))}r=[0,0,0];for(p=0;p<n.length;p++)r[0]+=n[p][0],r[1]+=n[p][1],r[2]+=n[p][2];r[0]/=n.length;r[1]/=n.length;r[2]/=n.length;s=4*(m*d+l);j[s]=255*((r[0]+1)/2)|0;j[s+1]=255*((r[1]+1)/2)|0;j[s+2]=255*r[2]|0;j[s+3]=255}h.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),h=Math.floor(255*c.g),c=Math.floor(255*c.b),g=0;g<d;g++)e[3*g]=f,e[3*g+1]=h,e[3*g+2]=c;a=new THREE.DataTexture(e,
|
|
|
a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
|
0,e=String(a).split(""),f=e.length,h=[],a=0;a<f;a++){var g=new THREE.Path,g=this.extractGlyphPoints(e[a],b,c,d,g),d=d+g.offset;h.push(g.path)}return{paths:h,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],h,g,i,j,l,m,n,p,t,q,r,s=b.glyphs[a]||b.glyphs["?"];if(s){if(s.o){b=s._cachedOutline||(s._cachedOutline=s.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;l=b[a++]*c;e.moveTo(i,l);break;case "l":i=b[a++]*c+d;l=b[a++]*c;e.lineTo(i,l);break;case "q":i=b[a++]*
|
|
|
-c+d;l=b[a++]*c;p=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(p,t,i,l);if(h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var v=h/g;THREE.Shape.Utils.b2(v,m,p,i);THREE.Shape.Utils.b2(v,n,t,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,p=b[a++]*c+d,t=b[a++]*-c,q=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,l,p,t,q,r),h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)v=h/g,THREE.Shape.Utils.b3(v,m,p,q,i),THREE.Shape.Utils.b3(v,n,t,r,l)}}}return{offset:s.ha*c,path:e}}}};
|
|
|
+c+d;l=b[a++]*c;p=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(p,t,i,l);if(h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++){var u=h/g;THREE.Shape.Utils.b2(u,m,p,i);THREE.Shape.Utils.b2(u,n,t,l)}}break;case "b":if(i=b[a++]*c+d,l=b[a++]*c,p=b[a++]*c+d,t=b[a++]*-c,q=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,l,p,t,q,r),h=f[f.length-1]){m=h.x;n=h.y;h=1;for(g=this.divisions;h<=g;h++)u=h/g,THREE.Shape.Utils.b3(u,m,p,q,i),THREE.Shape.Utils.b3(u,n,t,r,l)}}}return{offset:s.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)h[j]=j;else for(j=0;j<e;j++)h[j]=e-1-j;var m=2*e;for(j=e-1;2<e;){if(0>=m--){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 n;a:{var p=n=void 0,t=void 0,q=void 0,r=void 0,s=void 0,v=void 0,z=void 0,C=
|
|
|
-void 0,p=a[h[i]].x,t=a[h[i]].y,q=a[h[j]].x,r=a[h[j]].y,s=a[h[l]].x,v=a[h[l]].y;if(1E-10>(q-p)*(v-t)-(r-t)*(s-p))n=!1;else{var F=void 0,H=void 0,I=void 0,G=void 0,A=void 0,K=void 0,B=void 0,J=void 0,N=void 0,y=void 0,N=J=B=C=z=void 0,F=s-q,H=v-r,I=p-s,G=t-v,A=q-p,K=r-t;for(n=0;n<e;n++)if(!(n===i||n===j||n===l))if(z=a[h[n]].x,C=a[h[n]].y,B=z-p,J=C-t,N=z-q,y=C-r,z-=s,C-=v,N=F*y-H*N,B=A*J-K*B,J=I*C-G*z,0<=N&&0<=J&&0<=B){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[j]],a[h[l]]]);g.push([h[i],h[j],h[l]]);
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,h=0;h<b;f=h++)e+=a[f].x*a[h].y-a[h].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],h=[],g=[],i,j,l;if(0<b(a))for(j=0;j<e;j++)h[j]=j;else for(j=0;j<e;j++)h[j]=e-1-j;var m=2*e;for(j=e-1;2<e;){if(0>=m--){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 n;a:{var p=n=void 0,t=void 0,q=void 0,r=void 0,s=void 0,u=void 0,z=void 0,C=
|
|
|
+void 0,p=a[h[i]].x,t=a[h[i]].y,q=a[h[j]].x,r=a[h[j]].y,s=a[h[l]].x,u=a[h[l]].y;if(1E-10>(q-p)*(u-t)-(r-t)*(s-p))n=!1;else{var F=void 0,H=void 0,I=void 0,G=void 0,A=void 0,K=void 0,B=void 0,J=void 0,N=void 0,y=void 0,N=J=B=C=z=void 0,F=s-q,H=u-r,I=p-s,G=t-u,A=q-p,K=r-t;for(n=0;n<e;n++)if(!(n===i||n===j||n===l))if(z=a[h[n]].x,C=a[h[n]].y,B=z-p,J=C-t,N=z-q,y=C-r,z-=s,C-=u,N=F*y-H*N,B=A*J-K*B,J=I*C-G*z,0<=N&&0<=J&&0<=B){n=!1;break a}n=!0}}if(n){f.push([a[h[i]],a[h[j]],a[h[l]]]);g.push([h[i],h[j],h[l]]);
|
|
|
i=j;for(l=j+1;l<e;i++,l++)h[i]=h[l];e--;m=2*e}}return d?g:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var h=0,g=e-1,i;h<=g;)if(d=Math.floor(h+(g-h)/2),i=c[d]-f,0>i)h=d+1;else if(0<i)g=d-1;else{g=d;break}d=g;if(c[d]==f)return d/(e-1);h=c[d];return c=(d+(f-h)/(c[d+1]-h))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().sub(b).normalize()};
|
|
@@ -621,16 +622,16 @@ THREE.CombinedCamera.prototype.setSize=function(a,b){this.cameraP.aspect=a/b;thi
|
|
|
THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPerspectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var h=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(h);for(e=0;e<=b;e++){var g=new THREE.Vector3,i=c+e/b*d;g.x=a*Math.cos(i);g.y=a*Math.sin(i);this.vertices.push(g);f.push(new THREE.Vector2((g.x/a+1)/2,(g.y/a+1)/2))}c=new THREE.Vector3(0,0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),this.faceVertexUvs[0].push([f[e],
|
|
|
-f[e+1],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,q){var r,s=g.widthSegments,v=g.heightSegments,z=e/2,C=f/2,F=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)r="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)r="y",v=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)r="x",s=g.depthSegments;var H=s+1,I=v+1,G=e/s,A=f/v,K=new THREE.Vector3;K[r]=0<h?1:-1;for(e=0;e<I;e++)for(f=0;f<H;f++){var B=new THREE.Vector3;B[a]=(f*G-z)*c;B[b]=(e*A-C)*d;B[r]=h;g.vertices.push(B)}for(e=
|
|
|
-0;e<v;e++)for(f=0;f<s;f++)a=new THREE.Face4(f+H*e+F,f+H*(e+1)+F,f+1+H*(e+1)+F,f+1+H*e+F),a.normal.copy(K),a.vertexNormals.push(K.clone(),K.clone(),K.clone(),K.clone()),a.materialIndex=q,g.faces.push(a),g.faceVertexUvs[0].push([new THREE.Vector2(f/s,1-e/v),new THREE.Vector2(f/s,1-(e+1)/v),new THREE.Vector2((f+1)/s,1-(e+1)/v),new THREE.Vector2((f+1)/s,1-e/v)])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
+f[e+1],h]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function h(a,b,c,d,e,f,h,q){var r,s=g.widthSegments,u=g.heightSegments,z=e/2,C=f/2,F=g.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)r="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)r="y",u=g.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)r="x",s=g.depthSegments;var H=s+1,I=u+1,G=e/s,A=f/u,K=new THREE.Vector3;K[r]=0<h?1:-1;for(e=0;e<I;e++)for(f=0;f<H;f++){var B=new THREE.Vector3;B[a]=(f*G-z)*c;B[b]=(e*A-C)*d;B[r]=h;g.vertices.push(B)}for(e=
|
|
|
+0;e<u;e++)for(f=0;f<s;f++)a=new THREE.Face4(f+H*e+F,f+H*(e+1)+F,f+1+H*(e+1)+F,f+1+H*e+F),a.normal.copy(K),a.vertexNormals.push(K.clone(),K.clone(),K.clone(),K.clone()),a.materialIndex=q,g.faces.push(a),g.faceVertexUvs[0].push([new THREE.Vector2(f/s,1-e/u),new THREE.Vector2(f/s,1-(e+1)/u),new THREE.Vector2((f+1)/s,1-(e+1)/u),new THREE.Vector2((f+1)/s,1-e/u)])}THREE.Geometry.call(this);var g=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
f||1;a=this.width/2;b=this.height/2;c=this.depth/2;h("z","y",-1,-1,this.depth,this.height,a,0);h("z","y",1,-1,this.depth,this.height,-a,1);h("x","z",1,1,this.width,this.depth,b,2);h("x","z",1,-1,this.width,this.depth,-b,3);h("x","y",1,-1,this.width,this.height,c,4);h("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.radiusTop=a=void 0!==a?a:20;this.radiusBottom=b=void 0!==b?b:20;this.height=c=void 0!==c?c:100;this.radialSegments=d=d||8;this.heightSegments=e=e||1;this.openEnded=f=void 0!==f?f:!1;var h=c/2,g,i,j=[],l=[];for(i=0;i<=e;i++){var m=[],n=[],p=i/e,t=p*(b-a)+a;for(g=0;g<=d;g++){var q=g/d,r=new THREE.Vector3;r.x=t*Math.sin(2*q*Math.PI);r.y=-p*c+h;r.z=t*Math.cos(2*q*Math.PI);this.vertices.push(r);m.push(this.vertices.length-1);n.push(new THREE.Vector2(q,
|
|
|
-1-p))}j.push(m);l.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(m=this.vertices[j[0][g]].clone(),n=this.vertices[j[0][g+1]].clone()):(m=this.vertices[j[1][g]].clone(),n=this.vertices[j[1][g+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][g],t=j[i+1][g],q=j[i+1][g+1],r=j[i][g+1],s=m.clone(),v=m.clone(),z=n.clone(),C=n.clone(),F=l[i][g].clone(),H=l[i+1][g].clone(),I=l[i+1][g+1].clone(),G=l[i][g+1].clone();this.faces.push(new THREE.Face4(p,
|
|
|
-t,q,r,[s,v,z,C]));this.faceVertexUvs[0].push([F,H,I,G])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)p=j[0][g],t=j[0][g+1],q=this.vertices.length-1,s=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),F=l[0][g].clone(),H=l[0][g+1].clone(),I=new THREE.Vector2(H.u,0),this.faces.push(new THREE.Face3(p,t,q,[s,v,z])),this.faceVertexUvs[0].push([F,H,I])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)p=j[i][g+1],
|
|
|
-t=j[i][g],q=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),F=l[i][g+1].clone(),H=l[i][g].clone(),I=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(p,t,q,[s,v,z])),this.faceVertexUvs[0].push([F,H,I])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
+1-p))}j.push(m);l.push(n)}c=(b-a)/c;for(g=0;g<d;g++){0!==a?(m=this.vertices[j[0][g]].clone(),n=this.vertices[j[0][g+1]].clone()):(m=this.vertices[j[1][g]].clone(),n=this.vertices[j[1][g+1]].clone());m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();for(i=0;i<e;i++){var p=j[i][g],t=j[i+1][g],q=j[i+1][g+1],r=j[i][g+1],s=m.clone(),u=m.clone(),z=n.clone(),C=n.clone(),F=l[i][g].clone(),H=l[i+1][g].clone(),I=l[i+1][g+1].clone(),G=l[i][g+1].clone();this.faces.push(new THREE.Face4(p,
|
|
|
+t,q,r,[s,u,z,C]));this.faceVertexUvs[0].push([F,H,I,G])}}if(!1===f&&0<a){this.vertices.push(new THREE.Vector3(0,h,0));for(g=0;g<d;g++)p=j[0][g],t=j[0][g+1],q=this.vertices.length-1,s=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),F=l[0][g].clone(),H=l[0][g+1].clone(),I=new THREE.Vector2(H.u,0),this.faces.push(new THREE.Face3(p,t,q,[s,u,z])),this.faceVertexUvs[0].push([F,H,I])}if(!1===f&&0<b){this.vertices.push(new THREE.Vector3(0,-h,0));for(g=0;g<d;g++)p=j[i][g+1],
|
|
|
+t=j[i][g],q=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),F=l[i][g+1].clone(),H=l[i][g].clone(),I=new THREE.Vector2(H.u,1),this.faces.push(new THREE.Face3(p,t,q,[s,u,z])),this.faceVertexUvs[0].push([F,H,I])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).add(f);i.copy(a).add(g);if(h.equals(i))return g.clone();
|
|
|
h.copy(b).add(f);i.copy(c).add(g);f=d.dot(g);g=i.sub(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);for(var g=0,h=p+2*l,
|
|
|
-g=0;g<h;g++){var i=oa*g,j=oa*(g+1),m=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,q=c,r=g,s=h,t=e,w=f,m=m+J,i=i+J,n=n+J,j=j+J;B.faces.push(new THREE.Face4(m,i,n,j,null,null,v));m=z.generateSideWallUV(B,a,q,b,m,i,n,j,r,s,t,w);B.faceVertexUvs[0].push(m)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=J;d+=J;e+=J;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?z.generateBottomUV(B,a,b,c,d,e):z.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
|
|
|
-100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,p=void 0!==b.steps?b.steps:1,t=b.extrudePath,q,r=!1,s=b.material,v=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,C,F,H,I;t&&(q=t.getSpacedPoints(p),r=!0,m=!1,C=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,p,
|
|
|
+g=0;g<h;g++){var i=oa*g,j=oa*(g+1),m=d+e+i,i=d+f+i,n=d+f+j,j=d+e+j,q=c,r=g,s=h,t=e,w=f,m=m+J,i=i+J,n=n+J,j=j+J;B.faces.push(new THREE.Face4(m,i,n,j,null,null,u));m=z.generateSideWallUV(B,a,q,b,m,i,n,j,r,s,t,w);B.faceVertexUvs[0].push(m)}}}function f(a,b,c){B.vertices.push(new THREE.Vector3(a,b,c))}function h(c,d,e,f){c+=J;d+=J;e+=J;B.faces.push(new THREE.Face3(c,d,e,null,null,s));c=f?z.generateBottomUV(B,a,b,c,d,e):z.generateTopUV(B,a,b,c,d,e);B.faceVertexUvs[0].push(c)}var g=void 0!==b.amount?b.amount:
|
|
|
+100,i=void 0!==b.bevelThickness?b.bevelThickness:6,j=void 0!==b.bevelSize?b.bevelSize:i-2,l=void 0!==b.bevelSegments?b.bevelSegments:3,m=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments:12,p=void 0!==b.steps?b.steps:1,t=b.extrudePath,q,r=!1,s=b.material,u=b.extrudeMaterial,z=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,C,F,H,I;t&&(q=t.getSpacedPoints(p),r=!0,m=!1,C=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,p,
|
|
|
!1),F=new THREE.Vector3,H=new THREE.Vector3,I=new THREE.Vector3);m||(j=i=l=0);var G,A,K,B=this,J=this.vertices.length,n=a.extractPoints(n),N=n.shape,n=n.holes;if(t=!THREE.Shape.Utils.isClockWise(N)){N=N.reverse();A=0;for(K=n.length;A<K;A++)G=n[A],THREE.Shape.Utils.isClockWise(G)&&(n[A]=G.reverse());t=!1}var y=THREE.Shape.Utils.triangulateShape(N,n),t=N;A=0;for(K=n.length;A<K;A++)G=n[A],N=N.concat(G);var M,w,Z,L,oa=N.length,Pa=y.length,Va=[],O=0,qa=t.length;M=qa-1;for(w=O+1;O<qa;O++,M++,w++)M===qa&&
|
|
|
(M=0),w===qa&&(w=0),Va[O]=d(t[O],t[M],t[w]);var Fa=[],wa,D=Va.concat();A=0;for(K=n.length;A<K;A++){G=n[A];wa=[];O=0;qa=G.length;M=qa-1;for(w=O+1;O<qa;O++,M++,w++)M===qa&&(M=0),w===qa&&(w=0),wa[O]=d(G[O],G[M],G[w]);Fa.push(wa);D=D.concat(wa)}for(M=0;M<l;M++){G=M/l;Z=i*(1-G);w=j*Math.sin(G*Math.PI/2);O=0;for(qa=t.length;O<qa;O++)L=c(t[O],Va[O],w),f(L.x,L.y,-Z);A=0;for(K=n.length;A<K;A++){G=n[A];wa=Fa[A];O=0;for(qa=G.length;O<qa;O++)L=c(G[O],wa[O],w),f(L.x,L.y,-Z)}}w=j;for(O=0;O<oa;O++)L=m?c(N[O],D[O],
|
|
|
w):N[O],r?(H.copy(C.normals[0]).multiplyScalar(L.x),F.copy(C.binormals[0]).multiplyScalar(L.y),I.copy(q[0]).add(H).add(F),f(I.x,I.y,I.z)):f(L.x,L.y,0);for(G=1;G<=p;G++)for(O=0;O<oa;O++)L=m?c(N[O],D[O],w):N[O],r?(H.copy(C.normals[G]).multiplyScalar(L.x),F.copy(C.binormals[G]).multiplyScalar(L.y),I.copy(q[G]).add(H).add(F),f(I.x,I.y,I.z)):f(L.x,L.y,g/p*G);for(M=l-1;0<=M;M--){G=M/l;Z=i*(1-G);w=j*Math.sin(G*Math.PI/2);O=0;for(qa=t.length;O<qa;O++)L=c(t[O],Va[O],w),f(L.x,L.y,g+Z);A=0;for(K=n.length;A<
|
|
@@ -656,7 +657,7 @@ THREE.TubeGeometry.FrenetFrames=function(a,b,c){new THREE.Vector3;var d=new THRE
|
|
|
d).normalize();f[0].crossVectors(e[0],g);h[0].crossVectors(e[0],f[0]);for(j=1;j<b;j++)f[j]=f[j-1].clone(),h[j]=h[j-1].clone(),g.crossVectors(e[j-1],e[j]),1E-4<g.length()&&(g.normalize(),d=Math.acos(THREE.Math.clamp(e[j-1].dot(e[j]),-1,1)),f[j].applyMatrix4(i.makeRotationAxis(g,d))),h[j].crossVectors(e[j],f[j]);if(c){d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1));d/=b-1;0<e[0].dot(g.crossVectors(f[0],f[b-1]))&&(d=-d);for(j=1;j<b;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),h[j].crossVectors(e[j],
|
|
|
f[j])}};THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=g.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);d.centroid.add(a).add(b).add(c).divideScalar(3);g.faces.push(d);d=Math.atan2(d.centroid.z,-d.centroid.x);g.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),
|
|
|
h(c.uv,c,d)])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+0.5,a.y));return a.clone()}THREE.Geometry.call(this);for(var c=c||1,d=d||0,g=this,i=0,j=a.length;i<j;i++)e(new THREE.Vector3(a[i][0],a[i][1],a[i][2]));for(var l=this.vertices,a=[],i=0,j=b.length;i<j;i++){var m=l[b[i][0]],n=l[b[i][1]],p=l[b[i][2]];a[i]=new THREE.Face3(m.index,n.index,p.index,[m.clone(),n.clone(),p.clone()])}i=0;for(j=a.length;i<j;i++){n=a[i];l=d;b=Math.pow(2,
|
|
|
-l);Math.pow(4,l);for(var l=e(g.vertices[n.a]),m=e(g.vertices[n.b]),t=e(g.vertices[n.c]),n=[],p=0;p<=b;p++){n[p]=[];for(var q=e(l.clone().lerp(t,p/b)),r=e(m.clone().lerp(t,p/b)),s=b-p,v=0;v<=s;v++)n[p][v]=0==v&&p==b?q:e(q.clone().lerp(r,v/s))}for(p=0;p<b;p++)for(v=0;v<2*(b-p)-1;v++)l=Math.floor(v/2),0==v%2?f(n[p][l+1],n[p+1][l],n[p][l]):f(n[p][l+1],n[p+1][l+1],n[p+1][l])}i=0;for(j=this.faceVertexUvs[0].length;i<j;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,m=Math.max(a,Math.max(b,l)),
|
|
|
+l);Math.pow(4,l);for(var l=e(g.vertices[n.a]),m=e(g.vertices[n.b]),t=e(g.vertices[n.c]),n=[],p=0;p<=b;p++){n[p]=[];for(var q=e(l.clone().lerp(t,p/b)),r=e(m.clone().lerp(t,p/b)),s=b-p,u=0;u<=s;u++)n[p][u]=0==u&&p==b?q:e(q.clone().lerp(r,u/s))}for(p=0;p<b;p++)for(u=0;u<2*(b-p)-1;u++)l=Math.floor(u/2),0==u%2?f(n[p][l+1],n[p+1][l],n[p][l]):f(n[p][l+1],n[p+1][l+1],n[p+1][l])}i=0;for(j=this.faceVertexUvs[0].length;i<j;i++)d=this.faceVertexUvs[0][i],a=d[0].x,b=d[1].x,l=d[2].x,m=Math.max(a,Math.max(b,l)),
|
|
|
n=Math.min(a,Math.min(b,l)),0.9<m&&0.1>n&&(0.2>a&&(d[0].x+=1),0.2>b&&(d[1].x+=1),0.2>l&&(d[2].x+=1));i=0;for(j=this.vertices.length;i<j;i++)this.vertices[i].multiplyScalar(c);this.mergeVertices();this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.IcosahedronGeometry=function(a,b){this.radius=a;this.detail=b;var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry=function(a,b,c,d){THREE.Geometry.call(this);var e=this.vertices,f=this.faces,h=this.faceVertexUvs[0],d=void 0===d?!1:d,g,i,j,l,m=b+1;for(g=0;g<=c;g++){l=g/c;for(i=0;i<=b;i++)j=i/b,j=a(j,l),e.push(j)}var n,p,t,q;for(g=0;g<c;g++)for(i=0;i<b;i++)a=g*m+i,e=g*m+i+1,l=(g+1)*m+i,j=(g+1)*m+i+1,n=new THREE.Vector2(i/b,g/c),p=new THREE.Vector2((i+1)/b,g/c),t=new THREE.Vector2(i/b,(g+1)/c),q=new THREE.Vector2((i+1)/b,(g+1)/c),d?(f.push(new THREE.Face3(a,e,l)),f.push(new THREE.Face3(e,
|
|
|
j,l)),h.push([n,p,t]),h.push([p,q,t])):(f.push(new THREE.Face4(a,e,j,l)),h.push([n,p,q,t]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var a=a||1,b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a,0,0),new THREE.Vector3,new THREE.Vector3(0,a,0),new THREE.Vector3,new THREE.Vector3(0,0,a));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
|
THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=1);this.position=b;b=new THREE.Geometry;b.vertices.push(new THREE.Vector3(0,0,0));b.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(b,new THREE.LineBasicMaterial({color:d}));this.line.matrixAutoUpdate=!1;this.add(this.line);b=new THREE.CylinderGeometry(0,0.05,0.25,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,0.875,0));this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:d}));
|
|
@@ -693,29 +694,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
|
e[t++]=0;e[t++]=0;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=1;e[t++]=-1;e[t++]=1;e[t++]=0;e[t++]=1;t=0;f[t++]=0;f[t++]=1;f[t++]=2;f[t++]=0;f[t++]=2;f[t++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();j=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,j);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,m=a(THREE.ShaderFlares.lensFlare,d)):(l=!0,m=a(THREE.ShaderFlares.lensFlareVertexTexture,d));n={};p={};n.vertex=b.getAttribLocation(m,"position");n.uv=b.getAttribLocation(m,"uv");p.renderType=b.getUniformLocation(m,"renderType");p.map=b.getUniformLocation(m,"map");p.occlusionMap=b.getUniformLocation(m,"occlusionMap");p.opacity=
|
|
|
-b.getUniformLocation(m,"opacity");p.color=b.getUniformLocation(m,"color");p.scale=b.getUniformLocation(m,"scale");p.rotation=b.getUniformLocation(m,"rotation");p.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,v=a.length;if(v){var z=new THREE.Vector3,C=f/e,F=0.5*e,H=0.5*f,I=16/f,G=new THREE.Vector2(I*C,I),A=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),B=p,I=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
-b.uniform1i(B.occlusionMap,0);b.uniform1i(B.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,N,y,M,w;for(J=0;J<v;J++)if(I=16/f,G.set(I*C,I),M=a[J],z.set(M.matrixWorld.elements[12],M.matrixWorld.elements[13],M.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyProjection(d.projectionMatrix),A.copy(z),K.x=A.x*F+F,
|
|
|
+b.getUniformLocation(m,"opacity");p.color=b.getUniformLocation(m,"color");p.scale=b.getUniformLocation(m,"scale");p.rotation=b.getUniformLocation(m,"rotation");p.screenPosition=b.getUniformLocation(m,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,u=a.length;if(u){var z=new THREE.Vector3,C=f/e,F=0.5*e,H=0.5*f,I=16/f,G=new THREE.Vector2(I*C,I),A=new THREE.Vector3(1,1,0),K=new THREE.Vector2(1,1),B=p,I=n;b.useProgram(m);b.enableVertexAttribArray(n.vertex);b.enableVertexAttribArray(n.uv);
|
|
|
+b.uniform1i(B.occlusionMap,0);b.uniform1i(B.map,1);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(I.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(I.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.disable(b.CULL_FACE);b.depthMask(!1);var J,N,y,M,w;for(J=0;J<u;J++)if(I=16/f,G.set(I*C,I),M=a[J],z.set(M.matrixWorld.elements[12],M.matrixWorld.elements[13],M.matrixWorld.elements[14]),z.applyMatrix4(d.matrixWorldInverse),z.applyProjection(d.projectionMatrix),A.copy(z),K.x=A.x*F+F,
|
|
|
K.y=A.y*H+H,l||0<K.x&&K.x<e&&0<K.y&&K.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,K.x-8,K.y-8,16,16,0);b.uniform1i(B.renderType,0);b.uniform2f(B.scale,G.x,G.y);b.uniform3f(B.screenPosition,A.x,A.y,A.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,j);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,K.x-8,K.y-8,16,16,0);b.uniform1i(B.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);M.positionScreen.copy(A);M.customUpdateCallback?M.customUpdateCallback(M):M.updateLensFlares();b.uniform1i(B.renderType,2);b.enable(b.BLEND);N=0;for(y=M.lensFlares.length;N<y;N++)w=M.lensFlares[N],0.001<w.opacity&&0.001<w.scale&&(A.x=w.x,A.y=w.y,A.z=w.z,I=w.size*w.scale/f,G.x=I*C,G.y=I,b.uniform3f(B.screenPosition,A.x,A.y,A.z),b.uniform2f(B.scale,G.x,G.y),b.uniform1f(B.rotation,w.rotation),b.uniform1f(B.opacity,
|
|
|
w.opacity),b.uniform3f(B.color,w.color.r,w.color.g,w.color.b),c.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst),c.setTexture(w.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4,i=new THREE.Vector3,j=new THREE.Vector3,l=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var p,t,q,r,s,v,z,C,F,H=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var p,t,q,r,s,u,z,C,F,H=[];r=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);p=0;for(t=m.__lights.length;p<t;p++)if(q=m.__lights[p],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(s=0;s<q.shadowCascadeCount;s++){var I;if(q.shadowCascadeArray[s])I=q.shadowCascadeArray[s];else{F=q;z=s;I=new THREE.DirectionalLight;I.isVirtual=!0;I.onlyShadow=!0;I.castShadow=!0;I.shadowCameraNear=F.shadowCameraNear;I.shadowCameraFar=F.shadowCameraFar;I.shadowCameraLeft=F.shadowCameraLeft;I.shadowCameraRight=F.shadowCameraRight;
|
|
|
-I.shadowCameraBottom=F.shadowCameraBottom;I.shadowCameraTop=F.shadowCameraTop;I.shadowCameraVisible=F.shadowCameraVisible;I.shadowDarkness=F.shadowDarkness;I.shadowBias=F.shadowCascadeBias[z];I.shadowMapWidth=F.shadowCascadeWidth[z];I.shadowMapHeight=F.shadowCascadeHeight[z];I.pointsWorld=[];I.pointsFrustum=[];C=I.pointsWorld;v=I.pointsFrustum;for(var G=0;8>G;G++)C[G]=new THREE.Vector3,v[G]=new THREE.Vector3;C=F.shadowCascadeNearZ[z];F=F.shadowCascadeFarZ[z];v[0].set(-1,-1,C);v[1].set(1,-1,C);v[2].set(-1,
|
|
|
-1,C);v[3].set(1,1,C);v[4].set(-1,-1,F);v[5].set(1,-1,F);v[6].set(-1,1,F);v[7].set(1,1,F);I.originalCamera=n;v=new THREE.Gyroscope;v.position=q.shadowCascadeOffset;v.add(I);v.add(I.target);n.add(v);q.shadowCascadeArray[s]=I;console.log("Created virtualLight",I)}z=q;C=s;F=z.shadowCascadeArray[C];F.position.copy(z.position);F.target.position.copy(z.target.position);F.lookAt(F.target);F.shadowCameraVisible=z.shadowCameraVisible;F.shadowDarkness=z.shadowDarkness;F.shadowBias=z.shadowCascadeBias[C];v=z.shadowCascadeNearZ[C];
|
|
|
-z=z.shadowCascadeFarZ[C];F=F.pointsFrustum;F[0].z=v;F[1].z=v;F[2].z=v;F[3].z=v;F[4].z=z;F[5].z=z;F[6].z=z;F[7].z=z;H[r]=I;r++}else H[r]=q,r++;p=0;for(t=H.length;p<t;p++){q=H[p];q.shadowMap||(s=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(s=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:s,magFilter:s,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
+I.shadowCameraBottom=F.shadowCameraBottom;I.shadowCameraTop=F.shadowCameraTop;I.shadowCameraVisible=F.shadowCameraVisible;I.shadowDarkness=F.shadowDarkness;I.shadowBias=F.shadowCascadeBias[z];I.shadowMapWidth=F.shadowCascadeWidth[z];I.shadowMapHeight=F.shadowCascadeHeight[z];I.pointsWorld=[];I.pointsFrustum=[];C=I.pointsWorld;u=I.pointsFrustum;for(var G=0;8>G;G++)C[G]=new THREE.Vector3,u[G]=new THREE.Vector3;C=F.shadowCascadeNearZ[z];F=F.shadowCascadeFarZ[z];u[0].set(-1,-1,C);u[1].set(1,-1,C);u[2].set(-1,
|
|
|
+1,C);u[3].set(1,1,C);u[4].set(-1,-1,F);u[5].set(1,-1,F);u[6].set(-1,1,F);u[7].set(1,1,F);I.originalCamera=n;u=new THREE.Gyroscope;u.position=q.shadowCascadeOffset;u.add(I);u.add(I.target);n.add(u);q.shadowCascadeArray[s]=I;console.log("Created virtualLight",I)}z=q;C=s;F=z.shadowCascadeArray[C];F.position.copy(z.position);F.target.position.copy(z.target.position);F.lookAt(F.target);F.shadowCameraVisible=z.shadowCameraVisible;F.shadowDarkness=z.shadowDarkness;F.shadowBias=z.shadowCascadeBias[C];u=z.shadowCascadeNearZ[C];
|
|
|
+z=z.shadowCascadeFarZ[C];F=F.pointsFrustum;F[0].z=u;F[1].z=u;F[2].z=u;F[3].z=u;F[4].z=z;F[5].z=z;F[6].z=z;F[7].z=z;H[r]=I;r++}else H[r]=q,r++;p=0;for(t=H.length;p<t;p++){q=H[p];q.shadowMap||(s=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(s=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:s,magFilter:s,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(q.shadowCamera);!0===m.autoUpdate&&m.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
|
-!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&I.originalCamera==n){s=n;r=q.shadowCamera;v=q.pointsFrustum;F=q.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(z=0;8>z;z++)C=F[z],C.copy(v[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(C,s),C.applyMatrix4(r.matrixWorldInverse),C.x<i.x&&(i.x=C.x),C.x>j.x&&(j.x=C.x),C.y<i.y&&(i.y=C.y),C.y>j.y&&(j.y=C.y),C.z<i.z&&(i.z=C.z),C.z>j.z&&
|
|
|
-(j.z=C.z);r.left=i.x;r.right=j.x;r.top=j.y;r.bottom=i.y;r.updateProjectionMatrix()}r=q.shadowMap;v=q.shadowMatrix;s=q.shadowCamera;s.position.getPositionFromMatrix(q.matrixWorld);l.getPositionFromMatrix(q.target.matrixWorld);s.lookAt(l);s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiply(s.projectionMatrix);v.multiply(s.matrixWorldInverse);
|
|
|
-g.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(r);b.clear();F=m.__webglObjects;q=0;for(r=F.length;q<r;q++)if(z=F[q],v=z.object,z.render=!1,v.visible&&v.castShadow&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||h.intersectsObject(v)))v._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,v.matrixWorld),z.render=!0;q=0;for(r=F.length;q<r;q++)z=F[q],z.render&&(v=z.object,z=z.buffer,G=v.material instanceof THREE.MeshFaceMaterial?
|
|
|
-v.material.materials[0]:v.material,C=0<v.geometry.morphTargets.length&&G.morphTargets,G=v instanceof THREE.SkinnedMesh&&G.skinning,C=v.customDepthMaterial?v.customDepthMaterial:G?C?f:e:C?d:c,z instanceof THREE.BufferGeometry?b.renderBufferDirect(s,m.__lights,null,C,z,v):b.renderBuffer(s,m.__lights,null,C,z,v));F=m.__webglObjectsImmediate;q=0;for(r=F.length;q<r;q++)z=F[q],v=z.object,v.visible&&v.castShadow&&(v._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,v.matrixWorld),b.renderImmediateObject(s,
|
|
|
-m.__lights,null,c,v))}p=b.getClearColor();t=b.getClearAlpha();a.clearColor(p.r,p.g,p.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,j,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
|
|
|
+!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&I.originalCamera==n){s=n;r=q.shadowCamera;u=q.pointsFrustum;F=q.pointsWorld;i.set(Infinity,Infinity,Infinity);j.set(-Infinity,-Infinity,-Infinity);for(z=0;8>z;z++)C=F[z],C.copy(u[z]),THREE.ShadowMapPlugin.__projector.unprojectVector(C,s),C.applyMatrix4(r.matrixWorldInverse),C.x<i.x&&(i.x=C.x),C.x>j.x&&(j.x=C.x),C.y<i.y&&(i.y=C.y),C.y>j.y&&(j.y=C.y),C.z<i.z&&(i.z=C.z),C.z>j.z&&
|
|
|
+(j.z=C.z);r.left=i.x;r.right=j.x;r.top=j.y;r.bottom=i.y;r.updateProjectionMatrix()}r=q.shadowMap;u=q.shadowMatrix;s=q.shadowCamera;s.position.getPositionFromMatrix(q.matrixWorld);l.getPositionFromMatrix(q.target.matrixWorld);s.lookAt(l);s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();u.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiply(s.projectionMatrix);u.multiply(s.matrixWorldInverse);
|
|
|
+g.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(r);b.clear();F=m.__webglObjects;q=0;for(r=F.length;q<r;q++)if(z=F[q],u=z.object,z.render=!1,u.visible&&u.castShadow&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||h.intersectsObject(u)))u._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,u.matrixWorld),z.render=!0;q=0;for(r=F.length;q<r;q++)z=F[q],z.render&&(u=z.object,z=z.buffer,G=u.material instanceof THREE.MeshFaceMaterial?
|
|
|
+u.material.materials[0]:u.material,C=0<u.geometry.morphTargets.length&&G.morphTargets,G=u instanceof THREE.SkinnedMesh&&G.skinning,C=u.customDepthMaterial?u.customDepthMaterial:G?C?f:e:C?d:c,z instanceof THREE.BufferGeometry?b.renderBufferDirect(s,m.__lights,null,C,z,u):b.renderBuffer(s,m.__lights,null,C,z,u));F=m.__webglObjectsImmediate;q=0;for(r=F.length;q<r;q++)z=F[q],u=z.object,u.visible&&u.castShadow&&(u._modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,u.matrixWorld),b.renderImmediateObject(s,
|
|
|
+m.__lights,null,c,u))}p=b.getClearColor();t=b.getClearAlpha();a.clearColor(p.r,p.g,p.b,t);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,h,g,i,j,l;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;h=b.createBuffer();g=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,h);b.bufferData(b.ARRAY_BUFFER,
|
|
|
e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),p=b.createShader(b.FRAGMENT_SHADER),t=b.createShader(b.VERTEX_SHADER),q="precision "+d+" float;\n";b.shaderSource(p,q+a.fragmentShader);b.shaderSource(t,q+a.vertexShader);b.compileShader(p);b.compileShader(t);b.attachShader(n,p);b.attachShader(n,t);b.linkProgram(n);i=n;j={};l={};j.position=b.getAttribLocation(i,"position");j.uv=b.getAttribLocation(i,
|
|
|
"uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,"uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");l.screenPosition=b.getUniformLocation(i,
|
|
|
-"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,t){var q=d.__webglSprites,r=q.length;if(r){var s=j,v=l,z=t/
|
|
|
-f,f=0.5*f,C=0.5*t;b.useProgram(i);b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(s.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(v.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(v.map,0);var F=s=0,H=d.fog;H?(b.uniform3f(v.fogColor,H.color.r,H.color.g,H.color.b),
|
|
|
-H instanceof THREE.Fog?(b.uniform1f(v.fogNear,H.near),b.uniform1f(v.fogFar,H.far),b.uniform1i(v.fogType,1),F=s=1):H instanceof THREE.FogExp2&&(b.uniform1f(v.fogDensity,H.density),b.uniform1i(v.fogType,2),F=s=2)):(b.uniform1i(v.fogType,0),F=s=0);for(var I,G,A=[],H=0;H<r;H++)I=q[H],G=I.material,I.visible&&0!==G.opacity&&(G.useScreenCoordinates?I.z=-I.position.z:(I._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,I.matrixWorld),I.z=-I._modelViewMatrix.elements[14]));q.sort(a);for(H=0;H<r;H++)I=
|
|
|
-q[H],G=I.material,I.visible&&0!==G.opacity&&(G.map&&G.map.image&&G.map.image.width)&&(b.uniform1f(v.alphaTest,G.alphaTest),!0===G.useScreenCoordinates?(b.uniform1i(v.useScreenCoordinates,1),b.uniform3f(v.screenPosition,(I.position.x*c.devicePixelRatio-f)/f,(C-I.position.y*c.devicePixelRatio)/C,Math.max(0,Math.min(1,I.position.z))),A[0]=c.devicePixelRatio,A[1]=c.devicePixelRatio):(b.uniform1i(v.useScreenCoordinates,0),b.uniform1i(v.sizeAttenuation,G.sizeAttenuation?1:0),b.uniformMatrix4fv(v.modelViewMatrix,
|
|
|
-!1,I._modelViewMatrix.elements),A[0]=1,A[1]=1),e=d.fog&&G.fog?F:0,s!==e&&(b.uniform1i(v.fogType,e),s=e),e=1/(G.scaleByViewport?t:1),A[0]*=e*z*I.scale.x,A[1]*=e*I.scale.y,b.uniform2f(v.uvScale,G.uvScale.x,G.uvScale.y),b.uniform2f(v.uvOffset,G.uvOffset.x,G.uvOffset.y),b.uniform2f(v.alignment,G.alignment.x,G.alignment.y),b.uniform1f(v.opacity,G.opacity),b.uniform3f(v.color,G.color.r,G.color.g,G.color.b),b.uniform1f(v.rotation,I.rotation),b.uniform2fv(v.scale,A),c.setBlending(G.blending,G.blendEquation,
|
|
|
+"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");l.fogType=b.getUniformLocation(i,"fogType");l.fogDensity=b.getUniformLocation(i,"fogDensity");l.fogNear=b.getUniformLocation(i,"fogNear");l.fogFar=b.getUniformLocation(i,"fogFar");l.fogColor=b.getUniformLocation(i,"fogColor");l.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,t){var q=d.__webglSprites,r=q.length;if(r){var s=j,u=l,z=t/
|
|
|
+f,f=0.5*f,C=0.5*t;b.useProgram(i);b.enableVertexAttribArray(s.position);b.enableVertexAttribArray(s.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,h);b.vertexAttribPointer(s.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(s.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g);b.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(u.map,0);var F=s=0,H=d.fog;H?(b.uniform3f(u.fogColor,H.color.r,H.color.g,H.color.b),
|
|
|
+H instanceof THREE.Fog?(b.uniform1f(u.fogNear,H.near),b.uniform1f(u.fogFar,H.far),b.uniform1i(u.fogType,1),F=s=1):H instanceof THREE.FogExp2&&(b.uniform1f(u.fogDensity,H.density),b.uniform1i(u.fogType,2),F=s=2)):(b.uniform1i(u.fogType,0),F=s=0);for(var I,G,A=[],H=0;H<r;H++)I=q[H],G=I.material,I.visible&&0!==G.opacity&&(G.useScreenCoordinates?I.z=-I.position.z:(I._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,I.matrixWorld),I.z=-I._modelViewMatrix.elements[14]));q.sort(a);for(H=0;H<r;H++)I=
|
|
|
+q[H],G=I.material,I.visible&&0!==G.opacity&&(G.map&&G.map.image&&G.map.image.width)&&(b.uniform1f(u.alphaTest,G.alphaTest),!0===G.useScreenCoordinates?(b.uniform1i(u.useScreenCoordinates,1),b.uniform3f(u.screenPosition,(I.position.x*c.devicePixelRatio-f)/f,(C-I.position.y*c.devicePixelRatio)/C,Math.max(0,Math.min(1,I.position.z))),A[0]=c.devicePixelRatio,A[1]=c.devicePixelRatio):(b.uniform1i(u.useScreenCoordinates,0),b.uniform1i(u.sizeAttenuation,G.sizeAttenuation?1:0),b.uniformMatrix4fv(u.modelViewMatrix,
|
|
|
+!1,I._modelViewMatrix.elements),A[0]=1,A[1]=1),e=d.fog&&G.fog?F:0,s!==e&&(b.uniform1i(u.fogType,e),s=e),e=1/(G.scaleByViewport?t:1),A[0]*=e*z*I.scale.x,A[1]*=e*I.scale.y,b.uniform2f(u.uvScale,G.uvScale.x,G.uvScale.y),b.uniform2f(u.uvOffset,G.uvOffset.x,G.uvOffset.y),b.uniform2f(u.alignment,G.alignment.x,G.alignment.y),b.uniform1f(u.opacity,G.opacity),b.uniform3f(u.color,G.color.r,G.color.g,G.color.b),b.uniform1f(u.rotation,I.rotation),b.uniform2fv(u.scale,A),c.setBlending(G.blending,G.blendEquation,
|
|
|
G.blendSrc,G.blendDst),c.setDepthTest(G.depthTest),c.setDepthWrite(G.depthWrite),c.setTexture(G.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,h=new THREE.Frustum,g=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,j){var l,m,n,p,t,q;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);!0===i.autoUpdate&&i.updateMatrixWorld();j.matrixWorldInverse.getInverse(j.matrixWorld);g.multiplyMatrices(j.projectionMatrix,
|
|
|
j.matrixWorldInverse);h.setFromMatrix(g);b.setRenderTarget(this.renderTarget);b.clear();q=i.__webglObjects;l=0;for(m=q.length;l<m;l++)if(n=q[l],t=n.object,n.render=!1,t.visible&&(!(t instanceof THREE.Mesh||t instanceof THREE.ParticleSystem)||!t.frustumCulled||h.intersectsObject(t)))t._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,t.matrixWorld),n.render=!0;var r;l=0;for(m=q.length;l<m;l++)if(n=q[l],n.render&&(t=n.object,n=n.buffer,!(t instanceof THREE.ParticleSystem)||t.customDepthMaterial))(r=
|