|
@@ -106,15 +106,15 @@ e=Math.sin(e);if("XYZ"===a.order){a=g*h;var k=g*e,l=c*h,n=c*e;b[0]=f*h;b[4]=-f*e
|
|
|
n*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*f,b[10]=g*f):"YZX"===a.order?(a=g*f,k=g*d,l=c*f,n=c*d,b[0]=f*h,b[4]=n-a*e,b[8]=l*e+k,b[1]=e,b[5]=g*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-n*e):"XZY"===a.order&&(a=g*f,k=g*d,l=c*f,n=c*d,b[0]=f*h,b[4]=-e,b[8]=d*h,b[1]=a*e+n,b[5]=g*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=n*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");
|
|
|
return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,g=a.w,f=c+c,h=d+d,k=e+e;a=c*f;var l=c*h,c=c*k,n=d*h,d=d*k,e=e*k,f=g*f,h=g*h,g=g*k;b[0]=1-(n+e);b[4]=l-g;b[8]=c+h;b[1]=l+g;b[5]=1-(a+e);b[9]=d-f;b[2]=c-h;b[6]=d+f;b[10]=1-(a+n);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a,b,c;return function(d,e,g){void 0===a&&(a=new THREE.Vector3);void 0===b&&(b=new THREE.Vector3);void 0===c&&(c=new THREE.Vector3);
|
|
|
var f=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(g,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(g,c).normalize());b.crossVectors(c,a);f[0]=a.x;f[4]=b.x;f[8]=c.x;f[1]=a.y;f[5]=b.y;f[9]=c.y;f[2]=a.z;f[6]=b.z;f[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .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,g=c[0],f=c[4],h=c[8],k=c[12],l=c[1],n=c[5],p=c[9],m=c[13],q=c[2],t=c[6],r=c[10],u=c[14],x=c[3],v=c[7],y=c[11],c=c[15],w=d[0],E=d[4],B=d[8],z=d[12],A=d[1],M=d[5],J=d[9],D=d[13],P=d[2],K=d[6],C=d[10],G=d[14],H=d[3],O=d[7],Q=d[11],d=d[15];e[0]=g*w+f*A+h*P+k*H;e[4]=g*E+f*M+h*K+k*O;e[8]=g*B+f*J+h*C+k*Q;e[12]=g*z+f*D+h*G+k*d;e[1]=l*w+n*A+p*P+m*H;e[5]=l*E+n*M+p*K+m*O;e[9]=l*B+n*J+p*C+m*Q;e[13]=l*z+n*D+p*G+m*d;e[2]=q*w+t*A+r*P+u*H;e[6]=q*E+t*M+r*K+u*O;e[10]=
|
|
|
-q*B+t*J+r*C+u*Q;e[14]=q*z+t*D+r*G+u*d;e[3]=x*w+v*A+y*P+c*H;e[7]=x*E+v*M+y*K+c*O;e[11]=x*B+v*J+y*C+c*Q;e[15]=x*z+v*D+y*G+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]*=
|
|
|
+b){var c=a.elements,d=b.elements,e=this.elements,g=c[0],f=c[4],h=c[8],k=c[12],l=c[1],n=c[5],p=c[9],m=c[13],q=c[2],t=c[6],r=c[10],u=c[14],w=c[3],v=c[7],y=c[11],c=c[15],x=d[0],E=d[4],B=d[8],z=d[12],A=d[1],M=d[5],J=d[9],D=d[13],P=d[2],K=d[6],C=d[10],G=d[14],H=d[3],O=d[7],Q=d[11],d=d[15];e[0]=g*x+f*A+h*P+k*H;e[4]=g*E+f*M+h*K+k*O;e[8]=g*B+f*J+h*C+k*Q;e[12]=g*z+f*D+h*G+k*d;e[1]=l*x+n*A+p*P+m*H;e[5]=l*E+n*M+p*K+m*O;e[9]=l*B+n*J+p*C+m*Q;e[13]=l*z+n*D+p*G+m*d;e[2]=q*x+t*A+r*P+u*H;e[6]=q*E+t*M+r*K+u*O;e[10]=
|
|
|
+q*B+t*J+r*C+u*Q;e[14]=q*z+t*D+r*G+u*d;e[3]=w*x+v*A+y*P+c*H;e[7]=w*E+v*M+y*K+c*O;e[11]=w*B+v*J+y*C+c*Q;e[15]=w*z+v*D+y*G+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("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return a.applyProjection(this)},multiplyVector4:function(a){console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");
|
|
|
return this.applyToVector3Array(a)},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix4(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Vector3);void 0===c&&(c=0);void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(a.x,
|
|
|
a.y,a.z);return b}}(),rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){console.warn("THREE.Matrix4: .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],g=a[1],f=a[5],h=a[9],k=a[13],l=a[2],n=a[6],p=a[10],m=a[14];return a[3]*(+e*h*n-d*k*
|
|
|
n-e*f*p+c*k*p+d*f*m-c*h*m)+a[7]*(+b*h*m-b*k*p+e*g*p-d*g*m+d*k*l-e*h*l)+a[11]*(+b*k*n-b*f*m-e*g*n+c*g*m+e*f*l-c*k*l)+a[15]*(-d*f*l-b*h*n+b*f*p+d*g*n-c*g*p+c*h*l)},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},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;return function(){void 0===a&&(a=new THREE.Vector3);console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=
|
|
|
-this.elements,d=a.elements,e=d[0],g=d[4],f=d[8],h=d[12],k=d[1],l=d[5],n=d[9],p=d[13],m=d[2],q=d[6],t=d[10],r=d[14],u=d[3],x=d[7],v=d[11],d=d[15];c[0]=n*r*x-p*t*x+p*q*v-l*r*v-n*q*d+l*t*d;c[4]=h*t*x-f*r*x-h*q*v+g*r*v+f*q*d-g*t*d;c[8]=f*p*x-h*n*x+h*l*v-g*p*v-f*l*d+g*n*d;c[12]=h*n*q-f*p*q-h*l*t+g*p*t+f*l*r-g*n*r;c[1]=p*t*u-n*r*u-p*m*v+k*r*v+n*m*d-k*t*d;c[5]=f*r*u-h*t*u+h*m*v-e*r*v-f*m*d+e*t*d;c[9]=h*n*u-f*p*u-h*k*v+e*p*v+f*k*d-e*n*d;c[13]=f*p*m-h*n*m+h*k*t-e*p*t-f*k*r+e*n*r;c[2]=l*r*u-p*q*u+p*m*x-k*r*
|
|
|
-x-l*m*d+k*q*d;c[6]=h*q*u-g*r*u-h*m*x+e*r*x+g*m*d-e*q*d;c[10]=g*p*u-h*l*u+h*k*x-e*p*x-g*k*d+e*l*d;c[14]=h*l*m-g*p*m-h*k*q+e*p*q+g*k*r-e*l*r;c[3]=n*q*u-l*t*u-n*m*x+k*t*x+l*m*v-k*q*v;c[7]=g*t*u-f*q*u+f*m*x-e*t*x-g*m*v+e*q*v;c[11]=f*l*u-g*n*u-f*k*x+e*n*x+g*k*v-e*l*v;c[15]=g*n*m-f*l*m+f*k*q-e*n*q-g*k*t+e*l*t;c=e*c[0]+k*c[4]+m*c[8]+u*c[12];if(0===c){if(b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
+this.elements,d=a.elements,e=d[0],g=d[4],f=d[8],h=d[12],k=d[1],l=d[5],n=d[9],p=d[13],m=d[2],q=d[6],t=d[10],r=d[14],u=d[3],w=d[7],v=d[11],d=d[15];c[0]=n*r*w-p*t*w+p*q*v-l*r*v-n*q*d+l*t*d;c[4]=h*t*w-f*r*w-h*q*v+g*r*v+f*q*d-g*t*d;c[8]=f*p*w-h*n*w+h*l*v-g*p*v-f*l*d+g*n*d;c[12]=h*n*q-f*p*q-h*l*t+g*p*t+f*l*r-g*n*r;c[1]=p*t*u-n*r*u-p*m*v+k*r*v+n*m*d-k*t*d;c[5]=f*r*u-h*t*u+h*m*v-e*r*v-f*m*d+e*t*d;c[9]=h*n*u-f*p*u-h*k*v+e*p*v+f*k*d-e*n*d;c[13]=f*p*m-h*n*m+h*k*t-e*p*t-f*k*r+e*n*r;c[2]=l*r*u-p*q*u+p*m*w-k*r*
|
|
|
+w-l*m*d+k*q*d;c[6]=h*q*u-g*r*u-h*m*w+e*r*w+g*m*d-e*q*d;c[10]=g*p*u-h*l*u+h*k*w-e*p*w-g*k*d+e*l*d;c[14]=h*l*m-g*p*m-h*k*q+e*p*q+g*k*r-e*l*r;c[3]=n*q*u-l*t*u-n*m*w+k*t*w+l*m*v-k*q*v;c[7]=g*t*u-f*q*u+f*m*w-e*t*w-g*m*v+e*q*v;c[11]=f*l*u-g*n*u-f*k*w+e*n*w+g*k*v-e*l*v;c[15]=g*n*m-f*l*m+f*k*q-e*n*q-g*k*t+e*l*t;c=e*c[0]+k*c[4]+m*c[8]+u*c[12];if(0===c){if(b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");
|
|
|
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(a){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(a,b){console.error("THREE.Matrix4: .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,g=a.x,f=a.y,h=a.z,k=e*g,l=e*f;this.set(k*g+c,k*f-d*h,k*h+d*f,0,k*f+d*h,l*f+c,l*h-d*g,0,k*h-d*f,l*h+d*g,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,
|
|
@@ -204,29 +204,29 @@ this.verticesNeedUpdate=!0},rotateX:function(){var a;return function(b){void 0==
|
|
|
a.makeTranslation(b,c,d);this.applyMatrix(a);return this}}(),scale:function(){var a;return function(b,c,d){void 0===a&&(a=new THREE.Matrix4);a.makeScale(b,c,d);this.applyMatrix(a);return this}}(),lookAt:function(){var a;return function(b){void 0===a&&(a=new THREE.Object3D);a.lookAt(b);a.updateMatrix();this.applyMatrix(a.matrix)}}(),fromBufferGeometry:function(a){var b=this,c=a.attributes,d=c.position.array,e=void 0!==c.index?c.index.array:void 0,g=void 0!==c.normal?c.normal.array:void 0,f=void 0!==
|
|
|
c.color?c.color.array:void 0,h=void 0!==c.uv?c.uv.array:void 0,k=void 0!==c.uv2?c.uv2.array:void 0,l=void 0!==c.tangent?c.tangent.array:void 0;void 0!==k&&(this.faceVertexUvs[1]=[]);void 0!==l&&(this.hasTangents=!0);for(var n=[],p=[],m=[],q=[],t=c=0,r=0;c<d.length;c+=3,t+=2,r+=4)b.vertices.push(new THREE.Vector3(d[c],d[c+1],d[c+2])),void 0!==g&&n.push(new THREE.Vector3(g[c],g[c+1],g[c+2])),void 0!==f&&b.colors.push(new THREE.Color(f[c],f[c+1],f[c+2])),void 0!==h&&p.push(new THREE.Vector2(h[t],h[t+
|
|
|
1])),void 0!==k&&m.push(new THREE.Vector2(k[t],k[t+1])),void 0!==l&&q.push(new THREE.Vector4(l[r],l[r+1],l[r+2],l[r+3]));r=function(a,c,d){var e=void 0!==g?[n[a].clone(),n[c].clone(),n[d].clone()]:[],t=void 0!==f?[b.colors[a].clone(),b.colors[c].clone(),b.colors[d].clone()]:[],e=new THREE.Face3(a,c,d,e,t);b.faces.push(e);void 0!==h&&b.faceVertexUvs[0].push([p[a].clone(),p[c].clone(),p[d].clone()]);void 0!==k&&b.faceVertexUvs[1].push([m[a].clone(),m[c].clone(),m[d].clone()]);void 0!==l&&e.vertexTangents.push(q[a].clone(),
|
|
|
-q[c].clone(),q[d].clone())};if(void 0!==e)if(d=a.drawcalls,0<d.length)for(c=0;c<d.length;c++)for(var t=d[c],u=t.start,x=t.count,t=u,u=u+x;t<u;t+=3)r(e[t],e[t+1],e[t+2]);else for(c=0;c<e.length;c+=3)r(e[c],e[c+1],e[c+2]);else for(c=0;c<d.length/3;c+=3)r(c,c+1,c+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();var a=this.boundingBox.center().negate();
|
|
|
+q[c].clone(),q[d].clone())};if(void 0!==e)if(d=a.drawcalls,0<d.length)for(c=0;c<d.length;c++)for(var t=d[c],u=t.start,w=t.count,t=u,u=u+w;t<u;t+=3)r(e[t],e[t+1],e[t+2]);else for(c=0;c<e.length;c+=3)r(e[c],e[c+1],e[c+2]);else for(c=0;c<d.length/3;c+=3)r(c,c+1,c+2);this.computeFaceNormals();null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone());null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone());return this},center:function(){this.computeBoundingBox();var a=this.boundingBox.center().negate();
|
|
|
this.translate(a.x,a.y,a.z);return a},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,b=this.boundingSphere.radius,b=0===b?1:1/b,c=new THREE.Matrix4;c.set(b,0,0,-b*a.x,0,b,0,-b*a.y,0,0,b,-b*a.z,0,0,0,1);this.applyMatrix(c);return this},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],g=this.vertices[e.a],f=this.vertices[e.b];a.subVectors(this.vertices[e.c],f);b.subVectors(g,f);a.cross(b);
|
|
|
a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;if(a){var e,g,f,h=new THREE.Vector3,k=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],g=this.vertices[c.b],f=this.vertices[c.c],h.subVectors(f,g),k.subVectors(e,g),h.cross(k),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),
|
|
|
d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=c.vertexNormals,3===e.length?(e[0].copy(d[c.a]),e[1].copy(d[c.b]),e[2].copy(d[c.c])):(e[0]=d[c.a].clone(),e[1]=d[c.b].clone(),e[2]=d[c.c].clone())},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),
|
|
|
e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var g=new THREE.Geometry;g.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var f=this.morphNormals[a].vertexNormals,
|
|
|
h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),f.push(k)}f=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();g.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=f.faceNormals[c],k=f.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],
|
|
|
-e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,g,f,h,k,l,n,p,m,q,t,r,u,x=[],v=[];c=new THREE.Vector3;var y=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3,B=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)x[a]=new THREE.Vector3,v[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],g=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,f=this.vertices[d],h=this.vertices[u],k=this.vertices[e],l=g[0],n=
|
|
|
-g[1],p=g[2],g=h.x-f.x,m=k.x-f.x,q=h.y-f.y,t=k.y-f.y,h=h.z-f.z,f=k.z-f.z,k=n.x-l.x,r=p.x-l.x,n=n.y-l.y,l=p.y-l.y,p=1/(k*l-r*n),c.set((l*g-n*m)*p,(l*q-n*t)*p,(l*h-n*f)*p),y.set((k*m-r*g)*p,(k*t-r*q)*p,(k*f-r*h)*p),x[d].add(c),x[u].add(c),x[e].add(c),v[d].add(y),v[u].add(y),v[e].add(y);y=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)B.copy(e.vertexNormals[c]),d=e[y[c]],u=x[d],w.copy(u),w.sub(B.multiplyScalar(B.dot(u))).normalize(),
|
|
|
-E.crossVectors(e.vertexNormals[c],u),d=E.dot(v[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
+e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,g,f,h,k,l,n,p,m,q,t,r,u,w=[],v=[];c=new THREE.Vector3;var y=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3,B=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)w[a]=new THREE.Vector3,v[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],g=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,f=this.vertices[d],h=this.vertices[u],k=this.vertices[e],l=g[0],n=
|
|
|
+g[1],p=g[2],g=h.x-f.x,m=k.x-f.x,q=h.y-f.y,t=k.y-f.y,h=h.z-f.z,f=k.z-f.z,k=n.x-l.x,r=p.x-l.x,n=n.y-l.y,l=p.y-l.y,p=1/(k*l-r*n),c.set((l*g-n*m)*p,(l*q-n*t)*p,(l*h-n*f)*p),y.set((k*m-r*g)*p,(k*t-r*q)*p,(k*f-r*h)*p),w[d].add(c),w[u].add(c),w[e].add(c),v[d].add(y),v[u].add(y),v[e].add(y);y=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)B.copy(e.vertexNormals[c]),d=e[y[c]],u=w[d],x.copy(u),x.sub(B.multiplyScalar(B.dot(u))).normalize(),
|
|
|
+E.crossVectors(e.vertexNormals[c],u),d=E.dot(v[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(x.x,x.y,x.z,d);this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);
|
|
|
this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===a instanceof THREE.Geometry)console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,g=this.vertices,f=a.vertices,h=this.faces,k=a.faces,l=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var n=0,p=f.length;n<p;n++){var m=f[n].clone();void 0!==b&&m.applyMatrix4(b);g.push(m)}n=0;for(p=k.length;n<
|
|
|
p;n++){var f=k[n],q,t=f.vertexNormals,r=f.vertexColors,m=new THREE.Face3(f.a+e,f.b+e,f.c+e);m.normal.copy(f.normal);void 0!==d&&m.normal.applyMatrix3(d).normalize();b=0;for(g=t.length;b<g;b++)q=t[b].clone(),void 0!==d&&q.applyMatrix3(d).normalize(),m.vertexNormals.push(q);m.color.copy(f.color);b=0;for(g=r.length;b<g;b++)q=r[b],m.vertexColors.push(q.clone());m.materialIndex=f.materialIndex+c;h.push(m)}n=0;for(p=a.length;n<p;n++)if(c=a[n],d=[],void 0!==c){b=0;for(g=c.length;b<g;b++)d.push(c[b].clone());
|
|
|
l.push(d)}}},mergeMesh:function(a){!1===a instanceof THREE.Mesh?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];a=[];g=0;for(f=this.faces.length;g<
|
|
|
f;g++)for(e=this.faces[g],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]===e[(d+1)%3]){a.push(g);break}for(g=a.length-1;0<=g;g--)for(e=a[g],this.faces.splice(e,1),c=0,f=this.faceVertexUvs.length;c<f;c++)this.faceVertexUvs[c].splice(e,1);g=this.vertices.length-b.length;this.vertices=b;return g},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();if(void 0!==l[b])return l[b];l[b]=k.length/3;k.push(a.x,a.y,
|
|
|
a.z);return l[b]}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();if(void 0!==p[b])return p[b];p[b]=n.length;n.push(a.getHex());return p[b]}function d(a){var b=a.x.toString()+a.y.toString();if(void 0!==q[b])return q[b];q[b]=m.length/2;m.push(a.x,a.y);return q[b]}var e={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};e.uuid=this.uuid;e.type=this.type;""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var g=this.parameters,f;for(f in g)void 0!==g[f]&&
|
|
|
-(e[f]=g[f]);return e}g=[];for(f=0;f<this.vertices.length;f++){var h=this.vertices[f];g.push(h.x,h.y,h.z)}var h=[],k=[],l={},n=[],p={},m=[],q={};for(f=0;f<this.faces.length;f++){var t=this.faces[f],r=void 0!==this.faceVertexUvs[0][f],u=0<t.normal.length(),x=0<t.vertexNormals.length,v=1!==t.color.r||1!==t.color.g||1!==t.color.b,y=0<t.vertexColors.length,w=0,w=a(w,0,0),w=a(w,1,!1),w=a(w,2,!1),w=a(w,3,r),w=a(w,4,u),w=a(w,5,x),w=a(w,6,v),w=a(w,7,y);h.push(w);h.push(t.a,t.b,t.c);r&&(r=this.faceVertexUvs[0][f],
|
|
|
-h.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(t.normal));x&&(u=t.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));v&&h.push(c(t.color));y&&(t=t.vertexColors,h.push(c(t[0]),c(t[1]),c(t[2])))}e.data={};e.data.vertices=g;e.data.normals=k;0<n.length&&(e.data.colors=n);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());
|
|
|
+(e[f]=g[f]);return e}g=[];for(f=0;f<this.vertices.length;f++){var h=this.vertices[f];g.push(h.x,h.y,h.z)}var h=[],k=[],l={},n=[],p={},m=[],q={};for(f=0;f<this.faces.length;f++){var t=this.faces[f],r=void 0!==this.faceVertexUvs[0][f],u=0<t.normal.length(),w=0<t.vertexNormals.length,v=1!==t.color.r||1!==t.color.g||1!==t.color.b,y=0<t.vertexColors.length,x=0,x=a(x,0,0),x=a(x,1,!1),x=a(x,2,!1),x=a(x,3,r),x=a(x,4,u),x=a(x,5,w),x=a(x,6,v),x=a(x,7,y);h.push(x);h.push(t.a,t.b,t.c);r&&(r=this.faceVertexUvs[0][f],
|
|
|
+h.push(d(r[0]),d(r[1]),d(r[2])));u&&h.push(b(t.normal));w&&(u=t.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));v&&h.push(c(t.color));y&&(t=t.vertexColors,h.push(c(t[0]),c(t[1]),c(t[2])))}e.data={};e.data.vertices=g;e.data.normals=k;0<n.length&&(e.data.colors=n);0<m.length&&(e.data.uvs=[m]);e.data.faces=h;return e},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.vertices=[];this.faces=[];this.faceVertexUvs=[[]];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());
|
|
|
b=a.faces;c=0;for(d=b.length;c<d;c++)this.faces.push(b[c].clone());c=0;for(d=a.faceVertexUvs.length;c<d;c++){b=a.faceVertexUvs[c];void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var e=0,g=b.length;e<g;e++){for(var f=b[e],h=[],k=0,l=f.length;k<l;k++)h.push(f[k].clone());this.faceVertexUvs[c].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})},set groupsNeedUpdate(a){!0===a&&this.dispose()}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);
|
|
|
THREE.GeometryIdCount=0;
|
|
|
THREE.DirectGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="DirectGeometry";this.indices=[];this.vertices=[];this.normals=[];this.colors=[];this.uvs=[];this.uvs2=[];this.tangents=[];this.morphTargets={};this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.tangentsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1};
|
|
|
THREE.DirectGeometry.prototype={constructor:THREE.DirectGeometry,computeBoundingBox:THREE.Geometry.prototype.computeBoundingBox,computeBoundingSphere:THREE.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.");return this},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.");return this},computeTangents:function(){console.warn("THREE.DirectGeometry: computeTangents() is not a method of this type of geometry.");
|
|
|
-return this},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,g=d[1]&&0<d[1].length,f=a.hasTangents,h=a.morphTargets,k=h.length;if(0<k){for(var l=[],n=0;n<k;n++)l[n]=[];this.morphTargets.position=l}var p=a.morphNormals,m=p.length;if(0<m){for(var q=[],n=0;n<m;n++)q[n]=[];this.morphTargets.normal=q}for(var t=a.skinIndices,r=a.skinWeights,u=t.length===c.length,x=r.length===c.length,n=0;n<b.length;n++){var v=b[n];this.vertices.push(c[v.a],c[v.b],c[v.c]);var y=
|
|
|
+return this},fromGeometry:function(a){var b=a.faces,c=a.vertices,d=a.faceVertexUvs,e=d[0]&&0<d[0].length,g=d[1]&&0<d[1].length,f=a.hasTangents,h=a.morphTargets,k=h.length;if(0<k){for(var l=[],n=0;n<k;n++)l[n]=[];this.morphTargets.position=l}var p=a.morphNormals,m=p.length;if(0<m){for(var q=[],n=0;n<m;n++)q[n]=[];this.morphTargets.normal=q}for(var t=a.skinIndices,r=a.skinWeights,u=t.length===c.length,w=r.length===c.length,n=0;n<b.length;n++){var v=b[n];this.vertices.push(c[v.a],c[v.b],c[v.c]);var y=
|
|
|
v.vertexNormals;3===y.length?this.normals.push(y[0],y[1],y[2]):(y=v.normal,this.normals.push(y,y,y));y=v.vertexColors;3===y.length?this.colors.push(y[0],y[1],y[2]):(y=v.color,this.colors.push(y,y,y));!0===e&&(y=d[0][n],void 0!==y?this.uvs.push(y[0],y[1],y[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",n),this.uvs.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===g&&(y=d[1][n],void 0!==y?this.uvs2.push(y[0],y[1],y[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",
|
|
|
-n),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===f&&(y=v.vertexTangents,3===y.length?this.tangents.push(y[0],y[1],y[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined tangents ",n),this.tangents.push(new THREE.Vector4,new THREE.Vector4,new THREE.Vector4)));for(y=0;y<k;y++){var w=h[y].vertices;l[y].push(w[v.a],w[v.b],w[v.c])}for(y=0;y<m;y++)w=p[y].vertexNormals[n],q[y].push(w.a,w.b,w.c);u&&this.skinIndices.push(t[v.a],t[v.b],t[v.c]);x&&this.skinWeights.push(r[v.a],
|
|
|
+n),this.uvs2.push(new THREE.Vector2,new THREE.Vector2,new THREE.Vector2)));!0===f&&(y=v.vertexTangents,3===y.length?this.tangents.push(y[0],y[1],y[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined tangents ",n),this.tangents.push(new THREE.Vector4,new THREE.Vector4,new THREE.Vector4)));for(y=0;y<k;y++){var x=h[y].vertices;l[y].push(x[v.a],x[v.b],x[v.c])}for(y=0;y<m;y++)x=p[y].vertexNormals[n],q[y].push(x.a,x.b,x.c);u&&this.skinIndices.push(t[v.a],t[v.b],t[v.c]);w&&this.skinWeights.push(r[v.a],
|
|
|
r[v.b],r[v.c])}this.verticesNeedUpdate=a.verticesNeedUpdate;this.normalsNeedUpdate=a.normalsNeedUpdate;this.colorsNeedUpdate=a.colorsNeedUpdate;this.uvsNeedUpdate=a.uvsNeedUpdate;this.tangentsNeedUpdate=a.tangentsNeedUpdate;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.DirectGeometry.prototype);
|
|
|
THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="BufferGeometry";this.attributes={};this.morphAttributes={};this.drawcalls=[];this.boundingSphere=this.boundingBox=null};
|
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute&&!1===b instanceof THREE.InterleavedBufferAttribute?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[a]={array:b,itemSize:c}):this.attributes[a]=b},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){delete this.attributes[a]},get offsets(){console.warn("THREE.BufferGeometry: .offsets has been renamed to .drawcalls.");
|
|
@@ -245,9 +245,9 @@ isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('TH
|
|
|
e),a.expandByPoint(b);a.center(d);for(var f=0,e=0,g=c.length;e<g;e+=3)b.fromArray(c,e),f=Math.max(f,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(f);isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.attributes,b=this.drawcalls;if(a.position){var c=a.position.array;if(void 0===
|
|
|
a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(c.length),3));else for(var d=a.normal.array,e=0,g=d.length;e<g;e++)d[e]=0;var d=a.normal.array,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3;if(a.index){var t=a.index.array;0===b.length&&this.addDrawCall(0,t.length);for(var r=0,u=b.length;r<u;++r)for(e=b[r],g=e.start,f=e.count,e=g,g+=f;e<g;e+=3)f=3*t[e+0],h=3*t[e+1],k=3*t[e+2],l.fromArray(c,f),n.fromArray(c,h),
|
|
|
p.fromArray(c,k),m.subVectors(p,n),q.subVectors(l,n),m.cross(q),d[f]+=m.x,d[f+1]+=m.y,d[f+2]+=m.z,d[h]+=m.x,d[h+1]+=m.y,d[h+2]+=m.z,d[k]+=m.x,d[k+1]+=m.y,d[k+2]+=m.z}else for(e=0,g=c.length;e<g;e+=9)l.fromArray(c,e),n.fromArray(c,e+3),p.fromArray(c,e+6),m.subVectors(p,n),q.subVectors(l,n),m.cross(q),d[e]=m.x,d[e+1]=m.y,d[e+2]=m.z,d[e+3]=m.x,d[e+4]=m.y,d[e+5]=m.z,d[e+6]=m.x,d[e+7]=m.y,d[e+8]=m.z;this.normalizeNormals();a.normal.needsUpdate=!0}},computeTangents:function(){function a(a,b,c){p.fromArray(d,
|
|
|
-3*a);m.fromArray(d,3*b);q.fromArray(d,3*c);t.fromArray(g,2*a);r.fromArray(g,2*b);u.fromArray(g,2*c);x=m.x-p.x;v=q.x-p.x;y=m.y-p.y;w=q.y-p.y;E=m.z-p.z;B=q.z-p.z;z=r.x-t.x;A=u.x-t.x;M=r.y-t.y;J=u.y-t.y;D=1/(z*J-A*M);P.set((J*x-M*v)*D,(J*y-M*w)*D,(J*E-M*B)*D);K.set((z*v-A*x)*D,(z*w-A*y)*D,(z*B-A*E)*D);k[a].add(P);k[b].add(P);k[c].add(P);l[a].add(K);l[b].add(K);l[c].add(K)}function b(a){F.fromArray(e,3*a);$.copy(F);aa=k[a];R.copy(aa);R.sub(F.multiplyScalar(F.dot(aa))).normalize();U.crossVectors($,aa);
|
|
|
+3*a);m.fromArray(d,3*b);q.fromArray(d,3*c);t.fromArray(g,2*a);r.fromArray(g,2*b);u.fromArray(g,2*c);w=m.x-p.x;v=q.x-p.x;y=m.y-p.y;x=q.y-p.y;E=m.z-p.z;B=q.z-p.z;z=r.x-t.x;A=u.x-t.x;M=r.y-t.y;J=u.y-t.y;D=1/(z*J-A*M);P.set((J*w-M*v)*D,(J*y-M*x)*D,(J*E-M*B)*D);K.set((z*v-A*w)*D,(z*x-A*y)*D,(z*B-A*E)*D);k[a].add(P);k[b].add(P);k[c].add(P);l[a].add(K);l[b].add(K);l[c].add(K)}function b(a){F.fromArray(e,3*a);$.copy(F);aa=k[a];R.copy(aa);R.sub(F.multiplyScalar(F.dot(aa))).normalize();U.crossVectors($,aa);
|
|
|
pa=U.dot(l[a]);ea=0>pa?-1:1;h[4*a]=R.x;h[4*a+1]=R.y;h[4*a+2]=R.z;h[4*a+3]=ea}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,g=this.attributes.uv.array,f=d.length/3;void 0===this.attributes.tangent&&
|
|
|
-this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<f;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var p=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,x,v,y,w,E,B,z,A,M,J,D,P=new THREE.Vector3,K=new THREE.Vector3,C,G,H,O,Q;0===this.drawcalls.length&&this.addDrawCall(0,c.length);for(var T=this.drawcalls,f=0,n=T.length;f<n;++f)for(C=T[f],G=
|
|
|
+this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*f),4));for(var h=this.attributes.tangent.array,k=[],l=[],n=0;n<f;n++)k[n]=new THREE.Vector3,l[n]=new THREE.Vector3;var p=new THREE.Vector3,m=new THREE.Vector3,q=new THREE.Vector3,t=new THREE.Vector2,r=new THREE.Vector2,u=new THREE.Vector2,w,v,y,x,E,B,z,A,M,J,D,P=new THREE.Vector3,K=new THREE.Vector3,C,G,H,O,Q;0===this.drawcalls.length&&this.addDrawCall(0,c.length);for(var T=this.drawcalls,f=0,n=T.length;f<n;++f)for(C=T[f],G=
|
|
|
C.start,H=C.count,C=G,G+=H;C<G;C+=3)H=c[C+0],O=c[C+1],Q=c[C+2],a(H,O,Q);for(var R=new THREE.Vector3,U=new THREE.Vector3,F=new THREE.Vector3,$=new THREE.Vector3,ea,aa,pa,f=0,n=T.length;f<n;++f)for(C=T[f],G=C.start,H=C.count,C=G,G+=H;C<G;C+=3)H=c[C+0],O=c[C+1],Q=c[C+2],b(H),b(O),b(Q)}},computeOffsets:function(a){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",
|
|
|
a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,g=a.attributes[d],f=g.array,h=0,g=g.itemSize*b;h<f.length;h++,g++)e[g]=f[h];return this}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,g=a.length;e<g;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},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!==e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize*
|
|
|
c));for(var g=0;g<c;g++){var f=b[g];for(e in this.attributes)if("index"!==e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,l=d[e],n=0;n<k;n++)l[g*k+n]=h[f*k+n]}this.attributes.index.array=a;for(e in this.attributes)"index"!==e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function(){var a={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};a.uuid=this.uuid;a.type=this.type;""!==this.name&&(a.name=this.name);
|
|
@@ -283,7 +283,7 @@ THREE.SpotLight.prototype.copy=function(a){THREE.Light.prototype.copy.call(this,
|
|
|
this.shadowMapWidth=a.shadowMapWidth;this.shadowMapHeight=a.shadowMapHeight;return this};THREE.SpotLight.prototype.toJSON=function(a){a=THREE.Object3D.prototype.toJSON.call(this,a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;a.object.distance=this.distance;a.object.angle=this.angle;a.object.exponent=this.exponent;a.object.decay=this.decay;return a};
|
|
|
THREE.Cache={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};THREE.Loader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},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(){var a;return function(b,c,d){function e(a){a=Math.log(a)/Math.LN2;return Math.pow(2,
|
|
|
-Math.round(a))}function g(b,g,f,h,k,l,u){var x=c+f,v,y=THREE.Loader.Handlers.get(x);null!==y?v=y.load(x):(v=new THREE.Texture,y=a,y.setCrossOrigin(d),y.load(x,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=e(a.width),c=e(a.height),d=document.createElement("canvas");d.width=b;d.height=c;d.getContext("2d").drawImage(a,0,0,b,c);v.image=d}else v.image=a;v.needsUpdate=!0}));v.sourceFile=f;h&&(v.repeat.set(h[0],h[1]),1!==h[0]&&(v.wrapS=THREE.RepeatWrapping),
|
|
|
+Math.round(a))}function g(b,g,f,h,k,l,u){var w=c+f,v,y=THREE.Loader.Handlers.get(w);null!==y?v=y.load(w):(v=new THREE.Texture,y=a,y.setCrossOrigin(d),y.load(w,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=e(a.width),c=e(a.height),d=document.createElement("canvas");d.width=b;d.height=c;d.getContext("2d").drawImage(a,0,0,b,c);v.image=d}else v.image=a;v.needsUpdate=!0}));v.sourceFile=f;h&&(v.repeat.set(h[0],h[1]),1!==h[0]&&(v.wrapS=THREE.RepeatWrapping),
|
|
|
1!==h[1]&&(v.wrapT=THREE.RepeatWrapping));k&&v.offset.set(k[0],k[1]);l&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==f[l[0]]&&(v.wrapS=f[l[0]]),void 0!==f[l[1]]&&(v.wrapT=f[l[1]]));u&&(v.anisotropy=u);b[g]=v}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}void 0===d&&void 0!==this.crossOrigin&&(d=this.crossOrigin);void 0===a&&(a=new THREE.ImageLoader);var h="MeshLambertMaterial",k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,
|
|
|
wireframe:!1};if(b.shading){var l=b.shading.toLowerCase();"phong"===l?h="MeshPhongMaterial":"basic"===l&&(h="MeshBasicMaterial")}void 0!==b.blending&&void 0!==THREE[b.blending]&&(k.blending=THREE[b.blending]);void 0!==b.transparent&&(k.transparent=b.transparent);void 0!==b.opacity&&1>b.opacity&&(k.transparent=!0);void 0!==b.depthTest&&(k.depthTest=b.depthTest);void 0!==b.depthWrite&&(k.depthWrite=b.depthWrite);void 0!==b.visible&&(k.visible=b.visible);void 0!==b.flipSided&&(k.side=THREE.BackSide);
|
|
|
void 0!==b.doubleSided&&(k.side=THREE.DoubleSide);void 0!==b.wireframe&&(k.wireframe=b.wireframe);void 0!==b.vertexColors&&("face"===b.vertexColors?k.vertexColors=THREE.FaceColors:b.vertexColors&&(k.vertexColors=THREE.VertexColors));b.colorDiffuse?k.color=f(b.colorDiffuse):b.DbgColor&&(k.color=b.DbgColor);b.colorSpecular&&(k.specular=f(b.colorSpecular));b.colorEmissive&&(k.emissive=f(b.colorEmissive));void 0!==b.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),
|
|
@@ -295,10 +295,10 @@ void 0!==this.responseType&&(f.responseType=this.responseType);void 0!==this.wit
|
|
|
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,g=THREE.Cache.get(a);if(void 0!==g)return b&&setTimeout(function(){b(g)},0),g;var f=document.createElement("img");f.addEventListener("load",function(c){THREE.Cache.add(a,this);b&&b(this);e.manager.itemEnd(a)},!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);e.manager.itemStart(a);
|
|
|
f.src=a;return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.withCredentials=!1};
|
|
|
THREE.JSONLoader.prototype={constructor:THREE.JSONLoader,load:function(a,b,c,d){var e=this,g=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:THREE.Loader.prototype.extractUrlBase(a);c=new THREE.XHRLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.setWithCredentials(this.withCredentials);c.load(a,function(c){c=JSON.parse(c);var d=c.metadata;if(void 0!==d){if("object"===d.type){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===
|
|
|
-d.type){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.");return}}c=e.parse(c,g);b(c.geometry,c.materials)})},setCrossOrigin:function(a){this.crossOrigin=a},setTexturePath:function(a){this.texturePath=a},parse:function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,f,h,k,l,n,p,m,q,t,r,u,x,v=a.faces;n=a.vertices;var y=a.normals,w=a.colors,E=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&E++;for(d=0;d<E;d++)c.faceVertexUvs[d]=
|
|
|
-[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=v.length;k<l;)if(b=v[k++],q=b&1,h=b&2,d=b&8,p=b&16,t=b&32,n=b&64,b&=128,q){q=new THREE.Face3;q.a=v[k];q.b=v[k+1];q.c=v[k+3];r=new THREE.Face3;r.a=v[k+1];r.b=v[k+2];r.c=v[k+3];k+=4;h&&(h=v[k++],q.materialIndex=h,r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],f=0;4>f;f++)m=v[k++],x=u[2*m],m=u[2*m+1],x=new THREE.Vector2(x,
|
|
|
-m),2!==f&&c.faceVertexUvs[d][h].push(x),0!==f&&c.faceVertexUvs[d][h+1].push(x);p&&(p=3*v[k++],q.normal.set(y[p++],y[p++],y[p]),r.normal.copy(q.normal));if(t)for(d=0;4>d;d++)p=3*v[k++],t=new THREE.Vector3(y[p++],y[p++],y[p]),2!==d&&q.vertexNormals.push(t),0!==d&&r.vertexNormals.push(t);n&&(n=v[k++],n=w[n],q.color.setHex(n),r.color.setHex(n));if(b)for(d=0;4>d;d++)n=v[k++],n=w[n],2!==d&&q.vertexColors.push(new THREE.Color(n)),0!==d&&r.vertexColors.push(new THREE.Color(n));c.faces.push(q);c.faces.push(r)}else{q=
|
|
|
-new THREE.Face3;q.a=v[k++];q.b=v[k++];q.c=v[k++];h&&(h=v[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],f=0;3>f;f++)m=v[k++],x=u[2*m],m=u[2*m+1],x=new THREE.Vector2(x,m),c.faceVertexUvs[d][h].push(x);p&&(p=3*v[k++],q.normal.set(y[p++],y[p++],y[p]));if(t)for(d=0;3>d;d++)p=3*v[k++],t=new THREE.Vector3(y[p++],y[p++],y[p]),q.vertexNormals.push(t);n&&(n=v[k++],q.color.setHex(w[n]));if(b)for(d=0;3>d;d++)n=v[k++],q.vertexColors.push(new THREE.Color(w[n]));
|
|
|
+d.type){console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.");return}}c=e.parse(c,g);b(c.geometry,c.materials)})},setCrossOrigin:function(a){this.crossOrigin=a},setTexturePath:function(a){this.texturePath=a},parse:function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,f,h,k,l,n,p,m,q,t,r,u,w,v=a.faces;n=a.vertices;var y=a.normals,x=a.colors,E=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&E++;for(d=0;d<E;d++)c.faceVertexUvs[d]=
|
|
|
+[]}k=0;for(l=n.length;k<l;)d=new THREE.Vector3,d.x=n[k++]*b,d.y=n[k++]*b,d.z=n[k++]*b,c.vertices.push(d);k=0;for(l=v.length;k<l;)if(b=v[k++],q=b&1,h=b&2,d=b&8,p=b&16,t=b&32,n=b&64,b&=128,q){q=new THREE.Face3;q.a=v[k];q.b=v[k+1];q.c=v[k+3];r=new THREE.Face3;r.a=v[k+1];r.b=v[k+2];r.c=v[k+3];k+=4;h&&(h=v[k++],q.materialIndex=h,r.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],f=0;4>f;f++)m=v[k++],w=u[2*m],m=u[2*m+1],w=new THREE.Vector2(w,
|
|
|
+m),2!==f&&c.faceVertexUvs[d][h].push(w),0!==f&&c.faceVertexUvs[d][h+1].push(w);p&&(p=3*v[k++],q.normal.set(y[p++],y[p++],y[p]),r.normal.copy(q.normal));if(t)for(d=0;4>d;d++)p=3*v[k++],t=new THREE.Vector3(y[p++],y[p++],y[p]),2!==d&&q.vertexNormals.push(t),0!==d&&r.vertexNormals.push(t);n&&(n=v[k++],n=x[n],q.color.setHex(n),r.color.setHex(n));if(b)for(d=0;4>d;d++)n=v[k++],n=x[n],2!==d&&q.vertexColors.push(new THREE.Color(n)),0!==d&&r.vertexColors.push(new THREE.Color(n));c.faces.push(q);c.faces.push(r)}else{q=
|
|
|
+new THREE.Face3;q.a=v[k++];q.b=v[k++];q.c=v[k++];h&&(h=v[k++],q.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<E;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],f=0;3>f;f++)m=v[k++],w=u[2*m],m=u[2*m+1],w=new THREE.Vector2(w,m),c.faceVertexUvs[d][h].push(w);p&&(p=3*v[k++],q.normal.set(y[p++],y[p++],y[p]));if(t)for(d=0;3>d;d++)p=3*v[k++],t=new THREE.Vector3(y[p++],y[p++],y[p]),q.vertexNormals.push(t);n&&(n=v[k++],q.color.setHex(x[n]));if(b)for(d=0;3>d;d++)n=v[k++],q.vertexColors.push(new THREE.Color(x[n]));
|
|
|
c.faces.push(q)}})(d);(function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,f=a.skinWeights.length;d<f;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d],1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,f=a.skinIndices.length;d<f;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<
|
|
|
c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations})();(function(b){if(void 0!==a.morphTargets){var d,f,h,k,l,n;d=0;for(f=a.morphTargets.length;d<f;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=
|
|
|
[],l=c.morphTargets[d].vertices,n=a.morphTargets[d].vertices,h=0,k=n.length;h<k;h+=3){var p=new THREE.Vector3;p.x=n[h]*b;p.y=n[h+1]*b;p.z=n[h+2]*b;l.push(p)}}if(void 0!==a.morphColors)for(d=0,f=a.morphColors.length;d<f;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,b=0,h=l.length;b<h;b+=3)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)})(d);c.computeFaceNormals();c.computeBoundingSphere();
|
|
@@ -327,7 +327,7 @@ THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b
|
|
|
THREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(a,b,c,d){var e=this,g=new THREE.DataTexture,f=new THREE.XHRLoader(this.manager);f.setCrossOrigin(this.crossOrigin);f.setResponseType("arraybuffer");f.load(a,function(a){if(a=e._parser(a))void 0!==a.image?g.image=a.image:void 0!==a.data&&(g.image.width=a.width,g.image.height=a.height,g.image.data=a.data),g.wrapS=void 0!==a.wrapS?a.wrapS:THREE.ClampToEdgeWrapping,g.wrapT=void 0!==a.wrapT?a.wrapT:THREE.ClampToEdgeWrapping,
|
|
|
g.magFilter=void 0!==a.magFilter?a.magFilter:THREE.LinearFilter,g.minFilter=void 0!==a.minFilter?a.minFilter:THREE.LinearMipMapLinearFilter,g.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(g.format=a.format),void 0!==a.type&&(g.type=a.type),void 0!==a.mipmaps&&(g.mipmaps=a.mipmaps),1===a.mipmapCount&&(g.minFilter=THREE.LinearFilter),g.needsUpdate=!0,b&&b(g,a)},c,d);return g},setCrossOrigin:function(a){this.crossOrigin=a}};
|
|
|
THREE.CompressedTextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this._parser=null};
|
|
|
-THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(a,b,c,d){var e=this,g=[],f=new THREE.CompressedTexture;f.image=g;var h=new THREE.XHRLoader(this.manager);h.setCrossOrigin(this.crossOrigin);h.setResponseType("arraybuffer");if(Array.isArray(a))for(var k=0,l=function(l){h.load(a[l],function(a){a=e._parser(a,!0);g[l]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};k+=1;6===k&&(1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.format=
|
|
|
+THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(a,b,c,d){var e=this,g=[],f=new THREE.CompressedTexture;f.image=g;var h=new THREE.XHRLoader(this.manager);h.setCrossOrigin(this.crossOrigin);h.setResponseType("arraybuffer");if(Array.isArray(a))for(var k=0,l=function(m){h.load(a[m],function(a){a=e._parser(a,!0);g[m]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};k+=1;6===k&&(1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.format=
|
|
|
a.format,f.needsUpdate=!0,b&&b(f))},c,d)},n=0,p=a.length;n<p;++n)l(n);else h.load(a,function(a){a=e._parser(a,!0);if(a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,d=0;d<c;d++){g[d]={mipmaps:[]};for(var h=0;h<a.mipmapCount;h++)g[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+h]),g[d].format=a.format,g[d].width=a.width,g[d].height=a.height}else f.image.width=a.width,f.image.height=a.height,f.mipmaps=a.mipmaps;1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter);f.format=a.format;f.needsUpdate=!0;b&&
|
|
|
b(f)},c,d);return f},setCrossOrigin:function(a){this.crossOrigin=a}};
|
|
|
THREE.Material=function(){Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++});this.uuid=THREE.Math.generateUUID();this.name="";this.type="Material";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=THREE.LessEqualDepth;this.colorWrite=this.depthWrite=
|
|
@@ -381,7 +381,7 @@ g)}}}();THREE.PointCloud.prototype.clone=function(){return(new this.constructor(
|
|
|
THREE.ParticleSystem=function(a,b){console.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud.");return new THREE.PointCloud(a,b)};THREE.Line=function(a,b,c){1===c&&console.error("THREE.Line: THREE.LinePieces mode has been removed. Use THREE.LineSegments instead.");THREE.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()})};THREE.Line.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Line.prototype.constructor=THREE.Line;
|
|
|
THREE.Line.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere;return function(d,e){var g=d.linePrecision,g=g*g,f=this.geometry;null===f.boundingSphere&&f.computeBoundingSphere();c.copy(f.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==d.ray.isIntersectionSphere(c)){a.getInverse(this.matrixWorld);b.copy(d.ray).applyMatrix4(a);var h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3,p=this instanceof THREE.LineSegments?2:1;if(f instanceof
|
|
|
-THREE.BufferGeometry){var m=f.attributes;if(void 0!==m.index){var q=m.index.array,m=m.position.array,t=f.drawcalls;0===t.length&&f.addDrawCall(0,q.length);for(var r=0;r<t.length;r++)for(var f=t[r],u=f.start,x=f.count,f=u;f<u+x-1;f+=p){var v=q[f+1];h.fromArray(m,3*q[f]);k.fromArray(m,3*v);v=b.distanceSqToSegment(h,k,n,l);v>g||(v=b.origin.distanceTo(n),v<d.near||v>d.far||e.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),index:f,offsetIndex:r,face:null,faceIndex:null,object:this}))}}else for(m=
|
|
|
+THREE.BufferGeometry){var m=f.attributes;if(void 0!==m.index){var q=m.index.array,m=m.position.array,t=f.drawcalls;0===t.length&&f.addDrawCall(0,q.length);for(var r=0;r<t.length;r++)for(var f=t[r],u=f.start,w=f.count,f=u;f<u+w-1;f+=p){var v=q[f+1];h.fromArray(m,3*q[f]);k.fromArray(m,3*v);v=b.distanceSqToSegment(h,k,n,l);v>g||(v=b.origin.distanceTo(n),v<d.near||v>d.far||e.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),index:f,offsetIndex:r,face:null,faceIndex:null,object:this}))}}else for(m=
|
|
|
m.position.array,f=0;f<m.length/3-1;f+=p)h.fromArray(m,3*f),k.fromArray(m,3*f+3),v=b.distanceSqToSegment(h,k,n,l),v>g||(v=b.origin.distanceTo(n),v<d.near||v>d.far||e.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(f instanceof THREE.Geometry)for(h=f.vertices,k=h.length,f=0;f<k-1;f+=p)v=b.distanceSqToSegment(h[f],h[f+1],n,l),v>g||(v=b.origin.distanceTo(n),v<d.near||v>d.far||e.push({distance:v,point:l.clone().applyMatrix4(this.matrixWorld),
|
|
|
index:f,face:null,faceIndex:null,object:this}))}}}();THREE.Line.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};
|
|
|
THREE.Line.prototype.toJSON=function(a){var b=THREE.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON());void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON());b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};THREE.LineStrip=0;THREE.LinePieces=1;THREE.LineSegments=function(a,b){THREE.Line.call(this,a,b);this.type="LineSegments"};
|
|
@@ -389,10 +389,10 @@ THREE.LineSegments.prototype=Object.create(THREE.Line.prototype);THREE.LineSegme
|
|
|
THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
|
|
|
THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
|
|
|
THREE.Mesh.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere,d=new THREE.Vector3,e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3;return function(l,n){var p=this.geometry,m=this.material;if(void 0!==m&&(null===p.boundingSphere&&p.computeBoundingSphere(),c.copy(p.boundingSphere),c.applyMatrix4(this.matrixWorld),!1!==l.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(l.ray).applyMatrix4(a),null===
|
|
|
-p.boundingBox||!1!==b.isIntersectionBox(p.boundingBox)))){var q,t,r;if(p instanceof THREE.BufferGeometry)if(q=p.attributes,void 0!==q.index){var u=q.index.array,x=q.position.array,v=p.drawcalls;0===v.length&&p.addDrawCall(0,u.length);for(var p=0,y=v.length;p<y;++p){q=v[p];for(var w=t=q.start,E=t+q.count;w<E;w+=3){q=u[w];t=u[w+1];r=u[w+2];d.fromArray(x,3*q);e.fromArray(x,3*t);g.fromArray(x,3*r);var B=m.side===THREE.BackSide?b.intersectTriangle(g,e,d,!0):b.intersectTriangle(d,e,g,m.side!==THREE.DoubleSide);
|
|
|
-if(null!==B){B.applyMatrix4(this.matrixWorld);var z=l.ray.origin.distanceTo(B);z<l.near||z>l.far||n.push({distance:z,point:B,face:new THREE.Face3(q,t,r,THREE.Triangle.normal(d,e,g)),faceIndex:Math.floor(w/3),object:this})}}}}else for(x=q.position.array,w=0,E=x.length;w<E;w+=9)d.fromArray(x,w),e.fromArray(x,w+3),g.fromArray(x,w+6),B=m.side===THREE.BackSide?b.intersectTriangle(g,e,d,!0):b.intersectTriangle(d,e,g,m.side!==THREE.DoubleSide),null!==B&&(B.applyMatrix4(this.matrixWorld),z=l.ray.origin.distanceTo(B),
|
|
|
-z<l.near||z>l.far||(q=w/3,t=q+1,r=q+2,n.push({distance:z,point:B,face:new THREE.Face3(q,t,r,THREE.Triangle.normal(d,e,g)),index:q,object:this})));else if(p instanceof THREE.Geometry)for(u=m instanceof THREE.MeshFaceMaterial,x=!0===u?m.materials:null,v=p.vertices,y=p.faces,w=0,E=y.length;w<E;w++){var A=y[w],B=!0===u?x[A.materialIndex]:m;if(void 0!==B){q=v[A.a];t=v[A.b];r=v[A.c];if(!0===B.morphTargets){var z=p.morphTargets,M=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);g.set(0,0,0);for(var J=
|
|
|
-0,D=z.length;J<D;J++){var P=M[J];if(0!==P){var K=z[J].vertices;d.addScaledVector(f.subVectors(K[A.a],q),P);e.addScaledVector(h.subVectors(K[A.b],t),P);g.addScaledVector(k.subVectors(K[A.c],r),P)}}d.add(q);e.add(t);g.add(r);q=d;t=e;r=g}B=B.side===THREE.BackSide?b.intersectTriangle(r,t,q,!0):b.intersectTriangle(q,t,r,B.side!==THREE.DoubleSide);null!==B&&(B.applyMatrix4(this.matrixWorld),z=l.ray.origin.distanceTo(B),z<l.near||z>l.far||n.push({distance:z,point:B,face:A,faceIndex:w,object:this}))}}}}}();
|
|
|
+p.boundingBox||!1!==b.isIntersectionBox(p.boundingBox)))){var q,t,r;if(p instanceof THREE.BufferGeometry)if(q=p.attributes,void 0!==q.index){var u=q.index.array,w=q.position.array,v=p.drawcalls;0===v.length&&p.addDrawCall(0,u.length);for(var p=0,y=v.length;p<y;++p){q=v[p];for(var x=t=q.start,E=t+q.count;x<E;x+=3){q=u[x];t=u[x+1];r=u[x+2];d.fromArray(w,3*q);e.fromArray(w,3*t);g.fromArray(w,3*r);var B=m.side===THREE.BackSide?b.intersectTriangle(g,e,d,!0):b.intersectTriangle(d,e,g,m.side!==THREE.DoubleSide);
|
|
|
+if(null!==B){B.applyMatrix4(this.matrixWorld);var z=l.ray.origin.distanceTo(B);z<l.near||z>l.far||n.push({distance:z,point:B,face:new THREE.Face3(q,t,r,THREE.Triangle.normal(d,e,g)),faceIndex:Math.floor(x/3),object:this})}}}}else for(w=q.position.array,x=0,E=w.length;x<E;x+=9)d.fromArray(w,x),e.fromArray(w,x+3),g.fromArray(w,x+6),B=m.side===THREE.BackSide?b.intersectTriangle(g,e,d,!0):b.intersectTriangle(d,e,g,m.side!==THREE.DoubleSide),null!==B&&(B.applyMatrix4(this.matrixWorld),z=l.ray.origin.distanceTo(B),
|
|
|
+z<l.near||z>l.far||(q=x/3,t=q+1,r=q+2,n.push({distance:z,point:B,face:new THREE.Face3(q,t,r,THREE.Triangle.normal(d,e,g)),index:q,object:this})));else if(p instanceof THREE.Geometry)for(u=m instanceof THREE.MeshFaceMaterial,w=!0===u?m.materials:null,v=p.vertices,y=p.faces,x=0,E=y.length;x<E;x++){var A=y[x],B=!0===u?w[A.materialIndex]:m;if(void 0!==B){q=v[A.a];t=v[A.b];r=v[A.c];if(!0===B.morphTargets){var z=p.morphTargets,M=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);g.set(0,0,0);for(var J=
|
|
|
+0,D=z.length;J<D;J++){var P=M[J];if(0!==P){var K=z[J].vertices;d.addScaledVector(f.subVectors(K[A.a],q),P);e.addScaledVector(h.subVectors(K[A.b],t),P);g.addScaledVector(k.subVectors(K[A.c],r),P)}}d.add(q);e.add(t);g.add(r);q=d;t=e;r=g}B=B.side===THREE.BackSide?b.intersectTriangle(r,t,q,!0):b.intersectTriangle(q,t,r,B.side!==THREE.DoubleSide);null!==B&&(B.applyMatrix4(this.matrixWorld),z=l.ray.origin.distanceTo(B),z<l.near||z>l.far||n.push({distance:z,point:B,face:A,faceIndex:x,object:this}))}}}}}();
|
|
|
THREE.Mesh.prototype.clone=function(){return(new this.constructor(this.geometry,this.material)).copy(this)};THREE.Mesh.prototype.toJSON=function(a){var b=THREE.Object3D.prototype.toJSON.call(this,a);void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON(a));void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON(a));b.object.geometry=this.geometry.uuid;b.object.material=this.material.uuid;return b};
|
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.copy=function(a){THREE.Object3D.prototype.copy.call(this,a);this.skin=a.skin;return this};
|
|
|
THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=THREE.Math.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),
|
|
@@ -507,7 +507,7 @@ b[ba],Y.onlyShadow||(Ka=Y.color,Ra=Y.intensity,rb=Y.distance,Y instanceof THREE.
|
|
|
1]=ka.y,vb[bb+2]=ka.z,jb[La]=rb,kb[La]=0===Y.distance?0:Y.decay,La+=1)):Y instanceof THREE.SpotLight?(Eb+=1,Y.visible&&(Da=3*wa,y(wb,Da,Ka,Ra),ga.setFromMatrixPosition(Y.matrixWorld),xb[Da+0]=ga.x,xb[Da+1]=ga.y,xb[Da+2]=ga.z,Jb[wa]=rb,ka.setFromMatrixPosition(Y.target.matrixWorld),ga.sub(ka),ga.normalize(),yb[Da+0]=ga.x,yb[Da+1]=ga.y,yb[Da+2]=ga.z,Kb[wa]=Math.cos(Y.angle),Lb[wa]=Y.exponent,Mb[wa]=0===Y.distance?0:Y.decay,wa+=1)):Y instanceof THREE.HemisphereLight&&(gb+=1,Y.visible&&(ga.setFromMatrixPosition(Y.matrixWorld),
|
|
|
ga.normalize(),Ta=3*Sa,Bb[Ta+0]=ga.x,Bb[Ta+1]=ga.y,Bb[Ta+2]=ga.z,Ya=Y.color,db=Y.groundColor,y(zb,Ta,Ya,Ra),y(Ab,Ta,db,Ra),Sa+=1)));ba=3*$a;for(qa=Math.max(sb.length,3*Cb);ba<qa;ba++)sb[ba]=0;ba=3*La;for(qa=Math.max(ub.length,3*Db);ba<qa;ba++)ub[ba]=0;ba=3*wa;for(qa=Math.max(wb.length,3*Eb);ba<qa;ba++)wb[ba]=0;ba=3*Sa;for(qa=Math.max(zb.length,3*gb);ba<qa;ba++)zb[ba]=0;ba=3*Sa;for(qa=Math.max(Ab.length,3*gb);ba<qa;ba++)Ab[ba]=0;da.directional.length=$a;da.point.length=La;da.spot.length=wa;da.hemi.length=
|
|
|
Sa;da.ambient[0]=ob;da.ambient[1]=pb;da.ambient[2]=qb;eb=!1}if(ya){var ia=Qb;I.ambientLightColor.value=ia.ambient;I.directionalLightColor.value=ia.directional.colors;I.directionalLightDirection.value=ia.directional.positions;I.pointLightColor.value=ia.point.colors;I.pointLightPosition.value=ia.point.positions;I.pointLightDistance.value=ia.point.distances;I.pointLightDecay.value=ia.point.decays;I.spotLightColor.value=ia.spot.colors;I.spotLightPosition.value=ia.spot.positions;I.spotLightDistance.value=
|
|
|
-ia.spot.distances;I.spotLightDirection.value=ia.spot.directions;I.spotLightAngleCos.value=ia.spot.anglesCos;I.spotLightExponent.value=ia.spot.exponents;I.spotLightDecay.value=ia.spot.decays;I.hemisphereLightSkyColor.value=ia.hemi.skyColors;I.hemisphereLightGroundColor.value=ia.hemi.groundColors;I.hemisphereLightDirection.value=ia.hemi.positions;x(I,!0)}else x(I,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){I.opacity.value=
|
|
|
+ia.spot.distances;I.spotLightDirection.value=ia.spot.directions;I.spotLightAngleCos.value=ia.spot.anglesCos;I.spotLightExponent.value=ia.spot.exponents;I.spotLightDecay.value=ia.spot.decays;I.hemisphereLightSkyColor.value=ia.hemi.skyColors;I.hemisphereLightGroundColor.value=ia.hemi.groundColors;I.hemisphereLightDirection.value=ia.hemi.positions;w(I,!0)}else w(I,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){I.opacity.value=
|
|
|
d.opacity;I.diffuse.value=d.color;I.map.value=d.map;I.specularMap.value=d.specularMap;I.alphaMap.value=d.alphaMap;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 xa;d.map?xa=d.map:d.specularMap?xa=d.specularMap:d.normalMap?xa=d.normalMap:d.bumpMap?xa=d.bumpMap:d.alphaMap?xa=d.alphaMap:d.emissiveMap&&(xa=d.emissiveMap);if(void 0!==xa){var Rb=xa.offset,Sb=xa.repeat;I.offsetRepeat.value.set(Rb.x,
|
|
|
Rb.y,Sb.x,Sb.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}if(d instanceof THREE.LineBasicMaterial)I.diffuse.value=d.color,I.opacity.value=d.opacity;else if(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;else if(d instanceof THREE.PointCloudMaterial){if(I.psColor.value=
|
|
|
d.color,I.opacity.value=d.opacity,I.size.value=d.size,I.scale.value=J.height/2,I.map.value=d.map,null!==d.map){var Tb=d.map.offset,Ub=d.map.repeat;I.offsetRepeat.value.set(Tb.x,Tb.y,Ub.x,Ub.y)}}else d instanceof THREE.MeshPhongMaterial?(I.shininess.value=d.shininess,I.emissive.value=d.emissive,I.specular.value=d.specular,I.lightMap.value=d.lightMap,I.lightMapIntensity.value=d.lightMapIntensity,I.aoMap.value=d.aoMap,I.aoMapIntensity.value=d.aoMapIntensity,I.emissiveMap.value=d.emissiveMap):d instanceof
|
|
@@ -518,11 +518,11 @@ N.z);break;case "v4":s.uniform4f(W,N.x,N.y,N.z,N.w);break;case "c":s.uniform3f(W
|
|
|
N.length;S<oa;S++)sa=3*S,V._array[sa+0]=N[S].x,V._array[sa+1]=N[S].y,V._array[sa+2]=N[S].z;s.uniform3fv(W,V._array);break;case "v4v":void 0===V._array&&(V._array=new Float32Array(4*N.length));S=0;for(oa=N.length;S<oa;S++)sa=4*S,V._array[sa+0]=N[S].x,V._array[sa+1]=N[S].y,V._array[sa+2]=N[S].z,V._array[sa+3]=N[S].w;s.uniform4fv(W,V._array);break;case "m3":s.uniformMatrix3fv(W,!1,N.elements);break;case "m3v":void 0===V._array&&(V._array=new Float32Array(9*N.length));S=0;for(oa=N.length;S<oa;S++)N[S].flattenToArrayOffset(V._array,
|
|
|
9*S);s.uniformMatrix3fv(W,!1,V._array);break;case "m4":s.uniformMatrix4fv(W,!1,N.elements);break;case "m4v":void 0===V._array&&(V._array=new Float32Array(16*N.length));S=0;for(oa=N.length;S<oa;S++)N[S].flattenToArrayOffset(V._array,16*S);s.uniformMatrix4fv(W,!1,V._array);break;case "t":ra=N;Ma=v();s.uniform1i(W,Ma);if(!ra)continue;if(ra instanceof THREE.CubeTexture||Array.isArray(ra.image)&&6===ra.image.length){var fa=ra,Wb=Ma,Va=Z.get(fa);if(6===fa.image.length)if(0<fa.version&&Va.__version!==fa.version){Va.__image__webglTextureCube||
|
|
|
(fa.addEventListener("dispose",g),Va.__image__webglTextureCube=s.createTexture(),Ca.textures++);L.activeTexture(s.TEXTURE0+Wb);L.bindTexture(s.TEXTURE_CUBE_MAP,Va.__image__webglTextureCube);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,fa.flipY);for(var Xb=fa instanceof THREE.CompressedTexture,Hb=fa.image[0]instanceof THREE.DataTexture,Na=[],ha=0;6>ha;ha++)Na[ha]=!ja.autoScaleCubemaps||Xb||Hb?Hb?fa.image[ha].image:fa.image[ha]:E(fa.image[ha],bc);var Yb=Na[0],Zb=THREE.Math.isPowerOfTwo(Yb.width)&&THREE.Math.isPowerOfTwo(Yb.height),
|
|
|
-Fa=M(fa.format),Ib=M(fa.type);w(s.TEXTURE_CUBE_MAP,fa,Zb);for(ha=0;6>ha;ha++)if(Xb)for(var Oa,$b=Na[ha].mipmaps,cb=0,Pb=$b.length;cb<Pb;cb++)Oa=$b[cb],fa.format!==THREE.RGBAFormat&&fa.format!==THREE.RGBFormat?-1<L.getCompressedTextureFormats().indexOf(Fa)?L.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ha,cb,Fa,Oa.width,Oa.height,0,Oa.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+Fa=M(fa.format),Ib=M(fa.type);x(s.TEXTURE_CUBE_MAP,fa,Zb);for(ha=0;6>ha;ha++)if(Xb)for(var Oa,$b=Na[ha].mipmaps,cb=0,Pb=$b.length;cb<Pb;cb++)Oa=$b[cb],fa.format!==THREE.RGBAFormat&&fa.format!==THREE.RGBFormat?-1<L.getCompressedTextureFormats().indexOf(Fa)?L.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ha,cb,Fa,Oa.width,Oa.height,0,Oa.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
ha,cb,Fa,Oa.width,Oa.height,0,Fa,Ib,Oa.data);else Hb?L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ha,0,Fa,Na[ha].width,Na[ha].height,0,Fa,Ib,Na[ha].data):L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ha,0,Fa,Fa,Ib,Na[ha]);fa.generateMipmaps&&Zb&&s.generateMipmap(s.TEXTURE_CUBE_MAP);Va.__version=fa.version;if(fa.onUpdate)fa.onUpdate(fa)}else L.activeTexture(s.TEXTURE0+Wb),L.bindTexture(s.TEXTURE_CUBE_MAP,Va.__image__webglTextureCube)}else if(ra instanceof THREE.WebGLRenderTargetCube){var cc=ra;L.activeTexture(s.TEXTURE0+
|
|
|
Ma);L.bindTexture(s.TEXTURE_CUBE_MAP,Z.get(cc).__webglTexture)}else ja.setTexture(ra,Ma);break;case "tv":void 0===V._array&&(V._array=[]);S=0;for(oa=V.value.length;S<oa;S++)V._array[S]=v();s.uniform1iv(W,V._array);S=0;for(oa=V.value.length;S<oa;S++)ra=V.value[S],Ma=V._array[S],ra&&ja.setTexture(ra,Ma);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+Vb)}}}}s.uniformMatrix4fv(ca.modelViewMatrix,!1,e._modelViewMatrix.elements);ca.normalMatrix&&s.uniformMatrix3fv(ca.normalMatrix,
|
|
|
-!1,e._normalMatrix.elements);void 0!==ca.modelMatrix&&s.uniformMatrix4fv(ca.modelMatrix,!1,e.matrixWorld.elements);return Za}function x(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.pointLightDecay.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=
|
|
|
-b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.spotLightDecay.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function v(){var a=fb;a>=db&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+db);fb+=1;return a}function y(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function w(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,M(b.wrapS)),s.texParameteri(a,
|
|
|
+!1,e._normalMatrix.elements);void 0!==ca.modelMatrix&&s.uniformMatrix4fv(ca.modelMatrix,!1,e.matrixWorld.elements);return Za}function w(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.pointLightDecay.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate=
|
|
|
+b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.spotLightDecay.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function v(){var a=fb;a>=db&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+db);fb+=1;return a}function y(a,b,c,d){a[b+0]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function x(a,b,c){c?(s.texParameteri(a,s.TEXTURE_WRAP_S,M(b.wrapS)),s.texParameteri(a,
|
|
|
s.TEXTURE_WRAP_T,M(b.wrapT)),s.texParameteri(a,s.TEXTURE_MAG_FILTER,M(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,M(b.minFilter))):(s.texParameteri(a,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(a,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+b.sourceFile+" )"),s.texParameteri(a,s.TEXTURE_MAG_FILTER,
|
|
|
A(b.magFilter)),s.texParameteri(a,s.TEXTURE_MIN_FILTER,A(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+b.sourceFile+" )"));(c=X.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&b.type!==THREE.HalfFloatType&&(1<b.anisotropy||Z.get(b).__currentAnisotropy)&&(s.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,
|
|
|
Math.min(b.anisotropy,ja.getMaxAnisotropy())),Z.get(b).__currentAnisotropy=b.anisotropy)}function E(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a}function B(a,b,c){s.bindFramebuffer(s.FRAMEBUFFER,
|
|
@@ -546,7 +546,7 @@ function(){s.clear(s.STENCIL_BUFFER_BIT)};this.clearTarget=function(a,b,c,d){thi
|
|
|
a.hasPositions&&(s.bindBuffer(s.ARRAY_BUFFER,d.position),s.bufferData(s.ARRAY_BUFFER,a.positionArray,s.DYNAMIC_DRAW),L.enableAttribute(b.position),s.vertexAttribPointer(b.position,3,s.FLOAT,!1,0,0));if(a.hasNormals){s.bindBuffer(s.ARRAY_BUFFER,d.normal);if("MeshPhongMaterial"!==c.type&&c.shading===THREE.FlatShading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,k=(g[e+1]+g[e+4]+g[e+7])/3,l=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h;g[e+1]=k;g[e+2]=l;g[e+3]=h;g[e+4]=k;g[e+
|
|
|
5]=l;g[e+6]=h;g[e+7]=k;g[e+8]=l}s.bufferData(s.ARRAY_BUFFER,a.normalArray,s.DYNAMIC_DRAW);L.enableAttribute(b.normal);s.vertexAttribPointer(b.normal,3,s.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(s.bindBuffer(s.ARRAY_BUFFER,d.uv),s.bufferData(s.ARRAY_BUFFER,a.uvArray,s.DYNAMIC_DRAW),L.enableAttribute(b.uv),s.vertexAttribPointer(b.uv,2,s.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(s.bindBuffer(s.ARRAY_BUFFER,d.color),s.bufferData(s.ARRAY_BUFFER,a.colorArray,s.DYNAMIC_DRAW),L.enableAttribute(b.color),
|
|
|
s.vertexAttribPointer(b.color,3,s.FLOAT,!1,0,0));L.disableUnusedAttributes();s.drawArrays(s.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){r(e);var g=u(a,b,c,e,f),h=!1;a=d.id+"_"+g.id+"_"+e.wireframe;a!==Ia&&(Ia=a,h=!0);a=f.morphTargetInfluences;if(void 0!==a){b=[];c=0;for(var k=a.length;c<k;c++)h=a[c],b.push([h,c]);b.sort(l);8<b.length&&(b.length=8);var m=d.morphAttributes;c=0;for(k=b.length;c<k;c++)h=b[c],ib[c]=h[0],0!==h[0]?(a=h[1],!0===e.morphTargets&&d.addAttribute("morphTarget"+
|
|
|
-c,m.position[a]),!0===e.morphNormals&&d.addAttribute("morphNormal"+c,m.normal[a])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=g.getUniforms();null!==a.morphTargetInfluences&&s.uniform1fv(a.morphTargetInfluences,ib);h=!0}a=d.attributes.index;k=d.attributes.position;!0===e.wireframe&&(a=d.attributes.wireframe);b=d.drawcalls;void 0!==a?(c=Lb,c.setIndex(a)):c=Kb;if(h){a:{var h=void 0,n;if(d instanceof THREE.InstancedBufferGeometry&&
|
|
|
+c,m.position[a]),!0===e.morphNormals&&d.addAttribute("morphNormal"+c,m.normal[a])):(!0===e.morphTargets&&d.removeAttribute("morphTarget"+c),!0===e.morphNormals&&d.removeAttribute("morphNormal"+c));a=g.getUniforms();null!==a.morphTargetInfluences&&s.uniform1fv(a.morphTargetInfluences,ib);h=!0}a=d.attributes.index;k=d.attributes.position;!0===e.wireframe&&(a=ua.getWireframeAttribute(d));b=d.drawcalls;void 0!==a?(c=Lb,c.setIndex(a)):c=Kb;if(h){a:{var h=void 0,n;if(d instanceof THREE.InstancedBufferGeometry&&
|
|
|
(n=X.get("ANGLE_instanced_arrays"),null===n)){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");break a}void 0===h&&(h=0);L.initAttributes();var m=d.attributes,g=g.getAttributes(),p=e.defaultAttributeValues,q;for(q in g){var t=g[q];if(0<=t){var v=m[q];if(void 0!==v){L.enableAttribute(t);var w=v.itemSize,x=ua.getAttributeBuffer(v);if(v instanceof THREE.InterleavedBufferAttribute){var y=v.data,
|
|
|
z=y.stride,v=v.offset;s.bindBuffer(s.ARRAY_BUFFER,x);s.vertexAttribPointer(t,w,s.FLOAT,!1,z*y.array.BYTES_PER_ELEMENT,(h*z+v)*y.array.BYTES_PER_ELEMENT);if(y instanceof THREE.InstancedInterleavedBuffer){if(null===n){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}n.vertexAttribDivisorANGLE(t,y.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=y.meshPerAttribute*
|
|
|
y.count)}}else if(s.bindBuffer(s.ARRAY_BUFFER,x),s.vertexAttribPointer(t,w,s.FLOAT,!1,0,h*w*4),v instanceof THREE.InstancedBufferAttribute){if(null===n){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");break a}n.vertexAttribDivisorANGLE(t,v.meshPerAttribute);void 0===d.maxInstancedCount&&(d.maxInstancedCount=v.meshPerAttribute*v.count)}}else if(void 0!==p&&(w=p[q],void 0!==w))switch(w.length){case 2:s.vertexAttrib2fv(t,
|
|
@@ -557,11 +557,11 @@ this.autoClearDepth,this.autoClearStencil);a.overrideMaterial?(d=a.overrideMater
|
|
|
null)):(L.bindTexture(s.TEXTURE_2D,Z.get(c).__webglTexture),s.generateMipmap(s.TEXTURE_2D),L.bindTexture(s.TEXTURE_2D,null)));L.setDepthTest(!0);L.setDepthWrite(!0);L.setColorWrite(!0)}};var ac={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?L.disable(s.CULL_FACE):
|
|
|
(b===THREE.FrontFaceDirectionCW?s.frontFace(s.CW):s.frontFace(s.CCW),a===THREE.CullFaceBack?s.cullFace(s.BACK):a===THREE.CullFaceFront?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK),L.enable(s.CULL_FACE))};this.setTexture=function(a,b){var c=Z.get(a);if(0<a.version&&c.__version!==a.version){var d=a.image;if(void 0===d)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",a);else if(!1===d.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",
|
|
|
a);else{void 0===c.__webglInit&&(c.__webglInit=!0,a.__webglInit=!0,a.addEventListener("dispose",g),c.__webglTexture=s.createTexture(),Ca.textures++);L.activeTexture(s.TEXTURE0+b);L.bindTexture(s.TEXTURE_2D,c.__webglTexture);s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY);s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);s.pixelStorei(s.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=E(a.image,Mb);var e=a.image,d=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),f=M(a.format),
|
|
|
-h=M(a.type);w(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],L.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);a.generateMipmaps=!1}else L.texImage2D(s.TEXTURE_2D,0,f,e.width,e.height,0,f,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<L.getCompressedTextureFormats().indexOf(f)?L.compressedTexImage2D(s.TEXTURE_2D,
|
|
|
+h=M(a.type);x(s.TEXTURE_2D,a,d);var k=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<k.length&&d){for(var l=0,m=k.length;l<m;l++)e=k[l],L.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);a.generateMipmaps=!1}else L.texImage2D(s.TEXTURE_2D,0,f,e.width,e.height,0,f,h,e.data);else if(a instanceof THREE.CompressedTexture)for(l=0,m=k.length;l<m;l++)e=k[l],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<L.getCompressedTextureFormats().indexOf(f)?L.compressedTexImage2D(s.TEXTURE_2D,
|
|
|
l,f,e.width,e.height,0,e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):L.texImage2D(s.TEXTURE_2D,l,f,e.width,e.height,0,f,h,e.data);else if(0<k.length&&d){l=0;for(m=k.length;l<m;l++)e=k[l],L.texImage2D(s.TEXTURE_2D,l,f,f,h,e);a.generateMipmaps=!1}else L.texImage2D(s.TEXTURE_2D,0,f,f,h,a.image);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);c.__version=a.version;if(a.onUpdate)a.onUpdate(a)}}else L.activeTexture(s.TEXTURE0+
|
|
|
b),L.bindTexture(s.TEXTURE_2D,c.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===Z.get(a).__webglFramebuffer){var c=Z.get(a);void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",f);c.__webglTexture=s.createTexture();Ca.textures++;var d=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),e=M(a.format),g=M(a.type);if(b){c.__webglFramebuffer=[];c.__webglRenderbuffer=
|
|
|
-[];L.bindTexture(s.TEXTURE_CUBE_MAP,c.__webglTexture);w(s.TEXTURE_CUBE_MAP,a,d);for(var h=0;6>h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),z(c.__webglRenderbuffer[h],a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?
|
|
|
-a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),L.bindTexture(s.TEXTURE_2D,c.__webglTexture),w(s.TEXTURE_2D,a,d),L.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):
|
|
|
+[];L.bindTexture(s.TEXTURE_CUBE_MAP,c.__webglTexture);x(s.TEXTURE_CUBE_MAP,a,d);for(var h=0;6>h;h++)c.__webglFramebuffer[h]=s.createFramebuffer(),c.__webglRenderbuffer[h]=s.createRenderbuffer(),L.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer[h],a,s.TEXTURE_CUBE_MAP_POSITIVE_X+h),z(c.__webglRenderbuffer[h],a);a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_CUBE_MAP)}else c.__webglFramebuffer=s.createFramebuffer(),c.__webglRenderbuffer=a.shareDepthFrom?
|
|
|
+a.shareDepthFrom.__webglRenderbuffer:s.createRenderbuffer(),L.bindTexture(s.TEXTURE_2D,c.__webglTexture),x(s.TEXTURE_2D,a,d),L.texImage2D(s.TEXTURE_2D,0,e,a.width,a.height,0,e,g,null),B(c.__webglFramebuffer,a,s.TEXTURE_2D),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,c.__webglRenderbuffer):
|
|
|
z(c.__webglRenderbuffer,a),a.generateMipmaps&&d&&s.generateMipmap(s.TEXTURE_2D);b?L.bindTexture(s.TEXTURE_CUBE_MAP,null):L.bindTexture(s.TEXTURE_2D,null);s.bindRenderbuffer(s.RENDERBUFFER,null);s.bindFramebuffer(s.FRAMEBUFFER,null)}a?(c=Z.get(a),b=b?c.__webglFramebuffer[a.activeCubeFace]:c.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Ha,a=Ba,d=Aa,e=Ga);b!==ya&&(s.bindFramebuffer(s.FRAMEBUFFER,b),s.viewport(d,e,c,a),ya=b);jb=c;kb=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof
|
|
|
THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(Z.get(a).__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");else{var g=!1;Z.get(a).__webglFramebuffer!==ya&&(s.bindFramebuffer(s.FRAMEBUFFER,Z.get(a).__webglFramebuffer),g=!0);s.checkFramebufferStatus(s.FRAMEBUFFER)===s.FRAMEBUFFER_COMPLETE?
|
|
|
s.readPixels(b,c,d,e,s.RGBA,s.UNSIGNED_BYTE,f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");g&&s.bindFramebuffer(s.FRAMEBUFFER,ya)}};this.supportsFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).");return X.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).");
|
|
@@ -580,17 +580,17 @@ THREE.WebGLIndexedBufferRenderer=function(a,b,c){function d(b,d){a.drawElements(
|
|
|
null===c?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):c.drawElementsInstancedANGLE(e,a.attributes.index.array.length,g,0,a.maxInstancedCount)}};
|
|
|
THREE.WebGLExtensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
|
|
|
break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:d=a.getExtension(c)}null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}};
|
|
|
-THREE.WebGLGeometries=function(a,b,c){function d(a,b,c){if(!0===a[b+"|"+c])return!1;a[b+"|"+c]=!0;return a[c+"|"+b]=!0}function e(a){var b=a.attributes;a=[];var c=b.index,b=b.position;console.time("wireframe");if(void 0!==c)for(var e={},c=c.array,f=0,g=c.length;f<g;f+=3){var q=c[f+0],t=c[f+1],r=c[f+2];d(e,q,t)&&a.push(q,t);d(e,t,r)&&a.push(t,r);d(e,r,q)&&a.push(r,q)}else for(c=b.array,f=0,g=c.length/3-1;f<g;f+=3)q=f+0,t=f+1,r=f+2,a.push(q,t,t,r,r,q);console.timeEnd("wireframe");return new THREE.BufferAttribute(new (65535<
|
|
|
-b.array.length?Uint32Array:Uint16Array)(a),1)}function g(d){d=d.target;var e=f[d.id].attributes,l;for(l in e){var n=e[l],p;p=n;p=p instanceof THREE.InterleavedBufferAttribute?b.get(p.data).__webglBuffer:b.get(p).__webglBuffer;void 0!==p&&(a.deleteBuffer(p),n instanceof THREE.InterleavedBufferAttribute?b.delete(n.data):b.delete(n))}d.removeEventListener("dispose",g);delete f[d.id];c.memory.geometries--}var f={};this.get=function(a){var b=a.geometry;if(void 0!==f[b.id])return f[b.id];b.addEventListener("dispose",
|
|
|
-g);var d;b instanceof THREE.BufferGeometry?d=b:b instanceof THREE.Geometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new THREE.BufferGeometry).setFromObject(a)),d=b._bufferGeometry);a instanceof THREE.Mesh&&d.addAttribute("wireframe",e(d));f[b.id]=d;c.memory.geometries++;return d}};
|
|
|
-THREE.WebGLObjects=function(a,b,c){function d(a){a.target.traverse(function(a){a.removeEventListener("remove",d);(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)&&delete g[a.id];delete a._modelViewMatrix;delete a._normalMatrix;b.delete(a)})}function e(c,d){var e;e="index"===d||"wireframe"===d?a.ELEMENT_ARRAY_BUFFER:a.ARRAY_BUFFER;var f=c instanceof THREE.InterleavedBufferAttribute?c.data:c,g=b.get(f);if(void 0===g.__webglBuffer){g.__webglBuffer=a.createBuffer();a.bindBuffer(e,
|
|
|
-g.__webglBuffer);var m=a.STATIC_DRAW;if(f instanceof THREE.DynamicBufferAttribute||f instanceof THREE.InstancedBufferAttribute&&!0===f.dynamic||f instanceof THREE.InterleavedBuffer&&!0===f.dynamic)m=a.DYNAMIC_DRAW;a.bufferData(e,f.array,m);g.version=f.version}else g.version!==f.version&&(a.bindBuffer(e,g.__webglBuffer),void 0===f.updateRange||-1===f.updateRange.count?a.bufferSubData(e,0,f.array):0===f.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):
|
|
|
-(a.bufferSubData(e,f.updateRange.offset*f.array.BYTES_PER_ELEMENT,f.array.subarray(f.updateRange.offset,f.updateRange.offset+f.updateRange.count)),f.updateRange.count=0),g.version=f.version)}var g={},f=new THREE.WebGLGeometries(a,b,c);this.objects=g;this.init=function(a){var c=b.get(a);void 0===c.__webglInit&&(c.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",d));void 0===c.__webglActive&&(c.__webglActive=!0,a instanceof THREE.Mesh||
|
|
|
-a instanceof THREE.Line||a instanceof THREE.PointCloud)&&(g[a.id]={id:a.id,object:a,z:0})};this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.update=function(a){var b=f.get(a);a.geometry instanceof THREE.Geometry&&b.updateFromObject(a);a=b.attributes;for(var c in a)e(a[c],c);a=b.morphAttributes;for(c in a)for(var d=a[c],g=0,m=d.length;g<m;g++)e(d[g],g);return b};this.updateAttribute=e;this.clear=function(){g=
|
|
|
-{}}};
|
|
|
+THREE.WebGLGeometries=function(a,b,c){function d(g){g=g.target;var f=e[g.id].attributes,h;for(h in f){var k=f[h],l;l=k;l=l instanceof THREE.InterleavedBufferAttribute?b.get(l.data).__webglBuffer:b.get(l).__webglBuffer;void 0!==l&&(a.deleteBuffer(l),k instanceof THREE.InterleavedBufferAttribute?b.delete(k.data):b.delete(k))}g.removeEventListener("dispose",d);delete e[g.id];c.memory.geometries--}var e={};this.get=function(a){var b=a.geometry;if(void 0!==e[b.id])return e[b.id];b.addEventListener("dispose",
|
|
|
+d);var h;b instanceof THREE.BufferGeometry?h=b:b instanceof THREE.Geometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new THREE.BufferGeometry).setFromObject(a)),h=b._bufferGeometry);e[b.id]=h;c.memory.geometries++;return h}};
|
|
|
+THREE.WebGLObjects=function(a,b,c){function d(a){a.target.traverse(function(a){a.removeEventListener("remove",d);(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)&&delete f[a.id];delete a._modelViewMatrix;delete a._normalMatrix;b.delete(a)})}function e(c,d){var e;e="index"===d||"wireframe"===d?a.ELEMENT_ARRAY_BUFFER:a.ARRAY_BUFFER;var f=c instanceof THREE.InterleavedBufferAttribute?c.data:c,g=b.get(f);if(void 0===g.__webglBuffer){g.__webglBuffer=a.createBuffer();a.bindBuffer(e,
|
|
|
+g.__webglBuffer);var h=a.STATIC_DRAW;if(f instanceof THREE.DynamicBufferAttribute||f instanceof THREE.InstancedBufferAttribute&&!0===f.dynamic||f instanceof THREE.InterleavedBuffer&&!0===f.dynamic)h=a.DYNAMIC_DRAW;a.bufferData(e,f.array,h);g.version=f.version}else g.version!==f.version&&(a.bindBuffer(e,g.__webglBuffer),void 0===f.updateRange||-1===f.updateRange.count?a.bufferSubData(e,0,f.array):0===f.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):
|
|
|
+(a.bufferSubData(e,f.updateRange.offset*f.array.BYTES_PER_ELEMENT,f.array.subarray(f.updateRange.offset,f.updateRange.offset+f.updateRange.count)),f.updateRange.count=0),g.version=f.version)}function g(a,b,c){if(!0===a[b+"|"+c])return!1;a[b+"|"+c]=!0;return a[c+"|"+b]=!0}var f={},h=new THREE.WebGLGeometries(a,b,c);this.objects=f;this.init=function(a){var c=b.get(a);void 0===c.__webglInit&&(c.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",
|
|
|
+d));void 0===c.__webglActive&&(c.__webglActive=!0,a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.PointCloud)&&(f[a.id]={id:a.id,object:a,z:0})};this.getAttributeBuffer=function(a){return a instanceof THREE.InterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer};this.getWireframeAttribute=function(a){var b=a.attributes;if(void 0!==b.wireframe)return b.wireframe;var c=[],d=b.index,b=b.position;console.time("wireframe");if(void 0!==d)for(var f={},d=d.array,
|
|
|
+h=0,t=d.length;h<t;h+=3){var r=d[h+0],u=d[h+1],w=d[h+2];g(f,r,u)&&c.push(r,u);g(f,u,w)&&c.push(u,w);g(f,w,r)&&c.push(w,r)}else for(d=b.array,h=0,t=d.length/3-1;h<t;h+=3)r=h+0,u=h+1,w=h+2,c.push(r,u,u,w,w,r);console.timeEnd("wireframe");c=new THREE.BufferAttribute(new (65535<b.array.length?Uint32Array:Uint16Array)(c),1);e(c,"wireframe");a.addAttribute("wireframe",c);return c};this.update=function(a){var b=h.get(a);a.geometry instanceof THREE.Geometry&&b.updateFromObject(a);a=b.attributes;for(var c in a)e(a[c],
|
|
|
+c);a=b.morphAttributes;for(c in a)for(var d=a[c],f=0,g=d.length;f<g;f++)e(d[f],f);return b};this.updateAttribute=e;this.clear=function(){f={}}};
|
|
|
THREE.WebGLProgram=function(){function a(a){var b=[],c;for(c in a){var f=a[c];!1!==f&&b.push("#define "+c+" "+f)}return b.join("\n")}function b(a){return""!==a}var c=0;return function(d,e,g,f){var h=d.context,k=g.defines,l=g.__webglShader.vertexShader,n=g.__webglShader.fragmentShader,p="SHADOWMAP_TYPE_BASIC";f.shadowMapType===THREE.PCFShadowMap?p="SHADOWMAP_TYPE_PCF":f.shadowMapType===THREE.PCFSoftShadowMap&&(p="SHADOWMAP_TYPE_PCF_SOFT");var m="ENVMAP_TYPE_CUBE",q="ENVMAP_MODE_REFLECTION",t="ENVMAP_BLENDING_MULTIPLY";
|
|
|
if(f.envMap){switch(g.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:m="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:m="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:m="ENVMAP_TYPE_SPHERE"}switch(g.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:q="ENVMAP_MODE_REFRACTION"}switch(g.combine){case THREE.MultiplyOperation:t="ENVMAP_BLENDING_MULTIPLY";
|
|
|
-break;case THREE.MixOperation:t="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:t="ENVMAP_BLENDING_ADD"}}var r=0<d.gammaFactor?d.gammaFactor:1,u=a(k),x=h.createProgram();g instanceof THREE.RawShaderMaterial?d=k="":(k=["precision "+f.precision+" float;","precision "+f.precision+" int;","#define SHADER_NAME "+g.__webglShader.name,u,f.supportsVertexTextures?"#define VERTEX_TEXTURES":"",d.gammaInput?"#define GAMMA_INPUT":"",d.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+r,"#define MAX_DIR_LIGHTS "+
|
|
|
+break;case THREE.MixOperation:t="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:t="ENVMAP_BLENDING_ADD"}}var r=0<d.gammaFactor?d.gammaFactor:1,u=a(k),w=h.createProgram();g instanceof THREE.RawShaderMaterial?d=k="":(k=["precision "+f.precision+" float;","precision "+f.precision+" int;","#define SHADER_NAME "+g.__webglShader.name,u,f.supportsVertexTextures?"#define VERTEX_TEXTURES":"",d.gammaInput?"#define GAMMA_INPUT":"",d.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+r,"#define MAX_DIR_LIGHTS "+
|
|
|
f.maxDirLights,"#define MAX_POINT_LIGHTS "+f.maxPointLights,"#define MAX_SPOT_LIGHTS "+f.maxSpotLights,"#define MAX_HEMI_LIGHTS "+f.maxHemiLights,"#define MAX_SHADOWS "+f.maxShadows,"#define MAX_BONES "+f.maxBones,f.map?"#define USE_MAP":"",f.envMap?"#define USE_ENVMAP":"",f.envMap?"#define "+q:"",f.lightMap?"#define USE_LIGHTMAP":"",f.aoMap?"#define USE_AOMAP":"",f.emissiveMap?"#define USE_EMISSIVEMAP":"",f.bumpMap?"#define USE_BUMPMAP":"",f.normalMap?"#define USE_NORMALMAP":"",f.specularMap?"#define USE_SPECULARMAP":
|
|
|
"",f.alphaMap?"#define USE_ALPHAMAP":"",f.vertexColors?"#define USE_COLOR":"",f.flatShading?"#define FLAT_SHADED":"",f.skinning?"#define USE_SKINNING":"",f.useVertexTexture?"#define BONE_TEXTURE":"",f.morphTargets?"#define USE_MORPHTARGETS":"",f.morphNormals&&!1===f.flatShading?"#define USE_MORPHNORMALS":"",f.doubleSided?"#define DOUBLE_SIDED":"",f.flipSided?"#define FLIP_SIDED":"",f.shadowMapEnabled?"#define USE_SHADOWMAP":"",f.shadowMapEnabled?"#define "+p:"",f.shadowMapDebug?"#define SHADOWMAP_DEBUG":
|
|
|
"",f.sizeAttenuation?"#define USE_SIZEATTENUATION":"",f.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&d.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif",
|
|
@@ -598,61 +598,61 @@ f.maxDirLights,"#define MAX_POINT_LIGHTS "+f.maxPointLights,"#define MAX_SPOT_LI
|
|
|
"\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(b).join("\n"),d=[f.bumpMap||f.normalMap||f.flatShading||g.derivatives?"#extension GL_OES_standard_derivatives : enable":"",f.logarithmicDepthBuffer&&d.extensions.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"","precision "+f.precision+" float;","precision "+f.precision+" int;","#define SHADER_NAME "+g.__webglShader.name,u,"#define MAX_DIR_LIGHTS "+f.maxDirLights,"#define MAX_POINT_LIGHTS "+f.maxPointLights,
|
|
|
"#define MAX_SPOT_LIGHTS "+f.maxSpotLights,"#define MAX_HEMI_LIGHTS "+f.maxHemiLights,"#define MAX_SHADOWS "+f.maxShadows,f.alphaTest?"#define ALPHATEST "+f.alphaTest:"",d.gammaInput?"#define GAMMA_INPUT":"",d.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+r,f.useFog&&f.fog?"#define USE_FOG":"",f.useFog&&f.fogExp?"#define FOG_EXP2":"",f.map?"#define USE_MAP":"",f.envMap?"#define USE_ENVMAP":"",f.envMap?"#define "+m:"",f.envMap?"#define "+q:"",f.envMap?"#define "+t:"",f.lightMap?"#define USE_LIGHTMAP":
|
|
|
"",f.aoMap?"#define USE_AOMAP":"",f.emissiveMap?"#define USE_EMISSIVEMAP":"",f.bumpMap?"#define USE_BUMPMAP":"",f.normalMap?"#define USE_NORMALMAP":"",f.specularMap?"#define USE_SPECULARMAP":"",f.alphaMap?"#define USE_ALPHAMAP":"",f.vertexColors?"#define USE_COLOR":"",f.flatShading?"#define FLAT_SHADED":"",f.metal?"#define METAL":"",f.doubleSided?"#define DOUBLE_SIDED":"",f.flipSided?"#define FLIP_SIDED":"",f.shadowMapEnabled?"#define USE_SHADOWMAP":"",f.shadowMapEnabled?"#define "+p:"",f.shadowMapDebug?
|
|
|
-"#define SHADOWMAP_DEBUG":"",f.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&d.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(b).join("\n"));n=d+n;l=THREE.WebGLShader(h,h.VERTEX_SHADER,k+l);n=THREE.WebGLShader(h,h.FRAGMENT_SHADER,n);h.attachShader(x,l);h.attachShader(x,n);void 0!==g.index0AttributeName?h.bindAttribLocation(x,0,g.index0AttributeName):!0===f.morphTargets&&h.bindAttribLocation(x,
|
|
|
-0,"position");h.linkProgram(x);f=h.getProgramInfoLog(x);p=h.getShaderInfoLog(l);m=h.getShaderInfoLog(n);t=q=!0;if(!1===h.getProgramParameter(x,h.LINK_STATUS))q=!1,console.error("THREE.WebGLProgram: shader error: ",h.getError(),"gl.VALIDATE_STATUS",h.getProgramParameter(x,h.VALIDATE_STATUS),"gl.getProgramInfoLog",f,p,m);else if(""!==f)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",f);else if(""===p||""===m)t=!1;t&&(this.diagnostics={runnable:q,material:g,programLog:f,vertexShader:{log:p,
|
|
|
-prefix:k},fragmentShader:{log:m,prefix:d}});h.deleteShader(l);h.deleteShader(n);var v;this.getUniforms=function(){if(void 0===v){for(var a={},b=h.getProgramParameter(x,h.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=h.getActiveUniform(x,c).name,e=h.getUniformLocation(x,d),f=d.lastIndexOf("[0]");-1!==f&&f===d.length-3&&(a[d.substr(0,f)]=e);a[d]=e}v=a}return v};var y;this.getAttributes=function(){if(void 0===y){for(var a={},b=h.getProgramParameter(x,h.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=h.getActiveAttrib(x,
|
|
|
-c).name;a[d]=h.getAttribLocation(x,d)}y=a}return y};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});this.id=c++;this.code=e;this.usedTimes=1;this.program=x;this.vertexShader=l;this.fragmentShader=n;return this}}();
|
|
|
+"#define SHADOWMAP_DEBUG":"",f.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&d.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(b).join("\n"));n=d+n;l=THREE.WebGLShader(h,h.VERTEX_SHADER,k+l);n=THREE.WebGLShader(h,h.FRAGMENT_SHADER,n);h.attachShader(w,l);h.attachShader(w,n);void 0!==g.index0AttributeName?h.bindAttribLocation(w,0,g.index0AttributeName):!0===f.morphTargets&&h.bindAttribLocation(w,
|
|
|
+0,"position");h.linkProgram(w);f=h.getProgramInfoLog(w);p=h.getShaderInfoLog(l);m=h.getShaderInfoLog(n);t=q=!0;if(!1===h.getProgramParameter(w,h.LINK_STATUS))q=!1,console.error("THREE.WebGLProgram: shader error: ",h.getError(),"gl.VALIDATE_STATUS",h.getProgramParameter(w,h.VALIDATE_STATUS),"gl.getProgramInfoLog",f,p,m);else if(""!==f)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",f);else if(""===p||""===m)t=!1;t&&(this.diagnostics={runnable:q,material:g,programLog:f,vertexShader:{log:p,
|
|
|
+prefix:k},fragmentShader:{log:m,prefix:d}});h.deleteShader(l);h.deleteShader(n);var v;this.getUniforms=function(){if(void 0===v){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_UNIFORMS),c=0;c<b;c++){var d=h.getActiveUniform(w,c).name,e=h.getUniformLocation(w,d),f=d.lastIndexOf("[0]");-1!==f&&f===d.length-3&&(a[d.substr(0,f)]=e);a[d]=e}v=a}return v};var y;this.getAttributes=function(){if(void 0===y){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=h.getActiveAttrib(w,
|
|
|
+c).name;a[d]=h.getAttribLocation(w,d)}y=a}return y};Object.defineProperties(this,{uniforms:{get:function(){console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");return this.getUniforms()}},attributes:{get:function(){console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");return this.getAttributes()}}});this.id=c++;this.code=e;this.usedTimes=1;this.program=w;this.vertexShader=l;this.fragmentShader=n;return this}}();
|
|
|
THREE.WebGLProperties=function(){var a={};this.get=function(b){b=b.uuid;var c=a[b];void 0===c&&(c={},a[b]=c);return c};this.delete=function(b){delete a[b.uuid]};this.clear=function(){a={}}};
|
|
|
THREE.WebGLShader=function(){var a=function(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")};return function(b,c,d){var e=b.createShader(c);b.shaderSource(e,d);b.compileShader(e);!1===b.getShaderParameter(e,b.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(e)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",c===b.VERTEX_SHADER?"vertex":"fragment",b.getShaderInfoLog(e),a(d));return e}}();
|
|
|
THREE.WebGLShadowMap=function(a,b,c){function d(a,b){var c=a.geometry,c=void 0!==c.morphTargets&&0<c.morphTargets.length&&b.morphTargets,d=a instanceof THREE.SkinnedMesh&&b.skinning,c=a.customDepthMaterial?a.customDepthMaterial:d?c?u:r:c?t:q;c.wireframe=b.wireframe;c.wireframeLinewidth=b.wireframeLinewidth;return c}function e(a,b){if(!1!==a.visible){var d=c.objects[a.id];if(d&&a.castShadow&&(!1===a.frustumCulled||!0===h.intersectsObject(a))){var f=a.material;null!==f&&!0===f.visible&&(a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,
|
|
|
a.matrixWorld),n.push(d))}for(var d=a.children,f=0,g=d.length;f<g;f++)e(d[f],b)}}var g=a.context,f=a.state,h=new THREE.Frustum,k=new THREE.Matrix4;new THREE.Vector3;new THREE.Vector3;var l=new THREE.Vector3,n=[],p=THREE.ShaderLib.depthRGBA,m=THREE.UniformsUtils.clone(p.uniforms),q=new THREE.ShaderMaterial({uniforms:m,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}),t=new THREE.ShaderMaterial({uniforms:m,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,morphTargets:!0}),r=new THREE.ShaderMaterial({uniforms:m,
|
|
|
-vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,skinning:!0}),u=new THREE.ShaderMaterial({uniforms:m,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,morphTargets:!0,skinning:!0});q._shadowPass=!0;t._shadowPass=!0;r._shadowPass=!0;u._shadowPass=!0;var x=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;this.render=function(m,q){if(!1!==x.enabled&&(!1!==x.autoUpdate||!1!==x.needsUpdate)){g.clearColor(1,
|
|
|
-1,1,1);f.disable(g.BLEND);f.enable(g.CULL_FACE);g.frontFace(g.CCW);x.cullFace===THREE.CullFaceFront?g.cullFace(g.FRONT):g.cullFace(g.BACK);f.setDepthTest(!0);for(var p=0,t=b.length;p<t;p++){var r=b[p];if(r.castShadow){if(!r.shadowMap){var u=THREE.LinearFilter;x.type===THREE.PCFSoftShadowMap&&(u=THREE.NearestFilter);r.shadowMap=new THREE.WebGLRenderTarget(r.shadowMapWidth,r.shadowMapHeight,{minFilter:u,magFilter:u,format:THREE.RGBAFormat});r.shadowMapSize=new THREE.Vector2(r.shadowMapWidth,r.shadowMapHeight);
|
|
|
+vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,skinning:!0}),u=new THREE.ShaderMaterial({uniforms:m,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,morphTargets:!0,skinning:!0});q._shadowPass=!0;t._shadowPass=!0;r._shadowPass=!0;u._shadowPass=!0;var w=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=THREE.PCFShadowMap;this.cullFace=THREE.CullFaceFront;this.render=function(m,q){if(!1!==w.enabled&&(!1!==w.autoUpdate||!1!==w.needsUpdate)){g.clearColor(1,
|
|
|
+1,1,1);f.disable(g.BLEND);f.enable(g.CULL_FACE);g.frontFace(g.CCW);w.cullFace===THREE.CullFaceFront?g.cullFace(g.FRONT):g.cullFace(g.BACK);f.setDepthTest(!0);for(var p=0,t=b.length;p<t;p++){var r=b[p];if(r.castShadow){if(!r.shadowMap){var u=THREE.LinearFilter;w.type===THREE.PCFSoftShadowMap&&(u=THREE.NearestFilter);r.shadowMap=new THREE.WebGLRenderTarget(r.shadowMapWidth,r.shadowMapHeight,{minFilter:u,magFilter:u,format:THREE.RGBAFormat});r.shadowMapSize=new THREE.Vector2(r.shadowMapWidth,r.shadowMapHeight);
|
|
|
r.shadowMatrix=new THREE.Matrix4}if(!r.shadowCamera){if(r instanceof THREE.SpotLight)r.shadowCamera=new THREE.PerspectiveCamera(r.shadowCameraFov,r.shadowMapWidth/r.shadowMapHeight,r.shadowCameraNear,r.shadowCameraFar);else if(r instanceof THREE.DirectionalLight)r.shadowCamera=new THREE.OrthographicCamera(r.shadowCameraLeft,r.shadowCameraRight,r.shadowCameraTop,r.shadowCameraBottom,r.shadowCameraNear,r.shadowCameraFar);else{console.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",
|
|
|
r);continue}m.add(r.shadowCamera);!0===m.autoUpdate&&m.updateMatrixWorld()}r.shadowCameraVisible&&!r.cameraHelper&&(r.cameraHelper=new THREE.CameraHelper(r.shadowCamera),m.add(r.cameraHelper));var A=r.shadowMap,M=r.shadowMatrix,u=r.shadowCamera;u.position.setFromMatrixPosition(r.matrixWorld);l.setFromMatrixPosition(r.target.matrixWorld);u.lookAt(l);u.updateMatrixWorld();u.matrixWorldInverse.getInverse(u.matrixWorld);r.cameraHelper&&(r.cameraHelper.visible=r.shadowCameraVisible);r.shadowCameraVisible&&
|
|
|
r.cameraHelper.update();M.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);M.multiply(u.projectionMatrix);M.multiply(u.matrixWorldInverse);k.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse);h.setFromMatrix(k);a.setRenderTarget(A);a.clear();n.length=0;e(m,u);for(var J,D,r=0,A=n.length;r<A;r++)if(M=n[r],M=M.object,J=c.update(M),D=M.material,D instanceof THREE.MeshFaceMaterial)for(var P=D.materials,K=0,C=P.length;K<C;K++)D=P[K],D.visible&&a.renderBufferDirect(u,b,null,J,d(M,D),M);else a.renderBufferDirect(u,
|
|
|
-b,null,J,d(M,D),M)}}p=a.getClearColor();t=a.getClearAlpha();g.clearColor(p.r,p.g,p.b,t);f.enable(g.BLEND);x.cullFace===THREE.CullFaceFront&&g.cullFace(g.BACK);a.resetGLState();x.needsUpdate=!1}}};
|
|
|
-THREE.WebGLState=function(a,b,c){var d=this,e=new Uint8Array(16),g=new Uint8Array(16),f={},h=null,k=null,l=null,n=null,p=null,m=null,q=null,t=null,r=null,u=null,x=null,v=null,y=null,w=null,E=null,B=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),z=void 0,A={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);this.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.SRC_ALPHA,
|
|
|
+b,null,J,d(M,D),M)}}p=a.getClearColor();t=a.getClearAlpha();g.clearColor(p.r,p.g,p.b,t);f.enable(g.BLEND);w.cullFace===THREE.CullFaceFront&&g.cullFace(g.BACK);a.resetGLState();w.needsUpdate=!1}}};
|
|
|
+THREE.WebGLState=function(a,b,c){var d=this,e=new Uint8Array(16),g=new Uint8Array(16),f={},h=null,k=null,l=null,n=null,p=null,m=null,q=null,t=null,r=null,u=null,w=null,v=null,y=null,x=null,E=null,B=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),z=void 0,A={};this.init=function(){a.clearColor(0,0,0,1);a.clearDepth(1);a.clearStencil(0);this.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.frontFace(a.CCW);a.cullFace(a.BACK);this.enable(a.CULL_FACE);this.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.SRC_ALPHA,
|
|
|
a.ONE_MINUS_SRC_ALPHA)};this.initAttributes=function(){for(var a=0,b=e.length;a<b;a++)e[a]=0};this.enableAttribute=function(b){e[b]=1;0===g[b]&&(a.enableVertexAttribArray(b),g[b]=1)};this.disableUnusedAttributes=function(){for(var b=0,c=g.length;b<c;b++)g[b]!==e[b]&&(a.disableVertexAttribArray(b),g[b]=0)};this.enable=function(b){!0!==f[b]&&(a.enable(b),f[b]=!0)};this.disable=function(b){!1!==f[b]&&(a.disable(b),f[b]=!1)};this.getCompressedTextureFormats=function(){if(null===h&&(h=[],b.get("WEBGL_compressed_texture_pvrtc")||
|
|
|
b.get("WEBGL_compressed_texture_s3tc")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)h.push(c[d]);return h};this.getMaxPrecision=function(b){if("highp"===b){if(0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision)return"highp";b="mediump"}return"mediump"===b&&0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision?
|
|
|
"mediump":"lowp"};this.setBlending=function(b,d,e,f,g,h,r){b!==k&&(b===THREE.NoBlending?this.disable(a.BLEND):b===THREE.AdditiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):b===THREE.SubtractiveBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):b===THREE.MultiplyBlending?(this.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):b===THREE.CustomBlending?this.enable(a.BLEND):(this.enable(a.BLEND),
|
|
|
a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),k=b);if(b===THREE.CustomBlending){g=g||d;h=h||e;r=r||f;if(d!==l||g!==m)a.blendEquationSeparate(c(d),c(g)),l=d,m=g;if(e!==n||f!==p||h!==q||r!==t)a.blendFuncSeparate(c(e),c(f),c(h),c(r)),n=e,p=f,q=h,t=r}else t=q=m=p=n=l=null};this.setDepthFunc=function(b){if(r!==b){if(b)switch(b){case THREE.NeverDepth:a.depthFunc(a.NEVER);break;case THREE.AlwaysDepth:a.depthFunc(a.ALWAYS);
|
|
|
break;case THREE.LessDepth:a.depthFunc(a.LESS);break;case THREE.LessEqualDepth:a.depthFunc(a.LEQUAL);break;case THREE.EqualDepth:a.depthFunc(a.EQUAL);break;case THREE.GreaterEqualDepth:a.depthFunc(a.GEQUAL);break;case THREE.GreaterDepth:a.depthFunc(a.GREATER);break;case THREE.NotEqualDepth:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);r=b}};this.setDepthTest=function(b){b?this.enable(a.DEPTH_TEST):this.disable(a.DEPTH_TEST)};this.setDepthWrite=function(b){u!==
|
|
|
-b&&(a.depthMask(b),u=b)};this.setColorWrite=function(b){x!==b&&(a.colorMask(b,b,b,b),x=b)};this.setFlipSided=function(b){v!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),v=b)};this.setLineWidth=function(b){b!==y&&(a.lineWidth(b),y=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||w===c&&E===d||(a.polygonOffset(c,d),w=c,E=d)};this.setScissorTest=function(b){b?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=
|
|
|
+b&&(a.depthMask(b),u=b)};this.setColorWrite=function(b){w!==b&&(a.colorMask(b,b,b,b),w=b)};this.setFlipSided=function(b){v!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),v=b)};this.setLineWidth=function(b){b!==y&&(a.lineWidth(b),y=b)};this.setPolygonOffset=function(b,c,d){b?this.enable(a.POLYGON_OFFSET_FILL):this.disable(a.POLYGON_OFFSET_FILL);!b||x===c&&E===d||(a.polygonOffset(c,d),x=c,E=d)};this.setScissorTest=function(b){b?this.enable(a.SCISSOR_TEST):this.disable(a.SCISSOR_TEST)};this.activeTexture=
|
|
|
function(b){void 0===b&&(b=a.TEXTURE0+B-1);z!==b&&(a.activeTexture(b),z=b)};this.bindTexture=function(b,c){void 0===z&&d.activeTexture();var e=A[z];void 0===e&&(e={type:void 0,texture:void 0},A[z]=e);if(e.type!==b||e.texture!==c)a.bindTexture(b,c),e.type=b,e.texture=c};this.compressedTexImage2D=function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.texImage2D=function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error(b)}};this.reset=function(){for(var b=
|
|
|
-0;b<g.length;b++)1===g[b]&&(a.disableVertexAttribArray(b),g[b]=0);f={};v=x=u=k=h=null}};
|
|
|
-THREE.LensFlarePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m=a.context,q=a.state,t,r,u,x,v,y;this.render=function(w,E,B,z){if(0!==b.length){w=new THREE.Vector3;var A=z/B,M=.5*B,J=.5*z,D=16/z,P=new THREE.Vector2(D*A,D),K=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1);if(void 0===u){var D=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),G=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();r=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,D,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
+0;b<g.length;b++)1===g[b]&&(a.disableVertexAttribArray(b),g[b]=0);f={};v=w=u=k=h=null}};
|
|
|
+THREE.LensFlarePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m=a.context,q=a.state,t,r,u,w,v,y;this.render=function(x,E,B,z){if(0!==b.length){x=new THREE.Vector3;var A=z/B,M=.5*B,J=.5*z,D=16/z,P=new THREE.Vector2(D*A,D),K=new THREE.Vector3(1,1,0),C=new THREE.Vector2(1,1);if(void 0===u){var D=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),G=new Uint16Array([0,1,2,0,2,3]);t=m.createBuffer();r=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,t);m.bufferData(m.ARRAY_BUFFER,D,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,
|
|
|
r);m.bufferData(m.ELEMENT_ARRAY_BUFFER,G,m.STATIC_DRAW);v=m.createTexture();y=m.createTexture();q.bindTexture(m.TEXTURE_2D,v);m.texImage2D(m.TEXTURE_2D,0,m.RGB,16,16,0,m.RGB,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);q.bindTexture(m.TEXTURE_2D,y);m.texImage2D(m.TEXTURE_2D,0,
|
|
|
-m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var D=(x=0<m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
+m.RGBA,16,16,0,m.RGBA,m.UNSIGNED_BYTE,null);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST);var D=(w=0<m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
|
|
|
fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|
|
|
G=m.createProgram(),H=m.createShader(m.FRAGMENT_SHADER),O=m.createShader(m.VERTEX_SHADER),Q="precision "+a.getPrecision()+" float;\n";m.shaderSource(H,Q+D.fragmentShader);m.shaderSource(O,Q+D.vertexShader);m.compileShader(H);m.compileShader(O);m.attachShader(G,H);m.attachShader(G,O);m.linkProgram(G);u=G;n=m.getAttribLocation(u,"position");p=m.getAttribLocation(u,"uv");c=m.getUniformLocation(u,"renderType");d=m.getUniformLocation(u,"map");e=m.getUniformLocation(u,"occlusionMap");g=m.getUniformLocation(u,
|
|
|
"opacity");f=m.getUniformLocation(u,"color");h=m.getUniformLocation(u,"scale");k=m.getUniformLocation(u,"rotation");l=m.getUniformLocation(u,"screenPosition")}m.useProgram(u);q.initAttributes();q.enableAttribute(n);q.enableAttribute(p);q.disableUnusedAttributes();m.uniform1i(e,0);m.uniform1i(d,1);m.bindBuffer(m.ARRAY_BUFFER,t);m.vertexAttribPointer(n,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(p,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,r);q.disable(m.CULL_FACE);m.depthMask(!1);G=0;for(H=
|
|
|
-b.length;G<H;G++)if(D=16/z,P.set(D*A,D),O=b[G],w.set(O.matrixWorld.elements[12],O.matrixWorld.elements[13],O.matrixWorld.elements[14]),w.applyMatrix4(E.matrixWorldInverse),w.applyProjection(E.projectionMatrix),K.copy(w),C.x=K.x*M+M,C.y=K.y*J+J,x||0<C.x&&C.x<B&&0<C.y&&C.y<z){q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,null);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,C.x-8,C.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,P.x,P.y);m.uniform3f(l,
|
|
|
+b.length;G<H;G++)if(D=16/z,P.set(D*A,D),O=b[G],x.set(O.matrixWorld.elements[12],O.matrixWorld.elements[13],O.matrixWorld.elements[14]),x.applyMatrix4(E.matrixWorldInverse),x.applyProjection(E.projectionMatrix),K.copy(x),C.x=K.x*M+M,C.y=K.y*J+J,w||0<C.x&&C.x<B&&0<C.y&&C.y<z){q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,null);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,v);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGB,C.x-8,C.y-8,16,16,0);m.uniform1i(c,0);m.uniform2f(h,P.x,P.y);m.uniform3f(l,
|
|
|
K.x,K.y,K.z);q.disable(m.BLEND);q.enable(m.DEPTH_TEST);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);q.activeTexture(m.TEXTURE0);q.bindTexture(m.TEXTURE_2D,y);m.copyTexImage2D(m.TEXTURE_2D,0,m.RGBA,C.x-8,C.y-8,16,16,0);m.uniform1i(c,1);q.disable(m.DEPTH_TEST);q.activeTexture(m.TEXTURE1);q.bindTexture(m.TEXTURE_2D,v);m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0);O.positionScreen.copy(K);O.customUpdateCallback?O.customUpdateCallback(O):O.updateLensFlares();m.uniform1i(c,2);q.enable(m.BLEND);for(var Q=
|
|
|
0,T=O.lensFlares.length;Q<T;Q++){var R=O.lensFlares[Q];.001<R.opacity&&.001<R.scale&&(K.x=R.x,K.y=R.y,K.z=R.z,D=R.size*R.scale/z,P.x=D*A,P.y=D,m.uniform3f(l,K.x,K.y,K.z),m.uniform2f(h,P.x,P.y),m.uniform1f(k,R.rotation),m.uniform1f(g,R.opacity),m.uniform3f(f,R.color.r,R.color.g,R.color.b),q.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),a.setTexture(R.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}q.enable(m.CULL_FACE);q.enable(m.DEPTH_TEST);m.depthMask(!0);a.resetGLState()}}};
|
|
|
-THREE.SpritePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m,q,t,r,u,x,v;function y(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var w=a.context,E=a.state,B,z,A,M,J=new THREE.Vector3,D=new THREE.Quaternion,P=new THREE.Vector3;this.render=function(K,C){if(0!==b.length){if(void 0===A){var G=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),H=new Uint16Array([0,1,2,0,2,3]);B=w.createBuffer();z=w.createBuffer();w.bindBuffer(w.ARRAY_BUFFER,B);w.bufferData(w.ARRAY_BUFFER,G,w.STATIC_DRAW);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,
|
|
|
-z);w.bufferData(w.ELEMENT_ARRAY_BUFFER,H,w.STATIC_DRAW);var G=w.createProgram(),H=w.createShader(w.VERTEX_SHADER),O=w.createShader(w.FRAGMENT_SHADER);w.shaderSource(H,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
-w.shaderSource(O,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
|
|
|
-w.compileShader(H);w.compileShader(O);w.attachShader(G,H);w.attachShader(G,O);w.linkProgram(G);A=G;x=w.getAttribLocation(A,"position");v=w.getAttribLocation(A,"uv");c=w.getUniformLocation(A,"uvOffset");d=w.getUniformLocation(A,"uvScale");e=w.getUniformLocation(A,"rotation");g=w.getUniformLocation(A,"scale");f=w.getUniformLocation(A,"color");h=w.getUniformLocation(A,"map");k=w.getUniformLocation(A,"opacity");l=w.getUniformLocation(A,"modelViewMatrix");n=w.getUniformLocation(A,"projectionMatrix");p=
|
|
|
-w.getUniformLocation(A,"fogType");m=w.getUniformLocation(A,"fogDensity");q=w.getUniformLocation(A,"fogNear");t=w.getUniformLocation(A,"fogFar");r=w.getUniformLocation(A,"fogColor");u=w.getUniformLocation(A,"alphaTest");G=document.createElement("canvas");G.width=8;G.height=8;H=G.getContext("2d");H.fillStyle="white";H.fillRect(0,0,8,8);M=new THREE.Texture(G);M.needsUpdate=!0}w.useProgram(A);E.initAttributes();E.enableAttribute(x);E.enableAttribute(v);E.disableUnusedAttributes();E.disable(w.CULL_FACE);
|
|
|
-E.enable(w.BLEND);w.bindBuffer(w.ARRAY_BUFFER,B);w.vertexAttribPointer(x,2,w.FLOAT,!1,16,0);w.vertexAttribPointer(v,2,w.FLOAT,!1,16,8);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,z);w.uniformMatrix4fv(n,!1,C.projectionMatrix.elements);E.activeTexture(w.TEXTURE0);w.uniform1i(h,0);H=G=0;(O=K.fog)?(w.uniform3f(r,O.color.r,O.color.g,O.color.b),O instanceof THREE.Fog?(w.uniform1f(q,O.near),w.uniform1f(t,O.far),w.uniform1i(p,1),H=G=1):O instanceof THREE.FogExp2&&(w.uniform1f(m,O.density),w.uniform1i(p,2),H=G=2)):
|
|
|
-(w.uniform1i(p,0),H=G=0);for(var O=0,Q=b.length;O<Q;O++){var T=b[O];T._modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,T.matrixWorld);T.z=-T._modelViewMatrix.elements[14]}b.sort(y);for(var R=[],O=0,Q=b.length;O<Q;O++){var T=b[O],U=T.material;w.uniform1f(u,U.alphaTest);w.uniformMatrix4fv(l,!1,T._modelViewMatrix.elements);T.matrixWorld.decompose(J,D,P);R[0]=P.x;R[1]=P.y;T=0;K.fog&&U.fog&&(T=H);G!==T&&(w.uniform1i(p,T),G=T);null!==U.map?(w.uniform2f(c,U.map.offset.x,U.map.offset.y),w.uniform2f(d,
|
|
|
-U.map.repeat.x,U.map.repeat.y)):(w.uniform2f(c,0,0),w.uniform2f(d,1,1));w.uniform1f(k,U.opacity);w.uniform3f(f,U.color.r,U.color.g,U.color.b);w.uniform1f(e,U.rotation);w.uniform2fv(g,R);E.setBlending(U.blending,U.blendEquation,U.blendSrc,U.blendDst);E.setDepthTest(U.depthTest);E.setDepthWrite(U.depthWrite);U.map&&U.map.image&&U.map.image.width?a.setTexture(U.map,0):a.setTexture(M,0);w.drawElements(w.TRIANGLES,6,w.UNSIGNED_SHORT,0)}E.enable(w.CULL_FACE);a.resetGLState()}}};
|
|
|
+THREE.SpritePlugin=function(a,b){var c,d,e,g,f,h,k,l,n,p,m,q,t,r,u,w,v;function y(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var x=a.context,E=a.state,B,z,A,M,J=new THREE.Vector3,D=new THREE.Quaternion,P=new THREE.Vector3;this.render=function(K,C){if(0!==b.length){if(void 0===A){var G=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),H=new Uint16Array([0,1,2,0,2,3]);B=x.createBuffer();z=x.createBuffer();x.bindBuffer(x.ARRAY_BUFFER,B);x.bufferData(x.ARRAY_BUFFER,G,x.STATIC_DRAW);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,
|
|
|
+z);x.bufferData(x.ELEMENT_ARRAY_BUFFER,H,x.STATIC_DRAW);var G=x.createProgram(),H=x.createShader(x.VERTEX_SHADER),O=x.createShader(x.FRAGMENT_SHADER);x.shaderSource(H,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
|
|
|
+x.shaderSource(O,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n"));
|
|
|
+x.compileShader(H);x.compileShader(O);x.attachShader(G,H);x.attachShader(G,O);x.linkProgram(G);A=G;w=x.getAttribLocation(A,"position");v=x.getAttribLocation(A,"uv");c=x.getUniformLocation(A,"uvOffset");d=x.getUniformLocation(A,"uvScale");e=x.getUniformLocation(A,"rotation");g=x.getUniformLocation(A,"scale");f=x.getUniformLocation(A,"color");h=x.getUniformLocation(A,"map");k=x.getUniformLocation(A,"opacity");l=x.getUniformLocation(A,"modelViewMatrix");n=x.getUniformLocation(A,"projectionMatrix");p=
|
|
|
+x.getUniformLocation(A,"fogType");m=x.getUniformLocation(A,"fogDensity");q=x.getUniformLocation(A,"fogNear");t=x.getUniformLocation(A,"fogFar");r=x.getUniformLocation(A,"fogColor");u=x.getUniformLocation(A,"alphaTest");G=document.createElement("canvas");G.width=8;G.height=8;H=G.getContext("2d");H.fillStyle="white";H.fillRect(0,0,8,8);M=new THREE.Texture(G);M.needsUpdate=!0}x.useProgram(A);E.initAttributes();E.enableAttribute(w);E.enableAttribute(v);E.disableUnusedAttributes();E.disable(x.CULL_FACE);
|
|
|
+E.enable(x.BLEND);x.bindBuffer(x.ARRAY_BUFFER,B);x.vertexAttribPointer(w,2,x.FLOAT,!1,16,0);x.vertexAttribPointer(v,2,x.FLOAT,!1,16,8);x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,z);x.uniformMatrix4fv(n,!1,C.projectionMatrix.elements);E.activeTexture(x.TEXTURE0);x.uniform1i(h,0);H=G=0;(O=K.fog)?(x.uniform3f(r,O.color.r,O.color.g,O.color.b),O instanceof THREE.Fog?(x.uniform1f(q,O.near),x.uniform1f(t,O.far),x.uniform1i(p,1),H=G=1):O instanceof THREE.FogExp2&&(x.uniform1f(m,O.density),x.uniform1i(p,2),H=G=2)):
|
|
|
+(x.uniform1i(p,0),H=G=0);for(var O=0,Q=b.length;O<Q;O++){var T=b[O];T._modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,T.matrixWorld);T.z=-T._modelViewMatrix.elements[14]}b.sort(y);for(var R=[],O=0,Q=b.length;O<Q;O++){var T=b[O],U=T.material;x.uniform1f(u,U.alphaTest);x.uniformMatrix4fv(l,!1,T._modelViewMatrix.elements);T.matrixWorld.decompose(J,D,P);R[0]=P.x;R[1]=P.y;T=0;K.fog&&U.fog&&(T=H);G!==T&&(x.uniform1i(p,T),G=T);null!==U.map?(x.uniform2f(c,U.map.offset.x,U.map.offset.y),x.uniform2f(d,
|
|
|
+U.map.repeat.x,U.map.repeat.y)):(x.uniform2f(c,0,0),x.uniform2f(d,1,1));x.uniform1f(k,U.opacity);x.uniform3f(f,U.color.r,U.color.g,U.color.b);x.uniform1f(e,U.rotation);x.uniform2fv(g,R);E.setBlending(U.blending,U.blendEquation,U.blendSrc,U.blendDst);E.setDepthTest(U.depthTest);E.setDepthWrite(U.depthWrite);U.map&&U.map.image&&U.map.image.width?a.setTexture(U.map,0):a.setTexture(M,0);x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0)}E.enable(x.CULL_FACE);a.resetGLState()}}};
|
|
|
THREE.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}};
|
|
|
THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var g=new THREE.Texture(void 0,b);e.load(a,function(a){g.image=a;g.needsUpdate=!0;c&&c(g)},void 0,function(a){d&&d(a)});g.sourceFile=a;return g},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var g=new THREE.CubeTexture([],b),f=0;b=function(b){e.load(a[b],function(a){g.images[b]=a;f+=1;6===f&&(g.needsUpdate=!0,c&&c(g))},void 0,
|
|
|
d)};for(var h=0,k=a.length;h<k;++h)b(h);return g},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");
|
|
|
-g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,k=f.createImageData(d,e),l=k.data,n=0;n<d;n++)for(var p=0;p<e;p++){var m=0>p-1?0:p-1,q=p+1>e-1?e-1:p+1,t=0>n-1?0:n-1,r=n+1>d-1?d-1:n+1,u=[],x=[0,0,h[4*(p*d+n)]/255*b];u.push([-1,0,h[4*(p*d+t)]/255*b]);u.push([-1,-1,h[4*(m*d+t)]/255*b]);u.push([0,-1,h[4*(m*d+n)]/255*b]);u.push([1,-1,h[4*(m*d+r)]/255*b]);u.push([1,0,h[4*(p*d+r)]/255*b]);u.push([1,1,h[4*(q*d+r)]/255*b]);u.push([0,1,h[4*(q*d+n)]/255*
|
|
|
-b]);u.push([-1,1,h[4*(q*d+t)]/255*b]);m=[];t=u.length;for(q=0;q<t;q++){var r=u[q],v=u[(q+1)%t],r=[r[0]-x[0],r[1]-x[1],r[2]-x[2]],v=[v[0]-x[0],v[1]-x[1],v[2]-x[2]];m.push(c([r[1]*v[2]-r[2]*v[1],r[2]*v[0]-r[0]*v[2],r[0]*v[1]-r[1]*v[0]]))}u=[0,0,0];for(q=0;q<m.length;q++)u[0]+=m[q][0],u[1]+=m[q][1],u[2]+=m[q][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;x=4*(p*d+n);l[x]=(u[0]+1)/2*255|0;l[x+1]=(u[1]+1)/2*255|0;l[x+2]=255*u[2]|0;l[x+3]=255}f.putImageData(k,0,0);return g},generateDataTexture:function(a,
|
|
|
+g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,k=f.createImageData(d,e),l=k.data,n=0;n<d;n++)for(var p=0;p<e;p++){var m=0>p-1?0:p-1,q=p+1>e-1?e-1:p+1,t=0>n-1?0:n-1,r=n+1>d-1?d-1:n+1,u=[],w=[0,0,h[4*(p*d+n)]/255*b];u.push([-1,0,h[4*(p*d+t)]/255*b]);u.push([-1,-1,h[4*(m*d+t)]/255*b]);u.push([0,-1,h[4*(m*d+n)]/255*b]);u.push([1,-1,h[4*(m*d+r)]/255*b]);u.push([1,0,h[4*(p*d+r)]/255*b]);u.push([1,1,h[4*(q*d+r)]/255*b]);u.push([0,1,h[4*(q*d+n)]/255*
|
|
|
+b]);u.push([-1,1,h[4*(q*d+t)]/255*b]);m=[];t=u.length;for(q=0;q<t;q++){var r=u[q],v=u[(q+1)%t],r=[r[0]-w[0],r[1]-w[1],r[2]-w[2]],v=[v[0]-w[0],v[1]-w[1],v[2]-w[2]];m.push(c([r[1]*v[2]-r[2]*v[1],r[2]*v[0]-r[0]*v[2],r[0]*v[1]-r[1]*v[0]]))}u=[0,0,0];for(q=0;q<m.length;q++)u[0]+=m[q][0],u[1]+=m[q][1],u[2]+=m[q][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;w=4*(p*d+n);l[w]=(u[0]+1)/2*255|0;l[w+1]=(u[1]+1)/2*255|0;l[w+2]=255*u[2]|0;l[w+3]=255}f.putImageData(k,0,0);return g},generateDataTexture:function(a,
|
|
|
b,c){var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
|
|
|
THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face.toLowerCase()][this.weight][this.style]}catch(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing.";}},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=
|
|
|
-a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),g=e.length,f=[];for(a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,k,l,n,p,m,q,t,r,u,x=b.glyphs[a]||b.glyphs["?"];if(x){if(x.o)for(b=x._cachedOutline||(x._cachedOutline=x.o.split(" ")),l=b.length,a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;n=b[a++]*c;e.moveTo(k,n);
|
|
|
+a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),g=e.length,f=[];for(a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,k,l,n,p,m,q,t,r,u,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),l=b.length,a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;n=b[a++]*c;e.moveTo(k,n);
|
|
|
break;case "l":k=b[a++]*c+d;n=b[a++]*c;e.lineTo(k,n);break;case "q":k=b[a++]*c+d;n=b[a++]*c;q=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(q,t,k,n);if(f=g[g.length-1])for(p=f.x,m=f.y,f=1,h=this.divisions;f<=h;f++){var v=f/h;THREE.Shape.Utils.b2(v,p,q,k);THREE.Shape.Utils.b2(v,m,t,n)}break;case "b":if(k=b[a++]*c+d,n=b[a++]*c,q=b[a++]*c+d,t=b[a++]*c,r=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(q,t,r,u,k,n),f=g[g.length-1])for(p=f.x,m=f.y,f=1,h=this.divisions;f<=h;f++)v=f/h,THREE.Shape.Utils.b3(v,p,q,r,k),THREE.Shape.Utils.b3(v,
|
|
|
-m,t,u,n)}return{offset:x.ha*c,path:e}}}};
|
|
|
+m,t,u,n)}return{offset:w.ha*c,path:e}}}};
|
|
|
THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",g=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=g;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(g=c.length;e<g;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
|
(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var g=[],f=[],h=[],k,l,n;if(0<b(a))for(l=0;l<e;l++)f[l]=l;else for(l=0;l<e;l++)f[l]=e-1-l;var p=2*e;for(l=e-1;2<e;){if(0>=p--){console.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);n=l+1;e<=n&&(n=0);var m;a:{var q=m=void 0,t=void 0,r=void 0,
|
|
|
-u=void 0,x=void 0,v=void 0,y=void 0,w=void 0,q=a[f[k]].x,t=a[f[k]].y,r=a[f[l]].x,u=a[f[l]].y,x=a[f[n]].x,v=a[f[n]].y;if(1E-10>(r-q)*(v-t)-(u-t)*(x-q))m=!1;else{var E=void 0,B=void 0,z=void 0,A=void 0,M=void 0,J=void 0,D=void 0,P=void 0,K=void 0,C=void 0,K=P=D=w=y=void 0,E=x-r,B=v-u,z=q-x,A=t-v,M=r-q,J=u-t;for(m=0;m<e;m++)if(y=a[f[m]].x,w=a[f[m]].y,!(y===q&&w===t||y===r&&w===u||y===x&&w===v)&&(D=y-q,P=w-t,K=y-r,C=w-u,y-=x,w-=v,K=E*C-B*K,D=M*P-J*D,P=z*w-A*y,-1E-10<=K&&-1E-10<=P&&-1E-10<=D)){m=!1;break a}m=
|
|
|
+u=void 0,w=void 0,v=void 0,y=void 0,x=void 0,q=a[f[k]].x,t=a[f[k]].y,r=a[f[l]].x,u=a[f[l]].y,w=a[f[n]].x,v=a[f[n]].y;if(1E-10>(r-q)*(v-t)-(u-t)*(w-q))m=!1;else{var E=void 0,B=void 0,z=void 0,A=void 0,M=void 0,J=void 0,D=void 0,P=void 0,K=void 0,C=void 0,K=P=D=x=y=void 0,E=w-r,B=v-u,z=q-w,A=t-v,M=r-q,J=u-t;for(m=0;m<e;m++)if(y=a[f[m]].x,x=a[f[m]].y,!(y===q&&x===t||y===r&&x===u||y===w&&x===v)&&(D=y-q,P=x-t,K=y-r,C=x-u,y-=w,x-=v,K=E*C-B*K,D=M*P-J*D,P=z*x-A*y,-1E-10<=K&&-1E-10<=P&&-1E-10<=D)){m=!1;break a}m=
|
|
|
!0}}if(m){g.push([a[f[k]],a[f[l]],a[f[n]]]);h.push([f[k],f[l],f[n]]);k=l;for(n=l+1;n<e;k++,n++)f[k]=f[n];e--;p=2*e}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);THREE.typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};"undefined"!==typeof self&&(self._typeface_js=THREE.typeface_js);
|
|
|
THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.context;this.source=this.context.createBufferSource();this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain);this.autoplay=!1;this.startTime=0;this.playbackRate=1;this.isPlaying=!1};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
THREE.Audio.prototype.constructor=THREE.Audio;THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.autoplay&&b.play()})};c.send();return this};
|
|
@@ -684,9 +684,9 @@ THREE.Path.prototype.absarc=function(a,b,c,d,e,g){this.absellipse(a,b,c,c,d,e,g)
|
|
|
THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c};
|
|
|
THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,g,f,h,k,l,n,p,m,q,t,r;d=0;for(e=this.actions.length;d<e;d++)switch(g=this.actions[d],f=g.action,g=g.args,f){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];k=g[3];p=g[0];m=g[1];0<c.length?(f=c[c.length-1],q=f.x,t=f.y):(f=this.actions[d-
|
|
|
1].args,q=f[f.length-2],t=f[f.length-1]);for(g=1;g<=a;g++)r=g/a,f=THREE.Shape.Utils.b2(r,q,p,h),r=THREE.Shape.Utils.b2(r,t,m,k),c.push(new THREE.Vector2(f,r));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];k=g[5];p=g[0];m=g[1];l=g[2];n=g[3];0<c.length?(f=c[c.length-1],q=f.x,t=f.y):(f=this.actions[d-1].args,q=f[f.length-2],t=f[f.length-1]);for(g=1;g<=a;g++)r=g/a,f=THREE.Shape.Utils.b3(r,q,p,l,h),r=THREE.Shape.Utils.b3(r,t,m,n,k),c.push(new THREE.Vector2(f,r));break;case THREE.PathActions.CSPLINE_THRU:f=
|
|
|
-this.actions[d-1].args;r=[new THREE.Vector2(f[f.length-2],f[f.length-1])];f=a*g[0].length;r=r.concat(g[0]);r=new THREE.SplineCurve(r);for(g=1;g<=f;g++)c.push(r.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];k=g[1];m=g[2];l=g[3];f=g[4];p=!!g[5];q=f-l;t=2*a;for(g=1;g<=t;g++)r=g/t,p||(r=1-r),r=l+r*q,f=h+m*Math.cos(r),r=k+m*Math.sin(r),c.push(new THREE.Vector2(f,r));break;case THREE.PathActions.ELLIPSE:h=g[0];k=g[1];m=g[2];n=g[3];l=g[4];f=g[5];p=!!g[6];var u=g[7];q=f-l;t=2*a;var x,v;0!==u&&
|
|
|
-(x=Math.cos(u),v=Math.sin(u));for(g=1;g<=t;g++){r=g/t;p||(r=1-r);r=l+r*q;f=h+m*Math.cos(r);r=k+n*Math.sin(r);if(0!==u){var y=f;f=(y-h)*x-(r-k)*v+h;r=(y-h)*v+(r-k)*x+k}c.push(new THREE.Vector2(f,r))}}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
-THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,m=h.y-g.y;if(1E-10<Math.abs(m)){if(0>m&&(g=b[f],k=-k,h=b[e],m=-m),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=m*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&
|
|
|
+this.actions[d-1].args;r=[new THREE.Vector2(f[f.length-2],f[f.length-1])];f=a*g[0].length;r=r.concat(g[0]);r=new THREE.SplineCurve(r);for(g=1;g<=f;g++)c.push(r.getPointAt(g/f));break;case THREE.PathActions.ARC:h=g[0];k=g[1];m=g[2];l=g[3];f=g[4];p=!!g[5];q=f-l;t=2*a;for(g=1;g<=t;g++)r=g/t,p||(r=1-r),r=l+r*q,f=h+m*Math.cos(r),r=k+m*Math.sin(r),c.push(new THREE.Vector2(f,r));break;case THREE.PathActions.ELLIPSE:h=g[0];k=g[1];m=g[2];n=g[3];l=g[4];f=g[5];p=!!g[6];var u=g[7];q=f-l;t=2*a;var w,v;0!==u&&
|
|
|
+(w=Math.cos(u),v=Math.sin(u));for(g=1;g<=t;g++){r=g/t;p||(r=1-r);r=l+r*q;f=h+m*Math.cos(r);r=k+n*Math.sin(r);if(0!==u){var y=f;f=(y-h)*w-(r-k)*v+h;r=(y-h)*v+(r-k)*w+k}c.push(new THREE.Vector2(f,r))}}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
|
|
|
+THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(1E-10<Math.abs(l)){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&
|
|
|
a.x<=h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d===THREE.PathActions.MOVE_TO&&0!==g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!==g.actions.length&&f.push(g);return f}(this.actions);if(0===e.length)return[];if(!0===b)return c(e);var g,f,h,k=[];if(1===e.length)return f=e[0],h=new THREE.Shape,h.actions=f.actions,h.curves=f.curves,k.push(h),k;var l=!THREE.Shape.Utils.isClockWise(e[0].getPoints()),
|
|
|
l=a?!l:l;h=[];var n=[],p=[],m=0,q;n[m]=void 0;p[m]=[];var t,r;t=0;for(r=e.length;t<r;t++)f=e[t],q=f.getPoints(),g=THREE.Shape.Utils.isClockWise(q),(g=a?!g:g)?(!l&&n[m]&&m++,n[m]={s:new THREE.Shape,p:q},n[m].s.actions=f.actions,n[m].s.curves=f.curves,l&&m++,p[m]=[]):p[m].push({h:f,p:q[0]});if(!n[0])return c(e);if(1<n.length){t=!1;r=[];f=0;for(e=n.length;f<e;f++)h[f]=[];f=0;for(e=n.length;f<e;f++)for(g=p[f],l=0;l<g.length;l++){m=g[l];q=!0;for(var u=0;u<n.length;u++)d(m.p,n[u].p)&&(f!==u&&r.push({froms:f,
|
|
|
tos:u,hole:l}),q?(q=!1,h[u].push(m)):t=!0);q&&h[f].push(m)}0<r.length&&(t||(p=h))}t=0;for(r=n.length;t<r;t++)for(h=n[t].s,k.push(h),f=p[t],e=0,g=f.length;e<g;e++)h.holes.push(f[e].h);return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.constructor=THREE.Shape;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
@@ -724,10 +724,10 @@ THREE.Animation.prototype={constructor:THREE.Animation,keyTypes:["pos","rot","sc
|
|
|
var d=this.data.name,e=c.animationCache.animations,g=e[d];void 0===g&&(g={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:c.matrix},e[d]=g);for(c=0;3>c;c++){for(var d=this.keyTypes[c],e=this.data.hierarchy[a].keys[0],f=this.getNextKeyWith(d,a,1);f.time<this.currentTime&&f.index>e.index;)e=f,f=this.getNextKeyWith(d,a,f.index+1);g.prevKey[d]=e;g.nextKey[d]=f}}},resetBlendWeights:function(){for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a].animationCache;void 0!==
|
|
|
c&&(c=c.blending,c.positionWeight=0,c.quaternionWeight=0,c.scaleWeight=0)}},update:function(){var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,p,m,q,t,r;e=(a.length-1)*b;p=Math.floor(e);e-=p;c[0]=0===p?p:p-1;c[1]=p;c[2]=p>a.length-2?p:p+1;c[3]=p>a.length-3?p:p+2;p=a[c[0]];q=a[c[1]];t=a[c[2]];r=a[c[3]];c=e*e;m=e*c;d[0]=g(p[0],q[0],t[0],r[0],e,c,m);d[1]=g(p[1],q[1],t[1],r[1],e,c,m);d[2]=g(p[2],q[2],t[2],r[2],e,c,m);return d},g=function(a,b,c,d,
|
|
|
e,g,m){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*m+(-3*(b-c)-2*a-d)*g+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)this.loop?(this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset()):this.stop();f=0;for(var g=this.hierarchy.length;f<g;f++)for(var k=this.hierarchy[f],l=k.animationCache.animations[this.data.name],n=k.animationCache.blending,p=0;3>p;p++){var m=this.keyTypes[p],
|
|
|
-q=l.prevKey[m],t=l.nextKey[m];if(0<this.timeScale&&t.time<=this.currentTime||0>this.timeScale&&q.time>=this.currentTime){q=this.data.hierarchy[f].keys[0];for(t=this.getNextKeyWith(m,f,1);t.time<this.currentTime&&t.index>q.index;)q=t,t=this.getNextKeyWith(m,f,t.index+1);l.prevKey[m]=q;l.nextKey[m]=t}var r=(this.currentTime-q.time)/(t.time-q.time),u=q[m],x=t[m];0>r&&(r=0);1<r&&(r=1);if("pos"===m)if(this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=u[0]+(x[0]-u[0])*r,c.y=u[1]+(x[1]-u[1])*r,
|
|
|
-c.z=u[2]+(x[2]-u[2])*r,q=this.weight/(this.weight+n.positionWeight),k.position.lerp(c,q),n.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,q.index-1).pos,a[1]=u,a[2]=x,a[3]=this.getNextKeyWith("pos",f,t.index+1).pos,r=.33*r+.33,t=e(a,r),q=this.weight/(this.weight+n.positionWeight),n.positionWeight+=this.weight,m=k.position,m.x+=(t[0]-m.x)*q,m.y+=(t[1]-
|
|
|
-m.y)*q,m.z+=(t[2]-m.z)*q,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(r=e(a,1.01*r),b.set(r[0],r[1],r[2]),b.sub(m),b.y=0,b.normalize(),r=Math.atan2(b.x,b.z),k.rotation.set(0,r,0))}else"rot"===m?(THREE.Quaternion.slerp(u,x,d,r),0===n.quaternionWeight?(k.quaternion.copy(d),n.quaternionWeight=this.weight):(q=this.weight/(this.weight+n.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,q),n.quaternionWeight+=this.weight)):"scl"===m&&(c.x=u[0]+(x[0]-u[0])*r,c.y=
|
|
|
-u[1]+(x[1]-u[1])*r,c.z=u[2]+(x[2]-u[2])*r,q=this.weight/(this.weight+n.scaleWeight),k.scale.lerp(c,q),n.scaleWeight+=this.weight)}return!0}}}(),getNextKeyWith:function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]},getPrevKeyWith:function(a,b,c){var d=
|
|
|
+q=l.prevKey[m],t=l.nextKey[m];if(0<this.timeScale&&t.time<=this.currentTime||0>this.timeScale&&q.time>=this.currentTime){q=this.data.hierarchy[f].keys[0];for(t=this.getNextKeyWith(m,f,1);t.time<this.currentTime&&t.index>q.index;)q=t,t=this.getNextKeyWith(m,f,t.index+1);l.prevKey[m]=q;l.nextKey[m]=t}var r=(this.currentTime-q.time)/(t.time-q.time),u=q[m],w=t[m];0>r&&(r=0);1<r&&(r=1);if("pos"===m)if(this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=u[0]+(w[0]-u[0])*r,c.y=u[1]+(w[1]-u[1])*r,
|
|
|
+c.z=u[2]+(w[2]-u[2])*r,q=this.weight/(this.weight+n.positionWeight),k.position.lerp(c,q),n.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,q.index-1).pos,a[1]=u,a[2]=w,a[3]=this.getNextKeyWith("pos",f,t.index+1).pos,r=.33*r+.33,t=e(a,r),q=this.weight/(this.weight+n.positionWeight),n.positionWeight+=this.weight,m=k.position,m.x+=(t[0]-m.x)*q,m.y+=(t[1]-
|
|
|
+m.y)*q,m.z+=(t[2]-m.z)*q,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(r=e(a,1.01*r),b.set(r[0],r[1],r[2]),b.sub(m),b.y=0,b.normalize(),r=Math.atan2(b.x,b.z),k.rotation.set(0,r,0))}else"rot"===m?(THREE.Quaternion.slerp(u,w,d,r),0===n.quaternionWeight?(k.quaternion.copy(d),n.quaternionWeight=this.weight):(q=this.weight/(this.weight+n.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,q),n.quaternionWeight+=this.weight)):"scl"===m&&(c.x=u[0]+(w[0]-u[0])*r,c.y=
|
|
|
+u[1]+(w[1]-u[1])*r,c.z=u[2]+(w[2]-u[2])*r,q=this.weight/(this.weight+n.scaleWeight),k.scale.lerp(c,q),n.scaleWeight+=this.weight)}return!0}}}(),getNextKeyWith:function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]},getPrevKeyWith:function(a,b,c){var d=
|
|
|
this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]}};
|
|
|
THREE.KeyFrameAnimation=function(a){this.root=a.node;this.data=THREE.AnimationHandler.init(a);this.hierarchy=THREE.AnimationHandler.parse(this.root);this.currentTime=0;this.timeScale=.001;this.isPlaying=!1;this.loop=this.isPaused=!0;a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var g=c[e],f=this.getNextKeyWith(g,a,0);f&&f.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
|
|
|
d.matrixWorldNeedsUpdate=!0}}};
|
|
@@ -738,8 +738,8 @@ g.interpolate(f,f.time);this.data.hierarchy[a].node.updateMatrix();c.matrixWorld
|
|
|
THREE.MorphAnimation=function(a){this.mesh=a;this.frames=a.morphTargetInfluences.length;this.currentTime=0;this.duration=1E3;this.loop=!0;this.currentFrame=this.lastFrame=0;this.isPlaying=!1};
|
|
|
THREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(a){if(!1!==this.isPlaying){this.currentTime+=a;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);var b=this.duration/this.frames;a=Math.floor(this.currentTime/b);var c=this.mesh.morphTargetInfluences;a!==this.currentFrame&&(c[this.lastFrame]=0,c[this.currentFrame]=
|
|
|
1,c[a]=0,this.lastFrame=this.currentFrame,this.currentFrame=a);b=this.currentTime%b/b;c[a]=b;c[this.lastFrame]=1-b}}};
|
|
|
-THREE.BoxGeometry=function(a,b,c,d,e,g){function f(a,b,c,d,e,f,g,r){var u,x=h.widthSegments,v=h.heightSegments,y=e/2,w=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",v=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",x=h.depthSegments;var B=x+1,z=v+1,A=e/x,M=f/v,J=new THREE.Vector3;J[u]=0<g?1:-1;for(e=0;e<z;e++)for(f=0;f<B;f++){var D=new THREE.Vector3;D[a]=(f*A-y)*c;D[b]=(e*M-w)*d;D[u]=g;h.vertices.push(D)}for(e=
|
|
|
-0;e<v;e++)for(f=0;f<x;f++)w=f+B*e,a=f+B*(e+1),b=f+1+B*(e+1),c=f+1+B*e,d=new THREE.Vector2(f/x,1-e/v),g=new THREE.Vector2(f/x,1-(e+1)/v),u=new THREE.Vector2((f+1)/x,1-(e+1)/v),y=new THREE.Vector2((f+1)/x,1-e/v),w=new THREE.Face3(w+E,a+E,c+E),w.normal.copy(J),w.vertexNormals.push(J.clone(),J.clone(),J.clone()),w.materialIndex=r,h.faces.push(w),h.faceVertexUvs[0].push([d,g,y]),w=new THREE.Face3(a+E,b+E,c+E),w.normal.copy(J),w.vertexNormals.push(J.clone(),J.clone(),J.clone()),w.materialIndex=r,h.faces.push(w),
|
|
|
+THREE.BoxGeometry=function(a,b,c,d,e,g){function f(a,b,c,d,e,f,g,r){var u,w=h.widthSegments,v=h.heightSegments,y=e/2,x=f/2,E=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",v=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",w=h.depthSegments;var B=w+1,z=v+1,A=e/w,M=f/v,J=new THREE.Vector3;J[u]=0<g?1:-1;for(e=0;e<z;e++)for(f=0;f<B;f++){var D=new THREE.Vector3;D[a]=(f*A-y)*c;D[b]=(e*M-x)*d;D[u]=g;h.vertices.push(D)}for(e=
|
|
|
+0;e<v;e++)for(f=0;f<w;f++)x=f+B*e,a=f+B*(e+1),b=f+1+B*(e+1),c=f+1+B*e,d=new THREE.Vector2(f/w,1-e/v),g=new THREE.Vector2(f/w,1-(e+1)/v),u=new THREE.Vector2((f+1)/w,1-(e+1)/v),y=new THREE.Vector2((f+1)/w,1-e/v),x=new THREE.Face3(x+E,a+E,c+E),x.normal.copy(J),x.vertexNormals.push(J.clone(),J.clone(),J.clone()),x.materialIndex=r,h.faces.push(x),h.faceVertexUvs[0].push([d,g,y]),x=new THREE.Face3(a+E,b+E,c+E),x.normal.copy(J),x.vertexNormals.push(J.clone(),J.clone(),J.clone()),x.materialIndex=r,h.faces.push(x),
|
|
|
h.faceVertexUvs[0].push([g.clone(),u,y.clone()])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:g};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=g||1;var h=this;d=a/2;e=b/2;g=c/2;f("z","y",-1,-1,c,b,d,0);f("z","y",1,-1,c,b,-d,1);f("x","z",1,1,a,c,e,2);f("x","z",1,-1,a,c,-e,3);f("x","y",1,-1,a,b,g,4);f("x","y",-1,-1,a,b,-g,5);this.mergeVertices()};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype);
|
|
|
THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry;THREE.BoxGeometry.prototype.clone=function(){return new THREE.BoxGeometry(this.parameters.width,this.parameters.height,this.parameters.depth,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.depthSegments)};THREE.CubeGeometry=THREE.BoxGeometry;
|
|
|
THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e,g=[];e=new THREE.Vector3;var f=new THREE.Vector2(.5,.5);this.vertices.push(e);g.push(f);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);g.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0,
|
|
@@ -748,20 +748,20 @@ THREE.CircleGeometry.prototype.clone=function(){return new THREE.CircleGeometry(
|
|
|
THREE.CircleBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="CircleBufferGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e=b+2,g=new Float32Array(3*e),f=new Float32Array(3*e),e=new Float32Array(2*e);f[3]=1;e[0]=.5;e[1]=.5;for(var h=0,k=3,l=2;h<=b;h++,k+=3,l+=2){var n=c+h/b*d;g[k]=a*Math.cos(n);g[k+1]=a*Math.sin(n);f[k+2]=1;e[l]=(g[k]/a+1)/2;e[l+1]=(g[k+1]/a+1)/2}c=
|
|
|
[];for(k=1;k<=b;k++)c.push(k),c.push(k+1),c.push(0);this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(c),1));this.addAttribute("position",new THREE.BufferAttribute(g,3));this.addAttribute("normal",new THREE.BufferAttribute(f,3));this.addAttribute("uv",new THREE.BufferAttribute(e,2));this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.CircleBufferGeometry.prototype.constructor=THREE.CircleBufferGeometry;
|
|
|
THREE.CircleBufferGeometry.prototype.clone=function(){var a=new THREE.CircleBufferGeometry(this.parameters.radius,this.parameters.segments,this.parameters.thetaStart,this.parameters.thetaLength);a.copy(this);return a};
|
|
|
-THREE.CylinderGeometry=function(a,b,c,d,e,g,f,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:g,thetaStart:f,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;g=void 0!==g?g:!1;f=void 0!==f?f:0;h=void 0!==h?h:2*Math.PI;var k=c/2,l,n,p=[],m=[];for(n=0;n<=e;n++){var q=[],t=[],r=n/e,u=r*(b-a)+a;for(l=0;l<=d;l++){var x=l/d,v=new THREE.Vector3;v.x=u*Math.sin(x*h+
|
|
|
-f);v.y=-r*c+k;v.z=u*Math.cos(x*h+f);this.vertices.push(v);q.push(this.vertices.length-1);t.push(new THREE.Vector2(x,1-r))}p.push(q);m.push(t)}c=(b-a)/c;for(l=0;l<d;l++)for(0!==a?(f=this.vertices[p[0][l]].clone(),h=this.vertices[p[0][l+1]].clone()):(f=this.vertices[p[1][l]].clone(),h=this.vertices[p[1][l+1]].clone()),f.setY(Math.sqrt(f.x*f.x+f.z*f.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),n=0;n<e;n++){var q=p[n][l],t=p[n+1][l],r=p[n+1][l+1],u=p[n][l+1],x=f.clone(),v=f.clone(),
|
|
|
-y=h.clone(),w=h.clone(),E=m[n][l].clone(),B=m[n+1][l].clone(),z=m[n+1][l+1].clone(),A=m[n][l+1].clone();this.faces.push(new THREE.Face3(q,t,u,[x,v,w]));this.faceVertexUvs[0].push([E,B,A]);this.faces.push(new THREE.Face3(t,r,u,[v.clone(),y,w.clone()]));this.faceVertexUvs[0].push([B.clone(),z,A.clone()])}if(!1===g&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)q=p[0][l],t=p[0][l+1],r=this.vertices.length-1,x=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,
|
|
|
-1,0),E=m[0][l].clone(),B=m[0][l+1].clone(),z=new THREE.Vector2(B.x,0),this.faces.push(new THREE.Face3(q,t,r,[x,v,y])),this.faceVertexUvs[0].push([E,B,z]);if(!1===g&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)q=p[e][l+1],t=p[e][l],r=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),E=m[e][l+1].clone(),B=m[e][l].clone(),z=new THREE.Vector2(B.x,1),this.faces.push(new THREE.Face3(q,t,r,[x,v,y])),this.faceVertexUvs[0].push([E,
|
|
|
+THREE.CylinderGeometry=function(a,b,c,d,e,g,f,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:g,thetaStart:f,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;g=void 0!==g?g:!1;f=void 0!==f?f:0;h=void 0!==h?h:2*Math.PI;var k=c/2,l,n,p=[],m=[];for(n=0;n<=e;n++){var q=[],t=[],r=n/e,u=r*(b-a)+a;for(l=0;l<=d;l++){var w=l/d,v=new THREE.Vector3;v.x=u*Math.sin(w*h+
|
|
|
+f);v.y=-r*c+k;v.z=u*Math.cos(w*h+f);this.vertices.push(v);q.push(this.vertices.length-1);t.push(new THREE.Vector2(w,1-r))}p.push(q);m.push(t)}c=(b-a)/c;for(l=0;l<d;l++)for(0!==a?(f=this.vertices[p[0][l]].clone(),h=this.vertices[p[0][l+1]].clone()):(f=this.vertices[p[1][l]].clone(),h=this.vertices[p[1][l+1]].clone()),f.setY(Math.sqrt(f.x*f.x+f.z*f.z)*c).normalize(),h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize(),n=0;n<e;n++){var q=p[n][l],t=p[n+1][l],r=p[n+1][l+1],u=p[n][l+1],w=f.clone(),v=f.clone(),
|
|
|
+y=h.clone(),x=h.clone(),E=m[n][l].clone(),B=m[n+1][l].clone(),z=m[n+1][l+1].clone(),A=m[n][l+1].clone();this.faces.push(new THREE.Face3(q,t,u,[w,v,x]));this.faceVertexUvs[0].push([E,B,A]);this.faces.push(new THREE.Face3(t,r,u,[v.clone(),y,x.clone()]));this.faceVertexUvs[0].push([B.clone(),z,A.clone()])}if(!1===g&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)q=p[0][l],t=p[0][l+1],r=this.vertices.length-1,w=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,
|
|
|
+1,0),E=m[0][l].clone(),B=m[0][l+1].clone(),z=new THREE.Vector2(B.x,0),this.faces.push(new THREE.Face3(q,t,r,[w,v,y])),this.faceVertexUvs[0].push([E,B,z]);if(!1===g&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)q=p[e][l+1],t=p[e][l],r=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),E=m[e][l+1].clone(),B=m[e][l].clone(),z=new THREE.Vector2(B.x,1),this.faces.push(new THREE.Face3(q,t,r,[w,v,y])),this.faceVertexUvs[0].push([E,
|
|
|
B,z]);this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.CylinderGeometry.prototype.clone=function(){return new THREE.CylinderGeometry(this.parameters.radiusTop,this.parameters.radiusBottom,this.parameters.height,this.parameters.radialSegments,this.parameters.heightSegments,this.parameters.openEnded,this.parameters.thetaStart,this.parameters.thetaLength)};
|
|
|
THREE.EdgesGeometry=function(a,b){THREE.BufferGeometry.call(this);var c=Math.cos(THREE.Math.degToRad(void 0!==b?b:1)),d=[0,0],e={},g=function(a,b){return a-b},f=["a","b","c"],h;a instanceof THREE.BufferGeometry?(h=new THREE.Geometry,h.fromBufferGeometry(a)):h=a.clone();h.mergeVertices();h.computeFaceNormals();var k=h.vertices;h=h.faces;for(var l=0,n=h.length;l<n;l++)for(var p=h[l],m=0;3>m;m++){d[0]=p[f[m]];d[1]=p[f[(m+1)%3]];d.sort(g);var q=d.toString();void 0===e[q]?e[q]={vert1:d[0],vert2:d[1],face1:l,
|
|
|
face2:void 0}:e[q].face2=l}d=[];for(q in e)if(g=e[q],void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=c)f=k[g.vert1],d.push(f.x),d.push(f.y),d.push(f.z),f=k[g.vert2],d.push(f.x),d.push(f.y),d.push(f.z);this.addAttribute("position",new THREE.BufferAttribute(new Float32Array(d),3))};THREE.EdgesGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.EdgesGeometry.prototype.constructor=THREE.EdgesGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;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.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone().multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=
|
|
|
-!0):-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(F=a.length;0<=--F;){c=F;d=F-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*n,e=0;e<f;e++){var g=T*e,h=T*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+J,g=g+J,l=l+J,h=h+J;M.faces.push(new THREE.Face3(k,g,h));M.faces.push(new THREE.Face3(g,l,h));k=x.generateSideWallUV(M,k,g,l,h);M.faceVertexUvs[0].push([k[0],k[1],k[3]]);M.faceVertexUvs[0].push([k[1],
|
|
|
-k[2],k[3]])}}}function g(a,b,c){M.vertices.push(new THREE.Vector3(a,b,c))}function f(a,b,c){a+=J;b+=J;c+=J;M.faces.push(new THREE.Face3(a,b,c));a=x.generateTopUV(M,a,b,c);M.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,t=b.extrudePath,
|
|
|
-r,u=!1,x=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,y,w,E;t&&(r=t.getSpacedPoints(q),u=!0,p=!1,v=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,q,!1),y=new THREE.Vector3,w=new THREE.Vector3,E=new THREE.Vector3);p||(l=k=n=0);var B,z,A,M=this,J=this.vertices.length,t=a.extractPoints(m),m=t.shape,D=t.holes;if(t=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();z=0;for(A=D.length;z<A;z++)B=D[z],THREE.Shape.Utils.isClockWise(B)&&(D[z]=B.reverse());t=
|
|
|
+!0):-1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(F=a.length;0<=--F;){c=F;d=F-1;0>d&&(d=a.length-1);for(var e=0,f=q+2*n,e=0;e<f;e++){var g=T*e,h=T*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+J,g=g+J,l=l+J,h=h+J;M.faces.push(new THREE.Face3(k,g,h));M.faces.push(new THREE.Face3(g,l,h));k=w.generateSideWallUV(M,k,g,l,h);M.faceVertexUvs[0].push([k[0],k[1],k[3]]);M.faceVertexUvs[0].push([k[1],
|
|
|
+k[2],k[3]])}}}function g(a,b,c){M.vertices.push(new THREE.Vector3(a,b,c))}function f(a,b,c){a+=J;b+=J;c+=J;M.faces.push(new THREE.Face3(a,b,c));a=w.generateTopUV(M,a,b,c);M.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,n=void 0!==b.bevelSegments?b.bevelSegments:3,p=void 0!==b.bevelEnabled?b.bevelEnabled:!0,m=void 0!==b.curveSegments?b.curveSegments:12,q=void 0!==b.steps?b.steps:1,t=b.extrudePath,
|
|
|
+r,u=!1,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v,y,x,E;t&&(r=t.getSpacedPoints(q),u=!0,p=!1,v=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(t,q,!1),y=new THREE.Vector3,x=new THREE.Vector3,E=new THREE.Vector3);p||(l=k=n=0);var B,z,A,M=this,J=this.vertices.length,t=a.extractPoints(m),m=t.shape,D=t.holes;if(t=!THREE.Shape.Utils.isClockWise(m)){m=m.reverse();z=0;for(A=D.length;z<A;z++)B=D[z],THREE.Shape.Utils.isClockWise(B)&&(D[z]=B.reverse());t=
|
|
|
!1}var P=THREE.Shape.Utils.triangulateShape(m,D),K=m;z=0;for(A=D.length;z<A;z++)B=D[z],m=m.concat(B);var C,G,H,O,Q,T=m.length,R,U=P.length,t=[],F=0;H=K.length;C=H-1;for(G=F+1;F<H;F++,C++,G++)C===H&&(C=0),G===H&&(G=0),t[F]=d(K[F],K[C],K[G]);var $=[],ea,aa=t.concat();z=0;for(A=D.length;z<A;z++){B=D[z];ea=[];F=0;H=B.length;C=H-1;for(G=F+1;F<H;F++,C++,G++)C===H&&(C=0),G===H&&(G=0),ea[F]=d(B[F],B[C],B[G]);$.push(ea);aa=aa.concat(ea)}for(C=0;C<n;C++){H=C/n;O=k*(1-H);G=l*Math.sin(H*Math.PI/2);F=0;for(H=
|
|
|
-K.length;F<H;F++)Q=c(K[F],t[F],G),g(Q.x,Q.y,-O);z=0;for(A=D.length;z<A;z++)for(B=D[z],ea=$[z],F=0,H=B.length;F<H;F++)Q=c(B[F],ea[F],G),g(Q.x,Q.y,-O)}G=l;for(F=0;F<T;F++)Q=p?c(m[F],aa[F],G):m[F],u?(w.copy(v.normals[0]).multiplyScalar(Q.x),y.copy(v.binormals[0]).multiplyScalar(Q.y),E.copy(r[0]).add(w).add(y),g(E.x,E.y,E.z)):g(Q.x,Q.y,0);for(H=1;H<=q;H++)for(F=0;F<T;F++)Q=p?c(m[F],aa[F],G):m[F],u?(w.copy(v.normals[H]).multiplyScalar(Q.x),y.copy(v.binormals[H]).multiplyScalar(Q.y),E.copy(r[H]).add(w).add(y),
|
|
|
+K.length;F<H;F++)Q=c(K[F],t[F],G),g(Q.x,Q.y,-O);z=0;for(A=D.length;z<A;z++)for(B=D[z],ea=$[z],F=0,H=B.length;F<H;F++)Q=c(B[F],ea[F],G),g(Q.x,Q.y,-O)}G=l;for(F=0;F<T;F++)Q=p?c(m[F],aa[F],G):m[F],u?(x.copy(v.normals[0]).multiplyScalar(Q.x),y.copy(v.binormals[0]).multiplyScalar(Q.y),E.copy(r[0]).add(x).add(y),g(E.x,E.y,E.z)):g(Q.x,Q.y,0);for(H=1;H<=q;H++)for(F=0;F<T;F++)Q=p?c(m[F],aa[F],G):m[F],u?(x.copy(v.normals[H]).multiplyScalar(Q.x),y.copy(v.binormals[H]).multiplyScalar(Q.y),E.copy(r[H]).add(x).add(y),
|
|
|
g(E.x,E.y,E.z)):g(Q.x,Q.y,h/q*H);for(C=n-1;0<=C;C--){H=C/n;O=k*(1-H);G=l*Math.sin(H*Math.PI/2);F=0;for(H=K.length;F<H;F++)Q=c(K[F],t[F],G),g(Q.x,Q.y,h+O);z=0;for(A=D.length;z<A;z++)for(B=D[z],ea=$[z],F=0,H=B.length;F<H;F++)Q=c(B[F],ea[F],G),u?g(Q.x,Q.y+r[q-1].y,r[q-1].x+O):g(Q.x,Q.y,h+O)}(function(){if(p){var a;a=0*T;for(F=0;F<U;F++)R=P[F],f(R[2]+a,R[1]+a,R[0]+a);a=q+2*n;a*=T;for(F=0;F<U;F++)R=P[F],f(R[0]+a,R[1]+a,R[2]+a)}else{for(F=0;F<U;F++)R=P[F],f(R[2],R[1],R[0]);for(F=0;F<U;F++)R=P[F],f(R[0]+
|
|
|
T*q,R[1]+T*q,R[2]+T*q)}})();(function(){var a=0;e(K,a);a+=K.length;z=0;for(A=D.length;z<A;z++)B=D[z],e(B,a),a+=B.length})()};
|
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y,
|
|
@@ -780,10 +780,10 @@ THREE.RingGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);this.type="Ri
|
|
|
THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry;THREE.RingGeometry.prototype.clone=function(){return new THREE.RingGeometry(this.parameters.innerRadius,this.parameters.outerRadius,this.parameters.thetaSegments,this.parameters.phiSegments,this.parameters.thetaStart,this.parameters.thetaLength)};
|
|
|
THREE.SphereGeometry=function(a,b,c,d,e,g,f){console.log("THREE.SphereGeometry: Consider using THREE.SphereBufferGeometry for lower memory footprint.");THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:g,thetaLength:f};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;g=void 0!==g?g:0;f=void 0!==f?f:Math.PI;var h,k,l=[],n=[];for(k=0;k<=c;k++){var p=
|
|
|
[],m=[];for(h=0;h<=b;h++){var q=h/b,t=k/c,r=new THREE.Vector3;r.x=-a*Math.cos(d+q*e)*Math.sin(g+t*f);r.y=a*Math.cos(g+t*f);r.z=a*Math.sin(d+q*e)*Math.sin(g+t*f);this.vertices.push(r);p.push(this.vertices.length-1);m.push(new THREE.Vector2(q,1-t))}l.push(p);n.push(m)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=l[k][h+1];e=l[k][h];g=l[k+1][h];f=l[k+1][h+1];var p=this.vertices[d].clone().normalize(),m=this.vertices[e].clone().normalize(),q=this.vertices[g].clone().normalize(),t=this.vertices[f].clone().normalize(),
|
|
|
-r=n[k][h+1].clone(),u=n[k][h].clone(),x=n[k+1][h].clone(),v=n[k+1][h+1].clone();Math.abs(this.vertices[d].y)===a?(r.x=(r.x+u.x)/2,this.faces.push(new THREE.Face3(d,g,f,[p,q,t])),this.faceVertexUvs[0].push([r,x,v])):Math.abs(this.vertices[g].y)===a?(x.x=(x.x+v.x)/2,this.faces.push(new THREE.Face3(d,e,g,[p,m,q])),this.faceVertexUvs[0].push([r,u,x])):(this.faces.push(new THREE.Face3(d,e,f,[p,m,t])),this.faceVertexUvs[0].push([r,u,v]),this.faces.push(new THREE.Face3(e,g,f,[m.clone(),q,t.clone()])),this.faceVertexUvs[0].push([u.clone(),
|
|
|
-x,v.clone()]))}this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.SphereGeometry.prototype.clone=function(){return new THREE.SphereGeometry(this.parameters.radius,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.phiStart,this.parameters.phiLength,this.parameters.thetaStart,this.parameters.thetaLength)};
|
|
|
+r=n[k][h+1].clone(),u=n[k][h].clone(),w=n[k+1][h].clone(),v=n[k+1][h+1].clone();Math.abs(this.vertices[d].y)===a?(r.x=(r.x+u.x)/2,this.faces.push(new THREE.Face3(d,g,f,[p,q,t])),this.faceVertexUvs[0].push([r,w,v])):Math.abs(this.vertices[g].y)===a?(w.x=(w.x+v.x)/2,this.faces.push(new THREE.Face3(d,e,g,[p,m,q])),this.faceVertexUvs[0].push([r,u,w])):(this.faces.push(new THREE.Face3(d,e,f,[p,m,t])),this.faceVertexUvs[0].push([r,u,v]),this.faces.push(new THREE.Face3(e,g,f,[m.clone(),q,t.clone()])),this.faceVertexUvs[0].push([u.clone(),
|
|
|
+w,v.clone()]))}this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.SphereGeometry.prototype.clone=function(){return new THREE.SphereGeometry(this.parameters.radius,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.phiStart,this.parameters.phiLength,this.parameters.thetaStart,this.parameters.thetaLength)};
|
|
|
THREE.SphereBufferGeometry=function(a,b,c,d,e,g,f){THREE.BufferGeometry.call(this);this.type="SphereBufferGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:g,thetaLength:f};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;g=void 0!==g?g:0;f=void 0!==f?f:Math.PI;for(var h=g+f,k=(b+1)*(c+1),l=new THREE.BufferAttribute(new Float32Array(3*k),3),n=new THREE.BufferAttribute(new Float32Array(3*
|
|
|
-k),3),k=new THREE.BufferAttribute(new Float32Array(2*k),2),p=0,m=[],q=new THREE.Vector3,t=0;t<=c;t++){for(var r=[],u=t/c,x=0;x<=b;x++){var v=x/b,y=-a*Math.cos(d+v*e)*Math.sin(g+u*f),w=a*Math.cos(g+u*f),E=a*Math.sin(d+v*e)*Math.sin(g+u*f);q.set(y,w,E).normalize();l.setXYZ(p,y,w,E);n.setXYZ(p,q.x,q.y,q.z);k.setXY(p,v,1-u);r.push(p);p++}m.push(r)}d=[];for(t=0;t<c;t++)for(x=0;x<b;x++)e=m[t][x+1],f=m[t][x],p=m[t+1][x],q=m[t+1][x+1],(0!==t||0<g)&&d.push(e,f,q),(t!==c-1||h<Math.PI)&&d.push(f,p,q);this.addAttribute("index",
|
|
|
+k),3),k=new THREE.BufferAttribute(new Float32Array(2*k),2),p=0,m=[],q=new THREE.Vector3,t=0;t<=c;t++){for(var r=[],u=t/c,w=0;w<=b;w++){var v=w/b,y=-a*Math.cos(d+v*e)*Math.sin(g+u*f),x=a*Math.cos(g+u*f),E=a*Math.sin(d+v*e)*Math.sin(g+u*f);q.set(y,x,E).normalize();l.setXYZ(p,y,x,E);n.setXYZ(p,q.x,q.y,q.z);k.setXY(p,v,1-u);r.push(p);p++}m.push(r)}d=[];for(t=0;t<c;t++)for(w=0;w<b;w++)e=m[t][w+1],f=m[t][w],p=m[t+1][w],q=m[t+1][w+1],(0!==t||0<g)&&d.push(e,f,q),(t!==c-1||h<Math.PI)&&d.push(f,p,q);this.addAttribute("index",
|
|
|
new THREE.BufferAttribute(new Uint16Array(d),1));this.addAttribute("position",l);this.addAttribute("normal",n);this.addAttribute("uv",k);this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.SphereBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.SphereBufferGeometry.prototype.constructor=THREE.SphereBufferGeometry;
|
|
|
THREE.SphereBufferGeometry.prototype.clone=function(){var a=new THREE.SphereBufferGeometry(this.parameters.radius,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.phiStart,this.parameters.phiLength,this.parameters.thetaStart,this.parameters.thetaLength);a.copy(this);return a};
|
|
|
THREE.TextGeometry=function(a,b){b=b||{};var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b);this.type="TextGeometry"};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype);THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
@@ -791,12 +791,12 @@ THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="Tor
|
|
|
d,k/c));h.push(m.clone().sub(g).normalize())}for(k=1;k<=c;k++)for(l=1;l<=d;l++)a=(d+1)*k+l-1,b=(d+1)*(k-1)+l-1,e=(d+1)*(k-1)+l,g=(d+1)*k+l,n=new THREE.Face3(a,b,g,[h[a].clone(),h[b].clone(),h[g].clone()]),this.faces.push(n),this.faceVertexUvs[0].push([f[a].clone(),f[b].clone(),f[g].clone()]),n=new THREE.Face3(b,e,g,[h[b].clone(),h[e].clone(),h[g].clone()]),this.faces.push(n),this.faceVertexUvs[0].push([f[b].clone(),f[e].clone(),f[g].clone()]);this.computeFaceNormals()};
|
|
|
THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;THREE.TorusGeometry.prototype.clone=function(){return new THREE.TorusGeometry(this.parameters.radius,this.parameters.tube,this.parameters.radialSegments,this.parameters.tubularSegments,this.parameters.arc)};
|
|
|
THREE.TorusKnotGeometry=function(a,b,c,d,e,g,f){function h(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=b/c;b=Math.cos(a);f*=d*(2+b)*.5;g=d*(2+b)*g*.5;d=e*d*Math.sin(a)*.5;return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,p:e,q:g,heightScale:f};a=a||100;b=b||40;c=c||64;d=d||8;e=e||2;g=g||3;f=f||1;for(var k=Array(c),l=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector3,m=0;m<c;++m){k[m]=
|
|
|
-Array(d);var q=m/c*2*e*Math.PI,t=h(q,g,e,a,f),q=h(q+.01,g,e,a,f);l.subVectors(q,t);n.addVectors(q,t);p.crossVectors(l,n);n.crossVectors(p,l);p.normalize();n.normalize();for(q=0;q<d;++q){var r=q/d*2*Math.PI,u=-b*Math.cos(r),r=b*Math.sin(r),x=new THREE.Vector3;x.x=t.x+u*n.x+r*p.x;x.y=t.y+u*n.y+r*p.y;x.z=t.z+u*n.z+r*p.z;k[m][q]=this.vertices.push(x)-1}}for(m=0;m<c;++m)for(q=0;q<d;++q)e=(m+1)%c,g=(q+1)%d,a=k[m][q],b=k[e][q],e=k[e][g],g=k[m][g],f=new THREE.Vector2(m/c,q/d),l=new THREE.Vector2((m+1)/c,
|
|
|
+Array(d);var q=m/c*2*e*Math.PI,t=h(q,g,e,a,f),q=h(q+.01,g,e,a,f);l.subVectors(q,t);n.addVectors(q,t);p.crossVectors(l,n);n.crossVectors(p,l);p.normalize();n.normalize();for(q=0;q<d;++q){var r=q/d*2*Math.PI,u=-b*Math.cos(r),r=b*Math.sin(r),w=new THREE.Vector3;w.x=t.x+u*n.x+r*p.x;w.y=t.y+u*n.y+r*p.y;w.z=t.z+u*n.z+r*p.z;k[m][q]=this.vertices.push(w)-1}}for(m=0;m<c;++m)for(q=0;q<d;++q)e=(m+1)%c,g=(q+1)%d,a=k[m][q],b=k[e][q],e=k[e][g],g=k[m][g],f=new THREE.Vector2(m/c,q/d),l=new THREE.Vector2((m+1)/c,
|
|
|
q/d),n=new THREE.Vector2((m+1)/c,(q+1)/d),p=new THREE.Vector2(m/c,(q+1)/d),this.faces.push(new THREE.Face3(a,b,g)),this.faceVertexUvs[0].push([f,l,p]),this.faces.push(new THREE.Face3(b,e,g)),this.faceVertexUvs[0].push([l.clone(),n,p.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
|
|
|
THREE.TorusKnotGeometry.prototype.clone=function(){return new THREE.TorusKnotGeometry(this.parameters.radius,this.parameters.tube,this.parameters.radialSegments,this.parameters.tubularSegments,this.parameters.p,this.parameters.q,this.parameters.heightScale)};
|
|
|
-THREE.TubeGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;g=g||THREE.TubeGeometry.NoTaper;var f=[],h,k,l=b+1,n,p,m,q,t,r=new THREE.Vector3,u,x,v;u=new THREE.TubeGeometry.FrenetFrames(a,b,e);x=u.normals;v=u.binormals;this.tangents=u.tangents;this.normals=x;this.binormals=v;for(u=0;u<l;u++)for(f[u]=[],n=u/(l-1),t=a.getPointAt(n),h=x[u],k=v[u],m=c*g(n),n=0;n<d;n++)p=
|
|
|
-n/d*2*Math.PI,q=-m*Math.cos(p),p=m*Math.sin(p),r.copy(t),r.x+=q*h.x+p*k.x,r.y+=q*h.y+p*k.y,r.z+=q*h.z+p*k.z,f[u][n]=this.vertices.push(new THREE.Vector3(r.x,r.y,r.z))-1;for(u=0;u<b;u++)for(n=0;n<d;n++)g=e?(u+1)%b:u+1,l=(n+1)%d,a=f[u][n],c=f[g][n],g=f[g][l],l=f[u][l],r=new THREE.Vector2(u/b,n/d),x=new THREE.Vector2((u+1)/b,n/d),v=new THREE.Vector2((u+1)/b,(n+1)/d),h=new THREE.Vector2(u/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,l)),this.faceVertexUvs[0].push([r,x,h]),this.faces.push(new THREE.Face3(c,
|
|
|
-g,l)),this.faceVertexUvs[0].push([x.clone(),v,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
|
|
|
+THREE.TubeGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;g=g||THREE.TubeGeometry.NoTaper;var f=[],h,k,l=b+1,n,p,m,q,t,r=new THREE.Vector3,u,w,v;u=new THREE.TubeGeometry.FrenetFrames(a,b,e);w=u.normals;v=u.binormals;this.tangents=u.tangents;this.normals=w;this.binormals=v;for(u=0;u<l;u++)for(f[u]=[],n=u/(l-1),t=a.getPointAt(n),h=w[u],k=v[u],m=c*g(n),n=0;n<d;n++)p=
|
|
|
+n/d*2*Math.PI,q=-m*Math.cos(p),p=m*Math.sin(p),r.copy(t),r.x+=q*h.x+p*k.x,r.y+=q*h.y+p*k.y,r.z+=q*h.z+p*k.z,f[u][n]=this.vertices.push(new THREE.Vector3(r.x,r.y,r.z))-1;for(u=0;u<b;u++)for(n=0;n<d;n++)g=e?(u+1)%b:u+1,l=(n+1)%d,a=f[u][n],c=f[g][n],g=f[g][l],l=f[u][l],r=new THREE.Vector2(u/b,n/d),w=new THREE.Vector2((u+1)/b,n/d),v=new THREE.Vector2((u+1)/b,(n+1)/d),h=new THREE.Vector2(u/b,(n+1)/d),this.faces.push(new THREE.Face3(a,c,l)),this.faceVertexUvs[0].push([r,w,h]),this.faces.push(new THREE.Face3(c,
|
|
|
+g,l)),this.faceVertexUvs[0].push([w.clone(),v,h.clone()]);this.computeFaceNormals();this.computeVertexNormals()};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)};
|
|
|
THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],g=[],f=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var l,n,p;this.tangents=e;this.normals=g;this.binormals=f;for(l=0;l<b;l++)n=l/(b-1),e[l]=a.getTangentAt(n),e[l].normalize();g[0]=new THREE.Vector3;f[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);n=Math.abs(e[0].y);p=Math.abs(e[0].z);l<=a&&(a=l,d.set(1,0,0));n<=a&&(a=n,d.set(0,1,0));p<=a&&d.set(0,0,1);h.crossVectors(e[0],d).normalize();g[0].crossVectors(e[0],
|
|
|
h);f[0].crossVectors(e[0],g[0]);for(l=1;l<b;l++)g[l]=g[l-1].clone(),f[l]=f[l-1].clone(),h.crossVectors(e[l-1],e[l]),1E-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[l-1].dot(e[l]),-1,1)),g[l].applyMatrix4(k.makeRotationAxis(h,d))),f[l].crossVectors(e[l],g[l]);if(c)for(d=Math.acos(THREE.Math.clamp(g[0].dot(g[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(g[0],g[b-1]))&&(d=-d),l=1;l<b;l++)g[l].applyMatrix4(k.makeRotationAxis(e[l],d*l)),f[l].crossVectors(e[l],g[l])};
|
|
|
THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function g(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);k.faces.push(d);u.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(u.z,-u.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function f(a,
|